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

docs: add typescript template #17500

Merged
merged 12 commits into from Sep 1, 2023
18 changes: 16 additions & 2 deletions docs/src/_includes/layouts/doc.html
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -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 %}
<h2 id="handled_by_typescript">Handled by TypeScript</h2>
It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check (
{%- for code in handled_by_typescript -%}
<code>ts({{ code }})</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 %}
<h2 id="related-rules">Related Rules</h2>
Expand Down Expand Up @@ -48,7 +61,7 @@ <h2 id="further-reading">Further Reading</h2>

{% set all_content = [all_content, further_reading_content] | join %}
{% endif %}

{% if rule_meta %}
{% set resources_content %}
<h2 id="resources">Resources</h2>
Expand Down Expand Up @@ -76,7 +89,7 @@ <h1>{{ title }}</h1>
{% endif %}

{% include 'components/docs-toc.html' %}

{{ all_content | safe }}
</div>

Expand All @@ -102,6 +115,7 @@ <h1>{{ title }}</h1>
{% include "partials/docs-footer.html" %}
</div>
</div>

<a id="scroll-up-btn" href="#site_top">
<svg fill="none" height="24" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" width="24"><line x1="12" x2="12" y1="19" y2="5"/><polyline points="5 12 12 5 19 12"/></svg>
</a>
Expand Down
5 changes: 3 additions & 2 deletions docs/src/rules/constructor-super.md
@@ -1,6 +1,9 @@
---
title: constructor-super
rule_type: problem
handled_by_typescript:
- 2335
- 2377
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
---

Constructors of derived classes must call `super()`.
Expand Down Expand Up @@ -69,5 +72,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)`).
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-const-assign.md
@@ -1,6 +1,8 @@
---
title: no-const-assign
rule_type: problem
handled_by_typescript:
- 2588
---


Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-dupe-args.md
@@ -1,6 +1,8 @@
---
title: no-dupe-args
rule_type: problem
handled_by_typescript:
- 2300
---


Expand Down
5 changes: 3 additions & 2 deletions docs/src/rules/no-dupe-class-members.md
@@ -1,6 +1,9 @@
---
title: no-dupe-class-members
rule_type: problem
handled_by_typescript:
- 2300
- 2393
---


Expand Down Expand Up @@ -101,5 +104,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)`).
2 changes: 2 additions & 0 deletions docs/src/rules/no-dupe-keys.md
@@ -1,6 +1,8 @@
---
title: no-dupe-keys
rule_type: problem
handled_by_typescript:
- 1117
---


Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-func-assign.md
@@ -1,6 +1,8 @@
---
title: no-func-assign
rule_type: problem
handled_by_typescript:
- 2539
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
---


Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-import-assign.md
Expand Up @@ -57,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.
2 changes: 2 additions & 0 deletions 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
---
Expand Down
2 changes: 2 additions & 0 deletions 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
---
Expand Down
2 changes: 2 additions & 0 deletions 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:
Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-this-before-super.md
@@ -1,6 +1,8 @@
---
title: no-this-before-super
rule_type: problem
handled_by_typescript:
- 2376
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
---


Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-undef.md
@@ -1,6 +1,8 @@
---
title: no-undef
rule_type: problem
handled_by_typescript:
- 2304
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
related_rules:
- no-global-assign
- no-redeclare
Expand Down
2 changes: 2 additions & 0 deletions docs/src/rules/no-unreachable.md
@@ -1,6 +1,8 @@
---
title: no-unreachable
rule_type: problem
handled_by_typescript:
- 7027
---


Expand Down
4 changes: 4 additions & 0 deletions docs/src/rules/no-unsafe-negation.md
@@ -1,6 +1,10 @@
---
title: no-unsafe-negation
rule_type: problem
handled_by_typescript:
- 2358
- 2360
- 2365
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
---


Expand Down