You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: designs/2019-eslintrc-improvements/README.md
+5-43
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
## Summary
8
8
9
-
This proposal improves the internal logic of configuration files to maintain our codebase easier and add enhancements easier. This is a change of architecture and large refactoring.
9
+
This proposal improves our configuration files. This changes the architecture of configuration files to maintain our codebase easier and make enhancing easier.
10
10
11
11
This RFC fixes two bugs I found while I make a PoC (I guess we don't want to make surprised behaviors on purpose).
12
12
@@ -18,9 +18,10 @@ To make sure if this refactoring is effective to make easier to enhance, the PoC
18
18
- ([link](#ext-functionality)) ESLint checks the files which are matched by a `overrides[].files` automatically even if the file is not `*.js` (fixes [eslint/eslint#11223]).
19
19
- ([link](#overrides-extends)) The configuration of <code>overrides</code> gets supporting <code>extends</code> proeprty and <code>overrides</code> property. (fixes <ahref="/eslint/eslint/issues/8813">eslint/eslint#8813</a>)
20
20
21
-
And, sorry, this RFC contains the change of the plugin resolution logic because I had misunderstood it has been accepted in [#7].
22
-
23
-
- ([link](#️-it-looks-plugins-up-from-the-location-where-the-config-file-is)) ESLint looks plugins up from the location where the config file is. This is a similar thing to [#14].
21
+
<table><td>
22
+
📝 <b>Note</b>:<br>
23
+
This RFC doesn't contain it, but <ahref="/eslint/rfcs/pull/14">#14</a> (the change of plugin resolution way) is very important. <ahref="/eslint/rfcs/pull/14">#14</a> solves an important pain of shareable config maintainers.
24
+
</td></table>
24
25
25
26
## Motivation
26
27
@@ -298,45 +299,6 @@ rules:
298
299
After this proposal, the setting in your `.eslintrc` priors to the setting in shareable configs always.
299
300
This is a breaking change, but I think this is a bug fix.
300
301
301
-
### ⚠️ It looks plugins up from the location where the config file is.
302
-
303
-
This means we get the consistent way to load `extends`, `parser`, and `plugins`.
304
-
305
-
Currently, ESLint finds shareable configs and parsers relatively from the location where the config file is. But ESLint finds plugins from the project root. This is forcing inconvenient to shareable config maintainers ([eslint/eslint#3458], [eslint/eslint#10643]).
306
-
307
-
> This is described on [#14] as well. This change has a huge impact, probably we should discuss on [#14] individually.
308
-
309
-
This proposal makes that all dependencies are found from the location where the config file is.
310
-
311
-
This means one same plugin can be loaded from different locations by two or more shareable configs. See more details: [Overview of options and tradeoffs for throwing an error on duplicate plugin names][shareable-config-conflict-overview.md]. ESLint has to throw a conflict error in such a situation.
312
-
313
-
Each element of `ConfigArray` has the loaded plugins. When ESLint merges those by `ConfigArray#extractConfig(filePath)`, if one same plugin is loaded from different config files and either file doesn't import another file by `extends` property regardless of direct or indirect, it throws a confliction error. This is the solution **4** of [Overview of options and tradeoffs for throwing an error on duplicate plugin names][shareable-config-conflict-overview.md].
314
-
315
-
People can solve the conflict error by importing the problematic plugin from own config file.
316
-
317
-
```yml
318
-
extends:
319
-
- foo
320
-
- bar
321
-
322
-
# Because this file imports both `eslint-config-foo` and `eslint-config-bar` by
323
-
# `extends` property, the conflict error disappears.
324
-
plugins:
325
-
- common
326
-
327
-
# If some settings of the shareable config file raised problems, they can tweak
328
-
# the settings.
329
-
rules:
330
-
common/problematic-rule: "off"
331
-
```
332
-
333
-
This means, the configuration uses the plugin the user selected rather than the plugin the shareable configs selected. This is a simpler solution than that the every plugin which is imported by shareable config works together.
334
-
335
-
<table><td>
336
-
📝 <b>Note</b>:<br>
337
-
For <a href="https://github.com/eslint/eslint/issues/9505">eslint/eslint#9505</a>, we need to use unused plugin instances as well in order to check rule's existence.
338
-
</td></table>
339
-
340
302
## Alternatives
341
303
342
304
- [#9] ... Double duplicate features cause confusion for the ecosystem. For newcomers, a mix of articles about two config systems makes hard to understand ESLint. For non-English users, the official document is far.
0 commit comments