Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:recommended
  • plugin:@typescript-eslint/recommended
  • prettier/@typescript-eslint
  • plugin:prettier/recommended
  • plugin:@angular-eslint/recommended

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?


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.

I looked at https://www.npmjs.com/package/eslint-find-rules which is a start. 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.

like image 511
Holly Avatar asked Sep 07 '20 10:09

Holly


1 Answers

The eslint --print-config file.js command should be able to list all the rules with their values applied to a specific file. However, it will not show in which plugin the rule was enabled.

like image 88
Ekaterina Prigara Avatar answered Nov 18 '22 17:11

Ekaterina Prigara