fix: improve rules for specific files

This commit is contained in:
Anthony Fu 2021-09-14 10:18:34 +08:00
parent 63ade1f6d1
commit d701469a55
5 changed files with 90 additions and 41 deletions

View File

@ -13,6 +13,6 @@
"@antfu/eslint-config": "*", "@antfu/eslint-config": "*",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"lerna": "^4.0.0", "lerna": "^4.0.0",
"typescript": "^4.4.2" "typescript": "^4.4.3"
} }
} }

View File

@ -5,21 +5,35 @@
"keywords": [], "keywords": [],
"license": "MIT", "license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"main": "index.js",
"files": [ "files": [
"index.js" "index.js"
], ],
"main": "index.js", "dependencies": {
"@antfu/eslint-config-react": "^0.8.2",
"@antfu/eslint-config-vue": "^0.8.2",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsonc": "^1.6.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-unicorn": "^35.0.0",
"eslint-plugin-vue": "7.17.0",
"eslint-plugin-yml": "^0.10.0",
"jsonc-eslint-parser": "^1.3.1",
"yaml-eslint-parser": "^0.4.1"
},
"devDependencies": {
"eslint": "^7.32.0"
},
"peerDependencies": { "peerDependencies": {
"eslint": ">=7.4.0" "eslint": ">=7.4.0"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
},
"dependencies": {
"@antfu/eslint-config-react": "^0.8.2",
"@antfu/eslint-config-vue": "^0.8.2"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View File

@ -11,7 +11,10 @@ module.exports = {
'plugin:jsonc/recommended-with-jsonc', 'plugin:jsonc/recommended-with-jsonc',
'plugin:yml/standard', 'plugin:yml/standard',
], ],
plugins: ['html', 'unicorn'], plugins: [
'html',
'unicorn',
],
settings: { settings: {
'import/resolver': { 'import/resolver': {
node: { extensions: ['.js', '.mjs', '.ts', '.d.ts'] }, node: { extensions: ['.js', '.mjs', '.ts', '.d.ts'] },
@ -68,6 +71,24 @@ module.exports = {
], ],
}, },
}, },
{
files: ['*.d.ts'],
rules: {
'import/no-duplicates': 'off',
},
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['scripts/**/*.*'],
rules: {
'no-console': 'off',
},
},
], ],
rules: { rules: {
// import // import

View File

@ -5,19 +5,13 @@
"keywords": [], "keywords": [],
"license": "MIT", "license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"main": "index.js",
"files": [ "files": [
"index.js" "index.js"
], ],
"main": "index.js",
"scripts": { "scripts": {
"lint": "eslint . --config=index.js" "lint": "eslint . --config=index.js"
}, },
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"eslint": ">=7.4.0"
},
"dependencies": { "dependencies": {
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
@ -33,5 +27,11 @@
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.32.0" "eslint": "^7.32.0"
},
"peerDependencies": {
"eslint": ">=7.4.0"
},
"publishConfig": {
"access": "public"
} }
} }

View File

