-
-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linter: cascading file configuration #7408
Comments
I did a bit of testing and thinking on this today. As it stands, these are my current thoughts on what we need to implement.
|
This is a brief informal description of the nested file configuration specification for oxlint. It is primarily based on ESLint, but with some inspiration taken from the https://docs.astral.sh/ruff/configuration/#config-file-discovery as well. This should be documented officially on the website later DecisionsThese are the main decisions / important points:
ContextIn large monorepositories (repositories containing multiple packages/projects), it is convenient for each project to have its own configuration files, rather than having a single shared file. This makes it easy to clone or work out of just a subdirectory and treat it as its own independent project. This means that each project directory should have its own
However, it is not possible to lint the entire Resolving configuration filesIn ESLint, configuration files are resolved by using the file in the current directory or nearest parent directory as the base configuration file, and then subsequently merging that with each file in each parent directory, up to the root directory. The base configuration file takes precedence over any parent configurations. However, this can create situations where you have more rules enabled than you want, such as rules that shouldn't apply for test files, or rules for packages you aren't using in a subdirectory. ESLint solves this by supporting adding a In oxlint, we will not automatically search upwards in the file hierarchy for configuration files. We will only use the closest configuration file to the file currently being linted. Every configuration file will essentially be treated as if it already contained In priority order, the "nearest" configuration should be defined as:
However, not automatically merging configuration files means that it becomes harder to share configuration across directories. So, we need to define a way to share lint configurations. Extending configuration filesIn ESLint, the Oxlint will also support the
The configuration file paths are resolved relative to the base configuration file. When extending other files, some general rules apply:
Other details and contextHow are CLI arguments resolved?In general, CLI arguments take precedence over the final resolved configuration. For example, if the Why
|
It would be nice if Oxlint could provide a migration program to convert YAML configuration(or other) files to JSON |
This is the tracking issue for cascading/nested file configuration in oxlint.
The text was updated successfully, but these errors were encountered: