corsa-oxlint 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/compat.d.ts CHANGED
@@ -32,6 +32,7 @@ declare const AST_NODE_TYPES: Readonly<{
32
32
  readonly ForStatement: "ForStatement";
33
33
  readonly FunctionDeclaration: "FunctionDeclaration";
34
34
  readonly FunctionExpression: "FunctionExpression";
35
+ readonly Hashbang: "Hashbang";
35
36
  readonly Identifier: "Identifier";
36
37
  readonly IfStatement: "IfStatement";
37
38
  readonly ImportAttribute: "ImportAttribute";
@@ -64,6 +65,7 @@ declare const AST_NODE_TYPES: Readonly<{
64
65
  readonly NewExpression: "NewExpression";
65
66
  readonly ObjectExpression: "ObjectExpression";
66
67
  readonly ObjectPattern: "ObjectPattern";
68
+ readonly ParenthesizedExpression: "ParenthesizedExpression";
67
69
  readonly PrivateIdentifier: "PrivateIdentifier";
68
70
  readonly Program: "Program";
69
71
  readonly Property: "Property";
@@ -84,6 +86,7 @@ declare const AST_NODE_TYPES: Readonly<{
84
86
  readonly TryStatement: "TryStatement";
85
87
  readonly UnaryExpression: "UnaryExpression";
86
88
  readonly UpdateExpression: "UpdateExpression";
89
+ readonly V8IntrinsicExpression: "V8IntrinsicExpression";
87
90
  readonly VariableDeclaration: "VariableDeclaration";
88
91
  readonly VariableDeclarator: "VariableDeclarator";
89
92
  readonly WhileStatement: "WhileStatement";
@@ -138,8 +141,12 @@ declare const AST_NODE_TYPES: Readonly<{
138
141
  readonly TSNullKeyword: "TSNullKeyword";
139
142
  readonly TSNumberKeyword: "TSNumberKeyword";
140
143
  readonly TSObjectKeyword: "TSObjectKeyword";
144
+ readonly TSJSDocNonNullableType: "TSJSDocNonNullableType";
145
+ readonly TSJSDocNullableType: "TSJSDocNullableType";
146
+ readonly TSJSDocUnknownType: "TSJSDocUnknownType";
141
147
  readonly TSOptionalType: "TSOptionalType";
142
148
  readonly TSParameterProperty: "TSParameterProperty";
149
+ readonly TSParenthesizedType: "TSParenthesizedType";
143
150
  readonly TSPrivateKeyword: "TSPrivateKeyword";
144
151
  readonly TSPropertySignature: "TSPropertySignature";
145
152
  readonly TSProtectedKeyword: "TSProtectedKeyword";
@@ -220,6 +227,7 @@ declare const TSESTree: Readonly<{
220
227
  readonly ForStatement: "ForStatement";
221
228
  readonly FunctionDeclaration: "FunctionDeclaration";
222
229
  readonly FunctionExpression: "FunctionExpression";
230
+ readonly Hashbang: "Hashbang";
223
231
  readonly Identifier: "Identifier";
224
232
  readonly IfStatement: "IfStatement";
225
233
  readonly ImportAttribute: "ImportAttribute";
@@ -252,6 +260,7 @@ declare const TSESTree: Readonly<{
252
260
  readonly NewExpression: "NewExpression";
253
261
  readonly ObjectExpression: "ObjectExpression";
254
262
  readonly ObjectPattern: "ObjectPattern";
263
+ readonly ParenthesizedExpression: "ParenthesizedExpression";
255
264
  readonly PrivateIdentifier: "PrivateIdentifier";
256
265
  readonly Program: "Program";
257
266
  readonly Property: "Property";
@@ -272,6 +281,7 @@ declare const TSESTree: Readonly<{
272
281
  readonly TryStatement: "TryStatement";
273
282
  readonly UnaryExpression: "UnaryExpression";
274
283
  readonly UpdateExpression: "UpdateExpression";
284
+ readonly V8IntrinsicExpression: "V8IntrinsicExpression";
275
285
  readonly VariableDeclaration: "VariableDeclaration";
276
286
  readonly VariableDeclarator: "VariableDeclarator";
277
287
  readonly WhileStatement: "WhileStatement";
@@ -326,8 +336,12 @@ declare const TSESTree: Readonly<{
326
336
  readonly TSNullKeyword: "TSNullKeyword";
327
337
  readonly TSNumberKeyword: "TSNumberKeyword";
328
338
  readonly TSObjectKeyword: "TSObjectKeyword";
339
+ readonly TSJSDocNonNullableType: "TSJSDocNonNullableType";
340
+ readonly TSJSDocNullableType: "TSJSDocNullableType";
341
+ readonly TSJSDocUnknownType: "TSJSDocUnknownType";
329
342
  readonly TSOptionalType: "TSOptionalType";
330
343
  readonly TSParameterProperty: "TSParameterProperty";
344
+ readonly TSParenthesizedType: "TSParenthesizedType";
331
345
  readonly TSPrivateKeyword: "TSPrivateKeyword";
332
346
  readonly TSPropertySignature: "TSPropertySignature";
333
347
  readonly TSProtectedKeyword: "TSProtectedKeyword";
package/dist/compat.js CHANGED
@@ -32,6 +32,7 @@ const AST_NODE_TYPES = Object.freeze({
32
32
  ForStatement: "ForStatement",
33
33
  FunctionDeclaration: "FunctionDeclaration",
34
34
  FunctionExpression: "FunctionExpression",
35
+ Hashbang: "Hashbang",
35
36
  Identifier: "Identifier",
36
37
  IfStatement: "IfStatement",
37
38
  ImportAttribute: "ImportAttribute",
@@ -64,6 +65,7 @@ const AST_NODE_TYPES = Object.freeze({
64
65
  NewExpression: "NewExpression",
65
66
  ObjectExpression: "ObjectExpression",
66
67
  ObjectPattern: "ObjectPattern",
68
+ ParenthesizedExpression: "ParenthesizedExpression",
67
69
  PrivateIdentifier: "PrivateIdentifier",
68
70
  Program: "Program",
69
71
  Property: "Property",
@@ -84,6 +86,7 @@ const AST_NODE_TYPES = Object.freeze({
84
86
  TryStatement: "TryStatement",
85
87
  UnaryExpression: "UnaryExpression",
86
88
  UpdateExpression: "UpdateExpression",
89
+ V8IntrinsicExpression: "V8IntrinsicExpression",
87
90
  VariableDeclaration: "VariableDeclaration",
88
91
  VariableDeclarator: "VariableDeclarator",
89
92
  WhileStatement: "WhileStatement",
@@ -138,8 +141,12 @@ const AST_NODE_TYPES = Object.freeze({
138
141
  TSNullKeyword: "TSNullKeyword",
139
142
  TSNumberKeyword: "TSNumberKeyword",
140
143
  TSObjectKeyword: "TSObjectKeyword",
144
+ TSJSDocNonNullableType: "TSJSDocNonNullableType",
145
+ TSJSDocNullableType: "TSJSDocNullableType",
146
+ TSJSDocUnknownType: "TSJSDocUnknownType",
141
147
  TSOptionalType: "TSOptionalType",
142
148
  TSParameterProperty: "TSParameterProperty",
149
+ TSParenthesizedType: "TSParenthesizedType",
143
150
  TSPrivateKeyword: "TSPrivateKeyword",
144
151
  TSPropertySignature: "TSPropertySignature",
145
152
  TSProtectedKeyword: "TSProtectedKeyword",
@@ -1 +1 @@
1
- {"version":3,"file":"compat.js","names":[],"sources":["../ts/compat.ts"],"sourcesContent":["export const AST_NODE_TYPES = Object.freeze({\n AccessorProperty: \"AccessorProperty\",\n ArrayExpression: \"ArrayExpression\",\n ArrayPattern: \"ArrayPattern\",\n ArrowFunctionExpression: \"ArrowFunctionExpression\",\n AssignmentExpression: \"AssignmentExpression\",\n AssignmentPattern: \"AssignmentPattern\",\n AwaitExpression: \"AwaitExpression\",\n BinaryExpression: \"BinaryExpression\",\n BlockStatement: \"BlockStatement\",\n BreakStatement: \"BreakStatement\",\n CallExpression: \"CallExpression\",\n CatchClause: \"CatchClause\",\n ChainExpression: \"ChainExpression\",\n ClassBody: \"ClassBody\",\n ClassDeclaration: \"ClassDeclaration\",\n ClassExpression: \"ClassExpression\",\n ConditionalExpression: \"ConditionalExpression\",\n ContinueStatement: \"ContinueStatement\",\n DebuggerStatement: \"DebuggerStatement\",\n Decorator: \"Decorator\",\n DoWhileStatement: \"DoWhileStatement\",\n EmptyStatement: \"EmptyStatement\",\n ExportAllDeclaration: \"ExportAllDeclaration\",\n ExportDefaultDeclaration: \"ExportDefaultDeclaration\",\n ExportNamedDeclaration: \"ExportNamedDeclaration\",\n ExportSpecifier: \"ExportSpecifier\",\n ExpressionStatement: \"ExpressionStatement\",\n ForInStatement: \"ForInStatement\",\n ForOfStatement: \"ForOfStatement\",\n ForStatement: \"ForStatement\",\n FunctionDeclaration: \"FunctionDeclaration\",\n FunctionExpression: \"FunctionExpression\",\n Identifier: \"Identifier\",\n IfStatement: \"IfStatement\",\n ImportAttribute: \"ImportAttribute\",\n ImportDeclaration: \"ImportDeclaration\",\n ImportDefaultSpecifier: \"ImportDefaultSpecifier\",\n ImportExpression: \"ImportExpression\",\n ImportNamespaceSpecifier: \"ImportNamespaceSpecifier\",\n ImportSpecifier: \"ImportSpecifier\",\n JSXAttribute: \"JSXAttribute\",\n JSXClosingElement: \"JSXClosingElement\",\n JSXClosingFragment: \"JSXClosingFragment\",\n JSXElement: \"JSXElement\",\n JSXEmptyExpression: \"JSXEmptyExpression\",\n JSXExpressionContainer: \"JSXExpressionContainer\",\n JSXFragment: \"JSXFragment\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXMemberExpression: \"JSXMemberExpression\",\n JSXNamespacedName: \"JSXNamespacedName\",\n JSXOpeningElement: \"JSXOpeningElement\",\n JSXOpeningFragment: \"JSXOpeningFragment\",\n JSXSpreadAttribute: \"JSXSpreadAttribute\",\n JSXSpreadChild: \"JSXSpreadChild\",\n JSXText: \"JSXText\",\n LabeledStatement: \"LabeledStatement\",\n Literal: \"Literal\",\n LogicalExpression: \"LogicalExpression\",\n MemberExpression: \"MemberExpression\",\n MetaProperty: \"MetaProperty\",\n MethodDefinition: \"MethodDefinition\",\n NewExpression: \"NewExpression\",\n ObjectExpression: \"ObjectExpression\",\n ObjectPattern: \"ObjectPattern\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Program: \"Program\",\n Property: \"Property\",\n PropertyDefinition: \"PropertyDefinition\",\n RestElement: \"RestElement\",\n ReturnStatement: \"ReturnStatement\",\n SequenceExpression: \"SequenceExpression\",\n SpreadElement: \"SpreadElement\",\n StaticBlock: \"StaticBlock\",\n Super: \"Super\",\n SwitchCase: \"SwitchCase\",\n SwitchStatement: \"SwitchStatement\",\n TaggedTemplateExpression: \"TaggedTemplateExpression\",\n TemplateElement: \"TemplateElement\",\n TemplateLiteral: \"TemplateLiteral\",\n ThisExpression: \"ThisExpression\",\n ThrowStatement: \"ThrowStatement\",\n TryStatement: \"TryStatement\",\n UnaryExpression: \"UnaryExpression\",\n UpdateExpression: \"UpdateExpression\",\n VariableDeclaration: \"VariableDeclaration\",\n VariableDeclarator: \"VariableDeclarator\",\n WhileStatement: \"WhileStatement\",\n WithStatement: \"WithStatement\",\n YieldExpression: \"YieldExpression\",\n TSAbstractAccessorProperty: \"TSAbstractAccessorProperty\",\n TSAbstractKeyword: \"TSAbstractKeyword\",\n TSAbstractMethodDefinition: \"TSAbstractMethodDefinition\",\n TSAbstractPropertyDefinition: \"TSAbstractPropertyDefinition\",\n TSAnyKeyword: \"TSAnyKeyword\",\n TSArrayType: \"TSArrayType\",\n TSAsExpression: \"TSAsExpression\",\n TSAsyncKeyword: \"TSAsyncKeyword\",\n TSBigIntKeyword: \"TSBigIntKeyword\",\n TSBooleanKeyword: \"TSBooleanKeyword\",\n TSCallSignatureDeclaration: \"TSCallSignatureDeclaration\",\n TSClassImplements: \"TSClassImplements\",\n TSConditionalType: \"TSConditionalType\",\n TSConstructorType: \"TSConstructorType\",\n TSConstructSignatureDeclaration: \"TSConstructSignatureDeclaration\",\n TSDeclareFunction: \"TSDeclareFunction\",\n TSDeclareKeyword: \"TSDeclareKeyword\",\n TSEmptyBodyFunctionExpression: \"TSEmptyBodyFunctionExpression\",\n TSEnumBody: \"TSEnumBody\",\n TSEnumDeclaration: \"TSEnumDeclaration\",\n TSEnumMember: \"TSEnumMember\",\n TSExportAssignment: \"TSExportAssignment\",\n TSExportKeyword: \"TSExportKeyword\",\n TSExpressionWithTypeArguments: \"TSExpressionWithTypeArguments\",\n TSExternalModuleReference: \"TSExternalModuleReference\",\n TSFunctionType: \"TSFunctionType\",\n TSImportEqualsDeclaration: \"TSImportEqualsDeclaration\",\n TSImportType: \"TSImportType\",\n TSIndexedAccessType: \"TSIndexedAccessType\",\n TSIndexSignature: \"TSIndexSignature\",\n TSInferType: \"TSInferType\",\n TSInstantiationExpression: \"TSInstantiationExpression\",\n TSInterfaceBody: \"TSInterfaceBody\",\n TSInterfaceDeclaration: \"TSInterfaceDeclaration\",\n TSInterfaceHeritage: \"TSInterfaceHeritage\",\n TSIntersectionType: \"TSIntersectionType\",\n TSIntrinsicKeyword: \"TSIntrinsicKeyword\",\n TSLiteralType: \"TSLiteralType\",\n TSMappedType: \"TSMappedType\",\n TSMethodSignature: \"TSMethodSignature\",\n TSModuleBlock: \"TSModuleBlock\",\n TSModuleDeclaration: \"TSModuleDeclaration\",\n TSNamedTupleMember: \"TSNamedTupleMember\",\n TSNamespaceExportDeclaration: \"TSNamespaceExportDeclaration\",\n TSNeverKeyword: \"TSNeverKeyword\",\n TSNonNullExpression: \"TSNonNullExpression\",\n TSNullKeyword: \"TSNullKeyword\",\n TSNumberKeyword: \"TSNumberKeyword\",\n TSObjectKeyword: \"TSObjectKeyword\",\n TSOptionalType: \"TSOptionalType\",\n TSParameterProperty: \"TSParameterProperty\",\n TSPrivateKeyword: \"TSPrivateKeyword\",\n TSPropertySignature: \"TSPropertySignature\",\n TSProtectedKeyword: \"TSProtectedKeyword\",\n TSPublicKeyword: \"TSPublicKeyword\",\n TSQualifiedName: \"TSQualifiedName\",\n TSReadonlyKeyword: \"TSReadonlyKeyword\",\n TSRestType: \"TSRestType\",\n TSSatisfiesExpression: \"TSSatisfiesExpression\",\n TSStaticKeyword: \"TSStaticKeyword\",\n TSStringKeyword: \"TSStringKeyword\",\n TSSymbolKeyword: \"TSSymbolKeyword\",\n TSTemplateLiteralType: \"TSTemplateLiteralType\",\n TSThisType: \"TSThisType\",\n TSTupleType: \"TSTupleType\",\n TSTypeAliasDeclaration: \"TSTypeAliasDeclaration\",\n TSTypeAnnotation: \"TSTypeAnnotation\",\n TSTypeAssertion: \"TSTypeAssertion\",\n TSTypeLiteral: \"TSTypeLiteral\",\n TSTypeOperator: \"TSTypeOperator\",\n TSTypeParameter: \"TSTypeParameter\",\n TSTypeParameterDeclaration: \"TSTypeParameterDeclaration\",\n TSTypeParameterInstantiation: \"TSTypeParameterInstantiation\",\n TSTypePredicate: \"TSTypePredicate\",\n TSTypeQuery: \"TSTypeQuery\",\n TSTypeReference: \"TSTypeReference\",\n TSUndefinedKeyword: \"TSUndefinedKeyword\",\n TSUnionType: \"TSUnionType\",\n TSUnknownKeyword: \"TSUnknownKeyword\",\n TSVoidKeyword: \"TSVoidKeyword\",\n} as const);\n\nexport const AST_TOKEN_TYPES = Object.freeze({\n Boolean: \"Boolean\",\n Identifier: \"Identifier\",\n JSXIdentifier: \"JSXIdentifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n JSXText: \"JSXText\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n RegularExpression: \"RegularExpression\",\n String: \"String\",\n Template: \"Template\",\n Block: \"Block\",\n Line: \"Line\",\n} as const);\n\nexport const TSESTree = Object.freeze({\n AST_NODE_TYPES,\n AST_TOKEN_TYPES,\n});\n"],"mappings":";AAAA,MAAa,iBAAiB,OAAO,OAAO;CAC1C,kBAAkB;CAClB,iBAAiB;CACjB,cAAc;CACd,yBAAyB;CACzB,sBAAsB;CACtB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,aAAa;CACb,iBAAiB;CACjB,WAAW;CACX,kBAAkB;CAClB,iBAAiB;CACjB,uBAAuB;CACvB,mBAAmB;CACnB,mBAAmB;CACnB,WAAW;CACX,kBAAkB;CAClB,gBAAgB;CAChB,sBAAsB;CACtB,0BAA0B;CAC1B,wBAAwB;CACxB,iBAAiB;CACjB,qBAAqB;CACrB,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;CACd,qBAAqB;CACrB,oBAAoB;CACpB,YAAY;CACZ,aAAa;CACb,iBAAiB;CACjB,mBAAmB;CACnB,wBAAwB;CACxB,kBAAkB;CAClB,0BAA0B;CAC1B,iBAAiB;CACjB,cAAc;CACd,mBAAmB;CACnB,oBAAoB;CACpB,YAAY;CACZ,oBAAoB;CACpB,wBAAwB;CACxB,aAAa;CACb,eAAe;CACf,qBAAqB;CACrB,mBAAmB;CACnB,mBAAmB;CACnB,oBAAoB;CACpB,oBAAoB;CACpB,gBAAgB;CAChB,SAAS;CACT,kBAAkB;CAClB,SAAS;CACT,mBAAmB;CACnB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;CAClB,eAAe;CACf,kBAAkB;CAClB,eAAe;CACf,mB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ACb,wBAAwB;CACxB,kBAAkB;CAClB,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,4BAA4B;CAC5B,8BAA8B;CAC9B,iBAAiB;CACjB,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACpB,aAAa;CACb,kBAAkB;CAClB,eAAe;AACjB,CAAU;AAEV,MAAa,kBAAkB,OAAO,OAAO;CAC3C,SAAS;CACT,YAAY;CACZ,eAAe;CACf,mBAAmB;CACnB,SAAS;CACT,SAAS;CACT,MAAM;CACN,SAAS;CACT,YAAY;CACZ,mBAAmB;CACnB,QAAQ;CACR,UAAU;CACV,OAAO;CACP,MAAM;AACR,CAAU;AAEV,MAAa,WAAW,OAAO,OAAO;CACpC;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"compat.js","names":[],"sources":["../ts/compat.ts"],"sourcesContent":["export const AST_NODE_TYPES = Object.freeze({\n AccessorProperty: \"AccessorProperty\",\n ArrayExpression: \"ArrayExpression\",\n ArrayPattern: \"ArrayPattern\",\n ArrowFunctionExpression: \"ArrowFunctionExpression\",\n AssignmentExpression: \"AssignmentExpression\",\n AssignmentPattern: \"AssignmentPattern\",\n AwaitExpression: \"AwaitExpression\",\n BinaryExpression: \"BinaryExpression\",\n BlockStatement: \"BlockStatement\",\n BreakStatement: \"BreakStatement\",\n CallExpression: \"CallExpression\",\n CatchClause: \"CatchClause\",\n ChainExpression: \"ChainExpression\",\n ClassBody: \"ClassBody\",\n ClassDeclaration: \"ClassDeclaration\",\n ClassExpression: \"ClassExpression\",\n ConditionalExpression: \"ConditionalExpression\",\n ContinueStatement: \"ContinueStatement\",\n DebuggerStatement: \"DebuggerStatement\",\n Decorator: \"Decorator\",\n DoWhileStatement: \"DoWhileStatement\",\n EmptyStatement: \"EmptyStatement\",\n ExportAllDeclaration: \"ExportAllDeclaration\",\n ExportDefaultDeclaration: \"ExportDefaultDeclaration\",\n ExportNamedDeclaration: \"ExportNamedDeclaration\",\n ExportSpecifier: \"ExportSpecifier\",\n ExpressionStatement: \"ExpressionStatement\",\n ForInStatement: \"ForInStatement\",\n ForOfStatement: \"ForOfStatement\",\n ForStatement: \"ForStatement\",\n FunctionDeclaration: \"FunctionDeclaration\",\n FunctionExpression: \"FunctionExpression\",\n Hashbang: \"Hashbang\",\n Identifier: \"Identifier\",\n IfStatement: \"IfStatement\",\n ImportAttribute: \"ImportAttribute\",\n ImportDeclaration: \"ImportDeclaration\",\n ImportDefaultSpecifier: \"ImportDefaultSpecifier\",\n ImportExpression: \"ImportExpression\",\n ImportNamespaceSpecifier: \"ImportNamespaceSpecifier\",\n ImportSpecifier: \"ImportSpecifier\",\n JSXAttribute: \"JSXAttribute\",\n JSXClosingElement: \"JSXClosingElement\",\n JSXClosingFragment: \"JSXClosingFragment\",\n JSXElement: \"JSXElement\",\n JSXEmptyExpression: \"JSXEmptyExpression\",\n JSXExpressionContainer: \"JSXExpressionContainer\",\n JSXFragment: \"JSXFragment\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXMemberExpression: \"JSXMemberExpression\",\n JSXNamespacedName: \"JSXNamespacedName\",\n JSXOpeningElement: \"JSXOpeningElement\",\n JSXOpeningFragment: \"JSXOpeningFragment\",\n JSXSpreadAttribute: \"JSXSpreadAttribute\",\n JSXSpreadChild: \"JSXSpreadChild\",\n JSXText: \"JSXText\",\n LabeledStatement: \"LabeledStatement\",\n Literal: \"Literal\",\n LogicalExpression: \"LogicalExpression\",\n MemberExpression: \"MemberExpression\",\n MetaProperty: \"MetaProperty\",\n MethodDefinition: \"MethodDefinition\",\n NewExpression: \"NewExpression\",\n ObjectExpression: \"ObjectExpression\",\n ObjectPattern: \"ObjectPattern\",\n ParenthesizedExpression: \"ParenthesizedExpression\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Program: \"Program\",\n Property: \"Property\",\n PropertyDefinition: \"PropertyDefinition\",\n RestElement: \"RestElement\",\n ReturnStatement: \"ReturnStatement\",\n SequenceExpression: \"SequenceExpression\",\n SpreadElement: \"SpreadElement\",\n StaticBlock: \"StaticBlock\",\n Super: \"Super\",\n SwitchCase: \"SwitchCase\",\n SwitchStatement: \"SwitchStatement\",\n TaggedTemplateExpression: \"TaggedTemplateExpression\",\n TemplateElement: \"TemplateElement\",\n TemplateLiteral: \"TemplateLiteral\",\n ThisExpression: \"ThisExpression\",\n ThrowStatement: \"ThrowStatement\",\n TryStatement: \"TryStatement\",\n UnaryExpression: \"UnaryExpression\",\n UpdateExpression: \"UpdateExpression\",\n V8IntrinsicExpression: \"V8IntrinsicExpression\",\n VariableDeclaration: \"VariableDeclaration\",\n VariableDeclarator: \"VariableDeclarator\",\n WhileStatement: \"WhileStatement\",\n WithStatement: \"WithStatement\",\n YieldExpression: \"YieldExpression\",\n TSAbstractAccessorProperty: \"TSAbstractAccessorProperty\",\n TSAbstractKeyword: \"TSAbstractKeyword\",\n TSAbstractMethodDefinition: \"TSAbstractMethodDefinition\",\n TSAbstractPropertyDefinition: \"TSAbstractPropertyDefinition\",\n TSAnyKeyword: \"TSAnyKeyword\",\n TSArrayType: \"TSArrayType\",\n TSAsExpression: \"TSAsExpression\",\n TSAsyncKeyword: \"TSAsyncKeyword\",\n TSBigIntKeyword: \"TSBigIntKeyword\",\n TSBooleanKeyword: \"TSBooleanKeyword\",\n TSCallSignatureDeclaration: \"TSCallSignatureDeclaration\",\n TSClassImplements: \"TSClassImplements\",\n TSConditionalType: \"TSConditionalType\",\n TSConstructorType: \"TSConstructorType\",\n TSConstructSignatureDeclaration: \"TSConstructSignatureDeclaration\",\n TSDeclareFunction: \"TSDeclareFunction\",\n TSDeclareKeyword: \"TSDeclareKeyword\",\n TSEmptyBodyFunctionExpression: \"TSEmptyBodyFunctionExpression\",\n TSEnumBody: \"TSEnumBody\",\n TSEnumDeclaration: \"TSEnumDeclaration\",\n TSEnumMember: \"TSEnumMember\",\n TSExportAssignment: \"TSExportAssignment\",\n TSExportKeyword: \"TSExportKeyword\",\n TSExpressionWithTypeArguments: \"TSExpressionWithTypeArguments\",\n TSExternalModuleReference: \"TSExternalModuleReference\",\n TSFunctionType: \"TSFunctionType\",\n TSImportEqualsDeclaration: \"TSImportEqualsDeclaration\",\n TSImportType: \"TSImportType\",\n TSIndexedAccessType: \"TSIndexedAccessType\",\n TSIndexSignature: \"TSIndexSignature\",\n TSInferType: \"TSInferType\",\n TSInstantiationExpression: \"TSInstantiationExpression\",\n TSInterfaceBody: \"TSInterfaceBody\",\n TSInterfaceDeclaration: \"TSInterfaceDeclaration\",\n TSInterfaceHeritage: \"TSInterfaceHeritage\",\n TSIntersectionType: \"TSIntersectionType\",\n TSIntrinsicKeyword: \"TSIntrinsicKeyword\",\n TSLiteralType: \"TSLiteralType\",\n TSMappedType: \"TSMappedType\",\n TSMethodSignature: \"TSMethodSignature\",\n TSModuleBlock: \"TSModuleBlock\",\n TSModuleDeclaration: \"TSModuleDeclaration\",\n TSNamedTupleMember: \"TSNamedTupleMember\",\n TSNamespaceExportDeclaration: \"TSNamespaceExportDeclaration\",\n TSNeverKeyword: \"TSNeverKeyword\",\n TSNonNullExpression: \"TSNonNullExpression\",\n TSNullKeyword: \"TSNullKeyword\",\n TSNumberKeyword: \"TSNumberKeyword\",\n TSObjectKeyword: \"TSObjectKeyword\",\n TSJSDocNonNullableType: \"TSJSDocNonNullableType\",\n TSJSDocNullableType: \"TSJSDocNullableType\",\n TSJSDocUnknownType: \"TSJSDocUnknownType\",\n TSOptionalType: \"TSOptionalType\",\n TSParameterProperty: \"TSParameterProperty\",\n TSParenthesizedType: \"TSParenthesizedType\",\n TSPrivateKeyword: \"TSPrivateKeyword\",\n TSPropertySignature: \"TSPropertySignature\",\n TSProtectedKeyword: \"TSProtectedKeyword\",\n TSPublicKeyword: \"TSPublicKeyword\",\n TSQualifiedName: \"TSQualifiedName\",\n TSReadonlyKeyword: \"TSReadonlyKeyword\",\n TSRestType: \"TSRestType\",\n TSSatisfiesExpression: \"TSSatisfiesExpression\",\n TSStaticKeyword: \"TSStaticKeyword\",\n TSStringKeyword: \"TSStringKeyword\",\n TSSymbolKeyword: \"TSSymbolKeyword\",\n TSTemplateLiteralType: \"TSTemplateLiteralType\",\n TSThisType: \"TSThisType\",\n TSTupleType: \"TSTupleType\",\n TSTypeAliasDeclaration: \"TSTypeAliasDeclaration\",\n TSTypeAnnotation: \"TSTypeAnnotation\",\n TSTypeAssertion: \"TSTypeAssertion\",\n TSTypeLiteral: \"TSTypeLiteral\",\n TSTypeOperator: \"TSTypeOperator\",\n TSTypeParameter: \"TSTypeParameter\",\n TSTypeParameterDeclaration: \"TSTypeParameterDeclaration\",\n TSTypeParameterInstantiation: \"TSTypeParameterInstantiation\",\n TSTypePredicate: \"TSTypePredicate\",\n TSTypeQuery: \"TSTypeQuery\",\n TSTypeReference: \"TSTypeReference\",\n TSUndefinedKeyword: \"TSUndefinedKeyword\",\n TSUnionType: \"TSUnionType\",\n TSUnknownKeyword: \"TSUnknownKeyword\",\n TSVoidKeyword: \"TSVoidKeyword\",\n} as const);\n\nexport const AST_TOKEN_TYPES = Object.freeze({\n Boolean: \"Boolean\",\n Identifier: \"Identifier\",\n JSXIdentifier: \"JSXIdentifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n JSXText: \"JSXText\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n RegularExpression: \"RegularExpression\",\n String: \"String\",\n Template: \"Template\",\n Block: \"Block\",\n Line: \"Line\",\n} as const);\n\nexport const TSESTree = Object.freeze({\n AST_NODE_TYPES,\n AST_TOKEN_TYPES,\n});\n"],"mappings":";AAAA,MAAa,iBAAiB,OAAO,OAAO;CAC1C,kBAAkB;CAClB,iBAAiB;CACjB,cAAc;CACd,yBAAyB;CACzB,sBAAsB;CACtB,mBAAmB;CACnB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,aAAa;CACb,iBAAiB;CACjB,WAAW;CACX,kBAAkB;CAClB,iBAAiB;CACjB,uBA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.d.ts CHANGED
@@ -24,7 +24,9 @@ declare namespace ESTree {
24
24
  } ? Kind extends CandidateKind ? Candidate & {
25
25
  readonly type: Kind;
26
26
  } : never : never;
27
- export type NodeByType<Kind extends string> = Kind extends string ? NarrowNode<OxlintNode, Kind> : never;
27
+ type RemapNodeField<Value> = Value extends ESTree$1.BindingIdentifier ? BindingIdentifier : Value extends OxlintNode ? NodeByType<Extract<Value["type"], string>> : Value extends readonly (infer Item)[] ? readonly RemapNodeField<Item>[] : Value extends (infer Item)[] ? RemapNodeField<Item>[] : Value;
28
+ type RemapNodeShape<Candidate> = Candidate extends object ? { [Key in keyof Candidate]: RemapNodeField<Candidate[Key]> } : Candidate;
29
+ export type NodeByType<Kind extends string> = Kind extends string ? RemapNodeShape<NarrowNode<OxlintNode, Kind>> : never;
28
30
  export type Node = { [Kind in CorsaAstNodeType]: NodeByType<Kind> }[CorsaAstNodeType] | BindingIdentifier;
29
31
  export type AccessorProperty = NodeByType<"AccessorProperty">;
30
32
  export type ArrayExpression = NodeByType<"ArrayExpression">;
@@ -58,6 +60,7 @@ declare namespace ESTree {
58
60
  export type ForStatement = NodeByType<"ForStatement">;
59
61
  export type FunctionDeclaration = NodeByType<"FunctionDeclaration">;
60
62
  export type FunctionExpression = NodeByType<"FunctionExpression">;
63
+ export type Hashbang = NodeByType<"Hashbang">;
61
64
  export type Identifier = NodeByType<"Identifier"> | BindingIdentifier;
62
65
  export type IfStatement = NodeByType<"IfStatement">;
63
66
  export type ImportAttribute = NodeByType<"ImportAttribute">;
@@ -90,6 +93,7 @@ declare namespace ESTree {
90
93
  export type NewExpression = NodeByType<"NewExpression">;
91
94
  export type ObjectExpression = NodeByType<"ObjectExpression">;
92
95
  export type ObjectPattern = NodeByType<"ObjectPattern">;
96
+ export type ParenthesizedExpression = NodeByType<"ParenthesizedExpression">;
93
97
  export type PrivateIdentifier = NodeByType<"PrivateIdentifier">;
94
98
  export type Program = NodeByType<"Program">;
95
99
  export type Property = NodeByType<"Property">;
@@ -110,6 +114,7 @@ declare namespace ESTree {
110
114
  export type TryStatement = NodeByType<"TryStatement">;
111
115
  export type UnaryExpression = NodeByType<"UnaryExpression">;
112
116
  export type UpdateExpression = NodeByType<"UpdateExpression">;
117
+ export type V8IntrinsicExpression = NodeByType<"V8IntrinsicExpression">;
113
118
  export type VariableDeclaration = NodeByType<"VariableDeclaration">;
114
119
  export type VariableDeclarator = NodeByType<"VariableDeclarator">;
115
120
  export type WhileStatement = NodeByType<"WhileStatement">;
@@ -160,12 +165,16 @@ declare namespace ESTree {
160
165
  export type TSNamedTupleMember = NodeByType<"TSNamedTupleMember">;
161
166
  export type TSNamespaceExportDeclaration = NodeByType<"TSNamespaceExportDeclaration">;
162
167
  export type TSNeverKeyword = NodeByType<"TSNeverKeyword">;
168
+ export type TSJSDocNonNullableType = NodeByType<"TSJSDocNonNullableType">;
169
+ export type TSJSDocNullableType = NodeByType<"TSJSDocNullableType">;
170
+ export type TSJSDocUnknownType = NodeByType<"TSJSDocUnknownType">;
163
171
  export type TSNonNullExpression = NodeByType<"TSNonNullExpression">;
164
172
  export type TSNullKeyword = NodeByType<"TSNullKeyword">;
165
173
  export type TSNumberKeyword = NodeByType<"TSNumberKeyword">;
166
174
  export type TSObjectKeyword = NodeByType<"TSObjectKeyword">;
167
175
  export type TSOptionalType = NodeByType<"TSOptionalType">;
168
176
  export type TSParameterProperty = NodeByType<"TSParameterProperty">;
177
+ export type TSParenthesizedType = NodeByType<"TSParenthesizedType">;
169
178
  export type TSPrivateKeyword = NodeByType<"TSPrivateKeyword">;
170
179
  export type TSPropertySignature = NodeByType<"TSPropertySignature">;
171
180
  export type TSProtectedKeyword = NodeByType<"TSProtectedKeyword">;
@@ -195,7 +204,7 @@ declare namespace ESTree {
195
204
  export type TSUnionType = NodeByType<"TSUnionType">;
196
205
  export type TSUnknownKeyword = NodeByType<"TSUnknownKeyword">;
197
206
  export type TSVoidKeyword = NodeByType<"TSVoidKeyword">;
198
- export type BindingIdentifier = Omit<ESTree$1.BindingIdentifier, "typeAnnotation"> & {
207
+ export type BindingIdentifier = RemapNodeShape<Omit<ESTree$1.BindingIdentifier, "typeAnnotation">> & {
199
208
  typeAnnotation?: TSTypeAnnotation | null;
200
209
  };
201
210
  export type BindingPattern = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;
@@ -204,7 +213,7 @@ declare namespace ESTree {
204
213
  export type Declaration = VariableDeclaration | Function | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration;
205
214
  export type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;
206
215
  export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | Declaration | ModuleDeclaration;
207
- export type Expression = Literal | TemplateLiteral | Identifier | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | MemberExpression;
216
+ export type Expression = Literal | TemplateLiteral | Identifier | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | V8IntrinsicExpression | YieldExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | MemberExpression;
208
217
  export type SimpleAssignmentTarget = Identifier | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | MemberExpression;
209
218
  export type AssignmentTarget = SimpleAssignmentTarget | ArrayPattern | ObjectPattern;
210
219
  export type ChainElement = CallExpression | TSNonNullExpression | MemberExpression;
@@ -45,15 +45,12 @@ var RuleTester = class {
45
45
  }
46
46
  run(ruleName, rule, tests) {
47
47
  const workspace = createWorkspace();
48
+ writeWorkspaceConfig(workspace);
48
49
  const transformed = {
49
50
  valid: tests.valid.map((test, index) => prepareTestCase(workspace, test, this.#config, "valid", index)),
50
51
  invalid: tests.invalid.map((test, index) => prepareTestCase(workspace, test, this.#config, "invalid", index))
51
52
  };
52
- try {
53
- this.#inner.run(ruleName, decorateRule(rule), transformed);
54
- } finally {
55
- cleanupWorkspace(workspace);
56
- }
53
+ this.#inner.run(ruleName, decorateRule(rule), transformed);
57
54
  }
58
55
  };
59
56
  function createWorkspace() {
@@ -63,16 +60,13 @@ function createWorkspace() {
63
60
  }
64
61
  function prepareTestCase(workspace, test, config, group, index) {
65
62
  const caseWorkspace = resolve(workspace, `${group}-${index}`);
66
- if (typeof test === "string") {
67
- writeFixture(resolve(caseWorkspace, "case.ts"), test);
68
- return test;
69
- }
70
- const filename = resolveCaseFilename(caseWorkspace, test.filename, "case.ts");
71
- const projectRoot = isAbsolute(test.filename ?? "") ? dirname(filename) : caseWorkspace;
72
- writeFixture(filename, test.code);
63
+ const normalized = typeof test === "string" ? { code: test } : test;
64
+ const filename = resolveCaseFilename(caseWorkspace, normalized.filename, "case.ts");
65
+ const projectRoot = isAbsolute(normalized.filename ?? "") ? dirname(filename) : workspace;
66
+ writeFixture(filename, normalized.code, projectRoot);
73
67
  const testerConfig = config;
74
68
  const baseSettings = testerConfig?.settings?.corsaOxlint;
75
- const caseSettings = test.settings?.corsaOxlint;
69
+ const caseSettings = normalized.settings?.corsaOxlint;
76
70
  const parserOptionsWithRuntime = applyRuleTesterRuntimeDefaults(mergeTypeAwareParserOptions(mergeTypeAwareParserOptions(mergeTypeAwareParserOptions(mergeTypeAwareParserOptions(baseSettings, baseSettings?.parserOptions), mergeTypeAwareParserOptions(caseSettings, caseSettings?.parserOptions)), {
77
71
  tsconfigRootDir: projectRoot,
78
72
  projectService: { allowDefaultProject: [
@@ -81,22 +75,22 @@ function prepareTestCase(workspace, test, config, group, index) {
81
75
  "*.js",
82
76
  "*.jsx"
83
77
  ] }
84
- }), mergeTypeAwareParserOptions(config?.languageOptions?.parserOptions, test.languageOptions?.parserOptions)), test, config);
78
+ }), mergeTypeAwareParserOptions(config?.languageOptions?.parserOptions, normalized.languageOptions?.parserOptions)), normalized, config);
85
79
  return {
86
- ...test,
80
+ ...normalized,
87
81
  filename,
88
82
  settings: {
89
83
  ...testerConfig?.settings,
90
- ...test.settings,
84
+ ...normalized.settings,
91
85
  corsaOxlint: {
92
86
  ...testerConfig?.settings?.corsaOxlint,
93
- ...test.settings?.corsaOxlint,
87
+ ...normalized.settings?.corsaOxlint,
94
88
  parserOptions: parserOptionsWithRuntime
95
89
  }
96
90
  },
97
91
  languageOptions: {
98
92
  ...config?.languageOptions,
99
- ...test.languageOptions,
93
+ ...normalized.languageOptions,
100
94
  parserOptions: { ...parserOptionsWithRuntime }
101
95
  }
102
96
  };
@@ -119,10 +113,17 @@ function optionalDefaultCorsaExecutable(rootDir) {
119
113
  return;
120
114
  }
121
115
  }
122
- function writeFixture(filename, code) {
116
+ function writeWorkspaceConfig(workspace) {
117
+ writeProjectConfig(resolve(workspace, "tsconfig.json"));
118
+ }
119
+ function writeFixture(filename, code, projectRoot) {
123
120
  mkdirSync(dirname(filename), { recursive: true });
124
121
  writeFileSync(filename, code);
125
- writeFileSync(resolve(dirname(filename), "tsconfig.json"), JSON.stringify({
122
+ writeProjectConfig(resolve(projectRoot, "tsconfig.json"));
123
+ }
124
+ function writeProjectConfig(configPath) {
125
+ mkdirSync(dirname(configPath), { recursive: true });
126
+ writeFileSync(configPath, JSON.stringify({
126
127
  compilerOptions: {
127
128
  module: "esnext",
128
129
  target: "es2022",
@@ -1 +1 @@
1
- {"version":3,"file":"rule_tester.js","names":["OxlintRuleTester","#inner","#config"],"sources":["../ts/rule_tester.ts"],"sourcesContent":["import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\n\nimport { RuleTester as OxlintRuleTester } from \"oxlint/plugins-dev\";\n\nimport { defaultCorsaExecutable, mergeTypeAwareParserOptions } from \"./context\";\nimport { decorateRule } from \"./plugin\";\nimport type { CorsaOxlintSettings, TypeAwareParserOptions } from \"./types\";\n\ntype TesterConfig = import(\"oxlint/plugins-dev\").RuleTester.Config;\ntype TestCase = import(\"oxlint/plugins-dev\").RuleTester.ValidTestCase &\n Partial<import(\"oxlint/plugins-dev\").RuleTester.InvalidTestCase>;\ntype TestCases = import(\"oxlint/plugins-dev\").RuleTester.TestCases;\nexport type RuleTesterConfig = TesterConfig & {\n readonly settings?: {\n readonly corsaOxlint?: CorsaOxlintSettings;\n readonly [key: string]: unknown;\n };\n};\ntype TestLifecycleGlobal = typeof globalThis & {\n after?: (callback: () => void) => unknown;\n afterAll?: (callback: () => void) => unknown;\n};\n\nconst cleanupDirs = new Set<string>();\nlet cleanupInstalled = false;\n\nexport class RuleTester {\n /**\n * A thin Oxlint `RuleTester` wrapper that injects\n * `settings.corsaOxlint`\n * settings, temporary fixtures, and a default project service.\n *\n * @example\n * ```ts\n * const tester = new RuleTester();\n * tester.run(\"demo\", rule, {\n * valid: [{ code: \"const answer = 42;\" }],\n * invalid: [],\n * });\n * ```\n */\n static get describe() {\n return OxlintRuleTester.describe;\n }\n\n static set describe(value) {\n OxlintRuleTester.describe = value;\n }\n\n static get it() {\n return OxlintRuleTester.it;\n }\n\n static set it(value) {\n OxlintRuleTester.it = value;\n }\n\n static only(item: string | TestCase): TestCase {\n return OxlintRuleTester.only(item);\n }\n\n readonly #inner: OxlintRuleTester;\n readonly #config?: RuleTesterConfig;\n\n constructor(config?: RuleTesterConfig) {\n this.#config = config;\n this.#inner = new OxlintRuleTester(config);\n }\n\n run(ruleName: string, rule: Record<string, unknown>, tests: TestCases): void {\n const workspace = createWorkspace();\n const transformed = {\n valid: tests.valid.map((test, index) =>\n prepareTestCase(workspace, test, this.#config, \"valid\", index),\n ),\n invalid: tests.invalid.map((test, index) =>\n prepareTestCase(workspace, test, this.#config, \"invalid\", index),\n ),\n };\n try {\n this.#inner.run(ruleName, decorateRule(rule as never) as never, transformed as TestCases);\n } finally {\n cleanupWorkspace(workspace);\n }\n }\n}\n\nfunction createWorkspace(): string {\n const root = process.env.CORSA_OXLINT_RULE_TESTER_TMPDIR ?? tmpdir();\n const workspace = mkdtempSync(join(root, \"corsa-oxlint-\"));\n registerCleanup(workspace);\n return workspace;\n}\n\nfunction prepareTestCase(\n workspace: string,\n test: string | TestCase,\n config: RuleTesterConfig | undefined,\n group: \"valid\" | \"invalid\",\n index: number,\n): string | TestCase {\n const caseWorkspace = resolve(workspace, `${group}-${index}`);\n if (typeof test === \"string\") {\n const filename = resolve(caseWorkspace, \"case.ts\");\n writeFixture(filename, test);\n return test;\n }\n const filename = resolveCaseFilename(caseWorkspace, test.filename, \"case.ts\");\n const projectRoot = isAbsolute(test.filename ?? \"\") ? dirname(filename) : caseWorkspace;\n writeFixture(filename, test.code);\n const testerConfig = config;\n const baseSettings = testerConfig?.settings?.corsaOxlint;\n const caseSettings = (\n test.settings as {\n corsaOxlint?: CorsaOxlintSettings;\n }\n )?.corsaOxlint;\n const parserOptions = mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(baseSettings, baseSettings?.parserOptions),\n mergeTypeAwareParserOptions(caseSettings, caseSettings?.parserOptions),\n ),\n {\n tsconfigRootDir: projectRoot,\n projectService: {\n allowDefaultProject: [\"*.ts\", \"*.tsx\", \"*.js\", \"*.jsx\"],\n },\n },\n ),\n mergeTypeAwareParserOptions(\n config?.languageOptions?.parserOptions as TypeAwareParserOptions | undefined,\n test.languageOptions?.parserOptions as TypeAwareParserOptions | undefined,\n ),\n );\n const parserOptionsWithRuntime = applyRuleTesterRuntimeDefaults(parserOptions, test, config);\n return {\n ...test,\n filename,\n settings: {\n ...testerConfig?.settings,\n ...test.settings,\n corsaOxlint: {\n ...testerConfig?.settings?.corsaOxlint,\n ...(test.settings as { corsaOxlint?: CorsaOxlintSettings })?.corsaOxlint,\n parserOptions: parserOptionsWithRuntime,\n },\n } as never,\n languageOptions: {\n ...config?.languageOptions,\n ...test.languageOptions,\n parserOptions: {\n ...parserOptionsWithRuntime,\n } as never,\n },\n };\n}\n\nfunction resolveCaseFilename(\n caseWorkspace: string,\n filename: string | undefined,\n fallback: string,\n): string {\n if (!filename) {\n return resolve(caseWorkspace, fallback);\n }\n return isAbsolute(filename) ? filename : resolve(caseWorkspace, filename);\n}\n\nfunction applyRuleTesterRuntimeDefaults(\n parserOptions: TypeAwareParserOptions,\n test: TestCase,\n config: RuleTesterConfig | undefined,\n): TypeAwareParserOptions {\n if (parserOptions.corsa?.executable !== undefined) {\n return parserOptions;\n }\n const rootDir = resolve(test.cwd ?? config?.cwd ?? process.cwd());\n const executable = process.env.CORSA_EXECUTABLE ?? optionalDefaultCorsaExecutable(rootDir);\n if (!executable) {\n return parserOptions;\n }\n return mergeTypeAwareParserOptions(parserOptions, {\n corsa: {\n executable,\n },\n });\n}\n\nfunction optionalDefaultCorsaExecutable(rootDir: string): string | undefined {\n try {\n return defaultCorsaExecutable(rootDir);\n } catch {\n return undefined;\n }\n}\n\nfunction writeFixture(filename: string, code: string): void {\n mkdirSync(dirname(filename), { recursive: true });\n writeFileSync(filename, code);\n const configPath = resolve(dirname(filename), \"tsconfig.json\");\n writeFileSync(\n configPath,\n JSON.stringify(\n {\n compilerOptions: {\n module: \"esnext\",\n target: \"es2022\",\n strict: true,\n },\n include: [\"**/*\"],\n },\n null,\n 2,\n ),\n );\n}\n\nfunction registerCleanup(workspace: string): void {\n cleanupDirs.add(workspace);\n const afterAll = lifecycleCleanup();\n if (afterAll) {\n afterAll(() => cleanupWorkspace(workspace));\n }\n if (cleanupInstalled) {\n return;\n }\n cleanupInstalled = true;\n process.once(\"beforeExit\", cleanupAllWorkspaces);\n process.once(\"exit\", cleanupAllWorkspaces);\n}\n\nfunction lifecycleCleanup(): ((callback: () => void) => unknown) | undefined {\n const testGlobal = globalThis as TestLifecycleGlobal;\n return typeof testGlobal.afterAll === \"function\"\n ? testGlobal.afterAll\n : typeof testGlobal.after === \"function\"\n ? testGlobal.after\n : undefined;\n}\n\nfunction cleanupWorkspace(workspace: string): void {\n if (!cleanupDirs.delete(workspace)) {\n return;\n }\n rmSync(workspace, { force: true, recursive: true });\n}\n\nfunction cleanupAllWorkspaces(): void {\n for (const dir of cleanupDirs) {\n cleanupWorkspace(dir);\n }\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,8BAAc,IAAI,IAAY;AACpC,IAAI,mBAAmB;AAEvB,IAAa,aAAb,MAAwB;;;;;;;;;;;;;;;CAetB,WAAW,WAAW;EACpB,OAAOA,aAAiB;CAC1B;CAEA,WAAW,SAAS,OAAO;EACzB,aAAiB,WAAW;CAC9B;CAEA,WAAW,KAAK;EACd,OAAOA,aAAiB;CAC1B;CAEA,WAAW,GAAG,OAAO;EACnB,aAAiB,KAAK;CACxB;CAEA,OAAO,KAAK,MAAmC;EAC7C,OAAOA,aAAiB,KAAK,IAAI;CACnC;CAEA;CACA;CAEA,YAAY,QAA2B;EACrC,KAAKE,UAAU;EACf,KAAKD,SAAS,IAAID,aAAiB,MAAM;CAC3C;CAEA,IAAI,UAAkB,MAA+B,OAAwB;EAC3E,MAAM,YAAY,gBAAgB;EAClC,MAAM,cAAc;GAClB,OAAO,MAAM,MAAM,KAAK,MAAM,UAC5B,gBAAgB,WAAW,MAAM,KA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,aAClC,WAAW,WACX,OAAO,WAAW,UAAU,aAC1B,WAAW,QACX,KAAA;AACR;AAEA,SAAS,iBAAiB,WAAyB;CACjD,IAAI,CAAC,YAAY,OAAO,SAAS,GAC/B;CAEF,OAAO,WAAW;EAAE,OAAO;EAAM,WAAW;CAAK,CAAC;AACpD;AAEA,SAAS,uBAA6B;CACpC,KAAK,MAAM,OAAO,aAChB,iBAAiB,GAAG;AAExB"}
1
+ {"version":3,"file":"rule_tester.js","names":["OxlintRuleTester","#inner","#config"],"sources":["../ts/rule_tester.ts"],"sourcesContent":["import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\n\nimport { RuleTester as OxlintRuleTester } from \"oxlint/plugins-dev\";\n\nimport { defaultCorsaExecutable, mergeTypeAwareParserOptions } from \"./context\";\nimport { decorateRule } from \"./plugin\";\nimport type { CorsaOxlintSettings, TypeAwareParserOptions } from \"./types\";\n\ntype TesterConfig = import(\"oxlint/plugins-dev\").RuleTester.Config;\ntype TestCase = import(\"oxlint/plugins-dev\").RuleTester.ValidTestCase &\n Partial<import(\"oxlint/plugins-dev\").RuleTester.InvalidTestCase>;\ntype TestCases = import(\"oxlint/plugins-dev\").RuleTester.TestCases;\nexport type RuleTesterConfig = TesterConfig & {\n readonly settings?: {\n readonly corsaOxlint?: CorsaOxlintSettings;\n readonly [key: string]: unknown;\n };\n};\ntype TestLifecycleGlobal = typeof globalThis & {\n after?: (callback: () => void) => unknown;\n afterAll?: (callback: () => void) => unknown;\n};\n\nconst cleanupDirs = new Set<string>();\nlet cleanupInstalled = false;\n\nexport class RuleTester {\n /**\n * A thin Oxlint `RuleTester` wrapper that injects\n * `settings.corsaOxlint`\n * settings, temporary fixtures, and a default project service.\n *\n * @example\n * ```ts\n * const tester = new RuleTester();\n * tester.run(\"demo\", rule, {\n * valid: [{ code: \"const answer = 42;\" }],\n * invalid: [],\n * });\n * ```\n */\n static get describe() {\n return OxlintRuleTester.describe;\n }\n\n static set describe(value) {\n OxlintRuleTester.describe = value;\n }\n\n static get it() {\n return OxlintRuleTester.it;\n }\n\n static set it(value) {\n OxlintRuleTester.it = value;\n }\n\n static only(item: string | TestCase): TestCase {\n return OxlintRuleTester.only(item);\n }\n\n readonly #inner: OxlintRuleTester;\n readonly #config?: RuleTesterConfig;\n\n constructor(config?: RuleTesterConfig) {\n this.#config = config;\n this.#inner = new OxlintRuleTester(config);\n }\n\n run(ruleName: string, rule: Record<string, unknown>, tests: TestCases): void {\n const workspace = createWorkspace();\n writeWorkspaceConfig(workspace);\n const transformed = {\n valid: tests.valid.map((test, index) =>\n prepareTestCase(workspace, test, this.#config, \"valid\", index),\n ),\n invalid: tests.invalid.map((test, index) =>\n prepareTestCase(workspace, test, this.#config, \"invalid\", index),\n ),\n };\n this.#inner.run(ruleName, decorateRule(rule as never) as never, transformed as TestCases);\n }\n}\n\nfunction createWorkspace(): string {\n const root = process.env.CORSA_OXLINT_RULE_TESTER_TMPDIR ?? tmpdir();\n const workspace = mkdtempSync(join(root, \"corsa-oxlint-\"));\n registerCleanup(workspace);\n return workspace;\n}\n\nfunction prepareTestCase(\n workspace: string,\n test: string | TestCase,\n config: RuleTesterConfig | undefined,\n group: \"valid\" | \"invalid\",\n index: number,\n): TestCase {\n const caseWorkspace = resolve(workspace, `${group}-${index}`);\n const normalized = typeof test === \"string\" ? ({ code: test } as TestCase) : test;\n const filename = resolveCaseFilename(caseWorkspace, normalized.filename, \"case.ts\");\n const projectRoot = isAbsolute(normalized.filename ?? \"\") ? dirname(filename) : workspace;\n writeFixture(filename, normalized.code, projectRoot);\n const testerConfig = config;\n const baseSettings = testerConfig?.settings?.corsaOxlint;\n const caseSettings = (\n normalized.settings as {\n corsaOxlint?: CorsaOxlintSettings;\n }\n )?.corsaOxlint;\n const parserOptions = mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(\n mergeTypeAwareParserOptions(baseSettings, baseSettings?.parserOptions),\n mergeTypeAwareParserOptions(caseSettings, caseSettings?.parserOptions),\n ),\n {\n tsconfigRootDir: projectRoot,\n projectService: {\n allowDefaultProject: [\"*.ts\", \"*.tsx\", \"*.js\", \"*.jsx\"],\n },\n },\n ),\n mergeTypeAwareParserOptions(\n config?.languageOptions?.parserOptions as TypeAwareParserOptions | undefined,\n normalized.languageOptions?.parserOptions as TypeAwareParserOptions | undefined,\n ),\n );\n const parserOptionsWithRuntime = applyRuleTesterRuntimeDefaults(\n parserOptions,\n normalized,\n config,\n );\n return {\n ...normalized,\n filename,\n settings: {\n ...testerConfig?.settings,\n ...normalized.settings,\n corsaOxlint: {\n ...testerConfig?.settings?.corsaOxlint,\n ...(normalized.settings as { corsaOxlint?: CorsaOxlintSettings })?.corsaOxlint,\n parserOptions: parserOptionsWithRuntime,\n },\n } as never,\n languageOptions: {\n ...config?.languageOptions,\n ...normalized.languageOptions,\n parserOptions: {\n ...parserOptionsWithRuntime,\n } as never,\n },\n };\n}\n\nfunction resolveCaseFilename(\n caseWorkspace: string,\n filename: string | undefined,\n fallback: string,\n): string {\n if (!filename) {\n return resolve(caseWorkspace, fallback);\n }\n return isAbsolute(filename) ? filename : resolve(caseWorkspace, filename);\n}\n\nfunction applyRuleTesterRuntimeDefaults(\n parserOptions: TypeAwareParserOptions,\n test: TestCase,\n config: RuleTesterConfig | undefined,\n): TypeAwareParserOptions {\n if (parserOptions.corsa?.executable !== undefined) {\n return parserOptions;\n }\n const rootDir = resolve(test.cwd ?? config?.cwd ?? process.cwd());\n const executable = process.env.CORSA_EXECUTABLE ?? optionalDefaultCorsaExecutable(rootDir);\n if (!executable) {\n return parserOptions;\n }\n return mergeTypeAwareParserOptions(parserOptions, {\n corsa: {\n executable,\n },\n });\n}\n\nfunction optionalDefaultCorsaExecutable(rootDir: string): string | undefined {\n try {\n return defaultCorsaExecutable(rootDir);\n } catch {\n return undefined;\n }\n}\n\nfunction writeWorkspaceConfig(workspace: string): void {\n writeProjectConfig(resolve(workspace, \"tsconfig.json\"));\n}\n\nfunction writeFixture(filename: string, code: string, projectRoot: string): void {\n mkdirSync(dirname(filename), { recursive: true });\n writeFileSync(filename, code);\n writeProjectConfig(resolve(projectRoot, \"tsconfig.json\"));\n}\n\nfunction writeProjectConfig(configPath: string): void {\n mkdirSync(dirname(configPath), { recursive: true });\n writeFileSync(\n configPath,\n JSON.stringify(\n {\n compilerOptions: {\n module: \"esnext\",\n target: \"es2022\",\n strict: true,\n },\n include: [\"**/*\"],\n },\n null,\n 2,\n ),\n );\n}\n\nfunction registerCleanup(workspace: string): void {\n cleanupDirs.add(workspace);\n const afterAll = lifecycleCleanup();\n if (afterAll) {\n afterAll(() => cleanupWorkspace(workspace));\n }\n if (cleanupInstalled) {\n return;\n }\n cleanupInstalled = true;\n process.once(\"beforeExit\", cleanupAllWorkspaces);\n process.once(\"exit\", cleanupAllWorkspaces);\n}\n\nfunction lifecycleCleanup(): ((callback: () => void) => unknown) | undefined {\n const testGlobal = globalThis as TestLifecycleGlobal;\n return typeof testGlobal.afterAll === \"function\"\n ? testGlobal.afterAll\n : typeof testGlobal.after === \"function\"\n ? testGlobal.after\n : undefined;\n}\n\nfunction cleanupWorkspace(workspace: string): void {\n if (!cleanupDirs.delete(workspace)) {\n return;\n }\n rmSync(workspace, { force: true, recursive: true });\n}\n\nfunction cleanupAllWorkspaces(): void {\n for (const dir of cleanupDirs) {\n cleanupWorkspace(dir);\n }\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,8BAAc,IAAI,IAAY;AACpC,IAAI,mBAAmB;AAEvB,IAAa,aAAb,MAAwB;;;;;;;;;;;;;;;CAetB,WAAW,WAAW;EACpB,OAAOA,aAAiB;CAC1B;CAEA,WAAW,SAAS,OAAO;EACzB,aAAiB,WAAW;CAC9B;CAEA,WAAW,KAAK;EACd,OAAOA,aAAiB;CAC1B;CAEA,WAAW,GAAG,OAAO;EACnB,aAAiB,KAAK;CACxB;CAEA,OAAO,KAAK,M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B;GACf,QAAQ;GACR,QAAQ;GACR,QAAQ;EACV;EACA,SAAS,CAAC,MAAM;CAClB,GACA,MACA,CACF,CACF;AACF;AAEA,SAAS,gBAAgB,WAAyB;CAChD,YAAY,IAAI,SAAS;CACzB,MAAM,WAAW,iBAAiB;CAClC,IAAI,UACF,eAAe,iBAAiB,SAAS,CAAC;CAE5C,IAAI,kBACF;CAEF,mBAAmB;CACnB,QAAQ,KAAK,cAAc,oBAAoB;CAC/C,QAAQ,KAAK,QAAQ,oBAAoB;AAC3C;AAEA,SAAS,mBAAoE;CAC3E,MAAM,aAAa;CACnB,OAAO,OAAO,WAAW,aAAa,aAClC,WAAW,WACX,OAAO,WAAW,UAAU,aAC1B,WAAW,QACX,KAAA;AACR;AAEA,SAAS,iBAAiB,WAAyB;CACjD,IAAI,CAAC,YAAY,OAAO,SAAS,GAC/B;CAEF,OAAO,WAAW;EAAE,OAAO;EAAM,WAAW;CAAK,CAAC;AACpD;AAEA,SAAS,uBAA6B;CACpC,KAAK,MAAM,OAAO,aAChB,iBAAiB,GAAG;AAExB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corsa-oxlint",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "description": "Type-aware Oxlint helpers powered by Corsa",
5
5
  "homepage": "https://github.com/ubugeeei-prod/corsa-bind/tree/main/src/bindings/nodejs/corsa_oxlint",
6
6
  "bugs": {
@@ -101,7 +101,7 @@
101
101
  "./package.json": "./package.json"
102
102
  },
103
103
  "dependencies": {
104
- "@corsa-bind/napi": "0.45.0"
104
+ "@corsa-bind/napi": "0.47.0"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@oxlint/plugins": "1.69.0",