Skip to content

Commit 46826a5

Browse files
committed
feat(linter/plugins): introduce RuleTester
1 parent afc5df6 commit 46826a5

File tree

4 files changed

+393
-2
lines changed

4 files changed

+393
-2
lines changed

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)