@oxlint/plugins 1.55.0 → 1.56.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/index.d.ts +29 -20
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1048,6 +1048,15 @@ type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { // Fo
|
|
|
1048
1048
|
Partial<Pick<ObjectType, Exclude<KeysType, Key>>> }[KeysType] & // 3. Add the remaining keys not in `KeysType`
|
|
1049
1049
|
Except<ObjectType, KeysType>;
|
|
1050
1050
|
//#endregion
|
|
1051
|
+
//#region src-js/plugins/comments.d.ts
|
|
1052
|
+
/**
|
|
1053
|
+
* Comment.
|
|
1054
|
+
*/
|
|
1055
|
+
interface CommentType extends Span {
|
|
1056
|
+
type: "Line" | "Block" | "Shebang";
|
|
1057
|
+
value: string;
|
|
1058
|
+
}
|
|
1059
|
+
//#endregion
|
|
1051
1060
|
//#region src-js/plugins/tokens.d.ts
|
|
1052
1061
|
/**
|
|
1053
1062
|
* AST token type.
|
|
@@ -1098,16 +1107,15 @@ interface StringToken extends BaseToken {
|
|
|
1098
1107
|
interface TemplateToken extends BaseToken {
|
|
1099
1108
|
type: "Template";
|
|
1100
1109
|
}
|
|
1101
|
-
type TokenOrComment = TokenType |
|
|
1110
|
+
type TokenOrComment = TokenType | CommentType;
|
|
1102
1111
|
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 };
|
|
1112
|
+
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
1113
|
}
|
|
1105
1114
|
interface Program extends Span {
|
|
1106
1115
|
type: "Program";
|
|
1107
1116
|
body: Array<Directive | Statement>;
|
|
1108
1117
|
sourceType: ModuleKind;
|
|
1109
|
-
|
|
1110
|
-
comments: Comment[];
|
|
1118
|
+
comments: CommentType[];
|
|
1111
1119
|
tokens: TokenType[];
|
|
1112
1120
|
parent: null;
|
|
1113
1121
|
}
|
|
@@ -2743,11 +2751,7 @@ type VisitorWithHooks = VisitorObject & {
|
|
|
2743
2751
|
after?: AfterHook;
|
|
2744
2752
|
};
|
|
2745
2753
|
interface Node extends Span {}
|
|
2746
|
-
type NodeOrToken = Node | TokenType |
|
|
2747
|
-
interface Comment extends Span {
|
|
2748
|
-
type: "Line" | "Block" | "Shebang";
|
|
2749
|
-
value: string;
|
|
2750
|
-
}
|
|
2754
|
+
type NodeOrToken = Node | TokenType | CommentType;
|
|
2751
2755
|
//#endregion
|
|
2752
2756
|
//#region src-js/plugins/location.d.ts
|
|
2753
2757
|
/**
|
|
@@ -2895,12 +2899,12 @@ interface SuggestionBase {
|
|
|
2895
2899
|
*/
|
|
2896
2900
|
type Settings = JsonObject;
|
|
2897
2901
|
//#endregion
|
|
2898
|
-
//#region src-js/plugins/
|
|
2902
|
+
//#region src-js/plugins/comments_methods.d.ts
|
|
2899
2903
|
/**
|
|
2900
2904
|
* Retrieve an array containing all comments in the source code.
|
|
2901
2905
|
* @returns Array of `Comment`s in order they appear in source.
|
|
2902
2906
|
*/
|
|
2903
|
-
declare function getAllComments():
|
|
2907
|
+
declare function getAllComments(): CommentType[];
|
|
2904
2908
|
/**
|
|
2905
2909
|
* Get all comments directly before the given node or token.
|
|
2906
2910
|
*
|
|
@@ -2918,7 +2922,7 @@ declare function getAllComments(): Comment[];
|
|
|
2918
2922
|
* @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
|
|
2919
2923
|
* @returns Array of `Comment`s in occurrence order.
|
|
2920
2924
|
*/
|
|
2921
|
-
declare function getCommentsBefore(nodeOrToken: NodeOrToken):
|
|
2925
|
+
declare function getCommentsBefore(nodeOrToken: NodeOrToken): CommentType[];
|
|
2922
2926
|
/**
|
|
2923
2927
|
* Get all comment tokens directly after the given node or token.
|
|
2924
2928
|
*
|
|
@@ -2937,13 +2941,13 @@ declare function getCommentsBefore(nodeOrToken: NodeOrToken): Comment[];
|
|
|
2937
2941
|
* @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
|
|
2938
2942
|
* @returns Array of `Comment`s in occurrence order.
|
|
2939
2943
|
*/
|
|
2940
|
-
declare function getCommentsAfter(nodeOrToken: NodeOrToken):
|
|
2944
|
+
declare function getCommentsAfter(nodeOrToken: NodeOrToken): CommentType[];
|
|
2941
2945
|
/**
|
|
2942
2946
|
* Get all comment tokens inside the given node.
|
|
2943
2947
|
* @param node - The AST node to get the comments for.
|
|
2944
2948
|
* @returns Array of `Comment`s in occurrence order.
|
|
2945
2949
|
*/
|
|
2946
|
-
declare function getCommentsInside(node: Node):
|
|
2950
|
+
declare function getCommentsInside(node: Node): CommentType[];
|
|
2947
2951
|
/**
|
|
2948
2952
|
* Check whether any comments exist or not between the given 2 nodes.
|
|
2949
2953
|
* @param nodeOrToken1 - Start node/token.
|
|
@@ -2959,7 +2963,7 @@ declare function commentsExistBetween(nodeOrToken1: NodeOrToken, nodeOrToken2: N
|
|
|
2959
2963
|
* @param node - The AST node to get the comment for.
|
|
2960
2964
|
* @returns The JSDoc comment for the given node, or `null` if not found.
|
|
2961
2965
|
*/
|
|
2962
|
-
declare function getJSDocComment(node: Node):
|
|
2966
|
+
declare function getJSDocComment(node: Node): CommentType | null;
|
|
2963
2967
|
//#endregion
|
|
2964
2968
|
//#region src-js/plugins/scope.d.ts
|
|
2965
2969
|
interface Scope {
|
|
@@ -3059,12 +3063,17 @@ declare function getDeclaredVariables(node: Node$1): Variable[];
|
|
|
3059
3063
|
declare function getScope(node: Node$1): Scope;
|
|
3060
3064
|
/**
|
|
3061
3065
|
* Marks as used a variable with the given name in a scope indicated by the given reference node.
|
|
3062
|
-
*
|
|
3066
|
+
*
|
|
3067
|
+
* IMPORTANT: At present marking variables as used only affects other JS plugins.
|
|
3068
|
+
* It does *not* get communicated to Oxlint's rules which are implemented on Rust side e.g. `no-unused-vars`.
|
|
3069
|
+
* This is a known shortcoming, and will be addressed in a future release.
|
|
3070
|
+
* https://github.com/oxc-project/oxc/issues/20350
|
|
3071
|
+
*
|
|
3063
3072
|
* @param name - Variable name
|
|
3064
|
-
* @param refNode - Reference node
|
|
3073
|
+
* @param refNode - Reference node. Defaults to `Program` node if not provided.
|
|
3065
3074
|
* @returns `true` if a variable with the given name was found and marked as used, otherwise `false`
|
|
3066
3075
|
*/
|
|
3067
|
-
declare function markVariableAsUsed(name: string, refNode
|
|
3076
|
+
declare function markVariableAsUsed(name: string, refNode?: Node$1): boolean;
|
|
3068
3077
|
//#endregion
|
|
3069
3078
|
//#region src-js/plugins/tokens_methods.d.ts
|
|
3070
3079
|
/**
|
|
@@ -3361,7 +3370,7 @@ declare const SOURCE_CODE: Readonly<{
|
|
|
3361
3370
|
/**
|
|
3362
3371
|
* Array of all tokens and comments in the file, in source order.
|
|
3363
3372
|
*/
|
|
3364
|
-
readonly tokensAndComments: (TokenType |
|
|
3373
|
+
readonly tokensAndComments: (TokenType | CommentType)[];
|
|
3365
3374
|
/**
|
|
3366
3375
|
* Get the source code for the given node.
|
|
3367
3376
|
* @param node? - The AST node to get the text for.
|
|
@@ -3982,4 +3991,4 @@ declare function defineRule(rule: Rule): Rule;
|
|
|
3982
3991
|
*/
|
|
3983
3992
|
declare function eslintCompatPlugin(plugin: Plugin): Plugin;
|
|
3984
3993
|
//#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 };
|
|
3994
|
+
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 };
|