Skip to content

Commit 550e974

Browse files
committed
feat(linter/plugins): introduce RuleTester
1 parent 8df0e41 commit 550e974

File tree

7 files changed

+696
-3
lines changed

7 files changed

+696
-3
lines changed

apps/oxlint/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
"devDependencies": {
2323
"@types/esquery": "^1.5.4",
2424
"@types/estree": "^1.0.8",
25+
"@types/json-stable-stringify-without-jsonify": "^1.0.2",
2526
"@typescript-eslint/scope-manager": "8.46.2",
2627
"@typescript-eslint/typescript-estree": "^8.47.0",
2728
"cross-env": "catalog:",
2829
"eslint": "^9.36.0",
2930
"esquery": "^1.6.0",
3031
"execa": "^9.6.0",
3132
"jiti": "^2.6.0",
33+
"json-stable-stringify-without-jsonify": "^1.0.1",
3234
"oxc-parser": "^0.99.0",
3335
"rolldown": "catalog:",
3436
"tsdown": "catalog:",

apps/oxlint/src-js/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// Functions and classes
12
export { definePlugin, defineRule } from "./package/define.js";
3+
export { RuleTester } from "./package/rule_tester.js";
24

5+
// ESTree types
36
export type * as ESTree from "./generated/types.d.ts";
7+
8+
// Plugin types
49
export type { Context, LanguageOptions } from "./plugins/context.ts";
510
export type { Fix, Fixer, FixFn } from "./plugins/fix.ts";
611
export type { CreateOnceRule, CreateRule, Plugin, Rule } from "./plugins/load.ts";
@@ -57,3 +62,23 @@ export type {
5762
Visitor,
5863
VisitorWithHooks,
5964
} from "./plugins/types.ts";
65+
66+
// Rule tester types.
67+
// Export as namespace to avoid lengthy type names.
68+
import type {
69+
Config as _Config,
70+
DescribeFn as _DescribeFn,
71+
ItFn as _ItFn,
72+
ValidTestCase as _ValidTestCase,
73+
InvalidTestCase as _InvalidTestCase,
74+
TestCases as _TestCases,
75+
} from "./package/rule_tester.ts";
76+
77+
export namespace RuleTester {
78+
export type Config = _Config;
79+
export type DescribeFn = _DescribeFn;
80+
export type ItFn = _ItFn;
81+
export type ValidTestCase = _ValidTestCase;
82+
export type InvalidTestCase = _InvalidTestCase;
83+
export type TestCases = _TestCases;
84+
}

0 commit comments

Comments
 (0)