小编Zoc*_*lli的帖子

Eslint 不显示警告 - React

在我的新项目中,ESLint 没有像以前那样输出警告,我使用的是 VSCode。如果我的代码中某处有 unsed var,它不会再在终端输出中显示警告。仅在问题选项卡中。

在此输入图像描述

在此输入图像描述

这是我的 eslint 配置文件:

.eslintrc.json

{
  "env": {
      "browser": true,
      "es6": true
  },
  "extends": [
      "plugin:react/recommended",
      "airbnb-typescript",
      "plugin:@typescript-eslint/recommended",
      "plugin:@typescript-eslint/eslint-recommended",
      "prettier/@typescript-eslint",
      "plugin:prettier/recommended"
  ],
  "globals": {
      "Atomics": "readonly",
      "SharedArrayBuffer": "readonly"
  },
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
      "ecmaFeatures": {
          "jsx": true
      },
      "ecmaVersion": 2018,
      "sourceType": "module",
      "project": "./tsconfig.json"
  },
  "plugins": [
      "react",
      "react-hooks",
      "@typescript-eslint",
      "prettier"
  ],
  "rules": {
    "prettier/prettier": "error",
    "react-hooks/rules-of-hooks":"error",
    "react-hooks/exhaustive-deps": "warn",
    "camelcase": "off",
    "@typescript-eslint/camelcase": "off",
    "react/jsx-filename-extension": [1, {"extensions": [".tsx"]}],
    "import/prefer-default-export": "off",
    "react/jsx-one-expression-per-line": "off",
    "react/jsx-props-no-spreading": "off",
    "react/prop-types": "off",
    "no-unused-expressions": …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs eslint prettier

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

标签 统计

eslint ×1

prettier ×1

reactjs ×1

typescript ×1