我找不到解决方案。.我正在学习eslint并安装了airbnb配置所需的依赖项。它工作正常,但是一旦我解决了eslint给出的问题,当我保存文件时,它只会返回相同的错误。通常,它返回“字符串必须使用单引号”,“缺少尾部逗号”
.eslintrc
{
"extends": ["airbnb"],
"parser": "babel-eslint",
"rules": {
"linebreak-style": ["error", "windows"],
"class-methods-use-this": 0,
"import/no-named-as-default": 0,
"react/jsx-filename-extension": [
"error",
{
"extensions": [".js", ".jsx"]
}
]
}
}
.babelrc
{
"presets": ["react", "es2015"],
"plugins": ["transform-class-properties", "transform-object-rest-spread"]
}
.package.json
"eslint": "^5.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.11.0",
"prettier": "1.14.3",
"babel-core": "^6.26.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
答案 0 :(得分:0)
事实证明,这是prettier
和eslint
之间的冲突
在eslintrc prettier
中添加extends
可解决问题