小编Giu*_*oni的帖子

我需要删除分号错误 ESLint + Prettier

如何删除分号规则?

我尝试删除半规则,但没有成功。当我保存文件时,它删除了分号,并且 lint 抱怨它丢失了,当我插入它时,它再次抱怨说要删除。

我想保留分号

在此输入图像描述

那是我的 .prettierrc 文件:

{
  "printWidth": 100,
  "singleQuote": true,
  "tabWidth": 4,
  "trailingComma": "es5",
  "endOfLine":"auto",
  "semi": true
}
Run Code Online (Sandbox Code Playgroud)

这就是我的 .eslintrc 文件

{
    "parser": "babel-eslint",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "env": {
        "browser": true, 
        "node": true,
        "es6": true
    },
    "extends": [
        "airbnb",
        "plugin:prettier/recommended", 
        "plugin:react/recommended",
        "plugin:jsx-a11y/recommended"
    ],
    "plugins": ["prettier", "react", "react-hooks"],
    "rules": {
        "prettier/prettier": [
            "error",
            {
              "endOfLine": "auto"
            }
        ],
        "react-hooks/exhaustive-deps": "warn",
        "react-hooks/rules-of-hooks": "error",
        "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
        "react/jsx-indent-props": [2, 4],
        "react/jsx-indent": …
Run Code Online (Sandbox Code Playgroud)

javascript eslint eslint-config-airbnb prettier

7
推荐指数
2
解决办法
1万
查看次数

if 语句中的布尔表达式过多

我在 Lint 中有这个警告:R0916: Too many boolean expressions in if statement (6/5) (too-many-boolean-expressions)

那是我的代码:

if (
    old_image.get("var") == "Type1"
    or old_image.get("var") == "Type2"
    or old_image.get("var") == "Type3"
) and (
    new_image.get("var") != "Type1"
    and new_image.get("var") != "Type2"
    and new_image.get("var") != "Type3"
):
Run Code Online (Sandbox Code Playgroud)

如何删除此 lint 错误?

python lint python-3.x

3
推荐指数
1
解决办法
45
查看次数