Skip to content

Commit 453d647

Browse files
committed
docs(linter): Remove now-unnecessary compatibility notes from shared Jest/Vitest rules. (#21826)
Just a bit of cleanup on the rules that have been split so far.
1 parent a889ea9 commit 453d647

8 files changed

Lines changed: 17 additions & 105 deletions

File tree

crates/oxc_linter/src/rules/shared/jest_vitest/no_disabled_tests.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
},
1111
};
1212

13-
pub const DOCUMENTATION: &str = r#"### What it does
13+
pub const DOCUMENTATION: &str = r"### What it does
1414
1515
This rule raises a warning about disabled tests.
1616
@@ -43,18 +43,7 @@ it('foo', () => {
4343
pending();
4444
});
4545
```
46-
47-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-disabled-tests.md),
48-
to use it, add the following configuration to your `.oxlintrc.json`:
49-
50-
```json
51-
{
52-
"rules": {
53-
"vitest/no-disabled-tests": "error"
54-
}
55-
}
56-
```
57-
"#;
46+
";
5847

5948
fn no_disabled_tests_diagnostic(x1: &'static str, x2: &'static str, span3: Span) -> OxcDiagnostic {
6049
OxcDiagnostic::warn(x1).with_help(x2).with_label(span3)

crates/oxc_linter/src/rules/shared/jest_vitest/no_duplicate_hooks.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn no_duplicate_hooks_diagnostic(hook_name: &str, span: Span) -> OxcDiagnostic {
1818
.with_label(span)
1919
}
2020

21-
pub const DOCUMENTATION: &str = r#"### What it does
21+
pub const DOCUMENTATION: &str = r"### What it does
2222
2323
Disallows duplicate hooks in describe blocks.
2424
@@ -94,18 +94,7 @@ describe('foo', () => {
9494
});
9595
});
9696
```
97-
98-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md),
99-
to use it, add the following configuration to your `.oxlintrc.json`:
100-
101-
```json
102-
{
103-
"rules": {
104-
"vitest/no-duplicate-hooks": "error"
105-
}
106-
}
107-
```
108-
"#;
97+
";
10998

11099
pub fn run_once(ctx: &LintContext) {
111100
let mut hook_contexts: FxHashMap<NodeId, Vec<FxHashMap<String, i32>>> = FxHashMap::default();

crates/oxc_linter/src/rules/shared/jest_vitest/no_focused_tests.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn no_focused_tests_diagnostic(span: Span) -> OxcDiagnostic {
1616
.with_label(span)
1717
}
1818

19-
pub const DOCUMENTATION: &str = r#"### What it does
19+
pub const DOCUMENTATION: &str = r"### What it does
2020
2121
This rule reminds you to remove `.only` from your tests by raising a warning
2222
whenever you are using the exclusivity feature.
@@ -45,18 +45,7 @@ fit.each`
4545
table
4646
`();
4747
```
48-
49-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-focused-tests.md),
50-
to use it, add the following configuration to your `.oxlintrc.json`:
51-
52-
```json
53-
{
54-
"rules": {
55-
"vitest/no-focused-tests": "error"
56-
}
57-
}
58-
```
59-
"#;
48+
";
6049

6150
pub fn run<'a>(possible_jest_node: &PossibleJestNode<'a, '_>, ctx: &LintContext<'a>) {
6251
let node = possible_jest_node.node;

crates/oxc_linter/src/rules/shared/jest_vitest/no_hooks.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn unexpected_hook_diagnostic(span: Span) -> OxcDiagnostic {
1717
.with_label(span)
1818
}
1919

20-
pub const DOCUMENTATION: &str = r#"### What it does
20+
pub const DOCUMENTATION: &str = r"### What it does
2121
2222
Disallows Jest setup and teardown hooks, such as `beforeAll`.
2323
@@ -65,18 +65,7 @@ describe('foo', () => {
6565
});
6666
});
6767
```
68-
69-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md),
70-
to use it, add the following configuration to your `.oxlintrc.json`:
71-
72-
```json
73-
{
74-
"rules": {
75-
"vitest/no-hooks": "error"
76-
}
77-
}
78-
```
79-
"#;
68+
";
8069

