betterer icon indicating copy to clipboard operation
betterer copied to clipboard

feature idea: apply eslint rule config options

Open alexciesielski opened this issue 3 years ago • 4 comments
trafficstars

I have an eslint rule that uses additional configuration options. Currently I have to maintain this (duplicated) configuration in two places, .eslintrc.json + .betterer.ts.

Example:

eslintrc.json:

        "import/no-restricted-paths": [
          "warn",
          {
            "basePath": "./src/app",
            "zones": [
                   ... 
            ]
          }
        ],

.betterer.ts:

'import/no-restricted-paths': ['error', { ... }],

Obviously I want to keep my code DRY, so ideally .betterer would figure out that the rule exists in eslint.json and apply the additional options, such that it's enough to just write:

'import/no-restricted-paths': 'error',

So by default it would just take the already existing options from .eslintrc.json, but if I were to provide options also inside .betterer.ts then obviously it would just override (or merge?) those from eslint.

alexciesielski avatar Dec 31 '21 06:12 alexciesielski

What is the reason behind keeping the ESLint warnings as well? Seems to me like that will makes things noisy without much benefit?

phenomnomnominal avatar Feb 04 '22 19:02 phenomnomnominal

I want my IDE to warn me about the violations, so I still know that I'm doing something wrong

alexciesielski avatar Feb 04 '22 19:02 alexciesielski

Are you using VSCode? https://marketplace.visualstudio.com/items?itemName=Betterer.betterer-vscode

phenomnomnominal avatar Feb 04 '22 19:02 phenomnomnominal

I am but my team mates are on Web storm :) It's not a big deal, just a minor annoyance I guess. Just have to remember to update both places.

alexciesielski avatar Feb 05 '22 10:02 alexciesielski