chore: lint

This commit is contained in:
Anthony Fu 2020-08-12 20:08:06 +08:00
parent 24e025c12d
commit 7dd8ffaed0
9 changed files with 71 additions and 36 deletions

View File

@ -6,6 +6,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"lint": "npx eslint --ext .js --fix .",
"release": "lerna publish --conventional-commits" "release": "lerna publish --conventional-commits"
}, },
"devDependencies": { "devDependencies": {

View File

@ -18,5 +18,8 @@
"dependencies": { "dependencies": {
"@antfu/eslint-config-react": "^0.3.1", "@antfu/eslint-config-react": "^0.3.1",
"@antfu/eslint-config-vue": "^0.3.1" "@antfu/eslint-config-vue": "^0.3.1"
},
"devDependencies": {
"eslint": "^7.6.0"
} }
} }

View File

@ -26,15 +26,15 @@ module.exports = {
'import/no-unresolved': 'off', 'import/no-unresolved': 'off',
// Common // Common
'semi': [2, 'never'], semi: [2, 'never'],
'curly': [2, 'multi-or-nest', 'consistent'], curly: [2, 'multi-or-nest', 'consistent'],
'quotes': ['error', 'single'], quotes: ['error', 'single'],
'no-unused-vars': 'warn', 'no-unused-vars': 'warn',
'no-param-reassign': 'off', 'no-param-reassign': 'off',
'array-bracket-spacing': ['error', 'never'], 'array-bracket-spacing': ['error', 'never'],
'brace-style': ['error', 'stroustrup', { 'allowSingleLine': true }], 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
'block-spacing': ['error', 'always'], 'block-spacing': ['error', 'always'],
'camelcase': 'off', camelcase: 'off',
'comma-spacing': ['error', { before: false, after: true }], 'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last'], 'comma-style': ['error', 'last'],
'comma-dangle': ['error', 'always-multiline'], 'comma-dangle': ['error', 'always-multiline'],
@ -44,7 +44,7 @@ module.exports = {
'no-cond-assign': ['error', 'always'], 'no-cond-assign': ['error', 'always'],
'func-call-spacing': ['off', 'never'], 'func-call-spacing': ['off', 'never'],
'key-spacing': ['error', { beforeColon: false, afterColon: true }], 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'indent': ['error', 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }], indent: ['error', 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
'no-restricted-syntax': [ 'no-restricted-syntax': [
'error', 'error',
'DebuggerStatement', 'DebuggerStatement',
@ -82,8 +82,8 @@ module.exports = {
'array-callback-return': 'error', 'array-callback-return': 'error',
'block-scoped-var': 'error', 'block-scoped-var': 'error',
'consistent-return': 'off', 'consistent-return': 'off',
'complexity': ['off', 11], complexity: ['off', 11],
'eqeqeq': ['error', 'allow-null'], eqeqeq: ['error', 'allow-null'],
'no-alert': 'warn', 'no-alert': 'warn',
'no-case-declarations': 'error', 'no-case-declarations': 'error',
'no-multi-spaces': 'error', 'no-multi-spaces': 'error',

View File

@ -1,12 +1,12 @@
module.exports = { module.exports = {
extends: [ extends: [
"plugin:react/recommended", 'plugin:react/recommended',
'@antfu/eslint-config-ts', '@antfu/eslint-config-ts',
], ],
"rules": { rules: {
"jsx-quotes": [ 'jsx-quotes': [
"error", 'error',
"prefer-double" 'prefer-double',
] ],
} },
} }

View File

@ -24,6 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.6.0", "eslint": "^7.6.0",
"react": "^16.13.1",
"typescript": "^3.9.7" "typescript": "^3.9.7"
} }
} }

View File

@ -29,5 +29,5 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off', '@typescript-eslint/ban-types': 'off',
} },
} }

View File

@ -20,5 +20,8 @@
"@antfu/eslint-config-basic": "^0.3.0", "@antfu/eslint-config-basic": "^0.3.0",
"@typescript-eslint/eslint-plugin": "3.6.1", "@typescript-eslint/eslint-plugin": "3.6.1",
"@typescript-eslint/parser": "^3.9.0" "@typescript-eslint/parser": "^3.9.0"
},
"devDependencies": {
"eslint": "^7.6.0"
} }
} }

View File

@ -18,5 +18,8 @@
"dependencies": { "dependencies": {
"@antfu/eslint-config-ts": "^0.3.1", "@antfu/eslint-config-ts": "^0.3.1",
"eslint-plugin-vue": "7.0.0-alpha.10" "eslint-plugin-vue": "7.0.0-alpha.10"
},
"devDependencies": {
"eslint": "^7.6.0"
} }
} }

View File

@ -14,9 +14,12 @@ importers:
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'
devDependencies:
eslint: 7.6.0
specifiers: specifiers:
'@antfu/eslint-config-react': ^0.3.0 '@antfu/eslint-config-react': ^0.3.1
'@antfu/eslint-config-vue': ^0.3.0 '@antfu/eslint-config-vue': ^0.3.1
eslint: ^7.6.0
packages/basic: packages/basic:
dependencies: dependencies:
eslint-config-standard: 14.1.1_852544c994842eaa2dbc35fff65e8cbc eslint-config-standard: 14.1.1_852544c994842eaa2dbc35fff65e8cbc
@ -43,27 +46,35 @@ importers:
eslint-plugin-react: 7.20.5_eslint@7.6.0 eslint-plugin-react: 7.20.5_eslint@7.6.0
devDependencies: devDependencies:
eslint: 7.6.0 eslint: 7.6.0
react: 16.13.1
typescript: 3.9.7 typescript: 3.9.7
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.3.0 '@antfu/eslint-config-ts': ^0.3.1
eslint: ^7.6.0 eslint: ^7.6.0
eslint-plugin-react: ^7.20.5 eslint-plugin-react: ^7.20.5
react: ^16.13.1
typescript: ^3.9.7 typescript: ^3.9.7
packages/typescript: packages/typescript:
dependencies: dependencies:
'@antfu/eslint-config-basic': 'link:../basic' '@antfu/eslint-config-basic': 'link:../basic'
'@typescript-eslint/eslint-plugin': 3.6.1_@typescript-eslint+parser@3.9.0 '@typescript-eslint/eslint-plugin': 3.6.1_59c62cf4e3dde9582ccc3eef0435f14f
'@typescript-eslint/parser': 3.9.0 '@typescript-eslint/parser': 3.9.0_eslint@7.6.0
devDependencies:
eslint: 7.6.0
specifiers: specifiers:
'@antfu/eslint-config-basic': ^0.3.0 '@antfu/eslint-config-basic': ^0.3.0
'@typescript-eslint/eslint-plugin': 3.6.1 '@typescript-eslint/eslint-plugin': 3.6.1
'@typescript-eslint/parser': ^3.9.0 '@typescript-eslint/parser': ^3.9.0
eslint: ^7.6.0
packages/vue: packages/vue:
dependencies: dependencies:
'@antfu/eslint-config-ts': 'link:../typescript' '@antfu/eslint-config-ts': 'link:../typescript'
eslint-plugin-vue: 7.0.0-alpha.10 eslint-plugin-vue: 7.0.0-alpha.10_eslint@7.6.0
devDependencies:
eslint: 7.6.0
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.3.0 '@antfu/eslint-config-ts': ^0.3.1
eslint: ^7.6.0
eslint-plugin-vue: 7.0.0-alpha.10 eslint-plugin-vue: 7.0.0-alpha.10
lockfileVersion: 5.1 lockfileVersion: 5.1
packages: packages:
@ -1107,11 +1118,12 @@ packages:
/@types/normalize-package-data/2.4.0: /@types/normalize-package-data/2.4.0:
resolution: resolution:
integrity: sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== integrity: sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==
/@typescript-eslint/eslint-plugin/3.6.1_@typescript-eslint+parser@3.9.0: /@typescript-eslint/eslint-plugin/3.6.1_59c62cf4e3dde9582ccc3eef0435f14f:
dependencies: dependencies:
'@typescript-eslint/experimental-utils': 3.6.1 '@typescript-eslint/experimental-utils': 3.6.1_eslint@7.6.0
'@typescript-eslint/parser': 3.9.0 '@typescript-eslint/parser': 3.9.0_eslint@7.6.0
debug: 4.1.1 debug: 4.1.1
eslint: 7.6.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.2 semver: 7.3.2
@ -1128,11 +1140,12 @@ packages:
optional: true optional: true
resolution: resolution:
integrity: sha512-06lfjo76naNeOMDl+mWG9Fh/a0UHKLGhin+mGaIw72FUMbMGBkdi/FEJmgEDzh4eE73KIYzHWvOCYJ0ak7nrJQ== integrity: sha512-06lfjo76naNeOMDl+mWG9Fh/a0UHKLGhin+mGaIw72FUMbMGBkdi/FEJmgEDzh4eE73KIYzHWvOCYJ0ak7nrJQ==
/@typescript-eslint/experimental-utils/3.6.1: /@typescript-eslint/experimental-utils/3.6.1_eslint@7.6.0:
dependencies: dependencies:
'@types/json-schema': 7.0.5 '@types/json-schema': 7.0.5
'@typescript-eslint/types': 3.6.1 '@typescript-eslint/types': 3.6.1
'@typescript-eslint/typescript-estree': 3.6.1 '@typescript-eslint/typescript-estree': 3.6.1
eslint: 7.6.0
eslint-scope: 5.1.0 eslint-scope: 5.1.0
eslint-utils: 2.1.0 eslint-utils: 2.1.0
dev: false dev: false
@ -1142,11 +1155,12 @@ packages:
eslint: '*' eslint: '*'
resolution: resolution:
integrity: sha512-oS+hihzQE5M84ewXrTlVx7eTgc52eu+sVmG7ayLfOhyZmJ8Unvf3osyFQNADHP26yoThFfbxcibbO0d2FjnYhg== integrity: sha512-oS+hihzQE5M84ewXrTlVx7eTgc52eu+sVmG7ayLfOhyZmJ8Unvf3osyFQNADHP26yoThFfbxcibbO0d2FjnYhg==
/@typescript-eslint/experimental-utils/3.9.0: /@typescript-eslint/experimental-utils/3.9.0_eslint@7.6.0:
dependencies: dependencies:
'@types/json-schema': 7.0.5 '@types/json-schema': 7.0.5
'@typescript-eslint/types': 3.9.0 '@typescript-eslint/types': 3.9.0
'@typescript-eslint/typescript-estree': 3.9.0 '@typescript-eslint/typescript-estree': 3.9.0
eslint: 7.6.0
eslint-scope: 5.1.0 eslint-scope: 5.1.0
eslint-utils: 2.1.0 eslint-utils: 2.1.0
dev: false dev: false
@ -1156,12 +1170,13 @@ packages:
eslint: '*' eslint: '*'
resolution: resolution:
integrity: sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA== integrity: sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==
/@typescript-eslint/parser/3.9.0: /@typescript-eslint/parser/3.9.0_eslint@7.6.0:
dependencies: dependencies:
'@types/eslint-visitor-keys': 1.0.0 '@types/eslint-visitor-keys': 1.0.0
'@typescript-eslint/experimental-utils': 3.9.0 '@typescript-eslint/experimental-utils': 3.9.0_eslint@7.6.0
'@typescript-eslint/types': 3.9.0 '@typescript-eslint/types': 3.9.0
'@typescript-eslint/typescript-estree': 3.9.0 '@typescript-eslint/typescript-estree': 3.9.0
eslint: 7.6.0
eslint-visitor-keys: 1.3.0 eslint-visitor-keys: 1.3.0
dev: false dev: false
engines: engines:
@ -2598,12 +2613,13 @@ packages:
eslint: '>=7.3.0' eslint: '>=7.3.0'
resolution: resolution:
integrity: sha512-S8v7+v4gZTQPj4pKKvexhgSUaLQSyItvxW2SVZDaX9Iu5IjlAmF2eni+L6w8a2aqshxgU8Lle4FIAVDtuejSKQ== integrity: sha512-S8v7+v4gZTQPj4pKKvexhgSUaLQSyItvxW2SVZDaX9Iu5IjlAmF2eni+L6w8a2aqshxgU8Lle4FIAVDtuejSKQ==
/eslint-plugin-vue/7.0.0-alpha.10: /eslint-plugin-vue/7.0.0-alpha.10_eslint@7.6.0:
dependencies: dependencies:
eslint: 7.6.0
eslint-utils: 2.1.0 eslint-utils: 2.1.0
natural-compare: 1.4.0 natural-compare: 1.4.0
semver: 7.3.2 semver: 7.3.2
vue-eslint-parser: 7.1.0 vue-eslint-parser: 7.1.0_eslint@7.6.0
dev: false dev: false
engines: engines:
node: '>=8.10' node: '>=8.10'
@ -4008,7 +4024,6 @@ packages:
/loose-envify/1.4.0: /loose-envify/1.4.0:
dependencies: dependencies:
js-tokens: 4.0.0 js-tokens: 4.0.0
dev: false
hasBin: true hasBin: true
resolution: resolution:
integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@ -4988,7 +5003,6 @@ packages:
loose-envify: 1.4.0 loose-envify: 1.4.0
object-assign: 4.1.1 object-assign: 4.1.1
react-is: 16.13.1 react-is: 16.13.1
dev: false
resolution: resolution:
integrity: sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== integrity: sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
/proto-list/1.2.4: /proto-list/1.2.4:
@ -5063,9 +5077,18 @@ packages:
resolution: resolution:
integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==
/react-is/16.13.1: /react-is/16.13.1:
dev: false
resolution: resolution:
integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
/react/16.13.1:
dependencies:
loose-envify: 1.4.0
object-assign: 4.1.1
prop-types: 15.7.2
dev: true
engines:
node: '>=0.10.0'
resolution:
integrity: sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==
/read-cmd-shim/1.0.5: /read-cmd-shim/1.0.5:
dependencies: dependencies:
graceful-fs: 4.2.4 graceful-fs: 4.2.4
@ -6241,9 +6264,10 @@ packages:
'0': node >=0.6.0 '0': node >=0.6.0
resolution: resolution:
integrity: sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= integrity: sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=
/vue-eslint-parser/7.1.0: /vue-eslint-parser/7.1.0_eslint@7.6.0:
dependencies: dependencies:
debug: 4.1.1 debug: 4.1.1
eslint: 7.6.0
eslint-scope: 5.1.0 eslint-scope: 5.1.0
eslint-visitor-keys: 1.3.0 eslint-visitor-keys: 1.3.0
espree: 6.2.1 espree: 6.2.1