eslint-plugin-svelte 2.19.0 → 2.19.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.
@@ -70,6 +70,9 @@ exports.default = (0, utils_1.createRule)("no-dom-manipulating", {
70
70
  return;
71
71
  }
72
72
  }
73
+ else {
74
+ return;
75
+ }
73
76
  context.report({
74
77
  node: member,
75
78
  messageId: "disallowManipulateDOM",
@@ -354,10 +354,23 @@ function processIgnore(warnings, kind, stripStyleElements, ignoreComments, conte
354
354
  unusedIgnores: [...unusedIgnores],
355
355
  };
356
356
  function getWarningNode(warning) {
357
- const index = getWarningIndex(warning);
358
- if (index == null) {
359
- return null;
357
+ const indexes = getWarningIndexes(warning);
358
+ if (indexes.start != null) {
359
+ const node = getWarningTargetNodeFromIndex(indexes.start);
360
+ if (node) {
361
+ return node;
362
+ }
363
+ if (indexes.end != null) {
364
+ const center = Math.floor(indexes.start + (indexes.end - indexes.start) / 2);
365
+ return getWarningTargetNodeFromIndex(center);
366
+ }
367
+ }
368
+ if (indexes.end != null) {
369
+ return getWarningTargetNodeFromIndex(indexes.end);
360
370
  }
371
+ return null;
372
+ }
373
+ function getWarningTargetNodeFromIndex(index) {
361
374
  let targetNode = sourceCode.getNodeByRangeIndex(index);
362
375
  while (targetNode) {
363
376
  if (targetNode.type === "SvelteElement" ||
@@ -377,13 +390,10 @@ function processIgnore(warnings, kind, stripStyleElements, ignoreComments, conte
377
390
  }
378
391
  return null;
379
392
  }
380
- function getWarningIndex(warning) {
393
+ function getWarningIndexes(warning) {
381
394
  const start = warning.start && sourceCode.getIndexFromLoc(warning.start);
382
395
  const end = warning.end && sourceCode.getIndexFromLoc(warning.end);
383
- if (start != null && end != null) {
384
- return Math.floor(start + (end - start) / 2);
385
- }
386
- return start ?? end;
396
+ return { start, end };
387
397
  }
388
398
  }
389
399
  function isUseTypeScript(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.19.0",
3
+ "version": "2.19.2",
4
4
  "description": "ESLint plugin for Svelte using AST",
5
5
  "repository": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git",
6
6
  "homepage": "https://ota-meshi.github.io/eslint-plugin-svelte",
@@ -69,7 +69,7 @@
69
69
  "debug": "^4.3.1",
70
70
  "eslint-utils": "^3.0.0",
71
71
  "esutils": "^2.0.3",
72
- "known-css-properties": "^0.26.0",
72
+ "known-css-properties": "^0.27.0",
73
73
  "postcss": "^8.4.5",
74
74
  "postcss-load-config": "^3.1.4",
75
75
  "postcss-safe-parser": "^6.0.0",
@@ -140,7 +140,7 @@
140
140
  "less": "^4.1.2",
141
141
  "lint-staged": "^13.0.3",
142
142
  "locate-character": "^2.0.5",
143
- "magic-string": "^0.29.0",
143
+ "magic-string": "^0.30.0",
144
144
  "markdown-it-anchor": "^8.4.1",
145
145
  "markdown-it-container": "^3.0.0",
146
146
  "markdown-it-emoji": "^2.0.0",