@eslint-react/core 5.17.0 → 5.17.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/dist/index.d.ts CHANGED
@@ -287,7 +287,7 @@ type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticN
287
287
  * @param node The function node to analyze.
288
288
  * @returns The identifier node if found, `null` otherwise.
289
289
  */
290
- declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | TSESTree.PrivateIdentifier | null;
290
+ declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null;
291
291
  /**
292
292
  * Identifies the initialization path of a function node in the AST.
293
293
  *
package/dist/index.js CHANGED
@@ -427,6 +427,58 @@ const absurd = (_) => {
427
427
  * @since 2.0.0
428
428
  */
429
429
  const hole = cast(absurd);
430
+ /**
431
+ * Drops the longest prefix of elements from an array that satisfy the given predicate.
432
+ *
433
+ * Supports both data-first and data-last (`pipe`-friendly) call styles.
434
+ *
435
+ * @param pred - The predicate to test each element with.
436
+ * @returns A new array without the matching prefix.
437
+ * @example
438
+ * ```ts
439
+ * import * as assert from "node:assert"
440
+ * import { dropWhile, pipe } from "@local/eff"
441
+ *
442
+ * // data-first
443
+ * assert.deepStrictEqual(dropWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [3, 2, 1])
444
+ *
445
+ * // data-last
446
+ * assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], dropWhile((n: number) => n < 3)), [3, 2, 1])
447
+ * ```
448
+ * @category array
449
+ */
450
+ const dropWhile = dual(2, (xs, pred) => {
451
+ const len = xs.length;
452
+ let idx = 0;
453
+ while (idx < len && pred(xs[idx])) idx++;
454
+ return xs.slice(idx);
455
+ });
456
+ /**
457
+ * Takes the longest prefix of elements from an array that satisfy the given predicate.
458
+ *
459
+ * Supports both data-first and data-last (`pipe`-friendly) call styles.
460
+ *
461
+ * @param pred - The predicate to test each element with.
462
+ * @returns A new array containing only the matching prefix.
463
+ * @example
464
+ * ```ts
465
+ * import * as assert from "node:assert"
466
+ * import { pipe, takeWhile } from "@local/eff"
467
+ *
468
+ * // data-first
469
+ * assert.deepStrictEqual(takeWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [1, 2])
470
+ *
471
+ * // data-last
472
+ * assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], takeWhile((n: number) => n < 3)), [1, 2])
473
+ * ```
474
+ * @category array
475
+ */
476
+ const takeWhile = dual(2, (xs, pred) => {
477
+ const len = xs.length;
478
+ let idx = 0;
479
+ while (idx < len && pred(xs[idx])) idx++;
480
+ return xs.slice(0, idx);
481
+ });
430
482
 
431
483
  //#endregion
432
484
  //#region src/api.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.17.0",
3
+ "version": "5.17.1",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,21 +33,21 @@
33
33
  "@typescript-eslint/types": "^8.64.0",
34
34
  "@typescript-eslint/utils": "^8.64.0",
35
35
  "ts-pattern": "^5.9.0",
36
- "@eslint-react/jsx": "5.17.0",
37
- "@eslint-react/ast": "5.17.0",
38
- "@eslint-react/shared": "5.17.0",
39
- "@eslint-react/var": "5.17.0",
40
- "@eslint-react/eslint": "5.17.0"
36
+ "@eslint-react/ast": "5.17.1",
37
+ "@eslint-react/eslint": "5.17.1",
38
+ "@eslint-react/jsx": "5.17.1",
39
+ "@eslint-react/var": "5.17.1",
40
+ "@eslint-react/shared": "5.17.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@typescript-eslint/parser": "^8.64.0",
44
44
  "@typescript-eslint/typescript-estree": "^8.64.0",
45
45
  "eslint": "^10.7.0",
46
- "tsdown": "^0.22.7",
46
+ "tsdown": "^0.22.8",
47
47
  "typescript": "6.0.3",
48
48
  "vitest": "^4.1.10",
49
- "@local/eff": "0.0.0",
50
- "@local/configs": "0.0.0"
49
+ "@local/configs": "0.0.0",
50
+ "@local/eff": "0.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "eslint": "*",