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
feat(linter): inherit rules via the extended config files (#9308)
- part of #9307
This gives the `extends` keyword some functionality: specifically to allow inheriting rules from other configuration files. Rules that are in the extended configuration will be used as the base, and then files in the config doing the extending will override the extended rules.
So, you can, for example, specify a base configuration that defines rules that you generally want to be enabled. Then, in each nested configuration file, you could disable rules depending on the directory:
```text
.oxlintrc.json // { "rules: { "no-useless-escape": "error" } }
package1/
.oxlintrc.json // { "extends": ["../.oxlintrc.json"], "rules": { "no-useless-escape": "off" } }
package2/
src // uses ../.oxlintrc.json with `no-useless-escape` enabled
```
As a side effect of this, building a config from a `.oxlintrc.json` file can result in config errors, even if all of the syntax and rules are configured correctly, because an extended configuration file might be incorrect or unparseable. For now, we simply raise an error if this occurs and stop execution, but in the future we could make this more graceful if we wanted and just ignore that file.
We will also need to revisit performance here, as I think a global cache config might be necessary so that we never load a file more than once and parse it more than once.
0 commit comments