@oxlint/plugins 1.55.0 → 1.57.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.
Files changed (2) hide show
  1. package/index.d.ts +74 -38
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -241,7 +241,7 @@ type Options = JsonValue[];
241
241
  */
242
242
  type RuleOptionsSchema = JSONSchema4 | JSONSchema4[] | false;
243
243
  //#endregion
244
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-any.d.ts
244
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-any.d.ts
245
245
  /**
246
246
  Returns a boolean for whether the given type is `any`.
247
247
 
@@ -272,7 +272,7 @@ const anyA = get(anyObject, 'a');
272
272
  */
273
273
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
274
274
  //#endregion
275
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-optional-key-of.d.ts
275
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-optional-key-of.d.ts
276
276
  /**
277
277
  Returns a boolean for whether the given key is an optional key of type.
278
278
 
@@ -315,7 +315,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
315
315
  */
316
316
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
317
317
  //#endregion
318
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/optional-keys-of.d.ts
318
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/optional-keys-of.d.ts
319
319
  /**
320
320
  Extract all optional keys from the given type.
321
321
 
@@ -353,7 +353,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
353
353
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
354
354
  : never;
355
355
  //#endregion
356
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/required-keys-of.d.ts
356
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/required-keys-of.d.ts
357
357
  /**
358
358
  Extract all required keys from the given type.
359
359
 
@@ -387,7 +387,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
387
387
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
388
388
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
389
389
  //#endregion
390
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-never.d.ts
390
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-never.d.ts
391
391
  /**
392
392
  Returns a boolean for whether the given type is `never`.
393
393
 
@@ -443,7 +443,7 @@ type B = IsTrueFixed<never>;
443
443
  */
444
444
  type IsNever<T> = [T] extends [never] ? true : false;
445
445
  //#endregion
446
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/if.d.ts
446
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/if.d.ts
447
447
  /**
448
448
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
449
449
 
@@ -538,7 +538,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
538
538
  */
539
539
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
540
540
  //#endregion
541
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/internal/type.d.ts
541
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/type.d.ts
542
542
  /**
543
543
  An if-else-like type that resolves depending on whether the given type is `any` or `never`.
544
544
 
@@ -585,7 +585,7 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
585
585
  */
586
586
  type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever>>;
587
587
  //#endregion
588
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/simplify.d.ts
588
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/simplify.d.ts
589
589
  /**
590
590
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
591
591
 
@@ -646,7 +646,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
646
646
  */
647
647
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
648
648
  //#endregion
649
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-equal.d.ts
649
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-equal.d.ts
650
650
  /**
651
651
  Returns a boolean for whether the two given types are equal.
652
652
 
@@ -677,7 +677,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
677
677
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
678
678
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
679
679
  //#endregion
680
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/omit-index-signature.d.ts
680
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/omit-index-signature.d.ts
681
681
  /**
682
682
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
683
683
 
@@ -771,7 +771,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
771
771
  */
772
772
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
773
773
  //#endregion
774
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/pick-index-signature.d.ts
774
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/pick-index-signature.d.ts
775
775
  /**
776
776
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
777
777
 
@@ -819,12 +819,37 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
819
819
  */
820
820
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
821
821
  //#endregion
822
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/merge.d.ts
822
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/merge.d.ts
823
823
  // Merges two objects without worrying about index signatures.
824
824
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
825
825
  /**
826
826
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
827
827
 
828
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
829
+
830
+ @example
831
+ ```
832
+ import type {Merge} from 'type-fest';
833
+
834
+ type Foo = {
835
+ a: string;
836
+ b: number;
837
+ };
838
+
839
+ type Bar = {
840
+ a: number; // Conflicts with Foo['a']
841
+ c: boolean;
842
+ };
843
+
844
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
845
+ type WithIntersection = (Foo & Bar)['a'];
846
+ //=> never
847
+
848
+ // With `Merge`, `a` is cleanly overridden to `number`.
849
+ type WithMerge = Merge<Foo, Bar>['a'];
850
+ //=> number
851
+ ```
852
+
828
853
  @example
829
854
  ```
830
855
  import type {Merge} from 'type-fest';
@@ -866,7 +891,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
866
891
  // Should never happen
867
892
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
868
893
  //#endregion
869
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/internal/object.d.ts
894
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/object.d.ts
870
895
  /**
871
896
  Merges user specified options with default options.
872
897
 
@@ -921,7 +946,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
921
946
  */
922
947
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
923
948
  //#endregion
