This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(rome_js_analyze): enable the recommended nursery rules on un…
…stable builds (#3880) * add test for nested recommended settings * refactor `rome_flags` to expose a single `is_unstable` function * mark all nursery rules as recommended * add a test to ensure nursery rules are enabled in unstable builds * add contributor documentation for the recommended flag * mark additional rules as recommended and update playground * update documentation * update documentation * Update website/src/pages/linter/index.mdx Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * fix or suppress errors from nursery rules * additional rule fixes Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
- Loading branch information
Showing
84 changed files
with
464 additions
and
279 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ expression: content | |
## `fix.js` | ||
|
||
```js | ||
let a = 4; | ||
const a = 4; | ||
console.log(a); | ||
|
||
``` | ||
|
53 changes: 53 additions & 0 deletions
53
crates/rome_cli/tests/snapshots/main_commands_check/config_recommended_group.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,53 @@ | ||
--- | ||
source: crates/rome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `rome.json` | ||
|
||
```json | ||
{ | ||
"linter": { | ||
"rules": { | ||
"recommended": false, | ||
"correctness": { | ||
"recommended": true | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## `check.js` | ||
|
||
```js | ||
debugger; | ||
``` | ||
|
||
# Termination Message | ||
|
||
```block | ||
some errors were emitted while running checks | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
check.js:1:1 lint/correctness/noDebugger FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× This is an unexpected use of the debugger statement. | ||
> 1 │ debugger; | ||
│ ^^^^^^^^^ | ||
i Suggested fix: Remove debugger statement | ||
1 │ debugger; | ||
│ --------- | ||
``` | ||
|
||
```block | ||
Checked 1 file(s) in <TIME> | ||
``` | ||
|
||
|
42 changes: 42 additions & 0 deletions
42
crates/rome_cli/tests/snapshots/main_commands_check/nursery_unstable.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,42 @@ | ||
--- | ||
source: crates/rome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `check.js` | ||
|
||
```js | ||
const array = ["split", "the text", "into words"]; | ||
array.map(sentence => sentence.split(' ')).flat(); | ||
``` | ||
|
||
# Termination Message | ||
|
||
```block | ||
some errors were emitted while running checks | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
check.js:2:1 lint/nursery/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× The call chain .map().flat() can be replaced with a single .flatMap() call. | ||
1 │ const array = ["split", "the text", "into words"]; | ||
> 2 │ array.map(sentence => sentence.split(' ')).flat(); | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
i Safe fix: Replace the chain with .flatMap(). | ||
1 1 │ const array = ["split", "the text", "into words"]; | ||
2 │ - array.map(sentence·=>·sentence.split('·')).flat(); | ||
2 │ + array.flatMap(sentence·=>·sentence.split('·')); | ||
``` | ||
|
||
```block | ||
Checked 1 file(s) in <TIME> | ||
``` | ||
|
||
|
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
Oops, something went wrong.