Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(supicious/noDoubleEquals): fix typo #2006

Merged
merged 3 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ file.vue:1:3 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━
2 │ delete a.c;
3 │

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -105,5 +105,3 @@ file.vue:4:1 lint/style/noVar FIXABLE ━━━━━━━━━━━━━
Checked 1 file in <TIME>. No fixes needed.
Found 4 errors.
```


Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ file.vue:1:3 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━
2 │ delete a.c;
3 │

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -123,5 +123,3 @@ file.vue:4:1 lint/style/noVar FIXABLE ━━━━━━━━━━━━━
Checked 1 file in <TIME>. No fixes needed.
Found 5 errors.
```


Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare_rule! {
/// Require the use of `===` and `!==`
///
/// It is generally bad practice to use `==` for comparison instead of
/// `===`. Double operators will triger implicit [type coercion](https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion)
/// `===`. Double operators will trigger implicit [type coercion](https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion)
/// and are thus not prefered. Using strict equality operators is almost
/// always best practice.
///
Expand Down Expand Up @@ -96,7 +96,7 @@ impl Rule for NoDoubleEquals {
.detail(op.text_trimmed_range(), markup! {
<Emphasis>{text_trimmed}</Emphasis>" is only allowed when comparing against "<Emphasis>"null"</Emphasis>
}).note(markup! {
"Using "<Emphasis>{suggestion}</Emphasis>" may be unsafe if you are relying on type coercion"
"Using "<Emphasis>{text_trimmed}</Emphasis>" may be unsafe if you are relying on type coercion"
})
.description(description))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ invalid.js:3:5 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━
4 │ `;
5 │

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -77,7 +77,7 @@ invalid.js:7:3 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━
8 │
9 │ if (a == b) {

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -107,7 +107,7 @@ invalid.js:9:7 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━
10 │ false;
11 │ }

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -135,7 +135,7 @@ invalid.js:14:11 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━
15 │
16 │ }

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -163,13 +163,11 @@ invalid.js:19:34 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━
20 │ linter: ${linter}
21 │ `;

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

19 │ ··formatter·enabled:·${formatter·===·true}
│ +

```


Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ invalid.jsonc:1:18 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━
> 1 │ const isZero = a == 0;
│ ^^

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

Expand Down Expand Up @@ -49,13 +49,11 @@ invalid.jsonc:1:21 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━
> 1 │ const isNonZero = a != 0;
│ ^^

i Using !== may be unsafe if you are relying on type coercion
i Using != may be unsafe if you are relying on type coercion

i Unsafe fix: Use !==

1 │ const·isNonZero·=·a·!==·0;
│ +

```


Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ invalid.jsx:3:51 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━
4 │ style="color: red"
5 │ >

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Unsafe fix: Use ===

3 │ ····onClick={(event)·=>·console.log(event.ctrlKey·===·true)}
│ +

```


Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ noDoubleEquals.js:3:5 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
4 │ `;
5 │

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand Down Expand Up @@ -83,7 +83,7 @@ noDoubleEquals.js:7:3 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
8 │
9 │ if (a == b) {

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand Down Expand Up @@ -117,7 +117,7 @@ noDoubleEquals.js:9:7 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
10 │ false;
11 │ }

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand Down Expand Up @@ -149,7 +149,7 @@ noDoubleEquals.js:14:11 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
15 │
16 │ }

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand Down Expand Up @@ -183,7 +183,7 @@ noDoubleEquals.js:19:34 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
20 │ linter: ${linter}
21 │ `;

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand All @@ -197,5 +197,3 @@ noDoubleEquals.js:19:34 lint/suspicious/noDoubleEquals FIXABLE ━━━━━


```


Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ noDoubleEquals.jsx:3:51 lint/suspicious/noDoubleEquals FIXABLE ━━━━━
4 │ style="color: red"
5 │ >

i Using === may be unsafe if you are relying on type coercion
i Using == may be unsafe if you are relying on type coercion

i Safe fix: Suppress rule lint/suspicious/noDoubleEquals

Expand All @@ -49,5 +49,3 @@ noDoubleEquals.jsx:3:51 lint/suspicious/noDoubleEquals FIXABLE ━━━━━


```


4 changes: 2 additions & 2 deletions website/src/content/docs/linter/rules/no-double-equals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Source: <a href="https://eslint.org/docs/latest/rules/eqeqeq" target="_blank"><c
Require the use of `===` and `!==`

It is generally bad practice to use `==` for comparison instead of
`===`. Double operators will triger implicit [type coercion](https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion)
`===`. Double operators will trigger implicit [type coercion](https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion)
and are thus not prefered. Using strict equality operators is almost
always best practice.

Expand Down Expand Up @@ -42,7 +42,7 @@ foo == bar
<strong> │ </strong> <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong>
<strong>2 │ </strong>

<strong><span style="color: lightgreen;"> </span></strong><strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Using </span><span style="color: lightgreen;"><strong>===</strong></span><span style="color: lightgreen;"> may be unsafe if you are relying on type coercion</span>
<strong><span style="color: lightgreen;"> </span></strong><strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Using </span><span style="color: lightgreen;"><strong>==</strong></span><span style="color: lightgreen;"> may be unsafe if you are relying on type coercion</span>

<strong><span style="color: lightgreen;"> </span></strong><strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Unsafe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Use </span><span style="color: lightgreen;"><strong>===</strong></span>

Expand Down
Loading