924
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/except.d.ts
949
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/except.d.ts
925
950
  /**
926
951
  Filter out keys from an object.
927
952
 
@@ -1019,7 +1044,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
1019
1044
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
1020
1045
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
1021
1046
  //#endregion
1022
- //#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/require-at-least-one.d.ts
1047
+ //#region ../../node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/require-at-least-one.d.ts
1023
1048
  /**
1024
1049
  Create a type that requires at least one of the given keys. The remaining keys are kept as is.
1025
1050
 
@@ -1098,16 +1123,23 @@ interface StringToken extends BaseToken {
1098
1123
  interface TemplateToken extends BaseToken {
1099
1124
  type: "Template";
1100
1125
  }
1101
- type TokenOrComment = TokenType | Comment;
1126
+ //#endregion
1127
+ //#region src-js/plugins/comments.d.ts
1128
+ /**
1129
+ * Comment.
1130
+ */
1131
+ interface CommentType extends Span {
1132
+ type: "Line" | "Block" | "Shebang";
1133
+ value: string;
1134
+ }
1102
1135
  declare namespace types_d_exports {
1103
- export { AccessorProperty, AccessorPropertyType, Argument, ArrayAssignmentTarget, ArrayExpression, ArrayExpressionElement, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentTarget, AssignmentTargetMaybeDefault, AssignmentTargetPattern, AssignmentTargetProperty, AssignmentTargetPropertyIdentifier, AssignmentTargetPropertyProperty, AssignmentTargetRest, AssignmentTargetWithDefault, AwaitExpression, BigIntLiteral, BinaryExpression, BinaryOperator, BindingIdentifier, BindingPattern, BindingProperty, BindingRestElement, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassElement, ClassType, Comment, ComputedMemberExpression, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Decorator, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultDeclarationKind, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, ForStatementInit, ForStatementLeft, FormalParameter, FormalParameterRest, Function$1 as Function, FunctionBody, FunctionType, Hashbang, IdentifierName, IdentifierReference, IfStatement, ImportAttribute, ImportAttributeKey, ImportDeclaration, ImportDeclarationSpecifier, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportOrExportKind, ImportPhase, ImportSpecifier, JSDocNonNullableType, JSDocNullableType, JSDocUnknownType, JSXAttribute, JSXAttributeItem, JSXAttributeName, JSXAttributeValue, JSXChild, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementName, JSXEmptyExpression, JSXExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXMemberExpressionObject, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabelIdentifier, LabeledStatement, LogicalExpression, LogicalOperator, MemberExpression, MetaProperty, MethodDefinition, MethodDefinitionKind, MethodDefinitionType, ModuleDeclaration, ModuleExportName, ModuleKind, NewExpression, Node$1 as Node, NullLiteral, NumericLiteral, ObjectAssignmentTarget, ObjectExpression, ObjectPattern, ObjectProperty, ObjectPropertyKind, ParamPattern, ParenthesizedExpression, PrivateFieldExpression, PrivateIdentifier, PrivateInExpression, Program, PropertyDefinition, PropertyDefinitionType, PropertyKey$1 as PropertyKey, PropertyKind, RegExpLiteral, ReturnStatement, SequenceExpression, SimpleAssignmentTarget, Span, SpreadElement, Statement, StaticBlock, StaticMemberExpression, StringLiteral, Super, SwitchCase, SwitchStatement, TSAccessibility, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSClassImplements, TSConditionalType, TSConstructSignatureDeclaration, TSConstructorType, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSEnumMemberName, TSExportAssignment, TSExternalModuleReference, TSFunctionType, TSGlobalDeclaration, TSImportEqualsDeclaration, TSImportType, TSImportTypeQualifiedName, TSImportTypeQualifier, TSIndexSignature, TSIndexSignatureName, TSIndexedAccessType, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSInterfaceHeritage, TSIntersectionType, TSIntrinsicKeyword, TSLiteral, TSLiteralType, TSMappedType, TSMappedTypeModifierOperator, TSMethodSignature, TSMethodSignatureKind, TSModuleBlock, TSModuleDeclaration, TSModuleDeclarationKind, TSModuleReference, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSSignature, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisParameter, TSThisType, TSTupleElement, TSTupleType, TSType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeName, TSTypeOperator, TSTypeOperatorOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypePredicateName, TSTypeQuery, TSTypeQueryExprName, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TaggedTemplateExpression, TemplateElement, TemplateElementValue, TemplateLiteral, ThisExpression, ThrowStatement, TokenType as Token, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, V8IntrinsicExpression, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
1136
+ export { AccessorProperty, AccessorPropertyType, Argument, ArrayAssignmentTarget, ArrayExpression, ArrayExpressionElement, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentTarget, AssignmentTargetMaybeDefault, AssignmentTargetPattern, AssignmentTargetProperty, AssignmentTargetPropertyIdentifier, AssignmentTargetPropertyProperty, AssignmentTargetRest, AssignmentTargetWithDefault, AwaitExpression, BigIntLiteral, BinaryExpression, BinaryOperator, BindingIdentifier, BindingPattern, BindingProperty, BindingRestElement, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassElement, ClassType, CommentType as Comment, ComputedMemberExpression, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Decorator, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultDeclarationKind, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, ForStatementInit, ForStatementLeft, FormalParameter, FormalParameterRest, Function$1 as Function, FunctionBody, FunctionType, Hashbang, IdentifierName, IdentifierReference, IfStatement, ImportAttribute, ImportAttributeKey, ImportDeclaration, ImportDeclarationSpecifier, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportOrExportKind, ImportPhase, ImportSpecifier, JSDocNonNullableType, JSDocNullableType, JSDocUnknownType, JSXAttribute, JSXAttributeItem, JSXAttributeName, JSXAttributeValue, JSXChild, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementName, JSXEmptyExpression, JSXExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXMemberExpressionObject, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabelIdentifier, LabeledStatement, LogicalExpression, LogicalOperator, MemberExpression, MetaProperty, MethodDefinition, MethodDefinitionKind, MethodDefinitionType, ModuleDeclaration, ModuleExportName, ModuleKind, NewExpression, Node$1 as Node, NullLiteral, NumericLiteral, ObjectAssignmentTarget, ObjectExpression, ObjectPattern, ObjectProperty, ObjectPropertyKind, ParamPattern, ParenthesizedExpression, PrivateFieldExpression, PrivateIdentifier, PrivateInExpression, Program, PropertyDefinition, PropertyDefinitionType, PropertyKey$1 as PropertyKey, PropertyKind, RegExpLiteral, ReturnStatement, SequenceExpression, SimpleAssignmentTarget, Span, SpreadElement, Statement, StaticBlock, StaticMemberExpression, StringLiteral, Super, SwitchCase, SwitchStatement, TSAccessibility, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSClassImplements, TSConditionalType, TSConstructSignatureDeclaration, TSConstructorType, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSEnumMemberName, TSExportAssignment, TSExternalModuleReference, TSFunctionType, TSGlobalDeclaration, TSImportEqualsDeclaration, TSImportType, TSImportTypeQualifiedName, TSImportTypeQualifier, TSIndexSignature, TSIndexSignatureName, TSIndexedAccessType, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSInterfaceHeritage, TSIntersectionType, TSIntrinsicKeyword, TSLiteral, TSLiteralType, TSMappedType, TSMappedTypeModifierOperator, TSMethodSignature, TSMethodSignatureKind, TSModuleBlock, TSModuleDeclaration, TSModuleDeclarationKind, TSModuleReference, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSSignature, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisParameter, TSThisType, TSTupleElement, TSTupleType, TSType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeName, TSTypeOperator, TSTypeOperatorOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypePredicateName, TSTypeQuery, TSTypeQueryExprName, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TaggedTemplateExpression, TemplateElement, TemplateElementValue, TemplateLiteral, ThisExpression, ThrowStatement, TokenType as Token, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, V8IntrinsicExpression, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
1104
1137
  }
1105
1138
  interface Program extends Span {
1106
1139
  type: "Program";
1107
1140
  body: Array<Directive | Statement>;
1108
1141
  sourceType: ModuleKind;
1109
- hashbang: Hashbang | null;
1110
- comments: Comment[];
1142
+ comments: CommentType[];
1111
1143
  tokens: TokenType[];
1112
1144
  parent: null;
1113
1145
  }
@@ -2387,12 +2419,12 @@ interface JSDocUnknownType extends Span {
2387
2419
  type: "TSJSDocUnknownType";
2388
2420
  parent: Node$1;
2389
2421
  }
2422
+ type ModuleKind = "script" | "module" | "commonjs";
2390
2423
  type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
2391
2424
  type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
2392
2425
  type LogicalOperator = "||" | "&&" | "??";
2393
2426
  type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
2394
2427
  type UpdateOperator = "++" | "--";
2395
- type ModuleKind = "script" | "module" | "commonjs";
2396
2428
  type Node$1 = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function$1 | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
2397
2429
  //#endregion
2398
2430
  //#region src-js/generated/visitor.d.ts
@@ -2743,11 +2775,7 @@ type VisitorWithHooks = VisitorObject & {
2743
2775
  after?: AfterHook;
2744
2776
  };
2745
2777
  interface Node extends Span {}
2746
- type NodeOrToken = Node | TokenType | Comment;
2747
- interface Comment extends Span {
2748
- type: "Line" | "Block" | "Shebang";
2749
- value: string;
2750
- }
2778
+ type NodeOrToken = Node | TokenType | CommentType;
2751
2779
  //#endregion
2752
2780
  //#region src-js/plugins/location.d.ts
2753
2781
  /**
@@ -2895,12 +2923,12 @@ interface SuggestionBase {
2895
2923
  */
2896
2924
  type Settings = JsonObject;
2897
2925
  //#endregion
2898
- //#region src-js/plugins/comments.d.ts
2926
+ //#region src-js/plugins/comments_methods.d.ts
2899
2927
  /**
2900
2928
  * Retrieve an array containing all comments in the source code.
2901
2929
  * @returns Array of `Comment`s in order they appear in source.
2902
2930
  */
2903
- declare function getAllComments(): Comment[];
2931
+ declare function getAllComments(): CommentType[];
2904
2932
  /**
2905
2933
  * Get all comments directly before the given node or token.
2906
2934
  *
@@ -2918,7 +2946,7 @@ declare function getAllComments(): Comment[];
2918
2946
  * @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
2919
2947
  * @returns Array of `Comment`s in occurrence order.
2920
2948
  */
2921
- declare function getCommentsBefore(nodeOrToken: NodeOrToken): Comment[];
2949
+ declare function getCommentsBefore(nodeOrToken: NodeOrToken): CommentType[];
2922
2950
  /**
2923
2951
  * Get all comment tokens directly after the given node or token.
2924
2952
  *
@@ -2937,13 +2965,13 @@ declare function getCommentsBefore(nodeOrToken: NodeOrToken): Comment[];
2937
2965
  * @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
2938
2966
  * @returns Array of `Comment`s in occurrence order.
2939
2967
  */
2940
- declare function getCommentsAfter(nodeOrToken: NodeOrToken): Comment[];
2968
+ declare function getCommentsAfter(nodeOrToken: NodeOrToken): CommentType[];
2941
2969
  /**
2942
2970
  * Get all comment tokens inside the given node.
2943
2971
  * @param node - The AST node to get the comments for.
2944
2972
  * @returns Array of `Comment`s in occurrence order.
2945
2973
  */
2946
- declare function getCommentsInside(node: Node): Comment[];
2974
+ declare function getCommentsInside(node: Node): CommentType[];
2947
2975
  /**
2948
2976
  * Check whether any comments exist or not between the given 2 nodes.
2949
2977
  * @param nodeOrToken1 - Start node/token.
@@ -2959,7 +2987,7 @@ declare function commentsExistBetween(nodeOrToken1: NodeOrToken, nodeOrToken2: N
2959
2987
  * @param node - The AST node to get the comment for.
2960
2988
  * @returns The JSDoc comment for the given node, or `null` if not found.
2961
2989
  */
2962
- declare function getJSDocComment(node: Node): Comment | null;
2990
+ declare function getJSDocComment(node: Node): CommentType | null;
2963
2991
  //#endregion
2964
2992
  //#region src-js/plugins/scope.d.ts
2965
2993
  interface Scope {
@@ -3059,12 +3087,20 @@ declare function getDeclaredVariables(node: Node$1): Variable[];
3059
3087
  declare function getScope(node: Node$1): Scope;
3060
3088
  /**
3061
3089
  * Marks as used a variable with the given name in a scope indicated by the given reference node.
3062
- * This affects the `no-unused-vars` rule.
3090
+ *
3091
+ * IMPORTANT: At present marking variables as used only affects other JS plugins.
3092
+ * It does *not* get communicated to Oxlint's rules which are implemented on Rust side e.g. `no-unused-vars`.
3093
+ * This is a known shortcoming, and will be addressed in a future release.
3094
+ * https://github.com/oxc-project/oxc/issues/20350
3095
+ *
3063
3096
  * @param name - Variable name
3064
- * @param refNode - Reference node
3097
+ * @param refNode - Reference node. Defaults to `Program` node if not provided.
3065
3098
  * @returns `true` if a variable with the given name was found and marked as used, otherwise `false`
3066
3099
  */
3067
- declare function markVariableAsUsed(name: string, refNode: Node$1): boolean;
3100
+ declare function markVariableAsUsed(name: string, refNode?: Node$1): boolean;
3101
+ //#endregion
3102
+ //#region src-js/plugins/tokens_and_comments.d.ts
3103
+ type TokenOrComment = TokenType | CommentType;
3068
3104
  //#endregion
3069
3105
  //#region src-js/plugins/tokens_methods.d.ts
3070
3106
  /**
@@ -3275,11 +3311,11 @@ declare function getLastTokenBetween<Options extends SkipOptions | number | Filt
3275
3311
  declare function getLastTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
3276
3312
  /**
3277
3313
  * Get the token starting at the specified index.
3278
- * @param index - Index of the start of the token's range.
3314
+ * @param offset - Start offset of the token.
3279
3315
  * @param rangeOptions - Options object.
3280
3316
  * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
3281
3317
  */
3282
- declare function getTokenByRangeStart<Options extends RangeOptions | null | undefined>(index: number, rangeOptions?: Options): TokenResult<Options> | null;
3318
+ declare function getTokenByRangeStart<Options extends RangeOptions | null | undefined>(offset: number, rangeOptions?: Options): TokenResult<Options> | null;
3283
3319
  /**
3284
3320
  * Determine if two nodes or tokens have at least one whitespace character between them.
3285
3321
  * Order does not matter.
@@ -3361,7 +3397,7 @@ declare const SOURCE_CODE: Readonly<{
3361
3397
  /**
3362
3398
  * Array of all tokens and comments in the file, in source order.
3363
3399
  */
3364
- readonly tokensAndComments: (TokenType | Comment)[];
3400
+ readonly tokensAndComments: (TokenType | CommentType)[];
3365
3401
  /**
3366
3402
  * Get the source code for the given node.
3367
3403
  * @param node? - The AST node to get the text for.
@@ -3982,4 +4018,4 @@ declare function defineRule(rule: Rule): Rule;
3982
4018
  */
3983
4019
  declare function eslintCompatPlugin(plugin: Plugin): Plugin;
3984
4020
  //#endregion
3985
- export { type AfterHook, type BeforeHook, type BooleanToken, type Comment, type Context, type CountOptions, type CreateOnceRule, type CreateRule, type Definition, type DefinitionType, type Diagnostic, type DiagnosticData, type types_d_exports as ESTree, type Envs, type FilterFn, type Fix, type FixFn, type Fixer, type Globals, type IdentifierToken, type JSXIdentifierToken, type JSXTextToken, type KeywordToken, type LanguageOptions, type LineColumn, type Location, type Node, type NullToken, type NumericToken, type Options, type Plugin, type PrivateIdentifierToken, type PunctuatorToken, type Range, type RangeOptions, type Ranged, type Reference, type RegularExpressionToken, type Rule, type RuleDeprecatedInfo, type RuleDocs, type RuleMeta, type RuleOptionsSchema, type RuleReplacedByExternalSpecifier, type RuleReplacedByInfo, type Scope, type ScopeManager, type ScopeType, type Settings, type SkipOptions, type SourceCode, type Span, type StringToken, type Suggestion, type TemplateToken, type TokenType as Token, type Variable, type VisitorObject as Visitor, type VisitorWithHooks, definePlugin, defineRule, eslintCompatPlugin };
4021
+ export { type AfterHook, type BeforeHook, type BooleanToken, type CommentType as Comment, type Context, type CountOptions, type CreateOnceRule, type CreateRule, type Definition, type DefinitionType, type Diagnostic, type DiagnosticData, type types_d_exports as ESTree, type Envs, type FilterFn, type Fix, type FixFn, type Fixer, type Globals, type IdentifierToken, type JSXIdentifierToken, type JSXTextToken, type KeywordToken, type LanguageOptions, type LineColumn, type Location, type Node, type NullToken, type NumericToken, type Options, type Plugin, type PrivateIdentifierToken, type PunctuatorToken, type Range, type RangeOptions, type Ranged, type Reference, type RegularExpressionToken, type Rule, type RuleDeprecatedInfo, type RuleDocs, type RuleMeta, type RuleOptionsSchema, type RuleReplacedByExternalSpecifier, type RuleReplacedByInfo, type Scope, type ScopeManager, type ScopeType, type Settings, type SkipOptions, type SourceCode, type Span, type StringToken, type Suggestion, type TemplateToken, type TokenType as Token, type Variable, type VisitorObject as Visitor, type VisitorWithHooks, definePlugin, defineRule, eslintCompatPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/plugins",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "description": "Plugin utilities for Oxlint",
5
5
  "keywords": [
6
6
  "eslint",