Skip to content

Commit

Permalink
chore: gen-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
togami2864 committed Dec 2, 2023
1 parent 1c94e9c commit 0e69ea1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ use biome_rowan::{
declare_rule! {
/// Disallow characters which are made with multiple code points in character class syntax
///
/// Unicode includes the characters which are made with multiple code points. RegExp character class syntax (/[abc]/) cannot handle characters which are made by multiple code points as
/// expected. This rule reports the regular expressions which include multiple code point characters in character class syntax.
///
/// Source: https://eslint.org/docs/latest/rules/no-misleading-character-class
///
/// ## Examples
///
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_service/src/configuration/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@biomejs/backend-jsonrpc/src/workspace.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@biomejs/biome/configuration_schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/src/content/docs/linter/rules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Rules that belong to this group <strong>are not subject to semantic version</str
| [noDuplicateJsonKeys](/linter/rules/no-duplicate-json-keys) | Disallow two keys with the same name inside a JSON object. | |
| [noEmptyBlockStatements](/linter/rules/no-empty-block-statements) | Disallow empty block statements and static blocks. | |
| [noImplicitAnyLet](/linter/rules/no-implicit-any-let) | Disallow use of implicit <code>any</code> type on variable declarations. | |
| [noMisleadingCharacterClass](/linter/rules/no-misleading-character-class) | Succinct description of the rule. | |
| [noMisleadingCharacterClass](/linter/rules/no-misleading-character-class) | Disallow characters which are made with multiple code points in character class syntax | |
| [noUnusedImports](/linter/rules/no-unused-imports) | Disallow unused imports. | <span aria-label="The rule has a safe fix" role="img" title="The rule has a safe fix">🔧 </span> |
| [noUnusedPrivateClassMembers](/linter/rules/no-unused-private-class-members) | Disallow unused private class members | <span aria-label="The rule has an unsafe fix" role="img" title="The rule has an unsafe fix">⚠️ </span> |
| [noUselessLoneBlockStatements](/linter/rules/no-useless-lone-block-statements) | Disallow unnecessary nested block statements. | <span aria-label="The rule has an unsafe fix" role="img" title="The rule has an unsafe fix">⚠️ </span> |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: noMisleadingCharacterClass (since vnext)
title: noMisleadingCharacterClass (since v1.3.0)
---

**Diagnostic Category: `lint/nursery/noMisleadingCharacterClass`**
Expand All @@ -8,44 +8,54 @@ title: noMisleadingCharacterClass (since vnext)
This rule is part of the [nursery](/linter/rules/#nursery) group.
:::

Succinct description of the rule.
Disallow characters which are made with multiple code points in character class syntax

Put context and details about the rule.
As a starting point, you can take the description of the corresponding _ESLint_ rule (if any).
Unicode includes the characters which are made with multiple code points. RegExp character class syntax (/[abc]/) cannot handle characters which are made by multiple code points as
expected. This rule reports the regular expressions which include multiple code point characters in character class syntax.

Try to stay consistent with the descriptions of implemented rules.

Add a link to the corresponding ESLint rule (if any):

Source: https://eslint.org/docs/latest/rules/rule-name
Source: https://eslint.org/docs/latest/rules/no-misleading-character-class

## Examples

### Invalid

```jsx
var a = 1;
a = 2;
/^[Á]$/u;
/^[❇️]$/u;
/^[👶🏻]$/u;
/^[🇯🇵]$/u;
/^[👨‍👩‍👦]$/u;
/^[👍]$/;
```

<pre class="language-text"><code class="language-text">nursery/noMisleadingCharacterClass.js:1:11 <a href="https://biomejs.dev/linter/rules/no-misleading-character-class">lint/nursery/noMisleadingCharacterClass</a> ━━━━━━━━━━━━━━━━━
<pre class="language-text"><code class="language-text">nursery/noMisleadingCharacterClass.js:1:1 <a href="https://biomejs.dev/linter/rules/no-misleading-character-class">lint/nursery/noMisleadingCharacterClass</a> ━━━━━━━━━━━━━━━━━

<strong><span style="color: Orange;"> </span></strong><strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Variable is read here.</span>
<strong><span style="color: Orange;"> </span></strong><strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Unexpected combined character in character class.</span>

<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>var a = 1;
<strong> │ </strong>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>a = 2;
<strong> │ </strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong>
<strong>3 │ </strong>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>/^[Á]$/u;
<strong> │ </strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong>
<strong>2 │ </strong>/^[❇️]$/u;
<strong>3 │ </strong>/^[👶🏻]$/u;

nursery/noMisleadingCharacterClass.js:1:11 <a href="https://biomejs.dev/linter/rules/no-misleading-character-class">lint/nursery/noMisleadingCharacterClass</a> ━━━━━━━━━━━━━━━━━

<strong><span style="color: Orange;"> </span></strong><strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Unexpected combined character in character class.</span>

<strong><span style="color: lightgreen;"> </span></strong><strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This note will give you more information.</span>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>/^[Á]$/u;
<strong> │ </strong>
<strong><span style="color: Tomato;"> </span></strong><strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>/^[❇️]$/u;
<strong> │ </strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong>
<strong>3 │ </strong>/^[👶🏻]$/u;
<strong>4 │ </strong>/^[🇯🇵]$/u;

</code></pre>

## Valid

```jsx
var a = 1;
/^[abc]$/;
/^[👍]$/u;
/^[\q{👶🏻}]$/v;
```

## Related links
Expand Down

0 comments on commit 0e69ea1

Please sign in to comment.