-
-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linter): add support for nested config files
- Loading branch information
Showing
14 changed files
with
215 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rules": { | ||
"no-console": "error", | ||
"no-debugger": "error" | ||
} | ||
} |
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 @@ | ||
console.log("test"); |
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 @@ | ||
debugger; |
5 changes: 5 additions & 0 deletions
5
apps/oxlint/fixtures/nested_config/package1-empty-config/.oxlintrc.json
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,5 @@ | ||
{ | ||
// this is a nested config file, but it should use the default config which | ||
// is implicitly merged with this | ||
"rules": {} | ||
} |
1 change: 1 addition & 0 deletions
1
apps/oxlint/fixtures/nested_config/package1-empty-config/console.ts
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 @@ | ||
console.log("test"); |
1 change: 1 addition & 0 deletions
1
apps/oxlint/fixtures/nested_config/package1-empty-config/debugger.js
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 @@ | ||
debugger; |
1 change: 1 addition & 0 deletions
1
apps/oxlint/fixtures/nested_config/package2-no-config/console.ts
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 @@ | ||
console.log("test"); |
1 change: 1 addition & 0 deletions
1
apps/oxlint/fixtures/nested_config/package2-no-config/debugger.js
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 @@ | ||
debugger; |
6 changes: 6 additions & 0 deletions
6
apps/oxlint/fixtures/nested_config/package3-deep-config/.oxlintrc.json
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,6 @@ | ||
{ | ||
"rules": { | ||
// should not be used, as it is overridden by the nested config | ||
"no-console": "warn" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
apps/oxlint/fixtures/nested_config/package3-deep-config/src/.oxlintrc.json
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,5 @@ | ||
{ | ||
"rules": { | ||
"no-console": "error" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
apps/oxlint/fixtures/nested_config/package3-deep-config/src/components/component.js
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,3 @@ | ||
export function Component() { | ||
console.log("hello"); | ||
} |
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
57 changes: 57 additions & 0 deletions
57
apps/oxlint/src/snapshots/fixtures__nested_config_--experimental-nested-config@oxlint.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,57 @@ | ||
--- | ||
source: apps/oxlint/src/tester.rs | ||
--- | ||
########## | ||
arguments: --experimental-nested-config | ||
working directory: fixtures/nested_config | ||
---------- | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-console.html\eslint(no-console)]8;;\: eslint(no-console): Unexpected console statement. | ||
,-[console.ts:1:1] | ||
1 | console.log("test"); | ||
: ^^^^^^^^^^^ | ||
`---- | ||
help: Delete this console statement. | ||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
,-[debugger.js:1:1] | ||
1 | debugger; | ||
: ^^^^^^^^^ | ||
`---- | ||
help: Delete this code. | ||
|
||
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
,-[package1-empty-config/debugger.js:1:1] | ||
1 | debugger; | ||
: ^^^^^^^^^ | ||
`---- | ||
help: Delete this code. | ||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-console.html\eslint(no-console)]8;;\: eslint(no-console): Unexpected console statement. | ||
,-[package2-no-config/console.ts:1:1] | ||
1 | console.log("test"); | ||
: ^^^^^^^^^^^ | ||
`---- | ||
help: Delete this console statement. | ||
|
||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed | ||
,-[package2-no-config/debugger.js:1:1] | ||
1 | debugger; | ||
: ^^^^^^^^^ | ||
`---- | ||
help: Delete this code. | ||
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-console.html\eslint(no-console)]8;;\: eslint(no-console): Unexpected console statement. | ||
,-[package3-deep-config/src/components/component.js:2:3] | ||
1 | export function Component() { | ||
2 | console.log("hello"); | ||
: ^^^^^^^^^^^ | ||
3 | } | ||
`---- | ||
help: Delete this console statement. | ||
|
||
Found 1 warning and 5 errors. | ||
Finished in <variable>ms on 7 files with 98 rules using 1 threads. | ||
---------- | ||
CLI result: LintFoundErrors | ||
---------- |
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