简体   繁体   English

有没有办法在 Angular 项目中列出所有活动的 ESLint / Prettier 规则?

[英]Is there a way to list all active ESLint / Prettier rules in an Angular project?

Background:背景:

I'm trying to config ESLint and Prettier using .eslintrc.js and .prettierrc.js by starting with some extends like:我试图用一些像扩展开始配置ESLint和使用.eslintrc.js.prettierrc.js更漂亮

  • eslint:recommended eslint:推荐
  • plugin:@typescript-eslint/recommended插件:@typescript-eslint/推荐
  • prettier/@typescript-eslint更漂亮/@typescript-eslint
  • plugin:prettier/recommended插件:更漂亮/推荐
  • plugin:@angular-eslint/recommended插件:@angular-eslint/推荐

However these may contain conflicting rules or options / rules I find annoying.但是,这些可能包含我觉得烦人的冲突规则或选项/规则。


Question:题:

Is there a script, an IDE plugin (our team uses WebStorm and VS Code ) or a standalone tool which will compile a list of effective options and rules based on my current config?是否有脚本、IDE 插件(我们的团队使用WebStormVS Code )或独立工具来根据我当前的配置编译有效选项和规则列表?


It should ideally list all rules which are actually applied including imported rule sets.理想情况下,它应该列出实际应用的所有规则,包括导入的规则集。 For each rule it should show its current setting (maybe even the default and other options) and its origin (rule set, config file).对于每个规则,它应该显示其当前设置(甚至可能是默认选项和其他选项)及其来源(规则集、配置文件)。 If a rule has been overwritten or has conflicting settings from two ore more imported rule sets it should show that too.如果规则已被覆盖或来自两个或更多导入的规则集的设置冲突,它也应该显示。

I imagine something similar to an effective Maven POM or a Maven dependencies tree either as a printed output or a GUI tool window.我想象一些类似于有效的 Maven POM 或 Maven 依赖关系树的东西作为打印输出或 GUI 工具窗口。

I looked at https://www.npmjs.com/package/eslint-find-rules which is a start.我查看了https://www.npmjs.com/package/eslint-find-rules ,这是一个开始。 However so far I only got a list of rules with no info where they come from or what their current setting is.但是到目前为止,我只得到了一个规则列表,没有关于它们来自哪里或当前设置是什么的信息。

Motivation:动机:

We are looking for a way to determine which rule set(s) to use as a starting point and which rules we want to overwrite without having to blindly try for ages.我们正在寻找一种方法来确定使用哪些规则集作为起点以及我们想要覆盖哪些规则,而不必盲目尝试多年。

The eslint --print-config file.js command should be able to list all the rules with their values applied to a specific file. eslint --print-config file.js 命令应该能够列出所有规则及其应用于特定文件的值。 However, it will not show in which plugin the rule was enabled.但是,它不会显示在哪个插件中启用了规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM