首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在构建阶段禁用ESLint

如何在构建阶段禁用ESLint
EN

Stack Overflow用户
提问于 2021-06-15 12:52:46
回答 1查看 3.5K关注 0票数 8

我正在使用创建-反应-应用程序,并已配置我的项目为埃林特。下面是我的.eslintrc文件。

代码语言:javascript
复制
{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint",
    "react-hooks"
  ],
  "extends": [
    "plugin:prettier/recommended",
    "airbnb-typescript-prettier",
    "prettier",
    "plugin:import/typescript"
  ],
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "rules": {
    // Make prettier code formatting suggestions more verbose.
    "prettier/prettier": [
      "warn"
    ],
    "camelcase": "warn",
    "no-console": "error",
    "no-prototype-builtins": "warn",
    "arrow-body-style": "warn",
    "prefer-arrow-callback": "warn",
    "jsx-a11y/click-events-have-key-events": "warn",
    "jsx-a11y/no-noninteractive-element-interactions": "warn",
    // Disable <Fragment> => <> replacement. Feel free to change
    "react/jsx-fragments": "off",
    "react/destructuring-assignment": "warn",
    "react/no-unused-prop-types": "warn",
    //TODO: Remove this rule later
    "react/jsx-props-no-spreading": "off",
    "react/require-default-props": 0,
    "react-hooks/exhaustive-deps": "warn",
    // Disable prefer default export
    "import/prefer-default-export": "off",
    "no-underscore-dangle": "off",
    "@typescript-eslint/camelcase": 0,
    "@typescript-eslint/no-empty-function": "warn",
    "@typescript-eslint/ban-ts-comment": "warn",
    "@typescript-eslint/ban-types": "warn",
    "@typescript-eslint/naming-convention": "warn",
    "@typescript-eslint/no-empty-interface": "warn",
    "@typescript-eslint/no-inferrable-types": "warn",
    "import/no-extraneous-dependencies": [
      "error",
      {
        "devDependencies": true
      }
    ]
  }
}

问题是,在构建阶段,它占用了大量内存。由于这个原因,我无法使用内存为8Gb的对接器。是否只有在构建阶段才能禁用eslint ?在开发过程中,我需要这些规则,但不希望它们影响我的构建阶段。有人能帮忙吗?提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-15 12:54:23

您可以通过将DISABLE_ESLINT_PLUGIN=true添加到package.json中的“脚本”部分中的“构建”中来实现这一点。

代码语言:javascript
复制
{
  "scripts": {
    "start": "react-scripts start",
    "build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
    "test": "react-scripts test"
  }
}
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67986657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档