@crh-fe/eslint-config
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

CRH eslint 规则配置文件

使用

npm i -D eslint @crh-fe/eslint-config

配置

  • package.json中包含"type": "module"的配置方式
// eslint.config.js
import crh from '@crh-fe/eslint-config';

export default crh(
  {
    // 配置忽略配置的文件
    ignores: [],
  },
  {
    rules: {},
  },
);

package.json中新增脚本

例如:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

VS Code 支持 (自动fix)

安装 VS Code ESLint extension

将以下设置添加到 .vscode/settings.json:

{
  // Enable the ESlint flat config support
  "eslint.experimental.useFlatConfig": true,

  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,

  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off" },
    { "rule": "format/*", "severity": "off" },
    { "rule": "*-indent", "severity": "off" },
    { "rule": "*-spacing", "severity": "off" },
    { "rule": "*-spaces", "severity": "off" },
    { "rule": "*-order", "severity": "off" },
    { "rule": "*-dangle", "severity": "off" },
    { "rule": "*-newline", "severity": "off" },
    { "rule": "*quotes", "severity": "off" },
    { "rule": "*semi", "severity": "off" }
  ],

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml",
    "toml"
  ]
}

Readme

Keywords

Package Sidebar

Install

npm i @crh-fe/eslint-config

Weekly Downloads

2

Version

2.1.2

License

ISC

Unpacked Size

16.3 kB

Total Files

6

Last publish

Collaborators

  • wyx1089
  • lruri
  • xwei111
  • chenchuanxun
  • justli