简体   繁体   English

保存文件与代码时返回eslint问题

[英]eslint problems is returning when saving file vs code

I can't find the solution to this.. i'm learning eslint and installed the required dependencies for airbnb config. 我找不到解决方案。.我正在学习eslint并安装了airbnb配置所需的依赖项。 It is working fine, but once i fixed the problems that eslint gives it simply returns the same errors when i save the file. 它工作正常,但是一旦我解决了eslint给出的问题,当我保存文件时,它只会返回相同的错误。 Mostly it returns the 'String must use single quotes' , 'Missing trailing comma' 通常,它返回“字符串必须使用单引号”,“缺少尾部逗号”

.eslintrc .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 .babelrc

{
  "presets": ["react", "es2015"],
  "plugins": ["transform-class-properties", "transform-object-rest-spread"]
}

.package.json .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",

It turns out to be a conflict between prettier and eslint 事实证明,这是prettiereslint之间的冲突

adding prettier in eslintrc extends solve the problem 在eslintrc中添加prettierextends解决了问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM