当我启动我的dev服务器webpack控制台时,一些实际上不存在的linting错误。您可以看到下面给出的代码错误是“字符串必须使用单引号”,但实际上在代码中没有使用单引号。
controller.js
<div class="text">
<p>
"Old text 1 "
<img src="http://urlofimage.com"> "Old 2"
</p>
</div>
答案 0 :(得分:1)
babel在eslint开始扫描之前正在发送代码。
loaders: [
// Javascript
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
fix: true,
quiet: true,
failOnError: true,
},
{
enforce: "post",
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: 'babel',
query: {
presets: ['es2015'],
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
options: {
fix: true,
quiet: true,
failOnError: false,
},
},
},
在preloader属性中加载eslint-loader
preLoaders: [
// Javascript
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
fix: true,
quiet: true,
failOnError: true,
},
},
],