Skip to content

Commit 3d6c902

Browse files
committed
test(linter/plugins): convert all plugins in tests to TS
1 parent e37c435 commit 3d6c902

File tree

49 files changed

+166
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+166
-87
lines changed

apps/oxlint/test/fixtures/basic_custom_plugin/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jsPlugins": ["./plugin.js"],
2+
"jsPlugins": ["./plugin.ts"],
33
"rules": {
44
"basic-custom-plugin/no-debugger": "error"
55
}

apps/oxlint/test/fixtures/basic_custom_plugin/plugin.js renamed to apps/oxlint/test/fixtures/basic_custom_plugin/plugin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default {
1+
import type { Plugin } from '../../../dist/index.js';
2+
3+
const plugin: Plugin = {
24
meta: {
35
name: 'basic-custom-plugin',
46
},
@@ -17,3 +19,5 @@ export default {
1719
},
1820
},
1921
};
22+
23+
export default plugin;

apps/oxlint/test/fixtures/basic_custom_plugin_many_files/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jsPlugins": ["./plugin.js"],
2+
"jsPlugins": ["./plugin.ts"],
33
"rules": {
44
"basic-custom-plugin/no-debugger": "error"
55
}

apps/oxlint/test/fixtures/basic_custom_plugin_many_files/plugin.js renamed to apps/oxlint/test/fixtures/basic_custom_plugin_many_files/plugin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default {
1+
import type { Plugin } from '../../../dist/index.js';
2+
3+
const plugin: Plugin = {
24
meta: {
35
name: 'basic-custom-plugin',
46
},
@@ -17,3 +19,5 @@ export default {
1719
},
1820
},
1921
};
22+
23+
export default plugin;

apps/oxlint/test/fixtures/basic_custom_plugin_multiple_rules/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jsPlugins": ["./plugin.js"],
2+
"jsPlugins": ["./plugin.ts"],
33
"rules": {
44
"basic-custom-plugin/no-debugger": "error",
55
"basic-custom-plugin/no-debugger-2": "error",

apps/oxlint/test/fixtures/basic_custom_plugin_multiple_rules/plugin.js renamed to apps/oxlint/test/fixtures/basic_custom_plugin_multiple_rules/plugin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default {
1+
import type { Plugin } from '../../../dist/index.js';
2+
3+
const plugin: Plugin = {
24
meta: {
35
name: 'basic-custom-plugin',
46
},
@@ -40,3 +42,5 @@ export default {
4042
},
4143
},
4244
};
45+
46+
export default plugin;

apps/oxlint/test/fixtures/basic_custom_plugin_warn_severity/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jsPlugins": ["./plugin.js"],
2+
"jsPlugins": ["./plugin.ts"],
33
"rules": {
44
"basic-custom-plugin/no-debugger": "warn"
55
}

apps/oxlint/test/fixtures/custom_plugin_via_overrides/plugin.js renamed to apps/oxlint/test/fixtures/basic_custom_plugin_warn_severity/plugin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default {
1+
import type { Plugin } from '../../../dist/index.js';
2+
3+
const plugin: Plugin = {
24
meta: {
35
name: 'basic-custom-plugin',
46
},
@@ -17,3 +19,5 @@ export default {
1719
},
1820
},
1921
};
22+
23+
export default plugin;

apps/oxlint/test/fixtures/context_properties/.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jsPlugins": ["./plugin.js"],
2+
"jsPlugins": ["./plugin.ts"],
33
"categories": { "correctness": "off" },
44
"rules": {
55
"context-plugin/log-context": "error"

apps/oxlint/test/fixtures/context_properties/plugin.js renamed to apps/oxlint/test/fixtures/context_properties/plugin.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { sep } from 'node:path';
22

3+
import type { Plugin, Rule } from '../../../dist/index.js';
4+
35
const SPAN = { start: 0, end: 0 };
46

57
const DIR_PATH_LEN = import.meta.dirname.length + 1;
68

79
const relativePath = sep === '/'
8-
? path => path.slice(DIR_PATH_LEN)
9-
: path => path.slice(DIR_PATH_LEN).replace(/\\/g, '/');
10+
? (path: string) => path.slice(DIR_PATH_LEN)
11+
: (path: string) => path.slice(DIR_PATH_LEN).replace(/\\/g, '/');
1012

11-
const rule = {
13+
const rule: Rule = {
1214
create(context) {
1315
context.report({
1416
message: `id: ${context.id}`,
@@ -35,11 +37,13 @@ const rule = {
3537
},
3638
};
3739

38-
export default {
40+
const plugin: Plugin = {
3941
meta: {
4042
name: 'context-plugin',
4143
},
4244
rules: {
4345
'log-context': rule,
4446
},
4547
};
48+
49+
export default plugin;

0 commit comments

Comments
 (0)