eslint-plugin-svelte 2.27.0 → 2.27.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.
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const types_1 = require("@typescript-eslint/types");
4
3
  const utils_1 = require("../utils");
5
4
  const eslint_utils_1 = require("@eslint-community/eslint-utils");
6
5
  exports.default = (0, utils_1.createRule)("no-reactive-reassign", {
@@ -38,32 +37,32 @@ exports.default = (0, utils_1.createRule)("no-reactive-reassign", {
38
37
  return {};
39
38
  }
40
39
  const CHECK_REASSIGN = {
41
- [types_1.TSESTree.AST_NODE_TYPES.UpdateExpression]: ({ parent }) => ({ type: "reassign", node: parent }),
42
- [types_1.TSESTree.AST_NODE_TYPES.UnaryExpression]: ({ parent, }) => {
40
+ UpdateExpression: ({ parent }) => ({ type: "reassign", node: parent }),
41
+ UnaryExpression: ({ parent }) => {
43
42
  if (parent.operator === "delete") {
44
43
  return { type: "reassign", node: parent };
45
44
  }
46
45
  return null;
47
46
  },
48
- [types_1.TSESTree.AST_NODE_TYPES.AssignmentExpression]: ({ node, parent, }) => {
47
+ AssignmentExpression: ({ node, parent, }) => {
49
48
  if (parent.left === node) {
50
49
  return { type: "reassign", node: parent };
51
50
  }
52
51
  return null;
53
52
  },
54
- [types_1.TSESTree.AST_NODE_TYPES.ForInStatement]: ({ node, parent, }) => {
53
+ ForInStatement: ({ node, parent, }) => {
55
54
  if (parent.left === node) {
56
55
  return { type: "reassign", node: parent };
57
56
  }
58
57
  return null;
59
58
  },
60
- [types_1.TSESTree.AST_NODE_TYPES.ForOfStatement]: ({ node, parent, }) => {
59
+ ForOfStatement: ({ node, parent, }) => {
61
60
  if (parent.left === node) {
62
61
  return { type: "reassign", node: parent };
63
62
  }
64
63
  return null;
65
64
  },
66
- [types_1.TSESTree.AST_NODE_TYPES.CallExpression]: ({ node, parent, pathNodes, }) => {
65
+ CallExpression: ({ node, parent, pathNodes, }) => {
67
66
  if (pathNodes.length > 0 && parent.callee === node) {
68
67
  const mem = pathNodes[pathNodes.length - 1];
69
68
  const callName = (0, eslint_utils_1.getPropertyName)(mem);
@@ -78,7 +77,7 @@ exports.default = (0, utils_1.createRule)("no-reactive-reassign", {
78
77
  }
79
78
  return null;
80
79
  },
81
- [types_1.TSESTree.AST_NODE_TYPES.MemberExpression]: ({ node, parent, pathNodes, }) => {
80
+ MemberExpression: ({ node, parent, pathNodes, }) => {
82
81
  if (parent.object === node) {
83
82
  return {
84
83
  type: "check",
@@ -88,16 +87,16 @@ exports.default = (0, utils_1.createRule)("no-reactive-reassign", {
88
87
  }
89
88
  return null;
90
89
  },
91
- [types_1.TSESTree.AST_NODE_TYPES.ChainExpression]: ({ parent, }) => {
90
+ ChainExpression: ({ parent }) => {
92
91
  return { type: "check", node: parent };
93
92
  },
94
- [types_1.TSESTree.AST_NODE_TYPES.ConditionalExpression]: ({ node, parent, }) => {
93
+ ConditionalExpression: ({ node, parent, }) => {
95
94
  if (parent.test === node) {
96
95
  return null;
97
96
  }
98
97
  return { type: "check", node: parent };
99
98
  },
100
- [types_1.TSESTree.AST_NODE_TYPES.Property]: ({ node, parent, }) => {
99
+ Property: ({ node, parent }) => {
101
100
  if (parent.value === node &&
102
101
  parent.parent &&
103
102
  parent.parent.type === "ObjectPattern") {
@@ -105,13 +104,13 @@ exports.default = (0, utils_1.createRule)("no-reactive-reassign", {
105
104
  }
106
105
  return null;
107
106
  },
108
- [types_1.TSESTree.AST_NODE_TYPES.ArrayPattern]: ({ node, parent, }) => {
107
+ ArrayPattern: ({ node, parent }) => {
109
108
  if (parent.elements.includes(node)) {
110
109
  return { type: "check", node: parent };
111
110
  }
112
111
  return null;
113
112
  },
114
- [types_1.TSESTree.AST_NODE_TYPES.RestElement]: ({ node, parent, }) => {
113
+ RestElement: ({ node, parent }) => {
115
114
  if (parent.argument === node && parent.parent) {
116
115
  return {
117
116
  type: "check",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.27.0",
3
+ "version": "2.27.2",
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",