首先想在umi dev时进行eslint校验要在.env文件下设置ESLINT=1
umi使用的af-webpack中eslint-loader是以下配置,eslintignore就不起做用了。须要外部用webpack-chain修改optionconst eslintOptions = {
formatter: eslintFormatter,
baseConfig: {
extends: [require.resolve('eslint-config-umi')],
},
ignore: false,
eslintPath: require.resolve('eslint'),
useEslintrc: false,
};
例如:"start": "ESLINT=true umi dev",配置
执行 :npm run start 复制代码
问题解决:须要经过设置需 要外部用webpack-chain修改options 的配置项解决,webpack
如:web
手动开启配置
//设置开启.eslintignore config.module .rule('eslint') .use('eslint-loader') .tap((options: any) => ({ ...options, ...{ ignore: true, // 启用 .eslintignore } }) );
如图:复制代码