ANGLINT V13.eslintrc.json配置用于eslint-plugin-rxjs-angular [英] Angular v13 .eslintrc.json configuration for eslint-plugin-rxjs-angular

查看:5
本文介绍了ANGLINT V13.eslintrc.json配置用于eslint-plugin-rxjs-angular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的ANGLE V13项目中使用eslint-plugin-rxjs-angular。 在他们的github page上写着。

为ESLint配置解析器和parserOptions。在这里,我使用.eslintrc.js文件进行配置:

然后是一个代码片段。

const { join } = require("path");
module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaVersion: 2019,
    project: join(__dirname, "./tsconfig.json"),
    sourceType: "module"
  },
  plugins: ["rxjs-angular"],
  extends: [],
  rules: {
    "rxjs-angular/prefer-async-pipe": "error"
  }
};

如何在下面添加的.eslintrc.json文件中实现上面的.eslintrc.js配置?

{
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.ts"
      ],
      "parserOptions": {
        "project": [
          "tsconfig.json",
          "e2e/tsconfig.json"
        ],
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@angular-eslint/recommended",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "rules": {
        "@angular-eslint/component-selector": [
          "error",
          {
            "prefix": "app",
            "style": "kebab-case",
            "type": "element"
          }
        ],
        "@angular-eslint/directive-selector": [
          "error",
          {
            "prefix": "app",
            "style": "camelCase",
            "type": "attribute"
          }
        ]
      }
    },
    {
      "files": [
        "*.html"
      ],
      "extends": [
        "plugin:@angular-eslint/template/recommended"
      ],
      "rules": {}
    }
  ]
}

推荐答案

如果我理解正确的话,就是这样做的。
我扩展的预制配置@angular-eslint负责幕后的解析器选项。 因此,我唯一要做的就是:

"files": ["*.ts"]覆盖中,我添加了

"plugins": ["rxjs-angular"],  

"rxjs-angular/prefer-async-pipe": "error"  

在规则部分。

这篇关于ANGLINT V13.eslintrc.json配置用于eslint-plugin-rxjs-angular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