I use react & flux to develop my frontend web app:
So I define the constants like this:
/js/constants/AppConstants.js
const KeyMirror = require('keymirror');
module.exports = {
PayloadSources: KeyMirror({
SERVER_ACTION: null,
VIEW_ACTION: null
})
};
/js/constants/ProductConstants.js
const KeyMirror = require('keymirror');
module.exports = {
ActionTypes: KeyMirror({
GET_PRODUCT: null,
UPDATE_PRODUCT: null,
})
};
This totally works and is correct, then I push these codes to Github (with Codeclimate integration).
Codeclimate says:
Similar code found in 1 other location (mass = 54)
const KeyMirror = require('keymirror');
Obviously, we see that this line const KeyMirror = require('keymirror')
was defined in 2 different files, and Codeclimate thinks this should be changed. But I was thinking, this is just a statement to import the library.
How do you think? How should I need to refactor this?