You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module.exports = {
'env': {
'browser': true,
'es6': true,
'node': true,
},
'extends': ['eslint:recommended', 'prettier'],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
},
'parserOptions': {
'ecmaVersion': 2018,
"ecmaFeatures": {
"jsx": true,
},
},
'rules': {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
// Ignore all unused function arguments, because in some
// case they are kept to indicate the function signature.
"no-unused-vars": ["error", { "argsIgnorePattern": ".*" }],
"no-constant-condition": 0,
"no-prototype-builtins": 0,
"prettier/prettier": "error",
// Uncomment this to automatically remove unused requires:
"autofix/no-unused-vars": "error",
},
"plugins": [
"react",
"prettier",
"autofix",
],
};
Expected behavior
When using the rule no-unused-vars it should remove unused require statements such as this one: const fs = require('fs-extra');
Actual behavior
It doesn't.
When using the rule no-unused-vars, it changes unused require statements like this one:
const { sprintf } = require('sprintf-js');
to this:
const {} = require('sprintf-js');
Which is good. However for unused require statements like this:
const fs = require('fs-extra');
It doesn't remove them, while it would be great if it could. My use case is to process a large codebase with various unused require statements so since eslint can detect it, it would be great if it could be autofixed too.
The text was updated successfully, but these errors were encountered:
I wonder if that could be made optional, perhaps with a warning? When processing an entire codebase with eslint it would be useful if require or import statements were auto-removed. Then it's up to the user to check in the diff that nothing useful was lost. At least in my case nearly all the useless require statements could be removed.
Tell us about your environment
Expected behavior
When using the rule
no-unused-vars
it should remove unused require statements such as this one:const fs = require('fs-extra');
Actual behavior
It doesn't.
When using the rule
no-unused-vars
, it changes unused require statements like this one:to this:
Which is good. However for unused require statements like this:
const fs = require('fs-extra');
It doesn't remove them, while it would be great if it could. My use case is to process a large codebase with various unused require statements so since eslint can detect it, it would be great if it could be autofixed too.
The text was updated successfully, but these errors were encountered: