From 0f61783f418dbc60ee8e036182ad74313f056807 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:15:05 -0400 Subject: [PATCH 01/12] docs: add typescript template --- docs/src/_includes/layouts/doc.html | 18 ++++++++++++++++-- docs/src/rules/constructor-super.md | 7 +++++-- docs/src/rules/getter-return.md | 2 ++ docs/src/rules/no-const-assign.md | 2 ++ docs/src/rules/no-dupe-args.md | 2 ++ docs/src/rules/no-dupe-class-members.md | 7 +++---- docs/src/rules/no-dupe-keys.md | 2 ++ docs/src/rules/no-func-assign.md | 2 ++ docs/src/rules/no-import-assign.md | 3 +++ docs/src/rules/no-new-symbol.md | 2 ++ docs/src/rules/no-obj-calls.md | 2 ++ docs/src/rules/no-redeclare.md | 2 ++ docs/src/rules/no-setter-return.md | 2 ++ docs/src/rules/no-this-before-super.md | 2 ++ docs/src/rules/no-undef.md | 2 ++ docs/src/rules/no-unreachable.md | 2 ++ docs/src/rules/no-unsafe-negation.md | 4 ++++ 17 files changed, 55 insertions(+), 8 deletions(-) diff --git a/docs/src/_includes/layouts/doc.html b/docs/src/_includes/layouts/doc.html index 4050a901063..36ca10f8743 100644 --- a/docs/src/_includes/layouts/doc.html +++ b/docs/src/_includes/layouts/doc.html @@ -19,6 +19,19 @@ {% set added_version = rule_versions.added[title] %} {% set removed_version = rule_versions.removed[title] %} + {% if handled_by_typescript %} + {% set handled_by_typescript_content %} +

Handled by TypeScript

+ It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check ( + {%- for code in handled_by_typescript -%} + ts({{ code }}){% if not loop.last %} & {% endif %} + {%- endfor -%} + ). + {% endset %} + + {% set all_content = [all_content, handled_by_typescript_content] | join %} + {% endif %} + {% if related_rules %} {% set related_rules_content %} @@ -48,7 +61,7 @@

Further Reading

{% set all_content = [all_content, further_reading_content] | join %} {% endif %} - + {% if rule_meta %} {% set resources_content %}

Resources

@@ -76,7 +89,7 @@

{{ title }}

{% endif %} {% include 'components/docs-toc.html' %} - + {{ all_content | safe }} @@ -102,6 +115,7 @@

{{ title }}

{% include "partials/docs-footer.html" %} + diff --git a/docs/src/rules/constructor-super.md b/docs/src/rules/constructor-super.md index c172b0a7c27..87cecffb54e 100644 --- a/docs/src/rules/constructor-super.md +++ b/docs/src/rules/constructor-super.md @@ -1,8 +1,13 @@ --- title: constructor-super rule_type: problem +handled_by_typescript: +- 2335 +- 2377 --- + + Constructors of derived classes must call `super()`. Constructors of non derived classes must not call `super()`. If this is not observed, the JavaScript engine will raise a runtime error. @@ -69,5 +74,3 @@ class A extends B { ## When Not To Use It If you don't want to be notified about invalid/missing `super()` callings in constructors, you can safely disable this rule. - -It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check (`ts(2335) & ts(2377)`). diff --git a/docs/src/rules/getter-return.md b/docs/src/rules/getter-return.md index 0c8937d14cc..f93fd275d38 100644 --- a/docs/src/rules/getter-return.md +++ b/docs/src/rules/getter-return.md @@ -1,6 +1,8 @@ --- title: getter-return rule_type: problem +handled_by_typescript: +- 2378 further_reading: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get - https://leanpub.com/understandinges6/read/#leanpub-auto-accessor-properties diff --git a/docs/src/rules/no-const-assign.md b/docs/src/rules/no-const-assign.md index f9f0ed172bb..c655d437202 100644 --- a/docs/src/rules/no-const-assign.md +++ b/docs/src/rules/no-const-assign.md @@ -1,6 +1,8 @@ --- title: no-const-assign rule_type: problem +handled_by_typescript: +- 2588 --- diff --git a/docs/src/rules/no-dupe-args.md b/docs/src/rules/no-dupe-args.md index 79f791c4666..8e9ac1b879a 100644 --- a/docs/src/rules/no-dupe-args.md +++ b/docs/src/rules/no-dupe-args.md @@ -1,6 +1,8 @@ --- title: no-dupe-args rule_type: problem +handled_by_typescript: +- 2300 --- diff --git a/docs/src/rules/no-dupe-class-members.md b/docs/src/rules/no-dupe-class-members.md index d50a7fe74e1..b41d004dea2 100644 --- a/docs/src/rules/no-dupe-class-members.md +++ b/docs/src/rules/no-dupe-class-members.md @@ -1,10 +1,11 @@ --- title: no-dupe-class-members rule_type: problem +handled_by_typescript: +- 2300 +- 2393 --- - - If there are declarations of the same name in class members, the last declaration overwrites other declarations silently. It can cause unexpected behaviors. @@ -101,5 +102,3 @@ class Foo { This rule should not be used in ES3/5 environments. In ES2015 (ES6) or later, if you don't want to be notified about duplicate names in class members, you can safely disable this rule. - -It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check (`ts(2300) & ts(2393)`). diff --git a/docs/src/rules/no-dupe-keys.md b/docs/src/rules/no-dupe-keys.md index 75fc9491fb6..65a964e781e 100644 --- a/docs/src/rules/no-dupe-keys.md +++ b/docs/src/rules/no-dupe-keys.md @@ -1,6 +1,8 @@ --- title: no-dupe-keys rule_type: problem +handled_by_typescript: +- 1117 --- diff --git a/docs/src/rules/no-func-assign.md b/docs/src/rules/no-func-assign.md index ffbcb46c6b8..5a62269e611 100644 --- a/docs/src/rules/no-func-assign.md +++ b/docs/src/rules/no-func-assign.md @@ -1,6 +1,8 @@ --- title: no-func-assign rule_type: problem +handled_by_typescript: +- 2539 --- diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index ca4b912de81..7cd6da2af51 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -1,6 +1,9 @@ --- title: no-import-assign rule_type: problem +handled_by_typescript: +- 2539 +- 2540 --- diff --git a/docs/src/rules/no-new-symbol.md b/docs/src/rules/no-new-symbol.md index 44c34a4eef0..da55ca1ae75 100644 --- a/docs/src/rules/no-new-symbol.md +++ b/docs/src/rules/no-new-symbol.md @@ -1,6 +1,8 @@ --- title: no-new-symbol rule_type: problem +handled_by_typescript: +- 7009 further_reading: - https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects --- diff --git a/docs/src/rules/no-obj-calls.md b/docs/src/rules/no-obj-calls.md index 8d72e4ce277..38c20a62b69 100644 --- a/docs/src/rules/no-obj-calls.md +++ b/docs/src/rules/no-obj-calls.md @@ -1,6 +1,8 @@ --- title: no-obj-calls rule_type: problem +handled_by_typescript: +- 2349 further_reading: - https://es5.github.io/#x15.8 --- diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index e66f0570fc6..7254f83fc07 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -1,6 +1,8 @@ --- title: no-redeclare rule_type: suggestion +handled_by_typescript: +- 2451 related_rules: - no-shadow --- diff --git a/docs/src/rules/no-setter-return.md b/docs/src/rules/no-setter-return.md index ceb4558c15a..72ddbb69497 100644 --- a/docs/src/rules/no-setter-return.md +++ b/docs/src/rules/no-setter-return.md @@ -1,6 +1,8 @@ --- title: no-setter-return rule_type: problem +handled_by_typescript: +- 2408 related_rules: - getter-return further_reading: diff --git a/docs/src/rules/no-this-before-super.md b/docs/src/rules/no-this-before-super.md index f1425b5ed35..693ee345f59 100644 --- a/docs/src/rules/no-this-before-super.md +++ b/docs/src/rules/no-this-before-super.md @@ -1,6 +1,8 @@ --- title: no-this-before-super rule_type: problem +handled_by_typescript: +- 2376 --- diff --git a/docs/src/rules/no-undef.md b/docs/src/rules/no-undef.md index 0bc7a28279f..e1dee931a12 100644 --- a/docs/src/rules/no-undef.md +++ b/docs/src/rules/no-undef.md @@ -1,6 +1,8 @@ --- title: no-undef rule_type: problem +handled_by_typescript: +- 2304 related_rules: - no-global-assign - no-redeclare diff --git a/docs/src/rules/no-unreachable.md b/docs/src/rules/no-unreachable.md index 4f762084b41..34a6c93dfb2 100644 --- a/docs/src/rules/no-unreachable.md +++ b/docs/src/rules/no-unreachable.md @@ -1,6 +1,8 @@ --- title: no-unreachable rule_type: problem +handled_by_typescript: +- 7027 --- diff --git a/docs/src/rules/no-unsafe-negation.md b/docs/src/rules/no-unsafe-negation.md index 522e4ab4d1a..756915b3c0d 100644 --- a/docs/src/rules/no-unsafe-negation.md +++ b/docs/src/rules/no-unsafe-negation.md @@ -1,6 +1,10 @@ --- title: no-unsafe-negation rule_type: problem +handled_by_typescript: +- 2358 +- 2360 +- 2365 --- From 02e7e896f149e36562a7e36ab8a0e44a367bff92 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:19:51 -0400 Subject: [PATCH 02/12] fix: formatting --- docs/src/rules/constructor-super.md | 2 -- docs/src/rules/no-dupe-class-members.md | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/rules/constructor-super.md b/docs/src/rules/constructor-super.md index 87cecffb54e..d20ac449cea 100644 --- a/docs/src/rules/constructor-super.md +++ b/docs/src/rules/constructor-super.md @@ -6,8 +6,6 @@ handled_by_typescript: - 2377 --- - - Constructors of derived classes must call `super()`. Constructors of non derived classes must not call `super()`. If this is not observed, the JavaScript engine will raise a runtime error. diff --git a/docs/src/rules/no-dupe-class-members.md b/docs/src/rules/no-dupe-class-members.md index b41d004dea2..bb1cc9669f8 100644 --- a/docs/src/rules/no-dupe-class-members.md +++ b/docs/src/rules/no-dupe-class-members.md @@ -6,6 +6,8 @@ handled_by_typescript: - 2393 --- + + If there are declarations of the same name in class members, the last declaration overwrites other declarations silently. It can cause unexpected behaviors. From a797dea02e513adacfb3c82d60d418e7e3ab62b2 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Sun, 27 Aug 2023 11:42:03 -0400 Subject: [PATCH 03/12] chore: update docs with AndreaPontrandolfo's findings --- docs/src/rules/no-import-assign.md | 5 ++--- docs/src/rules/no-redeclare.md | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index 7cd6da2af51..fd8ce365d6e 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -1,9 +1,6 @@ --- title: no-import-assign rule_type: problem -handled_by_typescript: -- 2539 -- 2540 --- @@ -60,3 +57,5 @@ test(mod_ns) // Not errored because it doesn't know that 'test' updates the memb ## When Not To Use It If you don't want to be notified about modifying imported bindings, you can disable this rule. + +Note that if you are using TypeScript, the compiler will partially catch this error (`ts(2539)` & `ts(2540)`). However, it does not catch the `Object.assign` case, so this rule still provides some value to TypeScript users. diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index 7254f83fc07..e66f0570fc6 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -1,8 +1,6 @@ --- title: no-redeclare rule_type: suggestion -handled_by_typescript: -- 2451 related_rules: - no-shadow --- From 3c120ec53ebeb14e4334005580e95325803a242e Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:45:18 -0400 Subject: [PATCH 04/12] Update no-import-assign.md --- docs/src/rules/no-import-assign.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index fd8ce365d6e..4af31ebe0a8 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -58,4 +58,4 @@ test(mod_ns) // Not errored because it doesn't know that 'test' updates the memb If you don't want to be notified about modifying imported bindings, you can disable this rule. -Note that if you are using TypeScript, the compiler will partially catch this error (`ts(2539)` & `ts(2540)`). However, it does not catch the `Object.assign` case, so this rule still provides some value to TypeScript users. +If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2539)` & `ts(2540)`). However, note that the compiler does not catch the `Object.assign` case, so this rule still provides some miniscule value. From ddd11fe70174a8162549fd0ccb076ce8e5f60fb5 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:48:48 -0400 Subject: [PATCH 05/12] chore: update no-redeclare --- docs/src/rules/no-redeclare.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index e66f0570fc6..15aab895040 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -101,3 +101,7 @@ var top = 0; The `browser` environment has many built-in global variables (for example, `top`). Some of built-in global variables cannot be redeclared. Note that when using the `node` or `commonjs` environments (or `ecmaFeatures.globalReturn`, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [`no-shadow`](no-shadow) rule with the `"builtinGlobals"` option should be used. + +## When Not To Use It + +If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2451)`). However, note that while the compiler will catch `let` redeclares and `const` redeclares, it will not catch `var` redeclares. Thus, if you use the legacy `var` keyword in your TypeScript codebase, this rule still provides some miniscule value. From c41b48f698526c2fa1a9401bc0c72006ce98fb54 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:11:51 -0400 Subject: [PATCH 06/12] fix: update TS code numbers --- docs/src/rules/no-func-assign.md | 2 +- docs/src/rules/no-import-assign.md | 2 +- docs/src/rules/no-this-before-super.md | 1 + docs/src/rules/no-undef.md | 2 +- docs/src/rules/no-unsafe-negation.md | 3 +-- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/rules/no-func-assign.md b/docs/src/rules/no-func-assign.md index 5a62269e611..327dfeb6ac7 100644 --- a/docs/src/rules/no-func-assign.md +++ b/docs/src/rules/no-func-assign.md @@ -2,7 +2,7 @@ title: no-func-assign rule_type: problem handled_by_typescript: -- 2539 +- 2630 --- diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index 4af31ebe0a8..8eb2322a8d9 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -58,4 +58,4 @@ test(mod_ns) // Not errored because it doesn't know that 'test' updates the memb If you don't want to be notified about modifying imported bindings, you can disable this rule. -If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2539)` & `ts(2540)`). However, note that the compiler does not catch the `Object.assign` case, so this rule still provides some miniscule value. +If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2632)`). However, note that the compiler does not catch the `Object.assign` case, so this rule still provides some miniscule value. diff --git a/docs/src/rules/no-this-before-super.md b/docs/src/rules/no-this-before-super.md index 693ee345f59..23ec31e2fa3 100644 --- a/docs/src/rules/no-this-before-super.md +++ b/docs/src/rules/no-this-before-super.md @@ -3,6 +3,7 @@ title: no-this-before-super rule_type: problem handled_by_typescript: - 2376 +- 17009 --- diff --git a/docs/src/rules/no-undef.md b/docs/src/rules/no-undef.md index e1dee931a12..72e4c442ef3 100644 --- a/docs/src/rules/no-undef.md +++ b/docs/src/rules/no-undef.md @@ -2,7 +2,7 @@ title: no-undef rule_type: problem handled_by_typescript: -- 2304 +- 2552 related_rules: - no-global-assign - no-redeclare diff --git a/docs/src/rules/no-unsafe-negation.md b/docs/src/rules/no-unsafe-negation.md index 756915b3c0d..2f995973141 100644 --- a/docs/src/rules/no-unsafe-negation.md +++ b/docs/src/rules/no-unsafe-negation.md @@ -2,9 +2,8 @@ title: no-unsafe-negation rule_type: problem handled_by_typescript: +- 2322 - 2358 -- 2360 -- 2365 --- From aa614bada14240656715929bb4e63983f1fefb80 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:43:50 -0400 Subject: [PATCH 07/12] feat: cleanup typescript error codes --- docs/src/_includes/layouts/doc.html | 13 ++++++++----- docs/src/rules/constructor-super.md | 4 +--- docs/src/rules/getter-return.md | 3 +-- docs/src/rules/no-const-assign.md | 3 +-- docs/src/rules/no-dupe-args.md | 3 +-- docs/src/rules/no-dupe-class-members.md | 4 +--- docs/src/rules/no-dupe-keys.md | 3 +-- docs/src/rules/no-func-assign.md | 3 +-- docs/src/rules/no-import-assign.md | 4 ++-- docs/src/rules/no-invalid-this.md | 2 ++ docs/src/rules/no-new-symbol.md | 3 +-- docs/src/rules/no-obj-calls.md | 3 +-- docs/src/rules/no-redeclare.md | 6 ++---- docs/src/rules/no-setter-return.md | 3 +-- docs/src/rules/no-this-before-super.md | 4 +--- docs/src/rules/no-undef.md | 3 +-- docs/src/rules/no-unreachable.md | 3 +-- docs/src/rules/no-unsafe-negation.md | 4 +--- 18 files changed, 28 insertions(+), 43 deletions(-) diff --git a/docs/src/_includes/layouts/doc.html b/docs/src/_includes/layouts/doc.html index 36ca10f8743..e9204ff2e43 100644 --- a/docs/src/_includes/layouts/doc.html +++ b/docs/src/_includes/layouts/doc.html @@ -22,11 +22,14 @@ {% if handled_by_typescript %} {% set handled_by_typescript_content %}

Handled by TypeScript

- It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check ( - {%- for code in handled_by_typescript -%} - ts({{ code }}){% if not loop.last %} & {% endif %} - {%- endfor -%} - ). +

+ It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check. +

+ {% if extra_typescript_info %} +

+ {{ extra_typescript_info }} +

+ {% endif %} {% endset %} {% set all_content = [all_content, handled_by_typescript_content] | join %} diff --git a/docs/src/rules/constructor-super.md b/docs/src/rules/constructor-super.md index d20ac449cea..7c19df77dba 100644 --- a/docs/src/rules/constructor-super.md +++ b/docs/src/rules/constructor-super.md @@ -1,9 +1,7 @@ --- title: constructor-super rule_type: problem -handled_by_typescript: -- 2335 -- 2377 +handled_by_typescript: true --- Constructors of derived classes must call `super()`. diff --git a/docs/src/rules/getter-return.md b/docs/src/rules/getter-return.md index f93fd275d38..9d316303d02 100644 --- a/docs/src/rules/getter-return.md +++ b/docs/src/rules/getter-return.md @@ -1,8 +1,7 @@ --- title: getter-return rule_type: problem -handled_by_typescript: -- 2378 +handled_by_typescript: true further_reading: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get - https://leanpub.com/understandinges6/read/#leanpub-auto-accessor-properties diff --git a/docs/src/rules/no-const-assign.md b/docs/src/rules/no-const-assign.md index c655d437202..ca62132a757 100644 --- a/docs/src/rules/no-const-assign.md +++ b/docs/src/rules/no-const-assign.md @@ -1,8 +1,7 @@ --- title: no-const-assign rule_type: problem -handled_by_typescript: -- 2588 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-dupe-args.md b/docs/src/rules/no-dupe-args.md index 8e9ac1b879a..3cb9133c83f 100644 --- a/docs/src/rules/no-dupe-args.md +++ b/docs/src/rules/no-dupe-args.md @@ -1,8 +1,7 @@ --- title: no-dupe-args rule_type: problem -handled_by_typescript: -- 2300 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-dupe-class-members.md b/docs/src/rules/no-dupe-class-members.md index bb1cc9669f8..216f3c9fecd 100644 --- a/docs/src/rules/no-dupe-class-members.md +++ b/docs/src/rules/no-dupe-class-members.md @@ -1,9 +1,7 @@ --- title: no-dupe-class-members rule_type: problem -handled_by_typescript: -- 2300 -- 2393 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-dupe-keys.md b/docs/src/rules/no-dupe-keys.md index 65a964e781e..1527bf8f1ec 100644 --- a/docs/src/rules/no-dupe-keys.md +++ b/docs/src/rules/no-dupe-keys.md @@ -1,8 +1,7 @@ --- title: no-dupe-keys rule_type: problem -handled_by_typescript: -- 1117 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-func-assign.md b/docs/src/rules/no-func-assign.md index 327dfeb6ac7..a0f14620374 100644 --- a/docs/src/rules/no-func-assign.md +++ b/docs/src/rules/no-func-assign.md @@ -1,8 +1,7 @@ --- title: no-func-assign rule_type: problem -handled_by_typescript: -- 2630 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index 8eb2322a8d9..170e983e38e 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -1,6 +1,8 @@ --- title: no-import-assign rule_type: problem +handled_by_typescript: true +extra_typescript_info: However, note that the compiler will not catch the "Object.assign" case. Thus, if you use "Object.assign" in your codebase, this rule will still provide some miniscule value. --- @@ -57,5 +59,3 @@ test(mod_ns) // Not errored because it doesn't know that 'test' updates the memb ## When Not To Use It If you don't want to be notified about modifying imported bindings, you can disable this rule. - -If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2632)`). However, note that the compiler does not catch the `Object.assign` case, so this rule still provides some miniscule value. diff --git a/docs/src/rules/no-invalid-this.md b/docs/src/rules/no-invalid-this.md index f3aa6ed763e..ddc449b524d 100644 --- a/docs/src/rules/no-invalid-this.md +++ b/docs/src/rules/no-invalid-this.md @@ -1,6 +1,8 @@ --- title: no-invalid-this rule_type: suggestion +handled_by_typescript: true +extra_typescript_info: Note that technically, TypeScript will only catch this if you have the "strict" or "noImplicitThis" flags enabled. These are enabled in most TypeScript projects, since they are considered to be best practice. --- diff --git a/docs/src/rules/no-new-symbol.md b/docs/src/rules/no-new-symbol.md index da55ca1ae75..d557811f30c 100644 --- a/docs/src/rules/no-new-symbol.md +++ b/docs/src/rules/no-new-symbol.md @@ -1,8 +1,7 @@ --- title: no-new-symbol rule_type: problem -handled_by_typescript: -- 7009 +handled_by_typescript: true further_reading: - https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects --- diff --git a/docs/src/rules/no-obj-calls.md b/docs/src/rules/no-obj-calls.md index 38c20a62b69..2fde92e5cbf 100644 --- a/docs/src/rules/no-obj-calls.md +++ b/docs/src/rules/no-obj-calls.md @@ -1,8 +1,7 @@ --- title: no-obj-calls rule_type: problem -handled_by_typescript: -- 2349 +handled_by_typescript: true further_reading: - https://es5.github.io/#x15.8 --- diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index 15aab895040..3dc732a9cd4 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -1,6 +1,8 @@ --- title: no-redeclare rule_type: suggestion +handled_by_typescript: true +extra_typescript_info: However, note that while TypeScript will catch `let` redeclares and `const` redeclares, it will not catch `var` redeclares. Thus, if you use the legacy `var` keyword in your TypeScript codebase, this rule will still provide some miniscule value. related_rules: - no-shadow --- @@ -101,7 +103,3 @@ var top = 0; The `browser` environment has many built-in global variables (for example, `top`). Some of built-in global variables cannot be redeclared. Note that when using the `node` or `commonjs` environments (or `ecmaFeatures.globalReturn`, if using the default parser), the top scope of a program is not actually the global scope, but rather a "module" scope. When this is the case, declaring a variable named after a builtin global is not a redeclaration, but rather a shadowing of the global variable. In that case, the [`no-shadow`](no-shadow) rule with the `"builtinGlobals"` option should be used. - -## When Not To Use It - -If you use TypeScript, it is not recommended to use this rule, since the compiler will mostly catch this error (`ts(2451)`). However, note that while the compiler will catch `let` redeclares and `const` redeclares, it will not catch `var` redeclares. Thus, if you use the legacy `var` keyword in your TypeScript codebase, this rule still provides some miniscule value. diff --git a/docs/src/rules/no-setter-return.md b/docs/src/rules/no-setter-return.md index 72ddbb69497..50353c754da 100644 --- a/docs/src/rules/no-setter-return.md +++ b/docs/src/rules/no-setter-return.md @@ -1,8 +1,7 @@ --- title: no-setter-return rule_type: problem -handled_by_typescript: -- 2408 +handled_by_typescript: true related_rules: - getter-return further_reading: diff --git a/docs/src/rules/no-this-before-super.md b/docs/src/rules/no-this-before-super.md index 23ec31e2fa3..c1a654796cb 100644 --- a/docs/src/rules/no-this-before-super.md +++ b/docs/src/rules/no-this-before-super.md @@ -1,9 +1,7 @@ --- title: no-this-before-super rule_type: problem -handled_by_typescript: -- 2376 -- 17009 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-undef.md b/docs/src/rules/no-undef.md index 72e4c442ef3..72ea516f966 100644 --- a/docs/src/rules/no-undef.md +++ b/docs/src/rules/no-undef.md @@ -1,8 +1,7 @@ --- title: no-undef rule_type: problem -handled_by_typescript: -- 2552 +handled_by_typescript: true related_rules: - no-global-assign - no-redeclare diff --git a/docs/src/rules/no-unreachable.md b/docs/src/rules/no-unreachable.md index 34a6c93dfb2..15f77f8173e 100644 --- a/docs/src/rules/no-unreachable.md +++ b/docs/src/rules/no-unreachable.md @@ -1,8 +1,7 @@ --- title: no-unreachable rule_type: problem -handled_by_typescript: -- 7027 +handled_by_typescript: true --- diff --git a/docs/src/rules/no-unsafe-negation.md b/docs/src/rules/no-unsafe-negation.md index 2f995973141..f3b49522316 100644 --- a/docs/src/rules/no-unsafe-negation.md +++ b/docs/src/rules/no-unsafe-negation.md @@ -1,9 +1,7 @@ --- title: no-unsafe-negation rule_type: problem -handled_by_typescript: -- 2322 -- 2358 +handled_by_typescript: true --- From b887b9fb6f5532bd7a428cc77d735cc7cfd5c962 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:29:56 -0400 Subject: [PATCH 08/12] Update docs/src/_includes/layouts/doc.html Co-authored-by: Nicholas C. Zakas --- docs/src/_includes/layouts/doc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/_includes/layouts/doc.html b/docs/src/_includes/layouts/doc.html index e9204ff2e43..703d69815a5 100644 --- a/docs/src/_includes/layouts/doc.html +++ b/docs/src/_includes/layouts/doc.html @@ -27,7 +27,7 @@

Handled by TypeScript

{% if extra_typescript_info %}

- {{ extra_typescript_info }} + {{ extra_typescript_info | markdown }}

{% endif %} {% endset %} From 2fb48272114df2afcb665f6e23f9318e505c9a6e Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:36:24 -0400 Subject: [PATCH 09/12] Update docs/src/rules/no-redeclare.md Co-authored-by: Nicholas C. Zakas --- docs/src/rules/no-redeclare.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/no-redeclare.md b/docs/src/rules/no-redeclare.md index 3dc732a9cd4..009ba889fcc 100644 --- a/docs/src/rules/no-redeclare.md +++ b/docs/src/rules/no-redeclare.md @@ -2,7 +2,7 @@ title: no-redeclare rule_type: suggestion handled_by_typescript: true -extra_typescript_info: However, note that while TypeScript will catch `let` redeclares and `const` redeclares, it will not catch `var` redeclares. Thus, if you use the legacy `var` keyword in your TypeScript codebase, this rule will still provide some miniscule value. +extra_typescript_info: Note that while TypeScript will catch `let` redeclares and `const` redeclares, it will not catch `var` redeclares. Thus, if you use the legacy `var` keyword in your TypeScript codebase, this rule will still provide some value. related_rules: - no-shadow --- From d1ff2bc32f32b44ce0ca21d472b04d3d5622cbef Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:37:08 -0400 Subject: [PATCH 10/12] Update docs/src/rules/no-import-assign.md Co-authored-by: Nicholas C. Zakas --- docs/src/rules/no-import-assign.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/no-import-assign.md b/docs/src/rules/no-import-assign.md index 170e983e38e..b0a7432bb80 100644 --- a/docs/src/rules/no-import-assign.md +++ b/docs/src/rules/no-import-assign.md @@ -2,7 +2,7 @@ title: no-import-assign rule_type: problem handled_by_typescript: true -extra_typescript_info: However, note that the compiler will not catch the "Object.assign" case. Thus, if you use "Object.assign" in your codebase, this rule will still provide some miniscule value. +extra_typescript_info: Note that the compiler will not catch the `Object.assign()` case. Thus, if you use `Object.assign()` in your codebase, this rule will still provide some value. --- From f054dbb669970941af95056414c42d28ba8f4c35 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:37:20 -0400 Subject: [PATCH 11/12] Update docs/src/rules/no-invalid-this.md Co-authored-by: Nicholas C. Zakas --- docs/src/rules/no-invalid-this.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/no-invalid-this.md b/docs/src/rules/no-invalid-this.md index ddc449b524d..9e4a2aedffa 100644 --- a/docs/src/rules/no-invalid-this.md +++ b/docs/src/rules/no-invalid-this.md @@ -2,7 +2,7 @@ title: no-invalid-this rule_type: suggestion handled_by_typescript: true -extra_typescript_info: Note that technically, TypeScript will only catch this if you have the "strict" or "noImplicitThis" flags enabled. These are enabled in most TypeScript projects, since they are considered to be best practice. +extra_typescript_info: Note that, technically, TypeScript will only catch this if you have the `strict` or `noImplicitThis` flags enabled. These are enabled in most TypeScript projects, since they are considered to be best practice. --- From 06772362ccf5aedc5be6df8be31c86d3854b6d4b Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:49:43 -0400 Subject: [PATCH 12/12] fix: formatting error --- docs/src/_includes/layouts/doc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/_includes/layouts/doc.html b/docs/src/_includes/layouts/doc.html index 703d69815a5..58d8986a5dc 100644 --- a/docs/src/_includes/layouts/doc.html +++ b/docs/src/_includes/layouts/doc.html @@ -27,7 +27,7 @@

Handled by TypeScript

{% if extra_typescript_info %}

- {{ extra_typescript_info | markdown }} + {{ extra_typescript_info | markdown | safe }}

{% endif %} {% endset %}