Skip to content

Commit 0eb0f4d

Browse files
✨ feat(eslint): add eslint-plugin-unused-imports
1 parent 897bdc8 commit 0eb0f4d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"eslint-plugin-import": "latest",
6565
"eslint-plugin-simple-import-sort": "latest",
6666
"eslint-plugin-typescript-sort-keys": "latest",
67+
"eslint-plugin-unused-imports": "latest",
6768
"postcss-less": "latest",
6869
"postcss-styled-syntax": "latest",
6970
"prettier-plugin-organize-imports": "latest",

src/eslint/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
extends: [require.resolve('@umijs/lint/dist/config/eslint')],
3-
plugins: ['simple-import-sort', 'import', 'typescript-sort-keys'],
3+
plugins: ['simple-import-sort', 'import', 'typescript-sort-keys', 'unused-imports'],
44
rules: {
55
'simple-import-sort/exports': 'error',
66
'import/first': 'error',
@@ -10,5 +10,11 @@ module.exports = {
1010
'typescript-sort-keys/string-enum': 'error',
1111
'react/jsx-sort-props': 'error',
1212
'react/jsx-no-useless-fragment': 'error',
13+
'no-unused-vars': 'off',
14+
'unused-imports/no-unused-imports': 'error',
15+
'unused-imports/no-unused-vars': [
16+
'warn',
17+
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
18+
],
1319
},
1420
};

0 commit comments

Comments
 (0)