Skip to content

Commit 17f3cf6

Browse files
oxc-botgithub-actions[bot]
authored andcommitted
Release 0.16.11
1 parent 4a10f2c commit 17f3cf6

16 files changed

+377
-47
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Arguments:
104104
## Output
105105

106106
- **`-f`**, **`--format`**=_`ARG`_ —
107-
Use a specific output format. Possible values: `checkstyle`, `default`, `github`, `json`, `junit`, `stylish`, `unix`
107+
Use a specific output format. Possible values: `checkstyle`, `default`, `github`, `gitlab`, `json`, `junit`, `stylish`, `unix`
108108

109109
## Miscellaneous
110110

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

Lines changed: 22 additions & 19 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: 509
5+
- Total number of rules: 512
66
- Rules turned on by default: 123
77

88
**Legend for 'Fixable?' column:**
@@ -130,7 +130,7 @@ Code that is outright wrong or useless.
130130
| [no-duplicate-head](/docs/guide/usage/linter/rules/nextjs/no-duplicate-head.html) | nextjs || |
131131
| [no-head-element](/docs/guide/usage/linter/rules/nextjs/no-head-element.html) | nextjs || |
132132
| [no-head-import-in-document](/docs/guide/usage/linter/rules/nextjs/no-head-import-in-document.html) | nextjs || |
133-
| [no-img-element](/docs/guide/usage/linter/rules/nextjs/no-img-element.html) | nextjs || |
133+
| [no-img-element](/docs/guide/usage/linter/rules/nextjs/no-img-element.html) | nextjs || 🚧 |
134134
| [no-page-custom-font](/docs/guide/usage/linter/rules/nextjs/no-page-custom-font.html) | nextjs || |
135135
| [no-script-component-in-head](/docs/guide/usage/linter/rules/nextjs/no-script-component-in-head.html) | nextjs || |
136136
| [no-styled-jsx-in-document](/docs/guide/usage/linter/rules/nextjs/no-styled-jsx-in-document.html) | nextjs || |
@@ -211,7 +211,7 @@ Code that can be written to run faster.
211211
| [jsx-no-new-object-as-prop](/docs/guide/usage/linter/rules/react_perf/jsx-no-new-object-as-prop.html) | react_perf | | |
212212
| [prefer-set-has](/docs/guide/usage/linter/rules/unicorn/prefer-set-has.html) | unicorn | | ⚠️🛠️️ |
213213

214-
## Restriction (65):
214+
## Restriction (66):
215215

216216
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.
217217

@@ -256,6 +256,7 @@ Lints which prevent the use of language and library features. Must not be enable
256256
| [catch-or-return](/docs/guide/usage/linter/rules/promise/catch-or-return.html) | promise | | |
257257
| [spec-only](/docs/guide/usage/linter/rules/promise/spec-only.html) | promise | | |
258258
| [button-has-type](/docs/guide/usage/linter/rules/react/button-has-type.html) | react | | |
259+
| [forbid-elements](/docs/guide/usage/linter/rules/react/forbid-elements.html) | react | | |
259260
| [jsx-filename-extension](/docs/guide/usage/linter/rules/react/jsx-filename-extension.html) | react | | 🚧 |
260261
| [no-danger](/docs/guide/usage/linter/rules/react/no-danger.html) | react | | |
261262
| [no-unknown-property](/docs/guide/usage/linter/rules/react/no-unknown-property.html) | react | | 🚧 |
@@ -283,7 +284,7 @@ Lints which prevent the use of language and library features. Must not be enable
283284
| [prefer-node-protocol](/docs/guide/usage/linter/rules/unicorn/prefer-node-protocol.html) | unicorn | | 🛠️ |
284285
| [prefer-number-properties](/docs/guide/usage/linter/rules/unicorn/prefer-number-properties.html) | unicorn | | ⚠️🛠️️ |
285286

286-
## Suspicious (31):
287+
## Suspicious (32):
287288

288289
code that is most likely wrong or useless.
289290

