Extending multiple configs can cause conflicts
bmish opened this issue · comments
Bryan Mishkin commented
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:
ember
config loads which extends thebase
config:
1a.base
config turns various linting on including thearray-callback-return
rule
1b.ember
config configures various linting including turning off thearray-callback-return
rule off for a certain filetypescript
config loads which extends thebase
config:
2a.base
config loads again which turns thearray-callback-return
rule BACK ON everywhere (this breaks the intended behavior of theember
config)
2b.typescript
config configures various linting
Possible fixes:
- Stop extending
base
config automatically with all our configs. That would then require consumers to specify thebase
config first before other configs would they might forget to do. - Somehow prevent the
base
config from being loaded multiple times (if it could detect that it has already been loaded by a previous config). - ?
Max Beatty commented
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.