@eslint-react/ast 2.7.5-next.7 → 2.7.5-next.8

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -176,19 +176,19 @@ function getNestedIdentifiers(node) {
176
176
  const identifiers = [];
177
177
  if (node.type === AST_NODE_TYPES.Identifier) identifiers.push(node);
178
178
  if ("arguments" in node) {
179
- const chunk = node.arguments.map(getNestedIdentifiers).flat(1);
179
+ const chunk = node.arguments.flatMap(getNestedIdentifiers);
180
180
  identifiers.push(...chunk);
181
181
  }
182
182
  if ("elements" in node) {
183
- const chunk = node.elements.filter((x) => x != null).map(getNestedIdentifiers).flat(1);
183
+ const chunk = node.elements.filter((x) => x != null).flatMap(getNestedIdentifiers);
184
184
  identifiers.push(...chunk);
185
185
  }
186
186
  if ("properties" in node) {
187
- const chunk = node.properties.map(getNestedIdentifiers).flat(1);
187
+ const chunk = node.properties.flatMap(getNestedIdentifiers);
188
188
  identifiers.push(...chunk);
189
189
  }
190
190
  if ("expressions" in node) {
191
- const chunk = node.expressions.map(getNestedIdentifiers).flat(1);
191
+ const chunk = node.expressions.flatMap(getNestedIdentifiers);
192
192
  identifiers.push(...chunk);
193
193
  }
194
194
  if ("left" in node) {
@@ -256,12 +256,12 @@ function getNestedReturnStatements(node) {
256
256
  */
257
257
  function getNestedExpressionsOfType(type) {
258
258
  const isNodeOfType = is(type);
259
- return function(node) {
259
+ return (node) => {
260
260
  const boundGetNestedExpressionsOfType = getNestedExpressionsOfType(type);
261
261
  const expressions = [];
262
262
  if (isNodeOfType(node)) expressions.push(node);
263
263
  if ("arguments" in node) {
264
- const chunk = node.arguments.map(getNestedExpressionsOfType(type)).flat(1);
264
+ const chunk = node.arguments.flatMap(getNestedExpressionsOfType(type));
265
265
  expressions.push(...chunk);
266
266
  }
267
267
  if ("expression" in node && node.expression !== true && node.expression !== false) {
@@ -281,23 +281,23 @@ function getNestedExpressionsOfType(type) {
281
281
  expressions.push(...chunk);
282
282
  }
283
283
  if ("consequent" in node) {
284
- const chunk = Array.isArray(node.consequent) ? node.consequent.map(boundGetNestedExpressionsOfType).flat(1) : boundGetNestedExpressionsOfType(node.consequent);
284
+ const chunk = Array.isArray(node.consequent) ? node.consequent.flatMap(boundGetNestedExpressionsOfType) : boundGetNestedExpressionsOfType(node.consequent);
285
285
  expressions.push(...chunk);
286
286
  }
287
287
  if ("alternate" in node && node.alternate != null) {
288
- const chunk = Array.isArray(node.alternate) ? node.alternate.map(boundGetNestedExpressionsOfType).flat(1) : boundGetNestedExpressionsOfType(node.alternate);
288
+ const chunk = Array.isArray(node.alternate) ? node.alternate.flatMap(boundGetNestedExpressionsOfType) : boundGetNestedExpressionsOfType(node.alternate);
289
289
  expressions.push(...chunk);
290
290
  }
291
291
  if ("elements" in node) {
292
- const chunk = node.elements.filter((x) => x != null).map(getNestedExpressionsOfType(type)).flat(1);
292
+ const chunk = node.elements.filter((x) => x != null).flatMap(getNestedExpressionsOfType(type));
293
293
  expressions.push(...chunk);
294
294
  }
295
295
  if ("properties" in node) {
296
- const chunk = node.properties.map(boundGetNestedExpressionsOfType).flat(1);
296
+ const chunk = node.properties.flatMap(boundGetNestedExpressionsOfType);
297
297
  expressions.push(...chunk);
298
298
  }
299
299
  if ("expressions" in node) {
300
- const chunk = node.expressions.map(boundGetNestedExpressionsOfType).flat(1);
300
+ const chunk = node.expressions.flatMap(boundGetNestedExpressionsOfType);
301
301
  expressions.push(...chunk);
302
302
  }
303
303
  if (node.type === AST_NODE_TYPES.Property) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "2.7.5-next.7",
3
+ "version": "2.7.5-next.8",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "@typescript-eslint/typescript-estree": "^8.54.0",
35
35
  "@typescript-eslint/utils": "^8.54.0",
36
36
  "string-ts": "^2.3.1",
37
- "@eslint-react/eff": "2.7.5-next.7"
37
+ "@eslint-react/eff": "2.7.5-next.8"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsdown": "^0.20.1",