-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(configuration): merge inherited overrides (#3671)
- Loading branch information
Showing
7 changed files
with
356 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...s/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_merge_overrides.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
source: crates/biome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `biome.json` | ||
|
||
```json | ||
{ | ||
"extends": ["shared.json"], | ||
"overrides": [ | ||
{ | ||
"include": ["**/*.js"], | ||
"linter": { "rules": { "correctness": { "noUnusedVariables": "error" } } } | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## `shared.json` | ||
|
||
```json | ||
{ | ||
"overrides": [{ | ||
"include": ["**/*.js"], | ||
"linter": { "rules": { "suspicious": { "noDebugger": "off" } } } | ||
}] | ||
} | ||
``` | ||
|
||
## `test.js` | ||
|
||
```js | ||
debugger; const a = 0; | ||
``` | ||
|
||
# Termination Message | ||
|
||
```block | ||
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× Some errors were emitted while running checks. | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
test.js:1:17 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× This variable is unused. | ||
> 1 │ debugger; const a = 0; | ||
│ ^ | ||
i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. | ||
i Unsafe fix: If this is intentional, prepend a with an underscore. | ||
- debugger;·const·a·=·0; | ||
+ debugger;·const·_a·=·0; | ||
``` | ||
|
||
```block | ||
Checked 1 file in <TIME>. No fixes applied. | ||
Found 1 error. | ||
``` |
62 changes: 62 additions & 0 deletions
62
.../biome_cli/tests/snapshots/main_commands_migrate_eslint/migrate_merge_with_overrides.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
source: crates/biome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `biome.json` | ||
|
||
```json | ||
{ | ||
"overrides": [ | ||
{ | ||
"include": ["*.js"], | ||
"linter": { "enabled": false } | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## `.eslintrc.json` | ||
|
||
```json | ||
{ | ||
"overrides": [{ | ||
"files": ["bin/*.js", "lib/*.js"], | ||
"excludedFiles": "*.test.js", | ||
"rules": { | ||
"eqeqeq": ["off"] | ||
} | ||
}] | ||
} | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
biome.json migrate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
i Configuration file can be updated. | ||
1 1 │ { | ||
2 │ - ········"overrides":·[{ | ||
3 │ - ············"include":·["*.js"], | ||
4 │ - ············"linter":·{·"enabled":·false·} | ||
5 │ - ········}] | ||
6 │ - ····} | ||
2 │ + → "linter":·{·"rules":·{·"recommended":·false·}·}, | ||
3 │ + → "overrides":·[ | ||
4 │ + → → {·"include":·["*.js"],·"linter":·{·"enabled":·false·}·}, | ||
5 │ + → → { | ||
6 │ + → → → "ignore":·["*.test.js"], | ||
7 │ + → → → "include":·["bin/*.js",·"lib/*.js"], | ||
8 │ + → → → "linter":·{·"rules":·{·"suspicious":·{·"noDoubleEquals":·"off"·}·}·} | ||
9 │ + → → } | ||
10 │ + → ] | ||
11 │ + } | ||
12 │ + | ||
``` | ||
|
||
```block | ||
Run the command with the option --write to apply the changes. | ||
``` |
Oops, something went wrong.