diff --git a/.changeset/strange-kids-design.md b/.changeset/strange-kids-design.md new file mode 100644 index 00000000..dc5faf5a --- /dev/null +++ b/.changeset/strange-kids-design.md @@ -0,0 +1,5 @@ +--- +"@1stg/eslint-config": patch +--- + +fix: disable some duplicate or unuseful rules diff --git a/package.json b/package.json index 6307cbca..45bb99f8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@changesets/changelog-github": "^0.4.0", "@changesets/cli": "^2.16.0", "@types/jest": "^26.0.23", - "@types/node": "^15.6.0", + "@types/node": "^15.6.1", "@types/react": "^17.0.6", "@types/unist": "^2.0.3", "core-js": "^3.12.1", diff --git a/packages/eslint-config/base.js b/packages/eslint-config/base.js index 243b6036..63d2fcbc 100644 --- a/packages/eslint-config/base.js +++ b/packages/eslint-config/base.js @@ -1,11 +1,6 @@ const { getGlobals } = require('eslint-plugin-mdx') -const { - allowModules, - isWebpackAvailable, - magicNumbers, - webpackSpecVars, -} = require('./_util') +const { isWebpackAvailable, magicNumbers, webpackSpecVars } = require('./_util') module.exports = { extends: [ @@ -20,23 +15,6 @@ module.exports = { 'standard', 'plugin:prettier/recommended', ], - settings: { - node: { - allowModules, - tryExtensions: [ - '.ts', - '.tsx', - '.vue', - '.svelte', - '.mjs', - '.js', - '.jsx', - '.json', - '.node', - '.mdx', - ], - }, - }, globals: isWebpackAvailable ? getGlobals(webpackSpecVars) : undefined, rules: { 'arrow-body-style': 2, @@ -55,6 +33,7 @@ module.exports = { }, ], 'eslint-comments/no-unused-disable': 2, + 'import/newline-after-import': 2, 'import/order': [ 2, { @@ -85,6 +64,13 @@ module.exports = { ], 'no-negated-condition': 2, 'no-process-exit': 0, // suspended by unicorn/no-process-exit + + // The following rules are duplicate with `eslint-plugin-import` + 'node/no-extraneous-import': 0, + 'node/no-extraneous-require': 0, + 'node/no-missing-import': 0, + 'node/no-missing-require': 0, + 'node/no-unsupported-features/es-syntax': 0, 'node/no-unsupported-features/node-builtins': 0, 'node/no-unpublished-import': 0, diff --git a/packages/eslint-config/overrides.js b/packages/eslint-config/overrides.js index 7841b6b1..bcbf6c50 100644 --- a/packages/eslint-config/overrides.js +++ b/packages/eslint-config/overrides.js @@ -124,6 +124,14 @@ const tsBase = { }, ], '@typescript-eslint/ban-ts-comment': 0, + '@typescript-eslint/ban-types': [ + 2, + { + types: { + object: false, + }, + }, + ], '@typescript-eslint/consistent-type-definitions': [2, 'interface'], '@typescript-eslint/explicit-function-return-type': 0, '@typescript-eslint/explicit-member-accessibility': [ @@ -206,15 +214,16 @@ const tsBase = { 'no-unused-vars': 0, 'no-use-before-define': 0, 'no-useless-constructor': 0, - 'node/no-missing-import': 0, // TypeScript itself has handle this 'node/shebang': 0, - // @typescript-eslint/no-floating-promises has already handled there case + // covered by @typescript-eslint/no-floating-promises 'promise/always-return': 0, 'promise/catch-or-return': 0, // ts itself has guaranteed it 'unicorn/no-array-callback-reference': 0, - // already handled by @typescript-eslint/no-extraneous-class + // covered by @typescript-eslint/no-extraneous-class 'unicorn/no-static-only-class': 0, + // covered by @typescript-eslint/no-this-alias + 'unicorn/no-this-assignment': 0, }, } diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 256e14fd..f209168b 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -19,12 +19,12 @@ "@babel/eslint-parser": "^7.14.3", "@babel/eslint-plugin": "^7.13.16", "@pkgr/utils": "^0.7.1", - "@typescript-eslint/eslint-plugin": "^4.24.0", - "@typescript-eslint/eslint-plugin-tslint": "^4.24.0", - "@typescript-eslint/parser": "^4.24.0", + "@typescript-eslint/eslint-plugin": "^4.25.0", + "@typescript-eslint/eslint-plugin-tslint": "^4.25.0", + "@typescript-eslint/parser": "^4.25.0", "angular-eslint-template-parser": "^0.1.0", "eslint-config-prettier": "^8.3.0", - "eslint-config-standard": "^16.0.2", + "eslint-config-standard": "^16.0.3", "eslint-config-standard-jsx": "^10.0.0", "eslint-config-standard-react": "^11.0.1", "eslint-formatter-friendly": "^7.0.0", @@ -32,7 +32,7 @@ "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.23.3", "eslint-plugin-jest": "^24.3.6", - "eslint-plugin-jsdoc": "^34.8.2", + "eslint-plugin-jsdoc": "^35.0.0", "eslint-plugin-mdx": "^1.13.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", diff --git a/yarn.lock b/yarn.lock index 0f369375..731b6023 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1592,10 +1592,10 @@ resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-11.0.1.tgz#31ffab0bff5f4f09551e059359bc1977ac83a974" integrity sha512-kUlWZHQkll+lOlYdj7dg8XwziO9WALkfG2dAXLITZMB8gO99CXQBH5W/HleXC3YwWFWXVxe1UClMk/2qsB9oAw== -"@es-joy/jsdoccomment@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.6.0.tgz#8926a8184df0968860f8c69b3bfc52efa6aeaa30" - integrity sha512-zT1EtysKMITJ7vE4RvOJqitxk/Str6It8hq+fykxkwLuTyzgak+TnVuVSIyovT/qrEz3i46ypCSXgNtIDYwNOg== +"@es-joy/jsdoccomment@^0.7.2": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.7.2.tgz#5c0802982b28e7dcd381fbb1f52e6fd088525a31" + integrity sha512-i5p0VgxeCXbf5aPLPY9s9Fz6K5BkzYdbRCisw/vEY/FXAxUJ8SiAifPwkFUm0CJrmZ8tFBGW8bUtM7wiE4KTIA== dependencies: comment-parser "^1.1.5" esquery "^1.4.0" @@ -2209,10 +2209,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256" integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== -"@types/node@*", "@types/node@^15.6.0": - version "15.6.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.0.tgz#f0ddca5a61e52627c9dcb771a6039d44694597bc" - integrity sha512-gCYSfQpy+LYhOFTKAeE8BkyGqaxmlFxe+n4DKM6DR0wzw/HISUE/hAmkC/KT8Sw5PCJblqg062b3z9gucv3k0A== +"@types/node@*", "@types/node@^15.6.1": + version "15.6.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.1.tgz#32d43390d5c62c5b6ec486a9bc9c59544de39a08" + integrity sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA== "@types/node@^12.7.1": version "12.20.12" @@ -2292,21 +2292,21 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin-tslint@^4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-4.24.0.tgz#3514069b2a56d6f45a6025c98ff73dc05279c2b8" - integrity sha512-IPZmt7I7ESfoZ7aER7eDRzsrrrcGOaCG0200Nkl5lIcNf5x1YBT7GN+GQH6CllaQgnL8tJ5mSghejkVjg+pVAA== +"@typescript-eslint/eslint-plugin-tslint@^4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-4.25.0.tgz#444256741446b6bdbac08c6d862c317ce8651b7f" + integrity sha512-s5wXIswqaAAm17UulSocB6uaEHM4h+T6RoNOgHdbTlNVj8wTPB50T+8bbBmwmrxJR0JxLCyyBnot7JBhSYIz4g== dependencies: - "@typescript-eslint/experimental-utils" "4.24.0" + "@typescript-eslint/experimental-utils" "4.25.0" lodash "^4.17.15" -"@typescript-eslint/eslint-plugin@^4.0.0", "@typescript-eslint/eslint-plugin@^4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.24.0.tgz#03801ffc25b2af9d08f3dc9bccfc0b7ce3780d0f" - integrity sha512-qbCgkPM7DWTsYQGjx9RTuQGswi+bEt0isqDBeo+CKV0953zqI0Tp7CZ7Fi9ipgFA6mcQqF4NOVNwS/f2r6xShw== +"@typescript-eslint/eslint-plugin@^4.0.0", "@typescript-eslint/eslint-plugin@^4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.25.0.tgz#d82657b6ab4caa4c3f888ff923175fadc2f31f2a" + integrity sha512-Qfs3dWkTMKkKwt78xp2O/KZQB8MPS1UQ5D3YW2s6LQWBE1074BE+Rym+b1pXZIX3M3fSvPUDaCvZLKV2ylVYYQ== dependencies: - "@typescript-eslint/experimental-utils" "4.24.0" - "@typescript-eslint/scope-manager" "4.24.0" + "@typescript-eslint/experimental-utils" "4.25.0" + "@typescript-eslint/scope-manager" "4.25.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -2326,26 +2326,26 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/experimental-utils@4.24.0", "@typescript-eslint/experimental-utils@^4.0.0", "@typescript-eslint/experimental-utils@^4.0.1": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.24.0.tgz#c23ead9de44b99c3a5fd925c33a106b00165e172" - integrity sha512-IwTT2VNDKH1h8RZseMH4CcYBz6lTvRoOLDuuqNZZoThvfHEhOiZPQCow+5El3PtyxJ1iDr6UXZwYtE3yZQjhcw== +"@typescript-eslint/experimental-utils@4.25.0", "@typescript-eslint/experimental-utils@^4.0.0", "@typescript-eslint/experimental-utils@^4.0.1": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.25.0.tgz#b2febcfa715d2c1806fd5f0335193a6cd270df54" + integrity sha512-f0doRE76vq7NEEU0tw+ajv6CrmPelw5wLoaghEHkA2dNLFb3T/zJQqGPQ0OYt5XlZaS13MtnN+GTPCuUVg338w== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.24.0" - "@typescript-eslint/types" "4.24.0" - "@typescript-eslint/typescript-estree" "4.24.0" + "@typescript-eslint/scope-manager" "4.25.0" + "@typescript-eslint/types" "4.25.0" + "@typescript-eslint/typescript-estree" "4.25.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.0.0", "@typescript-eslint/parser@^4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.24.0.tgz#2e5f1cc78ffefe43bfac7e5659309a92b09a51bd" - integrity sha512-dj1ZIh/4QKeECLb2f/QjRwMmDArcwc2WorWPRlB8UNTZlY1KpTVsbX7e3ZZdphfRw29aTFUSNuGB8w9X5sS97w== +"@typescript-eslint/parser@^4.0.0", "@typescript-eslint/parser@^4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.25.0.tgz#6b2cb6285aa3d55bfb263c650739091b0f19aceb" + integrity sha512-OZFa1SKyEJpAhDx8FcbWyX+vLwh7OEtzoo2iQaeWwxucyfbi0mT4DijbOSsTgPKzGHr6GrF2V5p/CEpUH/VBxg== dependencies: - "@typescript-eslint/scope-manager" "4.24.0" - "@typescript-eslint/types" "4.24.0" - "@typescript-eslint/typescript-estree" "4.24.0" + "@typescript-eslint/scope-manager" "4.25.0" + "@typescript-eslint/types" "4.25.0" + "@typescript-eslint/typescript-estree" "4.25.0" debug "^4.1.1" "@typescript-eslint/scope-manager@4.23.0": @@ -2356,23 +2356,23 @@ "@typescript-eslint/types" "4.23.0" "@typescript-eslint/visitor-keys" "4.23.0" -"@typescript-eslint/scope-manager@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.24.0.tgz#38088216f0eaf235fa30ed8cabf6948ec734f359" - integrity sha512-9+WYJGDnuC9VtYLqBhcSuM7du75fyCS/ypC8c5g7Sdw7pGL4NDTbeH38eJPfzIydCHZDoOgjloxSAA3+4l/zsA== +"@typescript-eslint/scope-manager@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.25.0.tgz#9d86a5bcc46ef40acd03d85ad4e908e5aab8d4ca" + integrity sha512-2NElKxMb/0rya+NJG1U71BuNnp1TBd1JgzYsldsdA83h/20Tvnf/HrwhiSlNmuq6Vqa0EzidsvkTArwoq+tH6w== dependencies: - "@typescript-eslint/types" "4.24.0" - "@typescript-eslint/visitor-keys" "4.24.0" + "@typescript-eslint/types" "4.25.0" + "@typescript-eslint/visitor-keys" "4.25.0" "@typescript-eslint/types@4.23.0": version "4.23.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.23.0.tgz#da1654c8a5332f4d1645b2d9a1c64193cae3aa3b" integrity sha512-oqkNWyG2SLS7uTWLZf6Sr7Dm02gA5yxiz1RP87tvsmDsguVATdpVguHr4HoGOcFOpCvx9vtCSCyQUGfzq28YCw== -"@typescript-eslint/types@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.24.0.tgz#6d0cca2048cbda4e265e0c4db9c2a62aaad8228c" - integrity sha512-tkZUBgDQKdvfs8L47LaqxojKDE+mIUmOzdz7r+u+U54l3GDkTpEbQ1Jp3cNqqAU9vMUCBA1fitsIhm7yN0vx9Q== +"@typescript-eslint/types@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.25.0.tgz#0e444a5c5e3c22d7ffa5e16e0e60510b3de5af87" + integrity sha512-+CNINNvl00OkW6wEsi32wU5MhHti2J25TJsJJqgQmJu3B3dYDBcmOxcE5w9cgoM13TrdE/5ND2HoEnBohasxRQ== "@typescript-eslint/typescript-estree@4.23.0": version "4.23.0" @@ -2387,13 +2387,13 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.24.0.tgz#b49249679a98014d8b03e8d4b70864b950e3c90f" - integrity sha512-kBDitL/by/HK7g8CYLT7aKpAwlR8doshfWz8d71j97n5kUa5caHWvY0RvEUEanL/EqBJoANev8Xc/mQ6LLwXGA== +"@typescript-eslint/typescript-estree@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.25.0.tgz#942e4e25888736bff5b360d9b0b61e013d0cfa25" + integrity sha512-1B8U07TGNAFMxZbSpF6jqiDs1cVGO0izVkf18Q/SPcUAc9LhHxzvSowXDTvkHMWUVuPpagupaW63gB6ahTXVlg== dependencies: - "@typescript-eslint/types" "4.24.0" - "@typescript-eslint/visitor-keys" "4.24.0" + "@typescript-eslint/types" "4.25.0" + "@typescript-eslint/visitor-keys" "4.25.0" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -2408,12 +2408,12 @@ "@typescript-eslint/types" "4.23.0" eslint-visitor-keys "^2.0.0" -"@typescript-eslint/visitor-keys@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.24.0.tgz#a8fafdc76cad4e04a681a945fbbac4e35e98e297" - integrity sha512-4ox1sjmGHIxjEDBnMCtWFFhErXtKA1Ec0sBpuz0fqf3P+g3JFGyTxxbF06byw0FRsPnnbq44cKivH7Ks1/0s6g== +"@typescript-eslint/visitor-keys@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.25.0.tgz#863e7ed23da4287c5b469b13223255d0fde6aaa7" + integrity sha512-AmkqV9dDJVKP/TcZrbf6s6i1zYXt5Hl8qOLrRDTFfRNae4+LB8A4N3i+FLZPW85zIxRy39BgeWOfMS3HoH5ngg== dependencies: - "@typescript-eslint/types" "4.24.0" + "@typescript-eslint/types" "4.25.0" eslint-visitor-keys "^2.0.0" "@vue/babel-helper-vue-jsx-merge-props@^1.2.1": @@ -4758,10 +4758,10 @@ eslint-config-standard-react@^11.0.1: resolved "https://registry.yarnpkg.com/eslint-config-standard-react/-/eslint-config-standard-react-11.0.1.tgz#1f488e0062c1e21c4c8584551619f11750658f55" integrity sha512-4WlBynOqBZJRaX81CBcIGDHqUiqxvw4j/DbEIICz8QkMs3xEncoPgAoysiqCSsg71X92uhaBc8sgqB96smaMmg== -eslint-config-standard@^16.0.2: - version "16.0.2" - resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz#71e91727ac7a203782d0a5ca4d1c462d14e234f6" - integrity sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw== +eslint-config-standard@^16.0.3: + version "16.0.3" + resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz#6c8761e544e96c531ff92642eeb87842b8488516" + integrity sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg== eslint-formatter-friendly@^7.0.0: version "7.0.0" @@ -4860,12 +4860,12 @@ eslint-plugin-jest@^24.3.6: dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" -eslint-plugin-jsdoc@^34.8.2: - version "34.8.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-34.8.2.tgz#94708429667e165f722aa50b98e863920f9ba14e" - integrity sha512-UOU9A40Cl806JMtla2vF+RM6sNqfLPbhLv9FZqhcC7+LmChD3DVaWqM7ADxpF0kMyZNWe1QKUnqGnXaA3NTn+w== +eslint-plugin-jsdoc@^35.0.0: + version "35.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-35.0.0.tgz#12634f12d1882a4f77b49aba2c4a17a7bc88cfcd" + integrity sha512-n92EO6g84qzjF4Lyvg+hDouMQTRHCKvW0hRobGRza0aqbG9fmmlS4p1x8cvPPAc0P87TmahMZnrP0F7hPOcAoQ== dependencies: - "@es-joy/jsdoccomment" "^0.6.0" + "@es-joy/jsdoccomment" "^0.7.2" comment-parser "1.1.5" debug "^4.3.1" esquery "^1.4.0"