Skip to content

Commit a6ea645

Browse files
authored
Release 1.9.0 (#428)
1 parent 43080a9 commit a6ea645

File tree

4 files changed

+108
-3
lines changed

4 files changed

+108
-3
lines changed

src/docs/guide/usage/linter/generated-cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Arguments:
6969
Enable the promise plugin and detect promise usage problems
7070
- **`--node-plugin`** —
7171
Enable the node plugin and detect node usage problems
72+
- **`--regex-plugin`** —
73+
Enable the regex plugin and detect regex usage problems
74+
- **`--vue-plugin`** —
75+
Enable the vue plugin and detect vue usage problems
7276

7377
## Fix Problems
7478

src/docs/guide/usage/linter/generated-rules.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The progress of all rule implementations is tracked [here](https://github.com/oxc-project/oxc/issues/481).
44

5-
- Total number of rules: 525
5+
- Total number of rules: 526
66
- Rules turned on by default: 87
77

88
**Legend for 'Fixable?' column:**
@@ -215,7 +215,7 @@ Code that can be written to run faster.
215215
| [prefer-array-flat-map](/docs/guide/usage/linter/rules/unicorn/prefer-array-flat-map.html) | unicorn | | 🛠️ |
216216
| [prefer-set-has](/docs/guide/usage/linter/rules/unicorn/prefer-set-has.html) | unicorn | | ⚠️🛠️️ |
217217

218-
## Restriction (66):
218+
## Restriction (67):
219219

220220
Lints which prevent the use of language and library features. Must not be enabled as a whole, should be considered on a case-by-case basis before enabling.
221221

@@ -266,6 +266,7 @@ Lints which prevent the use of language and library features. Must not be enable
266266
| [no-danger](/docs/guide/usage/linter/rules/react/no-danger.html) | react | | |
267267
| [no-unknown-property](/docs/guide/usage/linter/rules/react/no-unknown-property.html) | react | | 🚧 |
268268
| [explicit-function-return-type](/docs/guide/usage/linter/rules/typescript/explicit-function-return-type.html) | typescript | | |
269+
| [explicit-module-boundary-types](/docs/guide/usage/linter/rules/typescript/explicit-module-boundary-types.html) | typescript | | |
269270
| [no-dynamic-delete](/docs/guide/usage/linter/rules/typescript/no-dynamic-delete.html) | typescript | | |
270271
| [no-empty-object-type](/docs/guide/usage/linter/rules/typescript/no-empty-object-type.html) | typescript | | |
271272
| [no-explicit-any](/docs/guide/usage/linter/rules/typescript/no-explicit-any.html) | typescript | | 🛠️ |
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
<script setup>
4+
import { data } from '../version.data.js';
5+
const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_linter/src/rules/typescript/explicit_module_boundary_types.rs`;
6+
</script>
7+
8+
# typescript/explicit-module-boundary-types <Badge type="info" text="Restriction" />
9+
10+
<div class="rule-meta">
11+
</div>
12+
13+
### What it does
14+
15+
Require explicit return and argument types on exported functions' and classes' public class methods.
16+
17+
### Why is this bad?
18+
19+
Explicit types for function return values and arguments makes it clear
20+
to any calling code what is the module boundary's input and output.
21+
Adding explicit type annotations for those types can help improve code
22+
readability. It can also improve TypeScript type checking performance on
23+
larger codebases.
24+
25+
### Examples
26+
27+
Examples of **incorrect** code for this rule:
28+
29+
```ts
30+
// Should indicate that no value is returned (void)
31+
export function test() {
32+
return;
33+
}
34+
35+
// Should indicate that a string is returned
36+
export var arrowFn = () => "test";
37+
38+
// All arguments should be typed
39+
export var arrowFn = (arg): string => `test ${arg}`;
40+
export var arrowFn = (arg: any): string => `test ${arg}`;
41+
42+
export class Test {
43+
// Should indicate that no value is returned (void)
44+
method() {
45+
return;
46+
}
47+
}
48+
```
49+
50+
Examples of **correct** code for this rule:
51+
52+
```ts
53+
// A function with no return value (void)
54+
export function test(): void {
55+
return;
56+
}
57+
58+
// A return value of type string
59+
export var arrowFn = (): string => "test";
60+
61+
// All arguments should be typed
62+
export var arrowFn = (arg: string): string => `test ${arg}`;
63+
export var arrowFn = (arg: unknown): string => `test ${arg}`;
64+
65+
export class Test {
66+
// A class method with no return value (void)
67+
method(): void {
68+
return;
69+
}
70+
}
71+
72+
// The function does not apply because it is not an exported function.
73+
function test() {
74+
return;
75+
}
76+
```
77+
78+
## How to use
79+
80+
To **enable** this rule in the CLI or using the config file, you can use:
81+
82+
::: code-group
83+
84+
```bash [CLI]
85+
oxlint --deny typescript/explicit-module-boundary-types
86+
```
87+
88+
```json [Config (.oxlintrc.json)]
89+
{
90+
"rules": {
91+
"typescript/explicit-module-boundary-types": "error"
92+
}
93+
}
94+
```
95+
96+
:::
97+
98+
## References
99+
100+
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
22
load() {
3-
return "2d9291c7d68352eafd0bfcf5d37b137cbadc1120";
3+
return "a696227142fa90e5e895c173ad4b7cb1207d4d92";
44
},
55
};

0 commit comments

Comments
 (0)