eslint-plugin-absolute 0.10.1 → 0.11.0-beta.0

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 +107 -76
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,12 @@
1
1
  // @bun
2
2
  // src/rules/angular-one-feature-per-file.ts
3
3
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
4
+
5
+ // src/createRule.ts
6
+ import { ESLintUtils } from "@typescript-eslint/utils";
7
+ var createRule = ESLintUtils.RuleCreator((name) => `https://absolutejs.com/documentation/eslint/${name}`);
8
+
9
+ // src/rules/angular-one-feature-per-file.ts
4
10
  var FEATURE_DECORATOR_NAMES = new Set([
5
11
  "Component",
6
12
  "Directive",
@@ -26,7 +32,7 @@ var isFeatureClass = (node) => {
26
32
  return name !== null && FEATURE_DECORATOR_NAMES.has(name);
27
33
  });
28
34
  };
29
- var angularOneFeaturePerFile = {
35
+ var angularOneFeaturePerFile = createRule({
30
36
  create(context) {
31
37
  const seenFeatures = [];
32
38
  return {
@@ -53,12 +59,13 @@ var angularOneFeaturePerFile = {
53
59
  },
54
60
  schema: [],
55
61
  type: "problem"
56
- }
57
- };
62
+ },
63
+ name: "angular-one-feature-per-file"
64
+ });
58
65
 
59
66
  // src/rules/no-nested-jsx-return.ts
60
67
  import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
61
- var noNestedJSXReturn = {
68
+ var noNestedJSXReturn = createRule({
62
69
  create(context) {
63
70
  const isJSX = (node) => node !== null && node !== undefined && (node.type === AST_NODE_TYPES2.JSXElement || node.type === AST_NODE_TYPES2.JSXFragment);
64
71
  const getLeftmostJSXIdentifier = (name) => {
@@ -190,11 +197,12 @@ var noNestedJSXReturn = {
190
197
  },
191
198
  schema: [],
192
199
  type: "problem"
193
- }
194
- };
200
+ },
201
+ name: "no-nested-jsx-return"
202
+ });
195
203
 
196
204
  // src/rules/explicit-object-types.ts
197
- var explicitObjectTypes = {
205
+ var explicitObjectTypes = createRule({
198
206
  create(context) {
199
207
  const isObjectLiteral = (node) => node !== null && node !== undefined && node.type === "ObjectExpression";
200
208
  return {
@@ -238,8 +246,9 @@ var explicitObjectTypes = {
238
246
  },
239
247
  schema: [],
240
248
  type: "problem"
241
- }
242
- };
249
+ },
250
+ name: "explicit-object-types"
251
+ });
243
252
 
244
253
  // src/rules/sort-keys-fixable.ts
245
254
  import * as ts from "typescript";
@@ -437,7 +446,7 @@ var hasDuplicatePropertyNames = (properties) => {
437
446
  });
438
447
  return [...kindsByName.values()].some((kinds) => kinds.length > 1 && !isAccessorPairOnly(kinds));
439
448
  };