8170
#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]
8271
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]

crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn test_repeat(span: Span) -> OxcDiagnostic {
2828
.with_label(span)
2929
}
3030

31-
pub const DOCUMENTATION: &str = r#"### What it does
31+
pub const DOCUMENTATION: &str = r"### What it does
3232
3333
This rule looks at the title of every test and test suite.
3434
It will report when two test suites or two test cases at the same level of a test suite have the same title.
@@ -51,18 +51,7 @@ Examples of **incorrect** code for this rule:
5151
// ...
5252
});
5353
```
54-
55-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-identical-title.md),
56-
to use it, add the following configuration to your `.oxlintrc.json`:
57-
58-
```json
59-
{
60-
"rules": {
61-
"vitest/no-identical-title": "error"
62-
}
63-
}
64-
```
65-
"#;
54+
";
6655

6756
pub fn run_once(ctx: &LintContext) {
6857
let possible_jest_nodes = collect_possible_jest_call_node(ctx);

crates/oxc_linter/src/rules/shared/jest_vitest/no_interpolation_in_snapshots.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn no_interpolation_in_snapshots_diagnostic(span: Span) -> OxcDiagnostic {
1313
.with_label(span)
1414
}
1515

16-
pub const DOCUMENTATION: &str = r#"### What it does
16+
pub const DOCUMENTATION: &str = r"### What it does
1717
1818
Prevents the use of string interpolations in snapshots.
1919
@@ -45,18 +45,7 @@ expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
4545
`${interpolated}`,
4646
);
4747
```
48-
49-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md),
50-
to use it, add the following configuration to your `.oxlintrc.json`:
51-
52-
```json
53-
{
54-
"rules": {
55-
"vitest/no-interpolation-in-snapshots": "error"
56-
}
57-
}
58-
```
59-
"#;
48+
";
6049

6150
pub fn run<'a>(possible_jest_node: &PossibleJestNode<'a, '_>, ctx: &LintContext<'a>) {
6251
let node = possible_jest_node.node;

crates/oxc_linter/src/rules/shared/jest_vitest/no_large_snapshots.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn too_long_snapshot(line_limit: usize, line_count: usize, span: Span) -> OxcDia
3131
.with_label(span)
3232
}
3333

34-
pub const DOCUMENTATION: &str = r#"### What it does
34+
pub const DOCUMENTATION: &str = r"### What it does
3535
3636
Disallow large snapshots.
3737
@@ -111,18 +111,7 @@ line 3
111111
line 4
112112
`;
113113
```
114-
115-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md),
116-
to use it, add the following configuration to your `.oxlintrc.json`:
117-
118-
```json
119-
{
120-
"rules": {
121-
"vitest/no-large-snapshots": "error"
122-
}
123-
}
124-
```
125-
"#;
114+
";
126115

127116
#[derive(Debug, Clone, Deserialize, JsonSchema)]
128117
#[serde(rename_all = "camelCase", default)]

crates/oxc_linter/src/rules/shared/jest_vitest/no_mocks_import.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ fn no_mocks_import_diagnostic(span: Span) -> OxcDiagnostic {
1212
.with_label(span)
1313
}
1414

15-
pub const DOCUMENTATION: &str = r#"### What it does
15+
pub const DOCUMENTATION: &str = r"### What it does
1616
17-
This rule reports imports from a path containing a __mocks__ component.
17+
This rule reports imports from a path containing a `__mocks__` component.
1818
1919
### Why is this bad?
2020
@@ -37,18 +37,7 @@ Examples of **correct** code for this rule:
3737
import thing from 'thing';
3838
require('thing');
3939
```
40-
41-
This rule is compatible with [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md),
42-
to use it, add the following configuration to your `.oxlintrc.json`:
43-
44-
```json
45-
{
46-
"rules": {
47-
"vitest/no-mocks-import": "error"
48-
}
49-
}
50-
```
51-
"#;
40+
";
5241

5342
pub fn run_once(ctx: &LintContext) {
5443
let module_records = ctx.module_record();

0 commit comments

Comments
 (0)