-
-
Notifications
You must be signed in to change notification settings - Fork 729
Description
While using nested configurations, there is an issue which is causing Oxlint CLI to bypass rules in nested directories.
├── .oxlintrc.json
├── packageA
│ ├── .oxlintrc.json
│ └── src
│ └── helpers.js
├── packageB
│ ├── .oxlintrc.json
│ └── helpers.js
In the example above, we have two nested configs.
packageAhas asrcdirectory with a file nested inside it. Lint configuration is at top-level.packageBhas a file which is adjacent to the lint configuration.
If the root config contains a rule no-console: warn, and a nested configuration has no-console: off, the rule is still applied in the nested directory when running the Oxlint CLI command. This only happens when files are nested within a subdirectory relative to the configuration file. The functionality works as expected if the subject file is located adjacently to .oxlintrc.json
The expected behaviour is that the rule should be turned off in the nested directory since there is a nested .oxlintrc.json file present.
This only applies to the Oxlint CLI. In the language server, it appears that the nested configuration is behaving correctly as the warning does disappear when the rule is turned off.
I've produced a minimal reproducible example of the issue in this project - https://github.com/zubhav/oxlint-nested-config-issue-example
- Clone project and run
yarn - Run
yarn lint
Output is:
⚠ eslint(no-console): eslint(no-console): Unexpected console statement.
╭─[packageA/src/helpers.js:1:1]
1 │ console.log("Hello from packageA");
· ───────────
╰────
help: Delete this console statement.
Found 1 warning and 0 errors.
- Based on the output above, the nested configuration in
packageAis not being used to lint files within subdirectories ofpackageA. The expected behaviour is that runningyarn lintwill output no warnings at all, since the rule is turned off in all nested configurations.