440
- var sortKeysFixable = {
449
+ var sortKeysFixable = createRule({
441
450
  create(context) {
442
451
  const { sourceCode } = context;
443
452
  const [option] = context.options;
@@ -1616,8 +1625,9 @@ ${indent}`;
1616
1625
  }
1617
1626
  ],
1618
1627
  type: "suggestion"
1619
- }
1620
- };
1628
+ },
1629
+ name: "sort-keys-fixable"
1630
+ });
1621
1631
 
1622
1632
  // src/rules/no-transition-cssproperties.ts
1623
1633
  var getKeyName = (prop) => {
@@ -1641,7 +1651,7 @@ var checkPropForTransition = (context, prop) => {
1641
1651
  });
1642
1652
  }
1643
1653
  };
1644
- var noTransitionCSSProperties = {
1654
+ var noTransitionCSSProperties = createRule({
1645
1655
  create(context) {
1646
1656
  const { sourceCode } = context;
1647
1657
  const isCSSPropertiesType = (typeAnnotation) => {
@@ -1689,11 +1699,12 @@ var noTransitionCSSProperties = {
1689
1699
  },
1690
1700
  schema: [],
1691
1701
  type: "problem"
1692
- }
1693
- };
1702
+ },
1703
+ name: "no-transition-cssproperties"
1704
+ });
1694
1705
 
1695
1706
  // src/rules/no-explicit-return-types.ts
1696
- var noExplicitReturnTypes = {
1707
+ var noExplicitReturnTypes = createRule({
1697
1708
  create(context) {
1698
1709
  const hasSingleObjectReturn = (body) => {
1699
1710
  const returnStatements = body.body.filter((stmt) => stmt.type === "ReturnStatement");
@@ -1736,12 +1747,13 @@ var noExplicitReturnTypes = {
1736
1747
  },
1737
1748
  schema: [],
1738
1749
  type: "suggestion"
1739
- }
1740
- };
1750
+ },
1751
+ name: "no-explicit-return-type"
1752
+ });
1741
1753
 
1742
1754
  // src/rules/max-jsx-nesting.ts
1743
1755
  var isJSXAncestor = (node) => node.type === "JSXElement" || node.type === "JSXFragment";
1744
- var maxJSXNesting = {
1756
+ var maxJSXNesting = createRule({
1745
1757
  create(context) {
1746
1758
  const [option] = context.options;
1747
1759
  const maxAllowed = typeof option === "number" ? option : 1;
@@ -1782,11 +1794,12 @@ var maxJSXNesting = {
1782
1794
  }
1783
1795
  ],
1784
1796
  type: "suggestion"
1785
- }
1786
- };
1797
+ },
1798
+ name: "max-jsxnesting"
1799
+ });
1787
1800
 
1788
1801
  // src/rules/seperate-style-files.ts
1789
- var seperateStyleFiles = {
1802
+ var seperateStyleFiles = createRule({
1790
1803
  create(context) {
1791
1804
  const { filename } = context;
1792
1805
  if (!filename.endsWith(".tsx") && !filename.endsWith(".jsx")) {
@@ -1837,8 +1850,9 @@ var seperateStyleFiles = {
1837
1850
  },
1838
1851
  schema: [],
1839
1852
  type: "suggestion"
1840
- }
1841
- };
1853
+ },
1854
+ name: "seperate-style-files"
1855
+ });
1842
1856
 
1843
1857
  // src/rules/no-unnecessary-key.ts
1844
1858
  var isMapCallExpression = (node) => {
@@ -1848,7 +1862,7 @@ var isMapCallExpression = (node) => {
1848
1862
  const { property } = node.callee;
1849
1863
  return property.type === "Identifier" && property.name === "map" || property.type === "Literal" && property.value === "map";
1850
1864
  };
1851
- var noUnnecessaryKey = {
1865
+ var noUnnecessaryKey = createRule({
1852
1866
  create(context) {
1853
1867
  const getAncestors = (node) => {
1854
1868
  const ancestors = [];
@@ -1892,8 +1906,9 @@ var noUnnecessaryKey = {
1892
1906
  },
1893
1907
  schema: [],
1894
1908
  type: "problem"
1895
- }
1896
- };
1909
+ },
1910
+ name: "no-unnecessary-key"
1911
+ });
1897
1912
 
1898
1913
  // src/rules/sort-exports.ts
1899
1914
  var SORT_BEFORE2 = Number.parseInt("-1", 10);
@@ -2036,7 +2051,7 @@ var getImmediateDependencyNames = (node) => {
2036
2051
  }
2037
2052
  return names;
2038
2053
  };
2039
- var sortExports = {
2054
+ var sortExports = createRule({
2040
2055
  create(context) {
2041
2056
  const { sourceCode } = context;
2042
2057
  const [option] = context.options;
@@ -2262,12 +2277,13 @@ var sortExports = {
2262
2277
  }
2263
2278
  ],
2264
2279
  type: "suggestion"
2265
- }
2266
- };
2280
+ },
2281
+ name: "sort-exports"
2282
+ });
2267
2283
 
2268
2284
  // src/rules/localize-react-props.ts
2269
2285
  import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/utils";
2270
- var localizeReactProps = {
2286
+ var localizeReactProps = createRule({
2271
2287
  create(context) {
2272
2288
  const candidateVariables = [];
2273
2289
  const getSingleSetElement = (set) => {
@@ -2533,11 +2549,12 @@ var localizeReactProps = {
2533
2549
  },
2534
2550
  schema: [],
2535
2551
  type: "suggestion"
2536
- }
2537
- };
2552
+ },
2553
+ name: "localize-react-props"
2554
+ });
2538
2555
 
2539
2556
  // src/rules/no-or-none-component.ts
2540
- var noOrNoneComponent = {
2557
+ var noOrNoneComponent = createRule({
2541
2558
  create(context) {
2542
2559
  return {
2543
2560
  ConditionalExpression(node) {
@@ -2571,11 +2588,12 @@ var noOrNoneComponent = {
2571
2588
  },
2572
2589
  schema: [],
2573
2590
  type: "suggestion"
2574
- }
2575
- };
2591
+ },
2592
+ name: "no-or-none-component"
2593
+ });
2576
2594
 
2577
2595
  // src/rules/no-button-navigation.ts
2578
- var noButtonNavigation = {
2596
+ var noButtonNavigation = createRule({
2579
2597
  create(context) {
2580
2598
  const handlerStack = [];
2581
2599
  const getCurrentHandler = () => {
@@ -2751,8 +2769,9 @@ var noButtonNavigation = {
2751
2769
  },
2752
2770
  schema: [],
2753
2771
  type: "suggestion"
2754
- }
2755
- };
2772
+ },
2773
+ name: "no-button-navigation"
2774
+ });
2756
2775
 
2757
2776
  // src/rules/no-multi-style-objects.ts
2758
2777
  var getPropertyName = (prop) => {
@@ -2765,7 +2784,7 @@ var getPropertyName = (prop) => {
2765
2784
  }
2766
2785
  return null;
2767
2786
  };
2768
- var noMultiStyleObjects = {
2787
+ var noMultiStyleObjects = createRule({
2769
2788
  create(context) {
2770
2789
  const checkObjectExpression = (node) => {
2771
2790
  if (!node.properties.length) {
@@ -2810,11 +2829,12 @@ var noMultiStyleObjects = {
2810
2829
  },
2811
2830
  schema: [],
2812
2831
  type: "problem"
2813
- }
2814
- };
2832
+ },
2833
+ name: "no-multi-style-objects"
2834
+ });
2815
2835
 
2816
2836
  // src/rules/no-useless-function.ts
2817
- var noUselessFunction = {
2837
+ var noUselessFunction = createRule({
2818
2838
  create(context) {
2819
2839
  const isCallbackFunction = (node) => {
2820
2840
  const { parent } = node;
@@ -2852,8 +2872,9 @@ var noUselessFunction = {
2852
2872
  },
2853
2873
  schema: [],
2854
2874
  type: "suggestion"
2855
- }
2856
- };
2875
+ },
2876
+ name: "no-useless-function"
2877
+ });
2857
2878
 
2858
2879
  // src/rules/min-var-length.ts
2859
2880
  var extractIdentifiersFromPattern = (pattern, identifiers = []) => {
@@ -2893,7 +2914,7 @@ var collectParamNames = (params) => {
2893
2914
  });
2894
2915
  return names;
2895
2916
  };
2896
- var minVarLength = {
2917
+ var minVarLength = createRule({
2897
2918
  create(context) {
2898
2919
  const { sourceCode } = context;
2899
2920
  const [options] = context.options;
@@ -3067,11 +3088,12 @@ var minVarLength = {
3067
3088
  }
3068
3089
  ],
3069
3090
  type: "problem"
3070
- }
3071
- };
3091
+ },
3092
+ name: "min-var-length"
3093
+ });
3072
3094
 
3073
3095
  // src/rules/max-depth-extended.ts
3074
- var maxDepthExtended = {
3096
+ var maxDepthExtended = createRule({
3075
3097
  create(context) {
3076
3098
  const [option] = context.options;
3077
3099
  const maxDepth = typeof option === "number" ? option : 1;
@@ -3189,8 +3211,9 @@ var maxDepthExtended = {
3189
3211
  }
3190
3212
  ],
3191
3213
  type: "suggestion"
3192
- }
3193
- };
3214
+ },
3215
+ name: "max-depth-extended"
3216
+ });
3194
3217
 
3195
3218
  // src/rules/spring-naming-convention.ts
3196
3219
  var SPRINGS_SUFFIX = "Springs";
@@ -3255,7 +3278,7 @@ var checkUseSprings = (context, firstElem, secondElem) => {
3255
3278
  });
3256
3279
  }
3257
3280
  };
3258
- var springNamingConvention = {
3281
+ var springNamingConvention = createRule({
3259
3282
  create(context) {
3260
3283
  return {
3261
3284
  VariableDeclarator(node) {
@@ -3301,12 +3324,13 @@ var springNamingConvention = {
3301
3324
  },
3302
3325
  schema: [],
3303
3326
  type: "problem"
3304
- }
3305
- };
3327
+ },
3328
+ name: "spring-naming-convention"
3329
+ });
3306
3330
 
3307
3331
  // src/rules/inline-style-limit.ts
3308
3332
  var DEFAULT_MAX_KEYS = 3;
3309
- var inlineStyleLimit = {
3333
+ var inlineStyleLimit = createRule({
3310
3334
  create(context) {
3311
3335
  const [option] = context.options;
3312
3336
  const maxKeys = typeof option === "number" ? option : option && option.maxKeys || DEFAULT_MAX_KEYS;
@@ -3358,8 +3382,9 @@ var inlineStyleLimit = {
3358
3382
  }
3359
3383
  ],
3360
3384
  type: "suggestion"
3361
- }
3362
- };
3385
+ },
3386
+ name: "inline-style-limit"
3387
+ });
3363
3388
 
3364
3389
  // src/rules/no-inline-object-types.ts
3365
3390
  var DEFAULT_MIN_PROPERTIES = 2;
@@ -3417,7 +3442,7 @@ var deriveNameFromAncestors = (node) => {
3417
3442
  }
3418
3443
  return "T";
3419
3444
  };
3420
- var noInlineObjectTypes = {
3445
+ var noInlineObjectTypes = createRule({
3421
3446
  create(context) {
3422
3447
  const [options] = context.options;
3423
3448
  const minProperties = options?.minProperties ?? DEFAULT_MIN_PROPERTIES;
@@ -3498,8 +3523,9 @@ var noInlineObjectTypes = {
3498
3523
  }
3499
3524
  ],
3500
3525
  type: "suggestion"
3501
- }
3502
- };
3526
+ },
3527
+ name: "no-inline-object-types"
3528
+ });
3503
3529
 
3504
3530
  // src/rules/no-nondeterministic-render.ts
3505
3531
  import { AST_NODE_TYPES as AST_NODE_TYPES4 } from "@typescript-eslint/utils";
@@ -3558,7 +3584,7 @@ var isInAngularFieldInitializer = (node) => {
3558
3584
  return getEnclosingAngularComponentClass(propertyDefinition) !== null;
3559
3585
  };
3560
3586
  var isBannedCall = (node) => isStaticMemberCall(node, "Math", "random") || isStaticMemberCall(node, "Date", "now") || isStaticMemberCall(node, "crypto", "randomUUID") || isStaticMemberCall(node, "performance", "now");
3561
- var noNondeterministicRender = {
3587
+ var noNondeterministicRender = createRule({
3562
3588
  create(context) {
3563
3589
  const reportField = (node) => {
3564
3590
  if (!isInAngularFieldInitializer(node))
@@ -3603,8 +3629,9 @@ var noNondeterministicRender = {
3603
3629
  },
3604
3630
  schema: [],
3605
3631
  type: "problem"
3606
- }
3607
- };
3632
+ },
3633
+ name: "no-nondeterministic-render"
3634
+ });
3608
3635
 
3609
3636
  // src/rules/no-redundant-type-annotation.ts
3610
3637
  import * as ts2 from "typescript";
@@ -3615,7 +3642,7 @@ var ALLOWED_INIT_TYPES = new Set([
3615
3642
  "NewExpression",
3616
3643
  "TSAsExpression"
3617
3644
  ]);
3618
- var noRedundantTypeAnnotation = {
3645
+ var noRedundantTypeAnnotation = createRule({
3619
3646
  create(context) {
3620
3647
  const { sourceCode } = context;
3621
3648
  const parserServices = sourceCode.parserServices ?? null;
@@ -3678,8 +3705,9 @@ var noRedundantTypeAnnotation = {
3678
3705
  },
3679
3706
  schema: [],
3680
3707
  type: "suggestion"
3681
- }
3682
- };
3708
+ },
3709
+ name: "no-redundant-type-annotation"
3710
+ });
3683
3711
 
3684
3712
  // src/rules/no-trivial-alias.ts
3685
3713
  var isBareTypeReference = (node) => {
@@ -3713,13 +3741,13 @@ var isConstSource = (context, id) => {
3713
3741
  return variable.defs.every((def) => {
3714
3742
  if (def.type !== "Variable")
3715
3743
  return false;
3716
- const parent = def.parent;
3744
+ const { parent } = def;
3717
3745
  if (!parent || parent.type !== "VariableDeclaration")
3718
3746
  return false;
3719
3747
  return parent.kind === "const";
3720
3748
  });
3721
3749
  };
3722
- var noTrivialAlias = {
3750
+ var noTrivialAlias = createRule({
3723
3751
  create(context) {
3724
3752
  return {
3725
3753
  TSTypeAliasDeclaration(node) {
@@ -3761,12 +3789,13 @@ var noTrivialAlias = {
3761
3789
  },
3762
3790
  schema: [],
3763
3791
  type: "suggestion"
3764
- }
3765
- };
3792
+ },
3793
+ name: "no-trivial-alias"
3794
+ });
3766
3795
 
3767
3796
  // src/rules/no-unnecessary-div.ts
3768
3797
  import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/utils";
3769
- var noUnnecessaryDiv = {
3798
+ var noUnnecessaryDiv = createRule({
3770
3799
  create(context) {
3771
3800
  const isDivElement = (node) => {
3772
3801
  const nameNode = node.openingElement.name;
@@ -3811,8 +3840,9 @@ var noUnnecessaryDiv = {
3811
3840
  },
3812
3841
  schema: [],
3813
3842
  type: "suggestion"
3814
- }
3815
- };
3843
+ },
3844
+ name: "no-unnecessary-div"
3845
+ });
3816
3846
 
3817
3847
  // src/rules/prefer-inline-exports.ts
3818
3848
  var isLocalDeclaration = (node) => node.type === "VariableDeclaration" || node.type === "FunctionDeclaration" || node.type === "ClassDeclaration" || node.type === "TSTypeAliasDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSEnumDeclaration";
@@ -3843,7 +3873,7 @@ var findOwnDeclaration = (program, name) => {
3843
3873
  }
3844
3874
  return null;
3845
3875
  };
3846
- var preferInlineExports = {
3876
+ var preferInlineExports = createRule({
3847
3877
  create(context) {
3848
3878
  const { sourceCode } = context;
3849
3879
  const program = sourceCode.ast;
@@ -3914,8 +3944,9 @@ var preferInlineExports = {
3914
3944
  },
3915
3945
  schema: [],
3916
3946
  type: "suggestion"
3917
- }
3918
- };
3947
+ },
3948
+ name: "prefer-inline-exports"
3949
+ });
3919
3950
 
3920
3951
  // src/index.ts
3921
3952
  var src_default = {
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "typecheck": "bun run tsc --noEmit"
41
41
  },
42
42
  "type": "module",
43
- "version": "0.10.1"
43
+ "version": "0.11.0-beta.0"
44
44
  }