feat: add eslint-webpack-plugin

This commit is contained in:
Nex Zhu 2021-12-27 17:37:41 +08:00
parent d848c6934c
commit d7dc53640b
No known key found for this signature in database
GPG Key ID: 15C6254AD19362B4
3 changed files with 99 additions and 3 deletions

View File

@ -1,4 +1,5 @@
// .fes.js 只负责管理编译时配置只能使用plain Object // .fes.js 只负责管理编译时配置只能使用plain Object
import ESLintPlugin from 'eslint-webpack-plugin'
import StylelintPlugin from 'stylelint-webpack-plugin' import StylelintPlugin from 'stylelint-webpack-plugin'
export default { export default {
@ -32,6 +33,11 @@ export default {
], ],
}, },
chainWebpack(config) { chainWebpack(config) {
config.plugin('eslint').use(ESLintPlugin, [
{
files: 'src/**/*.{js,ts,tsx,vue}',
},
])
config.plugin('stylelint').use(StylelintPlugin, [ config.plugin('stylelint').use(StylelintPlugin, [
{ {
extensions: ['css', 'scss', 'vue', 'tsx'], extensions: ['css', 'scss', 'vue', 'tsx'],

95
package-lock.json generated
View File

@ -24,6 +24,7 @@
"@fesjs/plugin-sass": "^2.0.0", "@fesjs/plugin-sass": "^2.0.0",
"@vue/compiler-sfc": "^3.2.26", "@vue/compiler-sfc": "^3.2.26",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint-webpack-plugin": "^3.1.1",
"husky": "^7.0.4", "husky": "^7.0.4",
"lint-staged": "^12.1.4", "lint-staged": "^12.1.4",
"postcss-html": "^1.3.0", "postcss-html": "^1.3.0",
@ -5500,6 +5501,58 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
} }
}, },
"node_modules/eslint-webpack-plugin": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-3.1.1.tgz",
"integrity": "sha512-xSucskTN9tOkfW7so4EaiFIkulWLXwCB/15H917lR6pTv0Zot6/fetFucmENRb7J5whVSFKIvwnrnsa78SG2yg==",
"dev": true,
"dependencies": {
"@types/eslint": "^7.28.2",
"jest-worker": "^27.3.1",
"micromatch": "^4.0.4",
"normalize-path": "^3.0.0",
"schema-utils": "^3.1.1"
},
"engines": {
"node": ">= 12.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
"webpack": "^5.0.0"
}
},
"node_modules/eslint-webpack-plugin/node_modules/@types/eslint": {
"version": "7.29.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz",
"integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==",
"dev": true,
"dependencies": {
"@types/estree": "*",
"@types/json-schema": "*"
}
},
"node_modules/eslint-webpack-plugin/node_modules/schema-utils": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.8",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
},
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/eslint/node_modules/ansi-styles": { "node_modules/eslint/node_modules/ansi-styles": {
"version": "4.3.0", "version": "4.3.0",
"dev": true, "dev": true,
@ -12479,7 +12532,6 @@
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -17938,6 +17990,42 @@
"version": "3.1.0", "version": "3.1.0",
"dev": true "dev": true
}, },
"eslint-webpack-plugin": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-3.1.1.tgz",
"integrity": "sha512-xSucskTN9tOkfW7so4EaiFIkulWLXwCB/15H917lR6pTv0Zot6/fetFucmENRb7J5whVSFKIvwnrnsa78SG2yg==",
"dev": true,
"requires": {
"@types/eslint": "^7.28.2",
"jest-worker": "^27.3.1",
"micromatch": "^4.0.4",
"normalize-path": "^3.0.0",
"schema-utils": "^3.1.1"
},
"dependencies": {
"@types/eslint": {
"version": "7.29.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz",
"integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==",
"dev": true,
"requires": {
"@types/estree": "*",
"@types/json-schema": "*"
}
},
"schema-utils": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.8",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
}
}
}
},
"espree": { "espree": {
"version": "9.2.0", "version": "9.2.0",
"dev": true, "dev": true,
@ -22821,8 +22909,9 @@
}, },
"typescript": { "typescript": {
"version": "4.5.4", "version": "4.5.4",
"dev": true, "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
"peer": true "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
"dev": true
}, },
"unicode-canonical-property-names-ecmascript": { "unicode-canonical-property-names-ecmascript": {
"version": "2.0.0", "version": "2.0.0",

View File

@ -44,6 +44,7 @@
"@fesjs/plugin-sass": "^2.0.0", "@fesjs/plugin-sass": "^2.0.0",
"@vue/compiler-sfc": "^3.2.26", "@vue/compiler-sfc": "^3.2.26",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint-webpack-plugin": "^3.1.1",
"husky": "^7.0.4", "husky": "^7.0.4",
"lint-staged": "^12.1.4", "lint-staged": "^12.1.4",
"postcss-html": "^1.3.0", "postcss-html": "^1.3.0",