Skip to content

Commit 852e697

Browse files
committed
feat: auto fix on unused imports
1 parent f301c05 commit 852e697

File tree

4 files changed

+97
-72
lines changed

4 files changed

+97
-72
lines changed

index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
extends: ['airbnb', 'xo', 'xo-react', 'prettier', 'plugin:react/recommended'],
3-
plugins: ['prettier', 'prefer-arrow'],
3+
plugins: ['prettier', 'prefer-arrow', 'unused-imports'],
44
rules: {
55
'prettier/prettier': [
66
'error',
@@ -98,6 +98,17 @@ module.exports = {
9898
{ allow: 'as-needed', extensions: ['.jsx', '.tsx'] },
9999
],
100100
'import/extensions': ['off'],
101+
'no-unused-vars': 'off',
102+
'unused-imports/no-unused-imports': 'warn',
103+
'unused-imports/no-unused-vars': [
104+
'warn',
105+
{
106+
vars: 'all',
107+
varsIgnorePattern: '^_',
108+
args: 'after-used',
109+
argsIgnorePattern: '^_',
110+
},
111+
],
101112
},
102113
env: {
103114
node: true,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"eslint-plugin-prettier": "4.0.0",
1818
"eslint-plugin-react": "7.29.3",
1919
"eslint-plugin-react-hooks": "4.3.0",
20+
"eslint-plugin-unused-imports": "^2.0.0",
2021
"merge-options": "3.0.4",
2122
"prettier": "2.5.1",
2223
"typescript": "4.6.2"

ts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = mergeOptions({}, config, {
2828
],
2929
'@typescript-eslint/no-parameter-properties': 'off',
3030
'@typescript-eslint/explicit-function-return-type': 'off',
31+
'@typescript-eslint/no-unused-vars': 'off',
3132
},
3233
parser: '@typescript-eslint/parser',
3334
parserOptions: {

yarn.lock

Lines changed: 83 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,18 @@ [email protected]:
16901690
semver "^6.3.0"
16911691
string.prototype.matchall "^4.0.6"
16921692

1693+
eslint-plugin-unused-imports@^2.0.0:
1694+
version "2.0.0"
1695+
resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz#d8db8c4d0cfa0637a8b51ce3fd7d1b6bc3f08520"
1696+
integrity sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==
1697+
dependencies:
1698+
eslint-rule-composer "^0.3.0"
1699+
1700+
eslint-rule-composer@^0.3.0:
1701+
version "0.3.0"
1702+
resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"
1703+
integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==
1704+
16931705
eslint-scope@^5.1.1:
16941706
version "5.1.1"
16951707
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -3487,77 +3499,77 @@ npm@^8.3.0:
34873499
resolved "https://registry.yarnpkg.com/npm/-/npm-8.3.1.tgz#c3f370a2e0c3575b863311efac666fba69a2e6d2"
34883500
integrity sha512-f552vKhT3r+PpCRnH7UferrrbcnvcFnGusN2T1mQqq/0UQd3pF1+ok4n0WahT0ZKxj10YU3b2VdhGrf39djHAA==
34893501
dependencies:
3490-
"@isaacs/string-locale-compare" "*"
3491-
"@npmcli/arborist" "*"
3492-
"@npmcli/ci-detect" "*"
3493-
"@npmcli/config" "*"
3494-
"@npmcli/map-workspaces" "*"
3495-
"@npmcli/package-json" "*"
3496-
"@npmcli/run-script" "*"
3497-
abbrev "*"
3498-
ansicolors "*"
3499-
ansistyles "*"
3500-
archy "*"
3501-
cacache "*"
3502-
chalk "*"
3503-
chownr "*"
3504-
cli-columns "*"
3505-
cli-table3 "*"
3506-
columnify "*"
3507-
fastest-levenshtein "*"
3508-
glob "*"
3509-
graceful-fs "*"
3510-
hosted-git-info "*"
3511-
ini "*"
3512-
init-package-json "*"
3513-
is-cidr "*"
3514-
json-parse-even-better-errors "*"
3515-
libnpmaccess "*"
3516-
libnpmdiff "*"
3517-
libnpmexec "*"
3518-
libnpmfund "*"
3519-
libnpmhook "*"
3520-
libnpmorg "*"
3521-
libnpmpack "*"
3522-
libnpmpublish "*"
3523-
libnpmsearch "*"
3524-
libnpmteam "*"
3525-
libnpmversion "*"
3526-
make-fetch-happen "*"
3527-
minipass "*"
3528-
minipass-pipeline "*"
3529-
mkdirp "*"
3530-
mkdirp-infer-owner "*"
3531-
ms "*"
3532-
node-gyp "*"
3533-
nopt "*"
3534-
npm-audit-report "*"
3535-
npm-install-checks "*"
3536-
npm-package-arg "*"
3537-
npm-pick-manifest "*"
3538-
npm-profile "*"
3539-
npm-registry-fetch "*"
3540-
npm-user-validate "*"
3541-
npmlog "*"
3542-
opener "*"
3543-
pacote "*"
3544-
parse-conflict-json "*"
3545-
proc-log "*"
3546-
qrcode-terminal "*"
3547-
read "*"
3548-
read-package-json "*"
3549-
read-package-json-fast "*"
3550-
readdir-scoped-modules "*"
3551-
rimraf "*"
3552-
semver "*"
3553-
ssri "*"
3554-
tar "*"
3555-
text-table "*"
3556-
tiny-relative-date "*"
3557-
treeverse "*"
3558-
validate-npm-package-name "*"
3559-
which "*"
3560-
write-file-atomic "*"
3502+
"@isaacs/string-locale-compare" "^1.1.0"
3503+
"@npmcli/arborist" "^4.2.0"
3504+
"@npmcli/ci-detect" "^1.4.0"
3505+
"@npmcli/config" "^2.4.0"
3506+
"@npmcli/map-workspaces" "^2.0.0"
3507+
"@npmcli/package-json" "^1.0.1"
3508+
"@npmcli/run-script" "^2.0.0"
3509+
abbrev "~1.1.1"
3510+
ansicolors "~0.3.2"
3511+
ansistyles "~0.1.3"
3512+
archy "~1.0.0"
3513+
cacache "^15.3.0"
3514+
chalk "^4.1.2"
3515+
chownr "^2.0.0"
3516+
cli-columns "^4.0.0"
3517+
cli-table3 "^0.6.0"
3518+
columnify "~1.5.4"
3519+
fastest-levenshtein "^1.0.12"
3520+
glob "^7.2.0"
3521+
graceful-fs "^4.2.8"
3522+
hosted-git-info "^4.1.0"
3523+
ini "^2.0.0"
3524+
init-package-json "^2.0.5"
3525+
is-cidr "^4.0.2"
3526+
json-parse-even-better-errors "^2.3.1"
3527+
libnpmaccess "^5.0.0"
3528+
libnpmdiff "^3.0.0"
3529+
libnpmexec "^3.0.2"
3530+
libnpmfund "^2.0.2"
3531+
libnpmhook "^7.0.0"
3532+
libnpmorg "^3.0.0"
3533+
libnpmpack "^3.0.1"
3534+
libnpmpublish "^5.0.0"
3535+
libnpmsearch "^4.0.0"
3536+
libnpmteam "^3.0.0"
3537+
libnpmversion "^2.0.2"
3538+
make-fetch-happen "^9.1.0"
3539+
minipass "^3.1.6"
3540+
minipass-pipeline "^1.2.4"
3541+
mkdirp "^1.0.4"
3542+
mkdirp-infer-owner "^2.0.0"
3543+
ms "^2.1.2"
3544+
node-gyp "^8.4.1"
3545+
nopt "^5.0.0"
3546+
npm-audit-report "^2.1.5"
3547+
npm-install-checks "^4.0.0"
3548+
npm-package-arg "^8.1.5"
3549+
npm-pick-manifest "^6.1.1"
3550+
npm-profile "^5.0.3"
3551+
npm-registry-fetch "^11.0.0"
3552+
npm-user-validate "^1.0.1"
3553+
npmlog "^6.0.0"
3554+
opener "^1.5.2"
3555+
pacote "^12.0.2"
3556+
parse-conflict-json "^2.0.1"
3557+
proc-log "^1.0.0"
3558+
qrcode-terminal "^0.12.0"
3559+
read "~1.0.7"
3560+
read-package-json "^4.1.1"
3561+
read-package-json-fast "^2.0.3"
3562+
readdir-scoped-modules "^1.1.0"
3563+
rimraf "^3.0.2"
3564+
semver "^7.3.5"
3565+
ssri "^8.0.1"
3566+
tar "^6.1.11"
3567+
text-table "~0.2.0"
3568+
tiny-relative-date "^1.3.0"
3569+
treeverse "^1.0.4"
3570+
validate-npm-package-name "~3.0.0"
3571+
which "^2.0.2"
3572+
write-file-atomic "^3.0.3"
35613573

35623574
npmlog@*, npmlog@^6.0.0:
35633575
version "6.0.0"

0 commit comments

Comments
 (0)