@vue-vine/eslint-parser 1.1.0 → 1.1.2
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/index.d.ts +2 -12
- package/dist/index.js +18 -17
- package/package.json +10 -11
package/dist/index.d.ts
CHANGED
@@ -9,9 +9,6 @@ import { VisitorKeys } from "eslint-visitor-keys";
|
|
9
9
|
/**
|
10
10
|
* HTML parse errors.
|
11
11
|
*/
|
12
|
-
/**
|
13
|
-
* HTML parse errors.
|
14
|
-
*/
|
15
12
|
declare class ParseError extends SyntaxError {
|
16
13
|
code?: ErrorCode;
|
17
14
|
index: number;
|
@@ -50,7 +47,8 @@ declare class ParseError extends SyntaxError {
|
|
50
47
|
* The error codes of HTML syntax errors.
|
51
48
|
* https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
|
52
49
|
*/
|
53
|
-
type ErrorCode = "abrupt-closing-of-empty-comment" | "absence-of-digits-in-numeric-character-reference" | "cdata-in-html-content" | "character-reference-outside-unicode-range" | "control-character-in-input-stream" | "control-character-reference" | "eof-before-tag-name" | "eof-in-cdata" | "eof-in-comment" | "eof-in-tag" | "incorrectly-closed-comment" | "incorrectly-opened-comment" | "invalid-first-character-of-tag-name" | "missing-attribute-value" | "missing-end-tag-name" | "missing-semicolon-after-character-reference" | "missing-whitespace-between-attributes" | "nested-comment" | "noncharacter-character-reference" | "noncharacter-in-input-stream" | "null-character-reference" | "surrogate-character-reference" | "surrogate-in-input-stream" | "unexpected-character-in-attribute-name" | "unexpected-character-in-unquoted-attribute-value" | "unexpected-equals-sign-before-attribute-name" | "unexpected-null-character" | "unexpected-question-mark-instead-of-tag-name" | "unexpected-solidus-in-tag" | "unknown-named-character-reference" | "end-tag-with-attributes" | "duplicate-attribute" | "end-tag-with-trailing-solidus" | "non-void-html-element-start-tag-with-trailing-solidus" | "x-invalid-end-tag" | "x-invalid-namespace" | "x-missing-interpolation-end";
|
50
|
+
type ErrorCode = "abrupt-closing-of-empty-comment" | "absence-of-digits-in-numeric-character-reference" | "cdata-in-html-content" | "character-reference-outside-unicode-range" | "control-character-in-input-stream" | "control-character-reference" | "eof-before-tag-name" | "eof-in-cdata" | "eof-in-comment" | "eof-in-tag" | "incorrectly-closed-comment" | "incorrectly-opened-comment" | "invalid-first-character-of-tag-name" | "missing-attribute-value" | "missing-end-tag-name" | "missing-semicolon-after-character-reference" | "missing-whitespace-between-attributes" | "nested-comment" | "noncharacter-character-reference" | "noncharacter-in-input-stream" | "null-character-reference" | "surrogate-character-reference" | "surrogate-in-input-stream" | "unexpected-character-in-attribute-name" | "unexpected-character-in-unquoted-attribute-value" | "unexpected-equals-sign-before-attribute-name" | "unexpected-null-character" | "unexpected-question-mark-instead-of-tag-name" | "unexpected-solidus-in-tag" | "unknown-named-character-reference" | "end-tag-with-attributes" | "duplicate-attribute" | "end-tag-with-trailing-solidus" | "non-void-html-element-start-tag-with-trailing-solidus" | "x-invalid-end-tag" | "x-invalid-namespace" | "x-missing-interpolation-end";
|
51
|
+
//#endregion
|
54
52
|
//#region src/ast/locations.d.ts
|
55
53
|
/**
|
56
54
|
* Location information in lines and columns.
|
@@ -100,7 +98,6 @@ interface HasLocation {
|
|
100
98
|
start?: number;
|
101
99
|
end?: number;
|
102
100
|
}
|
103
|
-
|
104
101
|
//#endregion
|
105
102
|
//#region src/ast/tokens.d.ts
|
106
103
|
/**
|
@@ -116,7 +113,6 @@ interface Token extends HasLocation {
|
|
116
113
|
*/
|
117
114
|
value: string;
|
118
115
|
}
|
119
|
-
|
120
116
|
//#endregion
|
121
117
|
//#region src/ast/nodes.d.ts
|
122
118
|
// ------------------------------------------------------------------------------
|
@@ -790,7 +786,6 @@ interface VTemplateRoot extends HasLocation {
|
|
790
786
|
children: (VElement | VText | VExpressionContainer)[];
|
791
787
|
templateInfo?: PrettierType<Omit<FinalProcessTemplateInfo, "templateMeta" | "templateRootAST">>;
|
792
788
|
}
|
793
|
-
|
794
789
|
//#endregion
|
795
790
|
//#region src/ast/traverse.d.ts
|
796
791
|
declare const KEYS: VisitorKeys;
|
@@ -814,7 +809,6 @@ interface Visitor {
|
|
814
809
|
* @param visitor Visitor.
|
815
810
|
*/
|
816
811
|
declare function traverseNodes(node: Node, visitor: Visitor): void;
|
817
|
-
|
818
812
|
//#endregion
|
819
813
|
//#region src/common/parser-object.d.ts
|
820
814
|
/**
|
@@ -837,14 +831,12 @@ interface EnhancedParserObject<R = ESLintExtendedProgram> {
|
|
837
831
|
* The type of ESLint (custom) parsers.
|
838
832
|
*/
|
839
833
|
type ParserObject<R1 = ESLintExtendedProgram, R2 = ESLintProgram> = EnhancedParserObject<R1> | BasicParserObject<R2>;
|
840
|
-
|
841
834
|
//#endregion
|
842
835
|
//#region src/template/utils/process-vine-template-node.d.ts
|
843
836
|
declare function prepareTemplate(templateNode: TSESTree.TaggedTemplateExpression): {
|
844
837
|
templatePositionInfo: VineTemplatePositionInfo;
|
845
838
|
templateRawContent: string;
|
846
839
|
};
|
847
|
-
|
848
840
|
//#endregion
|
849
841
|
//#region src/types.d.ts
|
850
842
|
type PrettierType<T> = { [K in keyof T]: T[K] } & {};
|
@@ -880,13 +872,11 @@ type FinalProcessTemplateInfo = ReturnType<typeof prepareTemplate> & {
|
|
880
872
|
templateRootAST: VTemplateRoot;
|
881
873
|
templateMeta: VineTemplateMeta;
|
882
874
|
};
|
883
|
-
|
884
875
|
//#endregion
|
885
876
|
//#region src/index.d.ts
|
886
877
|
declare const meta: ESLint.ObjectMetaProperties;
|
887
878
|
declare function parse(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult["ast"];
|
888
879
|
declare function parseForESLint(code: string, parserOptions: VineESLintParserOptions): ParseForESLintResult;
|
889
880
|
declare const _default: Linter.Parser;
|
890
|
-
|
891
881
|
//#endregion
|
892
882
|
export { ESLintArrayExpression, ESLintArrayPattern, ESLintArrowFunctionExpression, ESLintAssignmentExpression, ESLintAssignmentPattern, ESLintAssignmentProperty, ESLintAwaitExpression, ESLintBigIntLiteral, ESLintBinaryExpression, ESLintBlockStatement, ESLintBooleanLiteral, ESLintBreakStatement, ESLintCallExpression, ESLintCatchClause, ESLintChainElement, ESLintChainExpression, ESLintClassBody, ESLintClassDeclaration, ESLintClassExpression, ESLintConditionalExpression, ESLintContinueStatement, ESLintDebuggerStatement, ESLintDeclaration, ESLintDirective, ESLintDoWhileStatement, ESLintEmptyStatement, ESLintExportAllDeclaration, ESLintExportDefaultDeclaration, ESLintExportNamedDeclaration, ESLintExportSpecifier, ESLintExpression, ESLintExpressionStatement, ESLintExtendedProgram, ESLintForInStatement, ESLintForOfStatement, ESLintForStatement, ESLintFunctionDeclaration, ESLintFunctionExpression, ESLintIdentifier, ESLintIfStatement, ESLintImportDeclaration, ESLintImportDefaultSpecifier, ESLintImportExpression, ESLintImportNamespaceSpecifier, ESLintImportSpecifier, ESLintLabeledStatement, ESLintLegacyRestProperty, ESLintLegacySpreadProperty, ESLintLiteral, ESLintLogicalExpression, ESLintMemberExpression, ESLintMetaProperty, ESLintMethodDefinition, ESLintModuleDeclaration, ESLintModuleSpecifier, ESLintNewExpression, ESLintNode, ESLintNullLiteral, ESLintNumberLiteral, ESLintObjectExpression, ESLintObjectPattern, ESLintPattern, ESLintPrivateIdentifier, ESLintProgram, ESLintProperty, ESLintPropertyDefinition, ESLintRegExpLiteral, ESLintRestElement, ESLintReturnStatement, ESLintSequenceExpression, ESLintSpreadElement, ESLintStatement, ESLintStaticBlock, ESLintStringLiteral, ESLintSuper, ESLintSwitchCase, ESLintSwitchStatement, ESLintTaggedTemplateExpression, ESLintTemplateElement, ESLintTemplateLiteral, ESLintThisExpression, ESLintThrowStatement, ESLintTryStatement, ESLintUnaryExpression, ESLintUpdateExpression, ESLintVariableDeclaration, ESLintVariableDeclarator, ESLintWhileStatement, ESLintWithStatement, ESLintYieldExpression, ErrorCode, HasConcreteInfo, HasLocation, HasParent, KEYS, Location, LocationRange, NS, Namespace, Node, Offset, OffsetRange, ParseError, Reference, Token, VAttribute, VDirective, VDirectiveKey, VElement, VEndTag, VExpression, VExpressionContainer, VFilter, VFilterSequenceExpression, VForExpression, VIdentifier, VLiteral, VNode, VOnExpression, VSlotScopeExpression, VStartTag, VTemplateNode, VTemplateRoot, VText, Variable, Visitor, _default as default, getFallbackKeys, meta, parse, parseForESLint, traverseNodes };
|
package/dist/index.js
CHANGED
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
40
40
|
//#endregion
|
41
41
|
//#region package.json
|
42
42
|
var name = "@vue-vine/eslint-parser";
|
43
|
-
var version = "1.1.
|
43
|
+
var version = "1.1.2";
|
44
44
|
|
45
45
|
//#endregion
|
46
46
|
//#region src/ast/errors.ts
|
@@ -3516,7 +3516,7 @@ function fixLocations(result, locationCalculator) {
|
|
3516
3516
|
for (const comment of result.ast.comments || []) fixLocation(comment, locationCalculator);
|
3517
3517
|
}
|
3518
3518
|
function fixNodeLocations(rootNode, visitorKeys, locationCalculator) {
|
3519
|
-
const traversed = new Map();
|
3519
|
+
const traversed = /* @__PURE__ */ new Map();
|
3520
3520
|
traverseNodes(rootNode, {
|
3521
3521
|
visitorKeys,
|
3522
3522
|
enterNode(node, parent) {
|
@@ -3592,9 +3592,9 @@ function isBasicParserObject(value) {
|
|
3592
3592
|
|
3593
3593
|
//#endregion
|
3594
3594
|
//#region src/script/index.ts
|
3595
|
-
var import_first = __toESM(require_first()
|
3596
|
-
var import_last$2 = __toESM(require_last()
|
3597
|
-
var import_sortedIndexBy = __toESM(require_sortedIndexBy()
|
3595
|
+
var import_first = __toESM(require_first());
|
3596
|
+
var import_last$2 = __toESM(require_last());
|
3597
|
+
var import_sortedIndexBy = __toESM(require_sortedIndexBy());
|
3598
3598
|
const ALIAS_ITERATOR = /^([\s\S]*?(?:\s|\)))(\bin\b|\bof\b)([\s\S]*)$/u;
|
3599
3599
|
const PARENS = /^(\s*\()([\s\S]*?)(\)\s*)$/u;
|
3600
3600
|
const DUMMY_PARENT$2 = {};
|
@@ -4830,7 +4830,7 @@ function analyzeVariablesAndExternalReferences(parserResult, kind, parserOptions
|
|
4830
4830
|
};
|
4831
4831
|
}
|
4832
4832
|
function collectVariablesForVCF(tsFileScopeManager, templateRoot) {
|
4833
|
-
const scriptVariables = new Map();
|
4833
|
+
const scriptVariables = /* @__PURE__ */ new Map();
|
4834
4834
|
const globalScope = tsFileScopeManager.globalScope;
|
4835
4835
|
if (!globalScope) return scriptVariables;
|
4836
4836
|
for (const variable of globalScope.variables) scriptVariables.set(variable.name, variable);
|
@@ -4864,7 +4864,7 @@ function collectVariablesForVCF(tsFileScopeManager, templateRoot) {
|
|
4864
4864
|
}
|
4865
4865
|
function analyzeUsedInTemplateVariables(scopeManager, templateRoot) {
|
4866
4866
|
const scriptVariables = collectVariablesForVCF(scopeManager, templateRoot);
|
4867
|
-
const markedVariables = new Set();
|
4867
|
+
const markedVariables = /* @__PURE__ */ new Set();
|
4868
4868
|
/**
|
4869
4869
|
* @see https://github.com/vuejs/vue-next/blob/48de8a42b7fed7a03f7f1ff5d53d6a704252cafe/packages/compiler-core/src/transforms/transformElement.ts#L335
|
4870
4870
|
*/
|
@@ -5244,7 +5244,7 @@ var require_sortedLastIndex = __commonJS({ "../../node_modules/.pnpm/lodash@4.17
|
|
5244
5244
|
|
5245
5245
|
//#endregion
|
5246
5246
|
//#region src/common/lines-and-columns.ts
|
5247
|
-
var import_sortedLastIndex$1 = __toESM(require_sortedLastIndex()
|
5247
|
+
var import_sortedLastIndex$1 = __toESM(require_sortedLastIndex());
|
5248
5248
|
/**
|
5249
5249
|
* A class for getting lines and columns location.
|
5250
5250
|
*/
|
@@ -5282,7 +5282,7 @@ var LinesAndColumns = class {
|
|
5282
5282
|
|
5283
5283
|
//#endregion
|
5284
5284
|
//#region src/common/location-calculator.ts
|
5285
|
-
var import_sortedLastIndex = __toESM(require_sortedLastIndex()
|
5285
|
+
var import_sortedLastIndex = __toESM(require_sortedLastIndex());
|
5286
5286
|
/**
|
5287
5287
|
* Location calculators.
|
5288
5288
|
*
|
@@ -5374,7 +5374,7 @@ var LocationCalculatorForHtml = class LocationCalculatorForHtml extends LinesAnd
|
|
5374
5374
|
|
5375
5375
|
//#endregion
|
5376
5376
|
//#region src/template/intermediate-tokenizer.ts
|
5377
|
-
var import_last$1 = __toESM(require_last()
|
5377
|
+
var import_last$1 = __toESM(require_last());
|
5378
5378
|
const DUMMY_PARENT$1 = Object.freeze({});
|
5379
5379
|
/**
|
5380
5380
|
* Concatenate token values.
|
@@ -5445,7 +5445,7 @@ var IntermediateTokenizer = class {
|
|
5445
5445
|
this.baseParserOptions = parserOptions;
|
5446
5446
|
this.currentToken = null;
|
5447
5447
|
this.attribute = null;
|
5448
|
-
this.attributeNames = new Set();
|
5448
|
+
this.attributeNames = /* @__PURE__ */ new Set();
|
5449
5449
|
this.expressionStartToken = null;
|
5450
5450
|
this.expressionTokens = [];
|
5451
5451
|
this.tokens = [];
|
@@ -5897,7 +5897,7 @@ function fixFromVineTemplateRoot(root$10, fixCtx) {
|
|
5897
5897
|
}
|
5898
5898
|
function extractForVineTemplate(ast) {
|
5899
5899
|
const extractVineTemplateResult = [];
|
5900
|
-
const extractedTemplateNodes = new WeakSet();
|
5900
|
+
const extractedTemplateNodes = /* @__PURE__ */ new WeakSet();
|
5901
5901
|
try {
|
5902
5902
|
simpleTraverse(ast, { enter(node, parent) {
|
5903
5903
|
if (node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "vine") {
|
@@ -6176,13 +6176,13 @@ const SVG_TAGS = new Set([
|
|
6176
6176
|
/**
|
6177
6177
|
* The map from lowercase names to actual names in SVG.
|
6178
6178
|
*/
|
6179
|
-
const SVG_ELEMENT_NAME_MAP = new Map();
|
6179
|
+
const SVG_ELEMENT_NAME_MAP = /* @__PURE__ */ new Map();
|
6180
6180
|
for (const name$1 of SVG_TAGS) if (/[A-Z]/.test(name$1)) SVG_ELEMENT_NAME_MAP.set(name$1.toLowerCase(), name$1);
|
6181
6181
|
|
6182
6182
|
//#endregion
|
6183
6183
|
//#region src/template/parser.ts
|
6184
|
-
var import_findLastIndex = __toESM(require_findLastIndex()
|
6185
|
-
var import_last = __toESM(require_last()
|
6184
|
+
var import_findLastIndex = __toESM(require_findLastIndex());
|
6185
|
+
var import_last = __toESM(require_last());
|
6186
6186
|
const DIRECTIVE_NAME = /^(?:v-|[.:@#]).*[^.:@#]$/u;
|
6187
6187
|
const DT_DD = /^d[dt]$/u;
|
6188
6188
|
const DUMMY_PARENT = Object.freeze({});
|
@@ -10465,7 +10465,7 @@ function finalProcessForTSFileAST(bindVineTemplateESTree, tsFileAST, templateInf
|
|
10465
10465
|
}
|
10466
10466
|
function runParse(code, parserOptions) {
|
10467
10467
|
const { ast: tsESLintAST, scopeManager, services: tsESLintParserServices, visitorKeys: tsESLintVisitorKeys } = typescriptBasicESLintParse(code, parserOptions);
|
10468
|
-
const offsetFixedTokenSet = new WeakSet();
|
10468
|
+
const offsetFixedTokenSet = /* @__PURE__ */ new WeakSet();
|
10469
10469
|
const prepareResults = prepareForTemplateRootAST(tsESLintAST);
|
10470
10470
|
for (const prepareResult of prepareResults) {
|
10471
10471
|
const { bindVineTemplateESTree, templatePositionInfo, templateRawContent } = prepareResult;
|
@@ -10511,7 +10511,8 @@ function parseForESLint(code, parserOptions) {
|
|
10511
10511
|
comment: true,
|
10512
10512
|
loc: true,
|
10513
10513
|
range: true,
|
10514
|
-
tokens: true
|
10514
|
+
tokens: true,
|
10515
|
+
ecmaVersion: "latest"
|
10515
10516
|
}, parserOptions || {});
|
10516
10517
|
const { ast, services, scopeManager, visitorKeys } = runParse(code, options);
|
10517
10518
|
return {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vue-vine/eslint-parser",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.2",
|
5
5
|
"description": "ESLint parser for Vue Vine",
|
6
6
|
"author": "ShenQingchuan",
|
7
7
|
"license": "MIT",
|
@@ -29,30 +29,29 @@
|
|
29
29
|
"dist"
|
30
30
|
],
|
31
31
|
"dependencies": {
|
32
|
-
"@typescript-eslint/parser": "~8.
|
33
|
-
"@typescript-eslint/scope-manager": "~8.
|
34
|
-
"@typescript-eslint/typescript-estree": "~8.
|
35
|
-
"debug": "^4.4.
|
32
|
+
"@typescript-eslint/parser": "~8.32.1",
|
33
|
+
"@typescript-eslint/scope-manager": "~8.32.1",
|
34
|
+
"@typescript-eslint/typescript-estree": "~8.32.1",
|
35
|
+
"debug": "^4.4.1",
|
36
36
|
"eslint-scope": "^8.3.0",
|
37
37
|
"espree": "^10.3.0",
|
38
38
|
"line-column": "^1.0.2",
|
39
|
-
"semver": "^7.7.
|
39
|
+
"semver": "^7.7.2"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"@types/debug": "^4.1.12",
|
43
43
|
"@types/estree": "^1.0.7",
|
44
44
|
"@types/line-column": "^1.0.2",
|
45
|
-
"@types/lodash": "^4.17.
|
46
|
-
"@types/node": "^22.15.
|
45
|
+
"@types/lodash": "^4.17.17",
|
46
|
+
"@types/node": "^22.15.21",
|
47
47
|
"@types/semver": "^7.7.0",
|
48
|
-
"@typescript-eslint/types": "~8.
|
49
|
-
"eslint": "~9.
|
48
|
+
"@typescript-eslint/types": "~8.33.0",
|
49
|
+
"eslint": "~9.27.0",
|
50
50
|
"eslint-visitor-keys": "^4.2.0",
|
51
51
|
"lodash": "^4.17.21"
|
52
52
|
},
|
53
53
|
"scripts": {
|
54
54
|
"test": "vitest",
|
55
|
-
"test:dev": "vitest",
|
56
55
|
"typecheck": "tsc --noEmit"
|
57
56
|
}
|
58
57
|
}
|