@ -7,21 +7,29 @@ importers:
'@antfu/eslint-config': '*' '@antfu/eslint-config': '*'
eslint: ^7.32.0 eslint: ^7.32.0
lerna: ^4.0.0 lerna: ^4.0.0
typescript: ^4.4.2 typescript: ^4.4.3
devDependencies: devDependencies:
'@antfu/eslint-config': link:packages/all '@antfu/eslint-config': link:packages/all
eslint: 7.32.0 eslint: 7.32.0
lerna: 4.0.0 lerna: 4.0.0
typescript: 4.4.2 typescript: 4.4.3
packages/all: packages/all:
specifiers: specifiers:
'@antfu/eslint-config-react': ^0.7.0 '@antfu/eslint-config-react': ^0.8.2
'@antfu/eslint-config-vue': ^0.7.0 '@antfu/eslint-config-vue': ^0.8.2
'@typescript-eslint/eslint-plugin': ^4.31.0
'@typescript-eslint/parser': ^4.31.0
eslint: ^7.32.0 eslint: ^7.32.0
eslint-plugin-vue: 7.17.0
jsonc-eslint-parser: ^1.3.1
dependencies: dependencies:
'@antfu/eslint-config-react': link:../react '@antfu/eslint-config-react': link:../react
'@antfu/eslint-config-vue': link:../vue '@antfu/eslint-config-vue': link:../vue
'@typescript-eslint/eslint-plugin': 4.31.0_d9c1bc16c4e2aea4e8e177a5961dd3bf
'@typescript-eslint/parser': 4.31.0_eslint@7.32.0+typescript@4.4.3
eslint-plugin-vue: 7.17.0_eslint@7.32.0
jsonc-eslint-parser: 1.3.1
devDependencies: devDependencies:
eslint: 7.32.0 eslint: 7.32.0
@ -56,7 +64,7 @@ importers:
packages/react: packages/react:
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.7.0 '@antfu/eslint-config-ts': ^0.8.2
eslint: ^7.32.0 eslint: ^7.32.0
eslint-plugin-react: ^7.25.1 eslint-plugin-react: ^7.25.1
react: ^17.0.2 react: ^17.0.2
@ -71,20 +79,20 @@ importers:
packages/typescript: packages/typescript:
specifiers: specifiers:
'@antfu/eslint-config-basic': ^0.7.0 '@antfu/eslint-config-basic': ^0.8.1
'@typescript-eslint/eslint-plugin': ^4.31.0 '@typescript-eslint/eslint-plugin': ^4.31.0
'@typescript-eslint/parser': ^4.31.0 '@typescript-eslint/parser': ^4.31.0
eslint: ^7.32.0 eslint: ^7.32.0
dependencies: dependencies:
'@antfu/eslint-config-basic': link:../basic '@antfu/eslint-config-basic': link:../basic
'@typescript-eslint/eslint-plugin': 4.31.0_a690ff3776b01e92cf0b93501bb5ae6a '@typescript-eslint/eslint-plugin': 4.31.0_d9c1bc16c4e2aea4e8e177a5961dd3bf
'@typescript-eslint/parser': 4.31.0_eslint@7.32.0+typescript@4.4.2 '@typescript-eslint/parser': 4.31.0_eslint@7.32.0+typescript@4.4.3
devDependencies: devDependencies:
eslint: 7.32.0 eslint: 7.32.0
packages/vue: packages/vue:
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.7.0 '@antfu/eslint-config-ts': ^0.8.2
eslint: ^7.32.0 eslint: ^7.32.0
eslint-plugin-vue: 7.17.0 eslint-plugin-vue: 7.17.0
dependencies: dependencies:
@ -1225,7 +1233,7 @@ packages:
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
dev: true dev: true
/@typescript-eslint/eslint-plugin/4.31.0_a690ff3776b01e92cf0b93501bb5ae6a: /@typescript-eslint/eslint-plugin/4.31.0_d9c1bc16c4e2aea4e8e177a5961dd3bf:
resolution: {integrity: sha512-iPKZTZNavAlOhfF4gymiSuUkgLne/nh5Oz2/mdiUmuZVD42m9PapnCnzjxuDsnpnbH3wT5s2D8bw6S39TC6GNw==} resolution: {integrity: sha512-iPKZTZNavAlOhfF4gymiSuUkgLne/nh5Oz2/mdiUmuZVD42m9PapnCnzjxuDsnpnbH3wT5s2D8bw6S39TC6GNw==}
engines: {node: ^10.12.0 || >=12.0.0} engines: {node: ^10.12.0 || >=12.0.0}
peerDependencies: peerDependencies:
@ -1236,21 +1244,21 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/experimental-utils': 4.31.0_eslint@7.32.0+typescript@4.4.2 '@typescript-eslint/experimental-utils': 4.31.0_eslint@7.32.0+typescript@4.4.3
'@typescript-eslint/parser': 4.31.0_eslint@7.32.0+typescript@4.4.2 '@typescript-eslint/parser': 4.31.0_eslint@7.32.0+typescript@4.4.3
'@typescript-eslint/scope-manager': 4.31.0 '@typescript-eslint/scope-manager': 4.31.0
debug: 4.3.1 debug: 4.3.1
eslint: 7.32.0 eslint: 7.32.0
functional-red-black-tree: 1.0.1 functional-red-black-tree: 1.0.1
regexpp: 3.1.0 regexpp: 3.1.0
semver: 7.3.5 semver: 7.3.5
tsutils: 3.21.0_typescript@4.4.2 tsutils: 3.21.0_typescript@4.4.3
typescript: 4.4.2 typescript: 4.4.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: false dev: false
/@typescript-eslint/experimental-utils/4.31.0_eslint@7.32.0+typescript@4.4.2: /@typescript-eslint/experimental-utils/4.31.0_eslint@7.32.0+typescript@4.4.3:
resolution: {integrity: sha512-Hld+EQiKLMppgKKkdUsLeVIeEOrwKc2G983NmznY/r5/ZtZCDvIOXnXtwqJIgYz/ymsy7n7RGvMyrzf1WaSQrw==} resolution: {integrity: sha512-Hld+EQiKLMppgKKkdUsLeVIeEOrwKc2G983NmznY/r5/ZtZCDvIOXnXtwqJIgYz/ymsy7n7RGvMyrzf1WaSQrw==}
engines: {node: ^10.12.0 || >=12.0.0} engines: {node: ^10.12.0 || >=12.0.0}
peerDependencies: peerDependencies:
@ -1259,7 +1267,7 @@ packages:
'@types/json-schema': 7.0.7 '@types/json-schema': 7.0.7
'@typescript-eslint/scope-manager': 4.31.0 '@typescript-eslint/scope-manager': 4.31.0
'@typescript-eslint/types': 4.31.0 '@typescript-eslint/types': 4.31.0
'@typescript-eslint/typescript-estree': 4.31.0_typescript@4.4.2 '@typescript-eslint/typescript-estree': 4.31.0_typescript@4.4.3
eslint: 7.32.0 eslint: 7.32.0
eslint-scope: 5.1.1 eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@7.32.0 eslint-utils: 3.0.0_eslint@7.32.0
@ -1268,7 +1276,7 @@ packages:
- typescript - typescript
dev: false dev: false
/@typescript-eslint/parser/4.31.0_eslint@7.32.0+typescript@4.4.2: /@typescript-eslint/parser/4.31.0_eslint@7.32.0+typescript@4.4.3:
resolution: {integrity: sha512-oWbzvPh5amMuTmKaf1wp0ySxPt2ZXHnFQBN2Szu1O//7LmOvgaKTCIDNLK2NvzpmVd5A2M/1j/rujBqO37hj3w==} resolution: {integrity: sha512-oWbzvPh5amMuTmKaf1wp0ySxPt2ZXHnFQBN2Szu1O//7LmOvgaKTCIDNLK2NvzpmVd5A2M/1j/rujBqO37hj3w==}
engines: {node: ^10.12.0 || >=12.0.0} engines: {node: ^10.12.0 || >=12.0.0}
peerDependencies: peerDependencies:
@ -1280,10 +1288,10 @@ packages:
dependencies: dependencies:
'@typescript-eslint/scope-manager': 4.31.0 '@typescript-eslint/scope-manager': 4.31.0
'@typescript-eslint/types': 4.31.0 '@typescript-eslint/types': 4.31.0
'@typescript-eslint/typescript-estree': 4.31.0_typescript@4.4.2 '@typescript-eslint/typescript-estree': 4.31.0_typescript@4.4.3
debug: 4.3.1 debug: 4.3.1
eslint: 7.32.0 eslint: 7.32.0
typescript: 4.4.2 typescript: 4.4.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: false dev: false
@ -1301,7 +1309,7 @@ packages:
engines: {node: ^8.10.0 || ^10.13.0 || >=11.10.1} engines: {node: ^8.10.0 || ^10.13.0 || >=11.10.1}
dev: false dev: false
/@typescript-eslint/typescript-estree/4.31.0_typescript@4.4.2: /@typescript-eslint/typescript-estree/4.31.0_typescript@4.4.3:
resolution: {integrity: sha512-QHl2014t3ptg+xpmOSSPn5hm4mY8D4s97ftzyk9BZ8RxYQ3j73XcwuijnJ9cMa6DO4aLXeo8XS3z1omT9LA/Eg==} resolution: {integrity: sha512-QHl2014t3ptg+xpmOSSPn5hm4mY8D4s97ftzyk9BZ8RxYQ3j73XcwuijnJ9cMa6DO4aLXeo8XS3z1omT9LA/Eg==}
engines: {node: ^10.12.0 || >=12.0.0} engines: {node: ^10.12.0 || >=12.0.0}
peerDependencies: peerDependencies:
@ -1316,8 +1324,8 @@ packages:
globby: 11.0.4 globby: 11.0.4
is-glob: 4.0.1 is-glob: 4.0.1
semver: 7.3.5 semver: 7.3.5
tsutils: 3.21.0_typescript@4.4.2 tsutils: 3.21.0_typescript@4.4.3
typescript: 4.4.2 typescript: 4.4.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: false dev: false
@ -5417,14 +5425,14 @@ packages:
/tslib/1.13.0: /tslib/1.13.0:
resolution: {integrity: sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==} resolution: {integrity: sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==}
/tsutils/3.21.0_typescript@4.4.2: /tsutils/3.21.0_typescript@4.4.3:
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
dependencies: dependencies:
tslib: 1.13.0 tslib: 1.13.0
typescript: 4.4.2 typescript: 4.4.3
dev: false dev: false
/tunnel-agent/0.6.0: /tunnel-agent/0.6.0:
@ -5488,6 +5496,12 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/typescript/4.4.3:
resolution: {integrity: sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
/uglify-js/3.10.0: /uglify-js/3.10.0:
resolution: {integrity: sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==} resolution: {integrity: sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==}
engines: {node: '>=0.8.0'} engines: {node: '>=0.8.0'}