[英]“No ESLint configuration found” error
最近,我们已经升级到ESLint 3.0.0并开始收到以下消息运行grunt eslint
任务:
> $ grunt eslint
Running "eslint:files" (eslint) task
Warning: No ESLint configuration found. Use --force to continue.
这是grunt-eslint
配置:
var lintTargets = [
"<%= app.src %>/**/*/!(*test|swfobject)+(.js)",
"test/e2e/**/*/*.js",
"!test/e2e/db/models/*.js"
];
module.exports.tasks = {
eslint: {
files: {
options: {
config: 'eslint.json',
fix: true,
rulesdir: ['eslint_rules']
},
src: lintTargets
}
}
};
我们应该怎么做才能修复错误?
您面临的错误是因为您的配置不存在。 配置eslint类型
eslint --init
然后根据您的要求进行配置。
然后再次执行该项目。
尝试用configFile
交换config
。 然后:
eslint.json
文件和Gruntfile.js
文件)eslint.json
)中放置一些配置,即:.
{
"rules": {
"eqeqeq": "off",
"curly": "warn",
"quotes": ["warn", "double"]
}
}
有关更多示例,请转到此处。
我有同样的错误。 好像需要配置。
转到您的项目根目录并在终端中运行
./node_modules/.bin/eslint --init
我在 Gulp 和运行“gulp-eslint”:“^3.0.1”版本时遇到了同样的问题。 我不得不将 config: 重命名为 Gulp 任务中的 configFile
.pipe(lint({configFile: 'eslint.json'}))
对于那些有同样问题的人,我们就是这样解决的。
按照需要配置运行迁移过程,我们必须将eslint.json
重命名为.eslintrc.json
,这是现在默认的 ESLint 配置文件名之一。
我们还删除了config
grunt-eslint 选项。
只需按照步骤
1.创建eslint配置文件名eslintrc.json
2.放置如下代码
gulp.src(jsFiles)
// eslint() attaches the lint output to the "eslint" property
// of the file object so it can be used by other modules.
.pipe(eslint({configFile: 'eslintrc.json'}))
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError());
我的根项目目录中有 eslint.rc 文件,但尽管出现错误,但还是发生了事件。
解决方案是将 exclude 属性添加到“eslint-loader”规则配置中:
module.exports = {
// ...
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {
// eslint options (if necessary)
}
},
],
},
// ...
}
在根目录创建一个名为 .eslintrc.json 文件的新文件:
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": "error"
}
}
gulp.task('eslint',function(){
return gulp.src(['src/*.js'])
.pipe(eslint())
.pipe(eslint.format())
});
`touch .eslintrc` instead of .eslint
这两个步骤可以帮到你!
运行命令ember init 。 当它要求覆盖现有文件时。 键入 n 跳过覆盖文件。 现在它将自动创建所需的文件,如 .eslintrc 等。
对我来说,当我将除 dist、dist_production 和 node_modules 文件夹之外的文件夹复制到另一个系统并尝试运行ember build时,发生了同样的问题。
我们今天遇到了这个问题,并意识到问题不是在我们正在处理的项目内部引起的,而是在我们有使用命令的链接的包内部引起的:
yarn link
这是一项通常用于测试新功能或尝试调试在另一个项目中表现出来的包中的问题时有用的功能。 我们通过删除链接或在 ember.js 禁用我们插件包的开发人员模式的情况下解决了这个问题。
索引.js
module.exports = {
isDevelopingAddon: function() {
return false;
},
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.