refactor: rename eslintLoaderOptions to eslint (#290)

* refactor: rename eslintLoaderOptions to eslint

* feat: support eslint boolean
This commit is contained in:
chenbin92 2020-04-27 16:06:05 +08:00 committed by GitHub
parent 909ecbbf44
commit 1e566c905a
4 changed files with 10 additions and 7 deletions

View File

@ -6,7 +6,7 @@
"ignoreHtmlTemplate": false
}
},
"eslintLoaderOptions": {
"eslint": {
"disable": false,
"quiet": true
}

View File

@ -55,7 +55,5 @@ module.exports = {
compileDependencies: [],
babelPlugins: [],
babelPresets: [],
eslintLoaderOptions: {
disable: false
}
eslint: true
};

View File

@ -63,5 +63,7 @@ module.exports = {
compileDependencies: 'array',
babelPlugins: 'array',
babelPresets: 'array',
eslintLoaderOptions: 'object'
eslint: (val) => {
return validation('eslint', val, 'boolean|object');
}
};

View File

@ -1,7 +1,10 @@
const path = require('path');
module.exports = (config, eslintLoaderOptions, { rootDir }) => {
const { disable, ...args } = eslintLoaderOptions;
module.exports = (config, eslint, { rootDir }) => {
if (typeof eslint === 'boolean' && eslint === false) {
return config;
}
const { disable, ...args } = eslint;
if (!disable) {
const appSrc = path.join(rootDir, 'src');
config.module