我开始使用沃尔玛新推出的名为Electrode的React框架。
我试图配置eslint并尝试扩展walmart lint配置,如下所示:
https://github.com/walmartlabs/eslint-config-walmart
这里是.eslintrc
{
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true
},
"env": {
"es6": true
},
"extends": "walmart/configurations/es6-react-test",
"rules": {
"indent": ["error", 2]
}
}
和package.json
"devDependencies": {
"babel-eslint": "^7.1.1",
"electrode-archetype-react-app-dev": "^1.0.0",
"eslint": "^2.10.2",
"eslint-plugin-filenames": "^1.0.0",
"eslint-plugin-react": "^5.1.1",
"gulp": "^3.9.1"
},
但我收到definition for rule 'filenames/match-regex' was not found
错误。我安装了eslint-plugin-filenames,还有其他我需要设置的内容吗?
file: 'file:///foo/client/components/home.jsx'
severity: 'Error'
message: 'Definition for rule 'filenames/match-regex' was not found (filenames/match-regex)'
at: '1,1'
source: 'eslint'
答案 0 :(得分:0)
尝试升级软件包,我现在看不到新版本的任何问题。
有关配置/覆盖默认eslint
配置的信息,请参阅Electrode docs
例如要覆盖eslint
的默认client
配置(反应),我在.eslintec
文件夹中创建了一个client
文件,下面的代码段为:
---
extends:
- "../../node_modules/electrode-archetype-react-app-dev/config/eslint/.eslintrc-react"
- "eslint:recommended"
parser:
"babel-eslint"
rules:
quotes:
- 2
- "single"
答案 1 :(得分:0)
尝试从node_modules
运行ESLint,而不是全局安装的ESLint。像这样:
node_modules/eslint/bin/eslint.js --fix .
否则您的ESLint插件可能无法被接收。