@@ -117,9 +117,61 @@ interface Config {
117117 * If `true`, column offsets in diagnostics are incremented by 1, to match ESLint's behavior.
118118 */
119119 eslintCompat ?: boolean ;
120+ languageOptions ?: LanguageOptions ;
120121 [ key : string ] : unknown ;
121122}
122123
124+ /**
125+ * Language options config.
126+ */
127+ interface LanguageOptions {
128+ ecmaVersion ?: number | "latest" ;
129+ sourceType ?: SourceType ;
130+ globals ?: Record <
131+ string ,
132+ boolean | "true" | "writable" | "writeable" | "false" | "readonly" | "readable" | "off" | null
133+ > ;
134+ parser ?: {
135+ parse ?: ( code : string , options ?: Record < string , unknown > ) => unknown ;
136+ parseForESLint ?: ( code : string , options ?: Record < string , unknown > ) => unknown ;
137+ } ;
138+ parserOptions ?: ParserOptions ;
139+ }
140+
141+ /**
142+ * Source type.
143+ *
144+ * - `'unambiguous'` is not supported in ESLint compatibility mode.
145+ * - `'commonjs'` is only supported in ESLint compatibility mode.
146+ */
147+ type SourceType = "script" | "module" | "unambiguous" | "commonjs" ;
148+
149+ /**
150+ * Parser options config.
151+ */
152+ interface ParserOptions {
153+ ecmaFeatures ?: EcmaFeatures ;
154+ /**
155+ * Language variant to parse file as.
156+ */
157+ lang ?: Language ;
158+ }
159+
160+ /**
161+ * ECMA features config.
162+ */
163+ interface EcmaFeatures {
164+ /**
165+ * `true` to enable JSX parsing.
166+ */
167+ jsx ?: boolean ;
168+ }
169+
170+ /**
171+ * Parser language.
172+ */
173+ type Language = "js" | "jsx" | "ts" | "tsx" | "dts" ;
174+
123175// Default shared config
124176const DEFAULT_SHARED_CONFIG : Config = {
125177 eslintCompat : false ,
@@ -149,6 +201,7 @@ interface TestCase {
149201 * See `Config` type.
150202 */
151203 eslintCompat ?: boolean ;
204+ languageOptions ?: LanguageOptions ;
152205}
153206
154207/**
@@ -994,6 +1047,11 @@ function isSerializablePrimitiveOrPlainObject(value: unknown): boolean {
9941047
9951048// Add types to `RuleTester` namespace
9961049type _Config = Config ;
1050+ type _LanguageOptions = LanguageOptions ;
1051+ type _ParserOptions = ParserOptions ;
1052+ type _SourceType = SourceType ;
1053+ type _Language = Language ;
1054+ type _EcmaFeatures = EcmaFeatures ;
9971055type _DescribeFn = DescribeFn ;
9981056type _ItFn = ItFn ;
9991057type _ValidTestCase = ValidTestCase ;
@@ -1003,6 +1061,11 @@ type _Error = Error;
10031061
10041062export namespace RuleTester {
10051063 export type Config = _Config ;
1064+ export type LanguageOptions = _LanguageOptions ;
1065+ export type ParserOptions = _ParserOptions ;
1066+ export type SourceType = _SourceType ;
1067+ export type Language = _Language ;
1068+ export type EcmaFeatures = _EcmaFeatures ;
10061069 export type DescribeFn = _DescribeFn ;
10071070 export type ItFn = _ItFn ;
10081071 export type ValidTestCase = _ValidTestCase ;
0 commit comments