-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(biome_js_analyze): implement
useConsistentObjectDefinition
rule (
#5042) Co-authored-by: Emanuele Stoppa <[email protected]> Co-authored-by: ematipico <[email protected]> Co-authored-by: arendjr <[email protected]>
- Loading branch information
1 parent
7e938f3
commit d640aaf
Showing
21 changed files
with
1,262 additions
and
31 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,33 @@ | ||
--- | ||
"@biomejs/biome": minor | ||
--- | ||
|
||
Add the new JavaScript rule `useConsistentObjectDefinition` rule. The rule enforces a consistent style for the definition of objects: | ||
|
||
By the default, the rule enforces a shorthand style: | ||
|
||
```js | ||
const validShorthand = { | ||
// Property shorthand | ||
foo, | ||
|
||
// Method shorthand | ||
method() { | ||
return "method"; | ||
}, | ||
} | ||
``` | ||
|
||
Alternatively, the rule can be configured to enforce an explicit style: | ||
|
||
```js | ||
const invalidExplicit = { | ||
// Basic property shorthand violations | ||
foo: foo, | ||
|
||
// Method shorthand violations | ||
method: function () { | ||
return "method"; | ||
}, | ||
} | ||
``` |
15 changes: 15 additions & 0 deletions
15
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs
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.
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.