-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(noForEach): add
validIdentifiers
option
- Loading branch information
Showing
10 changed files
with
234 additions
and
4 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
3 changes: 3 additions & 0 deletions
3
crates/biome_js_analyze/tests/specs/complexity/noForEach/invalidConfig.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 @@ | ||
lib._.forEach([1, 2], function (value) { | ||
console.log(value); | ||
}); |
30 changes: 30 additions & 0 deletions
30
crates/biome_js_analyze/tests/specs/complexity/noForEach/invalidConfig.js.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,30 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: invalidConfig.js | ||
--- | ||
# Input | ||
```jsx | ||
lib._.forEach([1, 2], function (value) { | ||
console.log(value); | ||
}); | ||
|
||
``` | ||
|
||
# Diagnostics | ||
``` | ||
invalidConfig.options:8:17 deserialize ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× 'validIdentifiers' does not accept empty values or values with dots. | ||
6 │ "noForEach": { | ||
7 │ "level": "error", | ||
> 8 │ "options": { | ||
│ ^ | ||
> 9 │ "validIdentifiers": ["lib._"] | ||
> 10 │ } | ||
│ ^ | ||
11 │ } | ||
12 │ } | ||
``` |
15 changes: 15 additions & 0 deletions
15
crates/biome_js_analyze/tests/specs/complexity/noForEach/invalidConfig.options.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,15 @@ | ||
{ | ||
"$schema": "../../../../../../packages/@biomejs/biome/configuration_schema.json", | ||
"linter": { | ||
"rules": { | ||
"complexity": { | ||
"noForEach": { | ||
"level": "error", | ||
"options": { | ||
"validIdentifiers": ["lib._"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
crates/biome_js_analyze/tests/specs/complexity/noForEach/validIdentifiers.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,7 @@ | ||
Effect.forEach([1, 2, 3, 4, 5], (n) => | ||
Console.log(`Current element: ${n}`).pipe(Effect.as(n * 2)) | ||
); | ||
|
||
_.forEach([1, 2], function (value) { | ||
console.log(value); | ||
}); |
15 changes: 15 additions & 0 deletions
15
crates/biome_js_analyze/tests/specs/complexity/noForEach/validIdentifiers.js.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,15 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: validIdentifiers.js | ||
--- | ||
# Input | ||
```jsx | ||
Effect.forEach([1, 2, 3, 4, 5], (n) => | ||
Console.log(`Current element: ${n}`).pipe(Effect.as(n * 2)) | ||
); | ||
|
||
_.forEach([1, 2], function (value) { | ||
console.log(value); | ||
}); | ||
|
||
``` |
15 changes: 15 additions & 0 deletions
15
crates/biome_js_analyze/tests/specs/complexity/noForEach/validIdentifiers.options.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,15 @@ | ||
{ | ||
"$schema": "../../../../../../packages/@biomejs/biome/configuration_schema.json", | ||
"linter": { | ||
"rules": { | ||
"complexity": { | ||
"noForEach": { | ||
"level": "error", | ||
"options": { | ||
"validIdentifiers": ["Effect", "_"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.