eslint-plugin-square
eslint-plugin-square copied to clipboard
Extending multiple configs can cause conflicts
Let's say a consumer extends two of our configs like this:
extends: ['plugin:square/ember', 'plugin:square/typescript']
Here's an example of a problem that can happen:
-
emberconfig loads which extends thebaseconfig: 1a.baseconfig turns various linting on including thearray-callback-returnrule 1b.emberconfig configures various linting including turning off thearray-callback-returnrule off for a certain file -
typescriptconfig loads which extends thebaseconfig: 2a.baseconfig loads again which turns thearray-callback-returnrule BACK ON everywhere (this breaks the intended behavior of theemberconfig) 2b.typescriptconfig configures various linting
Possible fixes:
- Stop extending
baseconfig automatically with all our configs. That would then require consumers to specify thebaseconfig first before other configs would they might forget to do. - Somehow prevent the
baseconfig from being loaded multiple times (if it could detect that it has already been loaded by a previous config). - ?
One possible alternative would be to always respect the config you are extending ("append only"). This is difficult if you aren't super familiar with the config being extended and may be more of a design aspiration.
Another idea is to keep them scoped to their specialty like Ember, React, or TypeScript. That may help find the right home for a rule.