astro-eslint-parser 0.13.2 → 0.13.3
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.js +17 -3
- package/lib/index.mjs +17 -3
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -2180,6 +2180,8 @@ var import_scope_manager2 = require("@typescript-eslint/scope-manager");
|
|
|
2180
2180
|
var READ_FLAG = 1;
|
|
2181
2181
|
var WRITE_FLAG = 2;
|
|
2182
2182
|
var READ_WRITE_FLAG = 3;
|
|
2183
|
+
var REFERENCE_TYPE_VALUE_FLAG = 1;
|
|
2184
|
+
var REFERENCE_TYPE_TYPE_FLAG = 2;
|
|
2183
2185
|
function getProgramScope(scopeManager) {
|
|
2184
2186
|
const globalScope = scopeManager.globalScope;
|
|
2185
2187
|
return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
|
|
@@ -2213,15 +2215,25 @@ function removeAllScopeAndVariableAndReference(target, info) {
|
|
|
2213
2215
|
removeScope(info.scopeManager, scope);
|
|
2214
2216
|
}
|
|
2215
2217
|
}
|
|
2216
|
-
function addVirtualReference(node, variable, scope,
|
|
2218
|
+
function addVirtualReference(node, variable, scope, status) {
|
|
2217
2219
|
const reference = new import_scope_manager2.Reference(
|
|
2218
2220
|
node,
|
|
2219
2221
|
scope,
|
|
2220
|
-
|
|
2222
|
+
status.write && status.read ? READ_WRITE_FLAG : status.write ? WRITE_FLAG : READ_FLAG,
|
|
2223
|
+
void 0,
|
|
2224
|
+
// writeExpr
|
|
2225
|
+
void 0,
|
|
2226
|
+
// maybeImplicitGlobal
|
|
2227
|
+
void 0,
|
|
2228
|
+
// init
|
|
2229
|
+
status.typeRef ? REFERENCE_TYPE_TYPE_FLAG : REFERENCE_TYPE_VALUE_FLAG
|
|
2221
2230
|
);
|
|
2222
2231
|
reference.astroVirtualReference = true;
|
|
2223
2232
|
addReference(variable.references, reference);
|
|
2224
2233
|
reference.resolved = variable;
|
|
2234
|
+
if (status.forceUsed) {
|
|
2235
|
+
variable.eslintUsed = true;
|
|
2236
|
+
}
|
|
2225
2237
|
return reference;
|
|
2226
2238
|
}
|
|
2227
2239
|
function addGlobalVariable(reference, scopeManager) {
|
|
@@ -2443,7 +2455,9 @@ function parseForESLint(code, options) {
|
|
|
2443
2455
|
propsVariable,
|
|
2444
2456
|
scope,
|
|
2445
2457
|
{
|
|
2446
|
-
read: true
|
|
2458
|
+
read: true,
|
|
2459
|
+
typeRef: true,
|
|
2460
|
+
forceUsed: true
|
|
2447
2461
|
}
|
|
2448
2462
|
);
|
|
2449
2463
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -2149,6 +2149,8 @@ import {
|
|
|
2149
2149
|
var READ_FLAG = 1;
|
|
2150
2150
|
var WRITE_FLAG = 2;
|
|
2151
2151
|
var READ_WRITE_FLAG = 3;
|
|
2152
|
+
var REFERENCE_TYPE_VALUE_FLAG = 1;
|
|
2153
|
+
var REFERENCE_TYPE_TYPE_FLAG = 2;
|
|
2152
2154
|
function getProgramScope(scopeManager) {
|
|
2153
2155
|
const globalScope = scopeManager.globalScope;
|
|
2154
2156
|
return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
|
|
@@ -2182,15 +2184,25 @@ function removeAllScopeAndVariableAndReference(target, info) {
|
|
|
2182
2184
|
removeScope(info.scopeManager, scope);
|
|
2183
2185
|
}
|
|
2184
2186
|
}
|
|
2185
|
-
function addVirtualReference(node, variable, scope,
|
|
2187
|
+
function addVirtualReference(node, variable, scope, status) {
|
|
2186
2188
|
const reference = new ReferenceClass(
|
|
2187
2189
|
node,
|
|
2188
2190
|
scope,
|
|
2189
|
-
|
|
2191
|
+
status.write && status.read ? READ_WRITE_FLAG : status.write ? WRITE_FLAG : READ_FLAG,
|
|
2192
|
+
void 0,
|
|
2193
|
+
// writeExpr
|
|
2194
|
+
void 0,
|
|
2195
|
+
// maybeImplicitGlobal
|
|
2196
|
+
void 0,
|
|
2197
|
+
// init
|
|
2198
|
+
status.typeRef ? REFERENCE_TYPE_TYPE_FLAG : REFERENCE_TYPE_VALUE_FLAG
|
|
2190
2199
|
);
|
|
2191
2200
|
reference.astroVirtualReference = true;
|
|
2192
2201
|
addReference(variable.references, reference);
|
|
2193
2202
|
reference.resolved = variable;
|
|
2203
|
+
if (status.forceUsed) {
|
|
2204
|
+
variable.eslintUsed = true;
|
|
2205
|
+
}
|
|
2194
2206
|
return reference;
|
|
2195
2207
|
}
|
|
2196
2208
|
function addGlobalVariable(reference, scopeManager) {
|
|
@@ -2412,7 +2424,9 @@ function parseForESLint(code, options) {
|
|
|
2412
2424
|
propsVariable,
|
|
2413
2425
|
scope,
|
|
2414
2426
|
{
|
|
2415
|
-
read: true
|
|
2427
|
+
read: true,
|
|
2428
|
+
typeRef: true,
|
|
2429
|
+
forceUsed: true
|
|
2416
2430
|
}
|
|
2417
2431
|
);
|
|
2418
2432
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-eslint-parser",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Astro component parser for ESLint",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@types/mocha": "^10.0.0",
|
|
70
70
|
"@types/node": "^18.0.0",
|
|
71
71
|
"@types/semver": "^7.3.9",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
73
|
-
"@typescript-eslint/parser": "~5.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "~5.57.0",
|
|
73
|
+
"@typescript-eslint/parser": "~5.57.0",
|
|
74
74
|
"astro": "^2.0.0",
|
|
75
75
|
"astro-eslint-parser": ">=0.1.0",
|
|
76
76
|
"benchmark": "^2.1.4",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"svelte": "^3.48.0",
|
|
107
107
|
"tsup": "^6.2.3",
|
|
108
108
|
"typescript": "~5.0.0",
|
|
109
|
-
"typescript-eslint-parser-for-extra-files": "^0.
|
|
109
|
+
"typescript-eslint-parser-for-extra-files": "^0.3.0"
|
|
110
110
|
},
|
|
111
111
|
"publishConfig": {
|
|
112
112
|
"access": "public"
|