astro-eslint-parser 1.1.0 → 1.2.1

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.mts CHANGED
@@ -314,7 +314,7 @@ declare class ParseError extends SyntaxError {
314
314
  }
315
315
 
316
316
  var name = "astro-eslint-parser";
317
- var version = "1.1.0";
317
+ var version = "1.2.1";
318
318
 
319
319
  declare const meta_name: typeof name;
320
320
  declare const meta_version: typeof version;
package/lib/index.d.ts CHANGED
@@ -314,7 +314,7 @@ declare class ParseError extends SyntaxError {
314
314
  }
315
315
 
316
316
  var name = "astro-eslint-parser";
317
- var version = "1.1.0";
317
+ var version = "1.2.1";
318
318
 
319
319
  declare const meta_name: typeof name;
320
320
  declare const meta_version: typeof version;
package/lib/index.js CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  AST: () => ast_exports,
34
34
  ParseError: () => ParseError,
35
35
  VisitorKeys: () => VisitorKeys,
@@ -39,7 +39,7 @@ __export(src_exports, {
39
39
  parseTemplate: () => parseTemplate2,
40
40
  traverseNodes: () => traverseNodes
41
41
  });
42
- module.exports = __toCommonJS(src_exports);
42
+ module.exports = __toCommonJS(index_exports);
43
43
 
44
44
  // src/visitor-keys.ts
45
45
  var import_eslint_visitor_keys = require("eslint-visitor-keys");
@@ -132,7 +132,7 @@ var TSService = class {
132
132
  }
