astro-eslint-parser 0.13.2 → 0.14.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/lib/index.d.ts +13 -2
- package/lib/index.js +30 -4
- package/lib/index.mjs +34 -4
- package/package.json +6 -5
package/lib/index.d.ts
CHANGED
|
@@ -349,11 +349,22 @@ declare class ParseError extends SyntaxError {
|
|
|
349
349
|
}, ctx: Context);
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
var name = "astro-eslint-parser";
|
|
353
|
+
var version = "0.14.0";
|
|
354
|
+
|
|
355
|
+
declare const meta_name: typeof name;
|
|
356
|
+
declare const meta_version: typeof version;
|
|
357
|
+
declare namespace meta {
|
|
358
|
+
export {
|
|
359
|
+
meta_name as name,
|
|
360
|
+
meta_version as version,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
353
364
|
/**
|
|
354
365
|
* Parse source code
|
|
355
366
|
*/
|
|
356
367
|
declare function parseForESLint(code: string, options?: any): ReturnType<typeof parseForESLint$1>;
|
|
357
368
|
declare const VisitorKeys: eslint.SourceCode.VisitorKeys;
|
|
358
369
|
|
|
359
|
-
export { index as AST, ParseError, ParseTemplateResult, VisitorKeys, name, parseForESLint, parseTemplate, traverseNodes };
|
|
370
|
+
export { index as AST, ParseError, ParseTemplateResult, VisitorKeys, meta, name, parseForESLint, parseTemplate, traverseNodes };
|
package/lib/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
AST: () => ast_exports,
|
|
34
34
|
ParseError: () => ParseError,
|
|
35
35
|
VisitorKeys: () => VisitorKeys,
|
|
36
|
+
meta: () => meta_exports,
|
|
36
37
|
name: () => name,
|
|
37
38
|
parseForESLint: () => parseForESLint2,
|
|
38
39
|
parseTemplate: () => parseTemplate2,
|
|
@@ -2180,6 +2181,8 @@ var import_scope_manager2 = require("@typescript-eslint/scope-manager");
|
|
|
2180
2181
|
var READ_FLAG = 1;
|
|
2181
2182
|
var WRITE_FLAG = 2;
|
|
2182
2183
|
var READ_WRITE_FLAG = 3;
|
|
2184
|
+
var REFERENCE_TYPE_VALUE_FLAG = 1;
|
|
2185
|
+
var REFERENCE_TYPE_TYPE_FLAG = 2;
|
|
2183
2186
|
function getProgramScope(scopeManager) {
|
|
2184
2187
|
const globalScope = scopeManager.globalScope;
|
|
2185
2188
|
return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
|
|
@@ -2213,15 +2216,25 @@ function removeAllScopeAndVariableAndReference(target, info) {
|
|
|
2213
2216
|
removeScope(info.scopeManager, scope);
|
|
2214
2217
|
}
|
|
2215
2218
|
}
|
|
2216
|
-
function addVirtualReference(node, variable, scope,
|
|
2219
|
+
function addVirtualReference(node, variable, scope, status) {
|
|
2217
2220
|
const reference = new import_scope_manager2.Reference(
|
|
2218
2221
|
node,
|
|
2219
2222
|
scope,
|
|
2220
|
-
|
|
2223
|
+
status.write && status.read ? READ_WRITE_FLAG : status.write ? WRITE_FLAG : READ_FLAG,
|
|
2224
|
+
void 0,
|
|
2225
|
+
// writeExpr
|
|
2226
|
+
void 0,
|
|
2227
|
+
// maybeImplicitGlobal
|
|
2228
|
+
void 0,
|
|
2229
|
+
// init
|
|
2230
|
+
status.typeRef ? REFERENCE_TYPE_TYPE_FLAG : REFERENCE_TYPE_VALUE_FLAG
|
|
2221
2231
|
);
|
|
2222
2232
|
reference.astroVirtualReference = true;
|
|
2223
2233
|
addReference(variable.references, reference);
|
|
2224
2234
|
reference.resolved = variable;
|
|
2235
|
+
if (status.forceUsed) {
|
|
2236
|
+
variable.eslintUsed = true;
|
|
2237
|
+
}
|
|
2225
2238
|
return reference;
|
|
2226
2239
|
}
|
|
2227
2240
|
function addGlobalVariable(reference, scopeManager) {
|
|
@@ -2443,7 +2456,9 @@ function parseForESLint(code, options) {
|
|
|
2443
2456
|
propsVariable,
|
|
2444
2457
|
scope,
|
|
2445
2458
|
{
|
|
2446
|
-
read: true
|
|
2459
|
+
read: true,
|
|
2460
|
+
typeRef: true,
|
|
2461
|
+
forceUsed: true
|
|
2447
2462
|
}
|
|
2448
2463
|
);
|
|
2449
2464
|
}
|
|
@@ -2537,8 +2552,18 @@ function parseTemplate2(code) {
|
|
|
2537
2552
|
// src/ast/index.ts
|
|
2538
2553
|
var ast_exports = {};
|
|
2539
2554
|
|
|
2540
|
-
// src/
|
|
2555
|
+
// src/meta.ts
|
|
2556
|
+
var meta_exports = {};
|
|
2557
|
+
__export(meta_exports, {
|
|
2558
|
+
name: () => name,
|
|
2559
|
+
version: () => version
|
|
2560
|
+
});
|
|
2561
|
+
|
|
2562
|
+
// package.json
|
|
2541
2563
|
var name = "astro-eslint-parser";
|
|
2564
|
+
var version = "0.14.0";
|
|
2565
|
+
|
|
2566
|
+
// src/index.ts
|
|
2542
2567
|
function parseForESLint2(code, options) {
|
|
2543
2568
|
return parseForESLint(code, options);
|
|
2544
2569
|
}
|
|
@@ -2548,6 +2573,7 @@ var VisitorKeys = KEYS;
|
|
|
2548
2573
|
AST,
|
|
2549
2574
|
ParseError,
|
|
2550
2575
|
VisitorKeys,
|
|
2576
|
+
meta,
|
|
2551
2577
|
name,
|
|
2552
2578
|
parseForESLint,
|
|
2553
2579
|
parseTemplate,
|
package/lib/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
1
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
4
|
}) : x)(function(x) {
|
|
@@ -5,6 +6,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
5
6
|
return require.apply(this, arguments);
|
|
6
7
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
7
8
|
});
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name2 in all)
|
|
11
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
12
|
+
};
|
|
8
13
|
|
|
9
14
|
// src/visitor-keys.ts
|
|
10
15
|
import { unionWith } from "eslint-visitor-keys";
|
|
@@ -2149,6 +2154,8 @@ import {
|
|
|
2149
2154
|
var READ_FLAG = 1;
|
|
2150
2155
|
var WRITE_FLAG = 2;
|
|
2151
2156
|
var READ_WRITE_FLAG = 3;
|
|
2157
|
+
var REFERENCE_TYPE_VALUE_FLAG = 1;
|
|
2158
|
+
var REFERENCE_TYPE_TYPE_FLAG = 2;
|
|
2152
2159
|
function getProgramScope(scopeManager) {
|
|
2153
2160
|
const globalScope = scopeManager.globalScope;
|
|
2154
2161
|
return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
|
|
@@ -2182,15 +2189,25 @@ function removeAllScopeAndVariableAndReference(target, info) {
|
|
|
2182
2189
|
removeScope(info.scopeManager, scope);
|
|
2183
2190
|
}
|
|
2184
2191
|
}
|
|
2185
|
-
function addVirtualReference(node, variable, scope,
|
|
2192
|
+
function addVirtualReference(node, variable, scope, status) {
|
|
2186
2193
|
const reference = new ReferenceClass(
|
|
2187
2194
|
node,
|
|
2188
2195
|
scope,
|
|
2189
|
-
|
|
2196
|
+
status.write && status.read ? READ_WRITE_FLAG : status.write ? WRITE_FLAG : READ_FLAG,
|
|
2197
|
+
void 0,
|
|
2198
|
+
// writeExpr
|
|
2199
|
+
void 0,
|
|
2200
|
+
// maybeImplicitGlobal
|
|
2201
|
+
void 0,
|
|
2202
|
+
// init
|
|
2203
|
+
status.typeRef ? REFERENCE_TYPE_TYPE_FLAG : REFERENCE_TYPE_VALUE_FLAG
|
|
2190
2204
|
);
|
|
2191
2205
|
reference.astroVirtualReference = true;
|
|
2192
2206
|
addReference(variable.references, reference);
|
|
2193
2207
|
reference.resolved = variable;
|
|
2208
|
+
if (status.forceUsed) {
|
|
2209
|
+
variable.eslintUsed = true;
|
|
2210
|
+
}
|
|
2194
2211
|
return reference;
|
|
2195
2212
|
}
|
|
2196
2213
|
function addGlobalVariable(reference, scopeManager) {
|
|
@@ -2412,7 +2429,9 @@ function parseForESLint(code, options) {
|
|
|
2412
2429
|
propsVariable,
|
|
2413
2430
|
scope,
|
|
2414
2431
|
{
|
|
2415
|
-
read: true
|
|
2432
|
+
read: true,
|
|
2433
|
+
typeRef: true,
|
|
2434
|
+
forceUsed: true
|
|
2416
2435
|
}
|
|
2417
2436
|
);
|
|
2418
2437
|
}
|
|
@@ -2506,8 +2525,18 @@ function parseTemplate2(code) {
|
|
|
2506
2525
|
// src/ast/index.ts
|
|
2507
2526
|
var ast_exports = {};
|
|
2508
2527
|
|
|
2509
|
-
// src/
|
|
2528
|
+
// src/meta.ts
|
|
2529
|
+
var meta_exports = {};
|
|
2530
|
+
__export(meta_exports, {
|
|
2531
|
+
name: () => name,
|
|
2532
|
+
version: () => version
|
|
2533
|
+
});
|
|
2534
|
+
|
|
2535
|
+
// package.json
|
|
2510
2536
|
var name = "astro-eslint-parser";
|
|
2537
|
+
var version = "0.14.0";
|
|
2538
|
+
|
|
2539
|
+
// src/index.ts
|
|
2511
2540
|
function parseForESLint2(code, options) {
|
|
2512
2541
|
return parseForESLint(code, options);
|
|
2513
2542
|
}
|
|
@@ -2516,6 +2545,7 @@ export {
|
|
|
2516
2545
|
ast_exports as AST,
|
|
2517
2546
|
ParseError,
|
|
2518
2547
|
VisitorKeys,
|
|
2548
|
+
meta_exports as meta,
|
|
2519
2549
|
name,
|
|
2520
2550
|
parseForESLint2 as parseForESLint,
|
|
2521
2551
|
parseTemplate2 as parseTemplate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-eslint-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Astro component parser for ESLint",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"prebuild": "npm run -s clean",
|
|
15
|
-
"build": "tsup",
|
|
15
|
+
"build": "npm run build:tsup",
|
|
16
|
+
"build:tsup": "tsup",
|
|
16
17
|
"clean": "rimraf .nyc_output lib coverage",
|
|
17
18
|
"lint": "eslint . --ext .js,.ts,.json,.astro,.svelte",
|
|
18
19
|
"eslint-fix": "npm run lint -- --fix",
|
|
@@ -69,8 +70,8 @@
|
|
|
69
70
|
"@types/mocha": "^10.0.0",
|
|
70
71
|
"@types/node": "^18.0.0",
|
|
71
72
|
"@types/semver": "^7.3.9",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
73
|
-
"@typescript-eslint/parser": "~5.
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "~5.59.0",
|
|
74
|
+
"@typescript-eslint/parser": "~5.59.0",
|
|
74
75
|
"astro": "^2.0.0",
|
|
75
76
|
"astro-eslint-parser": ">=0.1.0",
|
|
76
77
|
"benchmark": "^2.1.4",
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
"svelte": "^3.48.0",
|
|
107
108
|
"tsup": "^6.2.3",
|
|
108
109
|
"typescript": "~5.0.0",
|
|
109
|
-
"typescript-eslint-parser-for-extra-files": "^0.
|
|
110
|
+
"typescript-eslint-parser-for-extra-files": "^0.4.0"
|
|
110
111
|
},
|
|
111
112
|
"publishConfig": {
|
|
112
113
|
"access": "public"
|