"No ESLint configuration found" 错误
"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
}
}
};
我们应该如何修复错误?
对于遇到相同问题的用户,我们已解决此问题。
在 Requiring Configuration to Run 迁移过程之后,我们不得不 将 eslint.json
重命名为 .eslintrc.json
,这是默认的 ESLint 配置文件名之一现在。
我们还删除了 config
grunt-eslint 选项。
尝试将 config
替换为 configFile
。然后:
- 创建
eslint.json
文件和
- 指向它的正确位置(相对于
Gruntfile.js
文件)
- 在该文件中放置一些配置 (
eslint.json
),即:
.
{
"rules": {
"eqeqeq": "off",
"curly": "warn",
"quotes": ["warn", "double"]
}
}
有关更多示例,请转至 here。
我对 Gulp 和 运行 "gulp-eslint": "^3.0.1" 版本有同样的问题。
我不得不将配置重命名为 Gulp 任务
中的配置文件
.pipe(lint({configFile: 'eslint.json'}))
gulp.task('eslint',function(){
return gulp.src(['src/*.js'])
.pipe(eslint())
.pipe(eslint.format())
});
`touch .eslintrc` instead of .eslint
这两个步骤或许能帮到你!
按照步骤操作即可
1.create eslint 配置文件名eslintrc.json
2.place代码如下
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类型
eslint --init
然后根据您的要求进行配置。
然后再次执行项目。
Webpack
我的根项目目录中有 eslint.rc 文件,但是事件
我遇到了错误。
解决方案是将排除 属性 添加到“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"
}
}
运行 命令 ember init。
当它要求覆盖现有文件时。输入 n 跳过覆盖文件。
现在它会自动创建所需的文件,如 .eslintrc 等
对我来说,当我将除 dist、dist_production 和 node_modules 文件夹之外的文件夹复制到另一个系统并尝试 运行 ember 建造.
我遇到了同样的错误。好像需要配置。
转到您的项目根目录并在终端运行
./node_modules/.bin/eslint --init
我们今天遇到了这个问题并意识到,问题不是在我们正在处理的项目内部引起的,而是在我们有一个 link 使用命令的包中引起的:
yarn link
该功能通常可用于测试新功能或尝试调试包中出现在另一个项目中的问题。
我们通过删除 link 或在 ember.js 禁用插件包的开发人员模式的情况下解决了这个问题。
index.js
module.exports = {
isDevelopingAddon: function() {
return false;
},
...
}
最近,我们升级到 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
}
}
};
我们应该如何修复错误?
对于遇到相同问题的用户,我们已解决此问题。
在 Requiring Configuration to Run 迁移过程之后,我们不得不 将 eslint.json
重命名为 .eslintrc.json
,这是默认的 ESLint 配置文件名之一现在。
我们还删除了 config
grunt-eslint 选项。
尝试将 config
替换为 configFile
。然后:
- 创建
eslint.json
文件和 - 指向它的正确位置(相对于
Gruntfile.js
文件) - 在该文件中放置一些配置 (
eslint.json
),即:
.
{
"rules": {
"eqeqeq": "off",
"curly": "warn",
"quotes": ["warn", "double"]
}
}
有关更多示例,请转至 here。
我对 Gulp 和 运行 "gulp-eslint": "^3.0.1" 版本有同样的问题。 我不得不将配置重命名为 Gulp 任务
中的配置文件.pipe(lint({configFile: 'eslint.json'}))
gulp.task('eslint',function(){
return gulp.src(['src/*.js'])
.pipe(eslint())
.pipe(eslint.format())
});
`touch .eslintrc` instead of .eslint
这两个步骤或许能帮到你!
按照步骤操作即可
1.create eslint 配置文件名eslintrc.json
2.place代码如下
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类型
eslint --init
然后根据您的要求进行配置。
然后再次执行项目。
Webpack
我的根项目目录中有 eslint.rc 文件,但是事件
我遇到了错误。
解决方案是将排除 属性 添加到“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"
}
}
运行 命令 ember init。 当它要求覆盖现有文件时。输入 n 跳过覆盖文件。 现在它会自动创建所需的文件,如 .eslintrc 等
对我来说,当我将除 dist、dist_production 和 node_modules 文件夹之外的文件夹复制到另一个系统并尝试 运行 ember 建造.
我遇到了同样的错误。好像需要配置。
转到您的项目根目录并在终端运行
./node_modules/.bin/eslint --init
我们今天遇到了这个问题并意识到,问题不是在我们正在处理的项目内部引起的,而是在我们有一个 link 使用命令的包中引起的:
yarn link
该功能通常可用于测试新功能或尝试调试包中出现在另一个项目中的问题。 我们通过删除 link 或在 ember.js 禁用插件包的开发人员模式的情况下解决了这个问题。
index.js
module.exports = {
isDevelopingAddon: function() {
return false;
},
...
}