133
133
  createWatch(tsconfigPath) {
134
134
  const { ts } = this;
135
- const createAbstractBuilder = (...args) => {
135
+ const createAbstractBuilder = (...buildArgs) => {
136
136
  const [
137
137
  rootNames,
138
138
  options,
@@ -140,7 +140,7 @@ var TSService = class {
140
140
  oldProgram,
141
141
  configFileParsingDiagnostics,
142
142
  projectReferences
143
- ] = args;
143
+ ] = buildArgs;
144
144
  const host = argHost;
145
145
  if (!this.patchedHostSet.has(host)) {
146
146
  this.patchedHostSet.add(host);
@@ -161,22 +161,22 @@ var TSService = class {
161
161
  getSourceFile: host.getSourceFile,
162
162
  getSourceFileByPath: host.getSourceFileByPath
163
163
  };
164
- host.getSourceFile = (fileName, languageVersionOrOptions, ...args2) => {
164
+ host.getSourceFile = (fileName, languageVersionOrOptions, ...args) => {
165
165
  const originalSourceFile = original2.getSourceFile.call(
166
166
  host,
167
167
  fileName,
168
168
  languageVersionOrOptions,
169
- ...args2
169
+ ...args
170
170
  );
171
171
  return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
172
172
  };
173
- host.getSourceFileByPath = (fileName, path7, languageVersionOrOptions, ...args2) => {
173
+ host.getSourceFileByPath = (fileName, filePath, languageVersionOrOptions, ...args) => {
174
174
  const originalSourceFile = original2.getSourceFileByPath.call(
175
175
  host,
176
176
  fileName,
177
- path7,
177
+ filePath,
178
178
  languageVersionOrOptions,
179
- ...args2
179
+ ...args
180
180
  );
181
181
  return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
182
182
  };
@@ -278,7 +278,7 @@ function toAbsolutePath(filePath, baseDir) {
278
278
  }
279
279
 
280
280
  // src/parser/ts-for-v5/resolve-project-list.ts
281
- var import_globby = require("globby");
281
+ var import_fast_glob = require("fast-glob");
282
282
  var import_is_glob = __toESM(require("is-glob"));
283
283
  var path3 = __toESM(require("path"));
284
284
  var import_module = require("module");
@@ -308,7 +308,7 @@ function resolveProjectList(options) {
308
308
  const globProjects = sanitizedProjects.filter((project) => (0, import_is_glob.default)(project));
309
309
  const uniqueCanonicalProjectPaths = new Set(
310
310
  nonGlobProjects.concat(
311
- globProjects.length === 0 ? [] : (0, import_globby.sync)([...globProjects, ...projectFolderIgnoreList], {
311
+ globProjects.length === 0 ? [] : (0, import_fast_glob.sync)([...globProjects, ...projectFolderIgnoreList], {
312
312
  cwd: options.tsconfigRootDir
313
313
  })
314
314
  ).map(
@@ -327,7 +327,7 @@ function correctPathCasing(filePath) {
327
327
  path3.join(process.cwd(), "__placeholder__.js")
328
328
  )("typescript");
329
329
  const useCaseSensitiveFileNames = ts.sys !== void 0 ? ts.sys.useCaseSensitiveFileNames : true;
330
- _correctPathCasing = useCaseSensitiveFileNames ? (filePath2) => filePath2 : (filePath2) => filePath2.toLowerCase();
330
+ _correctPathCasing = useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase();
331
331
  }
332
332
  return _correctPathCasing(filePath);
333
333
  }
@@ -610,31 +610,31 @@ function getProgramScope(scopeManager) {
610
610
  return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
611
611
  }
612
612
  function removeAllScopeAndVariableAndReference(target, info) {
613
- const targetScopes = /* @__PURE__ */ new Set();
613
+ const removeTargetScopes = /* @__PURE__ */ new Set();
614
614
  traverseNodes(target, {
615
615
  visitorKeys: info.visitorKeys,
616
616
  enterNode(node) {
617
617
  const scope = info.scopeManager.acquire(node);
618
618
  if (scope) {
619
- targetScopes.add(scope);
619
+ removeTargetScopes.add(scope);
620
620
  return;
621
621
  }
622
- if (node.type === "Identifier") {
623
- let scope2 = getInnermostScopeFromNode(info.scopeManager, node);
624
- while (scope2 && scope2.block.type !== "Program" && target.range[0] <= scope2.block.range[0] && scope2.block.range[1] <= target.range[1]) {
625
- scope2 = scope2.upper;
622
+ if (node.type === "Identifier" || node.type === "JSXIdentifier") {
623
+ let targetScope = getInnermostScopeFromNode(info.scopeManager, node);
624
+ while (targetScope && targetScope.block.type !== "Program" && target.range[0] <= targetScope.block.range[0] && targetScope.block.range[1] <= target.range[1]) {
625
+ targetScope = targetScope.upper;
626
626
  }
627
- if (targetScopes.has(scope2)) {
627
+ if (removeTargetScopes.has(targetScope)) {
628
628
  return;
629
629
  }
630
- removeIdentifierVariable(node, scope2);
631
- removeIdentifierReference(node, scope2);
630
+ removeIdentifierVariable(node, targetScope);
631
+ removeIdentifierReference(node, targetScope);
632
632
  }
633
633
  },
634
634
  leaveNode() {
635
635
  }
636
636
  });
637
- for (const scope of targetScopes) {
637
+ for (const scope of removeTargetScopes) {
638
638
  removeScope(info.scopeManager, scope);
639
639
  }
640
640
  }
@@ -892,7 +892,7 @@ function parseScriptInternal(code, _ctx, parserOptionsCtx) {
892
892
  "`astro-eslint-parser` does not support the `projectService` option, it will parse it as `project: true` instead."
893
893
  );
894
894
  patchResult = tsPatch(
895
- { ...parserOptions, project: true },
895
+ { ...parserOptions, project: true, projectService: void 0 },
896
896
  parserOptionsCtx.getTSParserName()
897
897
  );
898
898
  }
@@ -996,7 +996,7 @@ function sort(tokens) {
996
996
  var import_types2 = require("@typescript-eslint/types");
997
997
 
998
998
  // src/astro/index.ts
999
- var import_decode = require("entities/lib/decode.js");
999
+ var import_decode = require("entities/decode");
1000
1000
 
1001
1001
  // src/errors.ts
1002
1002
  var ParseError = class extends SyntaxError {
@@ -1919,6 +1919,10 @@ function processTemplate(ctx, resultTemplate) {
1919
1919
  (scriptNode, context) => {
1920
1920
  const parent2 = context.getParent(scriptNode);
1921
1921
  if (scriptNode.range[0] === offset && scriptNode.type === import_types2.AST_NODE_TYPES.JSXClosingElement && parent2.type === import_types2.AST_NODE_TYPES.JSXElement) {
1922
+ removeAllScopeAndVariableAndReference(scriptNode, {
1923
+ visitorKeys: context.result.visitorKeys,
1924
+ scopeManager: context.result.scopeManager
1925
+ });
1922
1926
  parent2.closingElement = null;
1923
1927
  return true;
1924
1928
  }
@@ -2818,7 +2822,7 @@ __export(meta_exports, {
2818
2822
 
2819
2823
  // package.json
2820
2824
  var name = "astro-eslint-parser";
2821
- var version = "1.1.0";
2825
+ var version = "1.2.1";
2822
2826
 
2823
2827
  // src/index.ts
2824
2828
  function parseForESLint2(code, options) {
package/lib/index.mjs CHANGED
@@ -101,7 +101,7 @@ var TSService = class {
101
101
  }
102
102
  createWatch(tsconfigPath) {
103
103
  const { ts } = this;
104
- const createAbstractBuilder = (...args) => {
104
+ const createAbstractBuilder = (...buildArgs) => {
105
105
  const [
106
106
  rootNames,
107
107
  options,
@@ -109,7 +109,7 @@ var TSService = class {
109
109
  oldProgram,
110
110
  configFileParsingDiagnostics,
111
111
  projectReferences
112
- ] = args;
112
+ ] = buildArgs;
113
113
  const host = argHost;
114
114
  if (!this.patchedHostSet.has(host)) {
115
115
  this.patchedHostSet.add(host);
@@ -130,22 +130,22 @@ var TSService = class {
130
130
  getSourceFile: host.getSourceFile,
131
131
  getSourceFileByPath: host.getSourceFileByPath
132
132
  };
133
- host.getSourceFile = (fileName, languageVersionOrOptions, ...args2) => {
133
+ host.getSourceFile = (fileName, languageVersionOrOptions, ...args) => {
134
134
  const originalSourceFile = original2.getSourceFile.call(
135
135
  host,
136
136
  fileName,
137
137
  languageVersionOrOptions,
138
- ...args2
138
+ ...args
139
139
  );
140
140
  return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
141
141
  };
142
- host.getSourceFileByPath = (fileName, path7, languageVersionOrOptions, ...args2) => {
142
+ host.getSourceFileByPath = (fileName, filePath, languageVersionOrOptions, ...args) => {
143
143
  const originalSourceFile = original2.getSourceFileByPath.call(
144
144
  host,
145
145
  fileName,
146
- path7,
146
+ filePath,
147
147
  languageVersionOrOptions,
148
- ...args2
148
+ ...args
149
149
  );
150
150
  return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
151
151
  };
@@ -247,7 +247,7 @@ function toAbsolutePath(filePath, baseDir) {
247
247
  }
248
248
 
249
249
  // src/parser/ts-for-v5/resolve-project-list.ts
250
- import { sync as globSync } from "globby";
250
+ import { sync as globSync } from "fast-glob";
251
251
  import isGlob from "is-glob";
252
252
  import * as path3 from "path";
253
253
  import { createRequire } from "module";
@@ -296,7 +296,7 @@ function correctPathCasing(filePath) {
296
296
  path3.join(process.cwd(), "__placeholder__.js")
297
297
  )("typescript");
298
298
  const useCaseSensitiveFileNames = ts.sys !== void 0 ? ts.sys.useCaseSensitiveFileNames : true;
299
- _correctPathCasing = useCaseSensitiveFileNames ? (filePath2) => filePath2 : (filePath2) => filePath2.toLowerCase();
299
+ _correctPathCasing = useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase();
300
300
  }
301
301
  return _correctPathCasing(filePath);
302
302
  }
@@ -588,31 +588,31 @@ function getProgramScope(scopeManager) {
588
588
  return globalScope.childScopes.find((s) => s.type === "module") || globalScope;
589
589
  }
590
590
  function removeAllScopeAndVariableAndReference(target, info) {
591
- const targetScopes = /* @__PURE__ */ new Set();
591
+ const removeTargetScopes = /* @__PURE__ */ new Set();
592
592
  traverseNodes(target, {
593
593
  visitorKeys: info.visitorKeys,
594
594
  enterNode(node) {
595
595
  const scope = info.scopeManager.acquire(node);
596
596
  if (scope) {
597
- targetScopes.add(scope);
597
+ removeTargetScopes.add(scope);
598
598
  return;
599
599
  }
600
- if (node.type === "Identifier") {
601
- let scope2 = getInnermostScopeFromNode(info.scopeManager, node);
602
- while (scope2 && scope2.block.type !== "Program" && target.range[0] <= scope2.block.range[0] && scope2.block.range[1] <= target.range[1]) {
603
- scope2 = scope2.upper;
600
+ if (node.type === "Identifier" || node.type === "JSXIdentifier") {
601
+ let targetScope = getInnermostScopeFromNode(info.scopeManager, node);
602
+ while (targetScope && targetScope.block.type !== "Program" && target.range[0] <= targetScope.block.range[0] && targetScope.block.range[1] <= target.range[1]) {
603
+ targetScope = targetScope.upper;
604
604
  }
605
- if (targetScopes.has(scope2)) {
605
+ if (removeTargetScopes.has(targetScope)) {
606
606
  return;
607
607
  }
608
- removeIdentifierVariable(node, scope2);
609
- removeIdentifierReference(node, scope2);
608
+ removeIdentifierVariable(node, targetScope);
609
+ removeIdentifierReference(node, targetScope);
610
610
  }
611
611
  },
612
612
  leaveNode() {
613
613
  }
614
614
  });
615
- for (const scope of targetScopes) {
615
+ for (const scope of removeTargetScopes) {
616
616
  removeScope(info.scopeManager, scope);
617
617
  }
618
618
  }
@@ -870,7 +870,7 @@ function parseScriptInternal(code, _ctx, parserOptionsCtx) {
870
870
  "`astro-eslint-parser` does not support the `projectService` option, it will parse it as `project: true` instead."
871
871
  );
872
872
  patchResult = tsPatch(
873
- { ...parserOptions, project: true },
873
+ { ...parserOptions, project: true, projectService: void 0 },
874
874
  parserOptionsCtx.getTSParserName()
875
875
  );
876
876
  }
@@ -974,11 +974,7 @@ function sort(tokens) {
974
974
  import { AST_TOKEN_TYPES, AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/types";
975
975
 
976
976
  // src/astro/index.ts
977
- import {
978
- EntityDecoder,
979
- DecodingMode,
980
- htmlDecodeTree
981
- } from "entities/lib/decode.js";
977
+ import { EntityDecoder, DecodingMode, htmlDecodeTree } from "entities/decode";
982
978
 
983
979
  // src/errors.ts
984
980
  var ParseError = class extends SyntaxError {
@@ -1901,6 +1897,10 @@ function processTemplate(ctx, resultTemplate) {
1901
1897
  (scriptNode, context) => {
1902
1898
  const parent2 = context.getParent(scriptNode);
1903
1899
  if (scriptNode.range[0] === offset && scriptNode.type === AST_NODE_TYPES2.JSXClosingElement && parent2.type === AST_NODE_TYPES2.JSXElement) {
1900
+ removeAllScopeAndVariableAndReference(scriptNode, {
1901
+ visitorKeys: context.result.visitorKeys,
1902
+ scopeManager: context.result.scopeManager
1903
+ });
1904
1904
  parent2.closingElement = null;
1905
1905
  return true;
1906
1906
  }
@@ -2800,7 +2800,7 @@ __export(meta_exports, {
2800
2800
 
2801
2801
  // package.json
2802
2802
  var name = "astro-eslint-parser";
2803
- var version = "1.1.0";
2803
+ var version = "1.2.1";
2804
2804
 
2805
2805
  // src/index.ts
2806
2806
  function parseForESLint2(code, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-eslint-parser",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Astro component parser for ESLint",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
@@ -15,7 +15,7 @@
15
15
  "build": "npm run build:tsup",
16
16
  "build:tsup": "tsup",
17
17
  "clean": "rimraf .nyc_output lib coverage",
18
- "lint": "eslint . --ext .js,.ts,.json,.astro,.svelte",
18
+ "lint": "eslint .",
19
19
  "eslint-fix": "npm run lint -- --fix",
20
20
  "test": "npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
21
21
  "cover": "nyc --reporter=lcov npm run test",
@@ -51,21 +51,21 @@
51
51
  "@astrojs/compiler": "^2.0.0",
52
52
  "@typescript-eslint/scope-manager": "^7.0.0 || ^8.0.0",
53
53
  "@typescript-eslint/types": "^7.0.0 || ^8.0.0",
54
- "@typescript-eslint/typescript-estree": "^7.0.0 || ^8.0.0",
55
54
  "astrojs-compiler-sync": "^1.0.0",
56
55
  "debug": "^4.3.4",
57
- "entities": "^4.5.0",
56
+ "entities": "^6.0.0",
58
57
  "eslint-scope": "^8.0.1",
59
58
  "eslint-visitor-keys": "^4.0.0",
60
59
  "espree": "^10.0.0",
61
- "globby": "^11.1.0",
60
+ "fast-glob": "^3.3.3",
62
61
  "is-glob": "^4.0.3",
63
62
  "semver": "^7.3.8"
64
63
  },
65
64
  "devDependencies": {
66
65
  "@changesets/changelog-github": "^0.5.0",
67
66
  "@changesets/cli": "^2.24.2",
68
- "@ota-meshi/eslint-plugin": "^0.15.0",
67
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
68
+ "@ota-meshi/eslint-plugin": "^0.17.6",
69
69
  "@types/benchmark": "^2.1.1",
70
70
  "@types/chai": "^5.0.0",
71
71
  "@types/debug": "^4.1.7",
@@ -76,20 +76,22 @@
76
76
  "@types/mocha": "^10.0.0",
77
77
  "@types/node": "^22.0.0",
78
78
  "@types/semver": "^7.3.9",
79
- "@typescript-eslint/eslint-plugin": "^8.0.0",
80
- "@typescript-eslint/parser": "^8.0.0",
81
- "astro": "^4.0.0",
79
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
80
+ "@typescript-eslint/parser": "^8.21.0",
81
+ "@typescript-eslint/typescript-estree": "^8.21.0",
82
+ "astro": "^5.0.0",
82
83
  "astro-eslint-parser": ">=0.1.0",
83
84
  "benchmark": "^2.1.4",
84
85
  "chai": "^5.0.0",
85
86
  "env-cmd": "^10.1.0",
86
87
  "esbuild": "^0.24.0",
87
88
  "esbuild-register": "^3.3.3",
88
- "eslint": "^8.15.0",
89
- "eslint-config-prettier": "^9.0.0",
89
+ "eslint": "^9.19.0",
90
+ "eslint-config-prettier": "^10.0.0",
90
91
  "eslint-formatter-codeframe": "^7.32.1",
91
92
  "eslint-plugin-astro": "^1.0.0",
92
93
  "eslint-plugin-eslint-comments": "^3.2.0",
94
+ "eslint-plugin-jsdoc": "^50.6.3",
93
95
  "eslint-plugin-json-schema-validator": "^5.0.0",
94
96
  "eslint-plugin-jsonc": "^2.0.0",
95
97
  "eslint-plugin-jsx-a11y": "^6.5.1",
@@ -99,21 +101,22 @@
99
101
  "eslint-plugin-react": "^7.29.4",
100
102
  "eslint-plugin-regexp": "^2.0.0",
101
103
  "eslint-plugin-simple-import-sort": "^12.0.0",
102
- "eslint-plugin-svelte": "^2.0.0",
104
+ "eslint-plugin-svelte": "^3.0.0-0",
103
105
  "estree-walker": "^3.0.0",
104
106
  "globals": "^15.0.0",
105
107
  "locate-character": "^3.0.0",
106
108
  "magic-string": "^0.30.0",
107
- "mocha": "^10.0.0",
109
+ "mocha": "^11.0.0",
108
110
  "mocha-chai-jest-snapshot": "^1.1.3",
109
111
  "nyc": "^17.0.0",
110
112
  "prettier": "^3.0.0",
111
113
  "prettier-plugin-astro": "^0.14.0",
112
114
  "prettier-plugin-svelte": "^3.0.0",
113
115
  "string-replace-loader": "^3.0.3",
114
- "svelte": "^4.0.0",
116
+ "svelte": "^5.19.3",
115
117
  "tsup": "^8.0.0",
116
- "typescript": "~5.6.0",
118
+ "typescript": "~5.7.0",
119
+ "typescript-eslint": "^8.21.0",
117
120
  "typescript-eslint-parser-for-extra-files": "^0.7.0"
118
121
  },
119
122
  "publishConfig": {