Skip to content

Commit

Permalink
feat: added enum to restricted syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed May 3, 2024
1 parent 71968db commit bfe231b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
12 changes: 12 additions & 0 deletions config/quality.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export default {
{ max: 1000, skipBlankLines: false, skipComments: false }
],

"no-restricted-syntax": [
"error",
{
selector: "TSEnumDeclaration",
message: "Don't declare enums - use union types instead"
},
{
selector: "WithStatement",
message: "Don't use with - it's deprecated"
}
],

// Useful rule for more maintainable code
// Block `prop` => `properties` (which is a very common wording in ReactJS)
"unicorn/prevent-abbreviations": [
Expand Down
11 changes: 9 additions & 2 deletions generated/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,15 @@
}
],
"no-restricted-syntax": [
"warn",
"WithStatement"
"error",
{
"selector": "TSEnumDeclaration",
"message": "Don't declare enums - use union types instead"
},
{
"selector": "WithStatement",
"message": "Don't use with - it's deprecated"
}
],
"no-return-assign": [
"error",
Expand Down
4 changes: 2 additions & 2 deletions generated/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -1478,11 +1478,11 @@
</tr>
<tr>
<th style="text-align:left">no-restricted-syntax</th>
<td style="background:#ffe0ad;padding:3px 6px">✓+</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#fdb5bb;padding:3px 6px">✓+</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#fdb5bb;padding:3px 6px">✓+</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
Expand Down

0 comments on commit bfe231b

Please sign in to comment.