eslint-plugin-svelte 2.27.2 → 2.27.4

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.
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  parser: string;
6
6
  rules: {
7
7
  "no-inner-declarations": string;
8
+ "no-self-assign": string;
8
9
  "svelte/comment-directive": string;
9
10
  "svelte/system": string;
10
11
  };
@@ -7,6 +7,7 @@ module.exports = {
7
7
  parser: require.resolve("svelte-eslint-parser"),
8
8
  rules: {
9
9
  "no-inner-declarations": "off",
10
+ "no-self-assign": "off",
10
11
  "svelte/comment-directive": "error",
11
12
  "svelte/system": "error",
12
13
  },
package/lib/index.d.ts CHANGED
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  parser: string;
10
10
  rules: {
11
11
  "no-inner-declarations": string;
12
+ "no-self-assign": string;
12
13
  "svelte/comment-directive": string;
13
14
  "svelte/system": string;
14
15
  };
@@ -91,9 +91,14 @@ exports.default = (0, utils_1.createRule)("no-immutable-reactive-statements", {
91
91
  return;
92
92
  }
93
93
  }
94
- if (globalScope.through.some((reference) => node.range[0] <= reference.identifier.range[0] &&
94
+ for (const through of toplevelScope.through.filter((reference) => node.range[0] <= reference.identifier.range[0] &&
95
95
  reference.identifier.range[1] <= node.range[1])) {
96
- return;
96
+ if (through.identifier.name.startsWith("$$")) {
97
+ return;
98
+ }
99
+ if (through.resolved == null) {
100
+ return;
101
+ }
97
102
  }
98
103
  context.report({
99
104
  node: node.body.type === "ExpressionStatement" &&
@@ -91,7 +91,7 @@ exports.default = (0, utils_1.createRule)("prefer-destructured-store-props", {
91
91
  "SvelteScriptElement:exit"() {
92
92
  inScriptElement = false;
93
93
  },
94
- "MemberExpression[object.type='Identifier'][object.name=/^\\$/]"(node) {
94
+ "MemberExpression[object.type='Identifier'][object.name=/^\\$[^\\$]/]"(node) {
95
95
  if (inScriptElement)
96
96
  return;
97
97
  storeMemberAccessStack.unshift({ node, identifiers: [] });
@@ -99,7 +99,7 @@ exports.default = (0, utils_1.createRule)("prefer-destructured-store-props", {
99
99
  Identifier(node) {
100
100
  storeMemberAccessStack[0]?.identifiers.push(node);
101
101
  },
102
- "MemberExpression[object.type='Identifier'][object.name=/^\\$/]:exit"(node) {
102
+ "MemberExpression[object.type='Identifier'][object.name=/^\\$[^\\$]/]:exit"(node) {
103
103
  if (storeMemberAccessStack[0]?.node !== node)
104
104
  return;
105
105
  const { identifiers } = storeMemberAccessStack.shift();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.27.2",
3
+ "version": "2.27.4",
4
4
  "description": "ESLint plugin for Svelte using AST",
5
5
  "repository": "git+https://github.com/sveltejs/eslint-plugin-svelte.git",
6
6
  "homepage": "https://sveltejs.github.io/eslint-plugin-svelte",