@@ -302,6 +303,7 @@ code that is most likely wrong or useless.
302303
| [no-named-as-default](/docs/guide/usage/linter/rules/import/no-named-as-default.html) | import | | |
303304
| [no-named-as-default-member](/docs/guide/usage/linter/rules/import/no-named-as-default-member.html) | import | | |
304305
| [no-self-import](/docs/guide/usage/linter/rules/import/no-self-import.html) | import | | |
306+
| [no-unassigned-import](/docs/guide/usage/linter/rules/import/no-unassigned-import.html) | import | | |
305307
| [no-commented-out-tests](/docs/guide/usage/linter/rules/jest/no-commented-out-tests.html) | jest | | |
306308
| [approx-constant](/docs/guide/usage/linter/rules/oxc/approx-constant.html) | oxc | | |
307309
| [misrefactored-assign-op](/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.html) | oxc | | 🚧 |
@@ -314,7 +316,7 @@ code that is most likely wrong or useless.
314316
| [react-in-jsx-scope](/docs/guide/usage/linter/rules/react/react-in-jsx-scope.html) | react | | |
315317
| [style-prop-object](/docs/guide/usage/linter/rules/react/style-prop-object.html) | react | | |
316318
| [no-confusing-non-null-assertion](/docs/guide/usage/linter/rules/typescript/no-confusing-non-null-assertion.html) | typescript | | 🚧 |
317-
| [no-extraneous-class](/docs/guide/usage/linter/rules/typescript/no-extraneous-class.html) | typescript | | |
319+
| [no-extraneous-class](/docs/guide/usage/linter/rules/typescript/no-extraneous-class.html) | typescript | | ⚠️💡 |
318320
| [no-unnecessary-type-constraint](/docs/guide/usage/linter/rules/typescript/no-unnecessary-type-constraint.html) | typescript | | |
319321
| [consistent-function-scoping](/docs/guide/usage/linter/rules/unicorn/consistent-function-scoping.html) | unicorn | | 🚧 |
320322
| [no-accessor-recursion](/docs/guide/usage/linter/rules/unicorn/no-accessor-recursion.html) | unicorn | | |
@@ -409,7 +411,7 @@ Lints which are rather strict or have occasional false positives.
409411
| [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🛠️ |
410412
| [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ |
411413

412-
## Style (138):
414+
## Style (140):
413415

414416
Code that should be written in a more idiomatic way.
415417

@@ -452,6 +454,7 @@ Code that should be written in a more idiomatic way.
452454
| [sort-keys](/docs/guide/usage/linter/rules/eslint/sort-keys.html) | eslint | | 🚧 |
453455
| [vars-on-top](/docs/guide/usage/linter/rules/eslint/vars-on-top.html) | eslint | | |
454456
| [yoda](/docs/guide/usage/linter/rules/eslint/yoda.html) | eslint | | 🛠️ |
457+
| [consistent-type-specifier-style](/docs/guide/usage/linter/rules/import/consistent-type-specifier-style.html) | import | | 🛠️ |
455458
| [exports-last](/docs/guide/usage/linter/rules/import/exports-last.html) | import | | |
456459
| [first](/docs/guide/usage/linter/rules/import/first.html) | import | | 🚧 |
457460
| [group-exports](/docs/guide/usage/linter/rules/import/group-exports.html) | import | | |
@@ -515,6 +518,7 @@ Code that should be written in a more idiomatic way.
515518
| [consistent-generic-constructors](/docs/guide/usage/linter/rules/typescript/consistent-generic-constructors.html) | typescript | | 🚧 |
516519
| [consistent-indexed-object-style](/docs/guide/usage/linter/rules/typescript/consistent-indexed-object-style.html) | typescript | | 🛠️ |
517520
| [consistent-type-definitions](/docs/guide/usage/linter/rules/typescript/consistent-type-definitions.html) | typescript | | 🛠️ |
521+
| [consistent-type-imports](/docs/guide/usage/linter/rules/typescript/consistent-type-imports.html) | typescript | | 🛠️ |
518522
| [no-empty-interface](/docs/guide/usage/linter/rules/typescript/no-empty-interface.html) | typescript | | |
519523
| [no-inferrable-types](/docs/guide/usage/linter/rules/typescript/no-inferrable-types.html) | typescript | | 🚧 |
520524
| [prefer-for-of](/docs/guide/usage/linter/rules/typescript/prefer-for-of.html) | typescript | | 🚧 |
@@ -554,19 +558,18 @@ Code that should be written in a more idiomatic way.
554558
| [prefer-to-be-object](/docs/guide/usage/linter/rules/vitest/prefer-to-be-object.html) | vitest | | 🛠️ |
555559
| [prefer-to-be-truthy](/docs/guide/usage/linter/rules/vitest/prefer-to-be-truthy.html) | vitest | | 🛠️ |
556560

557-
## Nursery (10):
561+
## Nursery (9):
558562

559563
New lints that are still under development.
560564

561-
| Rule name | Source | Default | Fixable? |
562-
| ------------------------------------------------------------------------------------------------- | ---------- | ------- | -------- |
563-
| [getter-return](/docs/guide/usage/linter/rules/eslint/getter-return.html) | eslint | | |
564-
| [no-undef](/docs/guide/usage/linter/rules/eslint/no-undef.html) | eslint | | |
565-
| [no-unreachable](/docs/guide/usage/linter/rules/eslint/no-unreachable.html) | eslint | | |
566-
| [export](/docs/guide/usage/linter/rules/import/export.html) | import | | |
567-
| [named](/docs/guide/usage/linter/rules/import/named.html) | import | | |
568-
| [no-map-spread](/docs/guide/usage/linter/rules/oxc/no-map-spread.html) | oxc | | 🛠️💡 |
569-
| [no-return-in-finally](/docs/guide/usage/linter/rules/promise/no-return-in-finally.html) | promise | | |
570-
| [exhaustive-deps](/docs/guide/usage/linter/rules/react/exhaustive-deps.html) | react | | |
571-
| [require-render-return](/docs/guide/usage/linter/rules/react/require-render-return.html) | react | | |
572-
| [consistent-type-imports](/docs/guide/usage/linter/rules/typescript/consistent-type-imports.html) | typescript | | 🛠️ |
565+
| Rule name | Source | Default | Fixable? |
566+
| ---------------------------------------------------------------------------------------- | ------- | ------- | -------- |
567+
| [getter-return](/docs/guide/usage/linter/rules/eslint/getter-return.html) | eslint | | |
568+
| [no-undef](/docs/guide/usage/linter/rules/eslint/no-undef.html) | eslint | | |
569+
| [no-unreachable](/docs/guide/usage/linter/rules/eslint/no-unreachable.html) | eslint | | |
570+
| [export](/docs/guide/usage/linter/rules/import/export.html) | import | | |
571+
| [named](/docs/guide/usage/linter/rules/import/named.html) | import | | |
572+
| [no-map-spread](/docs/guide/usage/linter/rules/oxc/no-map-spread.html) | oxc | | 🛠️💡 |
573+
| [no-return-in-finally](/docs/guide/usage/linter/rules/promise/no-return-in-finally.html) | promise | | |
574+
| [exhaustive-deps](/docs/guide/usage/linter/rules/react/exhaustive-deps.html) | react | | |
575+
| [require-render-return](/docs/guide/usage/linter/rules/react/require-render-return.html) | react | | |

src/docs/guide/usage/linter/rules/eslint/array-callback-return.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ consider using .forEach instead.
2323

2424
### Example
2525

26+
Examples of **incorrect** code for this rule:
27+
28+
```javascript
29+
let foo = [1, 2, 3, 4];
30+
foo.map((a) => {
31+
console.log(a);
32+
});
33+
```
34+
35+
Examples of **correct** code for this rule:
36+
2637
```javascript
2738
let foo = [1, 2, 3, 4];
2839
foo.map((a) => {
2940
console.log(a);
41+
return a;
3042
});
3143
```
3244

src/docs/guide/usage/linter/rules/eslint/default-case-last.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ If a switch statement should have a default clause, it’s considered a best pra
2323

2424
### Example
2525

26+
Examples of **incorrect** code for this rule:
27+
2628
```javascript
2729
switch (foo) {
2830
default:
@@ -46,6 +48,22 @@ switch (foo) {
4648
}
4749
```
4850

51+
Examples of **correct** code for this rule:
52+
53+
```javascript
54+
switch (foo) {
55+
case 1:
56+
bar();
57+
break;
58+
case 2:
59+
qux();
60+
break;
61+
default:
62+
baz();
63+
break;
64+
}
65+
```
66+
4967
## How to use
5068

5169
To **enable** this rule in the CLI or using the config file, you can use:

src/docs/guide/usage/linter/rules/eslint/default-param-last.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@ Putting default parameter at last allows function calls to omit optional tail ar
2020

2121
### Example
2222

23-
```javascript
24-
// Correct: optional argument can be omitted
25-
function createUser(id, isAdmin = false) {}
26-
createUser("tabby");
23+
Examples of **incorrect** code for this rule:
2724

25+
```javascript
2826
// Incorrect: optional argument can **not** be omitted
2927
function createUser(isAdmin = false, id) {}
3028
createUser(undefined, "tabby");
3129
```
3230

31+
Examples of **correct** code for this rule:
32+
33+
```javascript
34+
function createUser(id, isAdmin = false) {}
35+
createUser("tabby");
36+
```
37+
3338
## How to use
3439

3540
To **enable** this rule in the CLI or using the config file, you can use:

src/docs/guide/usage/linter/rules/eslint/no-constant-condition.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This rule disallows constant expressions in the test condition of:
2727
- `if`, `for`, `while`, or `do...while` statement
2828
- `?`: ternary expression
2929

30-
### Example
30+
### Examples
3131

3232
Examples of **incorrect** code for this rule:
3333

@@ -60,6 +60,16 @@ while (typeof x === "undefined") {
6060
}
6161
```
6262

63+
### Options
64+
65+
#### checkLoops
66+
67+
`{ type: "all" | "allExceptWhileTrue" | "none" | boolean, default: "allExceptWhileTrue" }`
68+
69+
- `"all"` or `true` disallows constant expressions in loops
70+
- `"allExceptWhileTrue"` disallows constant expressions in loops except while loops with expression `true`
71+
- `"none"` or `false` allows constant expressions in loops
72+
6373
## How to use
6474

6575
To **enable** this rule in the CLI or using the config file, you can use:

src/docs/guide/usage/linter/rules/eslint/no-debugger.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ They're most commonly an accidental debugging leftover.
2727

2828
### Example
2929

30+
Examples of **incorrect** code for this rule:
31+
3032
```javascript
3133
async function main() {
3234
const data = await getData();
@@ -35,6 +37,15 @@ async function main() {
3537
}
3638
```
3739

40+
Examples of **correct** code for this rule:
41+
42+
```javascript
43+
async function main() {
44+
const data = await getData();
45+
const result = complexCalculation(data);
46+
}
47+
```
48+
3849
## How to use
3950

4051
To **enable** this rule in the CLI or using the config file, you can use:

src/docs/guide/usage/linter/rules/eslint/no-redeclare.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ a = 10;
4040

4141
#### builtinGlobals
4242

43-
`{ type: bool, default: false }`
43+
`{ type: bool, default: true }`
4444

4545
When set `true`, it flags redeclaring built-in globals (e.g., `let Object = 1;`).
4646

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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/import/consistent_type_specifier_style.rs`;
6+
</script>
7+
8+
# import/consistent-type-specifier-style <Badge type="info" text="Style" />
9+
10+
<div class="rule-meta">
11+
<Alert class="fix" type="info">
12+
<span class="emoji">🛠️</span> An auto-fix is available for this rule for some violations.
13+
</Alert>
14+
</div>
15+
16+
### What it does
17+
18+
This rule either enforces or bans the use of inline type-only markers for named imports.
19+
20+
### Why is this bad?
21+
22+
Mixing top-level `import type { Foo } from 'foo'` with inline `{ type Bar }`
23+
forces readers to mentally switch contexts when scanning your imports.
24+
Enforcing one style makes it immediately obvious which imports are types and which are value imports.
25+
26+
### Examples
27+
28+
Examples of incorrect code for the default `prefer-top-level` option:
29+
30+
```typescript
31+
import { type Foo } from "Foo";
32+
import Foo, { type Bar } from "Foo";
33+
```
34+
35+
Examples of correct code for the default option:
36+
37+
```typescript
38+
import type { Foo } from "Foo";
39+
import type Foo, { Bar } from "Foo";
40+
```
41+
42+
Examples of incorrect code for the `prefer-inline` option:
43+
44+
```typescript
45+
import type { Foo } from "Foo";
46+
import type Foo, { Bar } from "Foo";
47+
```
48+
49+
Examples of correct code for the `prefer-inline` option:
50+
51+
```typescript
52+
import { type Foo } from "Foo";
53+
import Foo, { type Bar } from "Foo";
54+
```
55+
56+
## How to use
57+
58+
To **enable** this rule in the CLI or using the config file, you can use:
59+
60+
::: code-group
61+
62+
```bash [CLI]
63+
oxlint --deny import/consistent-type-specifier-style --import-plugin
64+
```
65+
66+
```json [Config (.oxlintrc.json)]
67+
{
68+
"plugins": ["import"],
69+
"rules": {
70+
"import/consistent-type-specifier-style": "error"
71+
}
72+
}
73+
```
74+
75+
:::
76+
77+
## References
78+
79+
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>

0 commit comments

Comments
 (0)