Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support eslint check via process.env.ESLINT (#1819)
Close #1770 现在有个问题,配置生效了,但是打印的日志里**定位文件错误**,都是定在了 eslint-load.js。
- Loading branch information
Showing
7 changed files
with
543 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import eslintFormatter from 'react-dev-utils/eslintFormatter'; | ||
|
||
export default function(webpackConfig, opts) { | ||
const eslintOptions = { | ||
formatter: eslintFormatter, | ||
baseConfig: { | ||
extends: [require.resolve('eslint-config-umi')], | ||
}, | ||
ignore: false, | ||
eslintPath: require.resolve('eslint'), | ||
useEslintrc: false, | ||
}; | ||
|
||
webpackConfig.module | ||
.rule('eslint') | ||
.test(/\.(js|jsx)$/) | ||
.include.add(opts.cwd) | ||
.end() | ||
.exclude | ||
.add(/node_modules/) | ||
.end() | ||
.enforce('pre') | ||
.use('eslint-loader') | ||
.loader(require.resolve('eslint-loader')) | ||
.options(eslintOptions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.