@ashstack/lint 0.1.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 (202) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/RULES.md +2881 -0
  4. package/dist/core/index.d.ts +15 -0
  5. package/dist/core/index.js +222 -0
  6. package/dist/core/rules/core/components-tsx-only.d.ts +2 -0
  7. package/dist/core/rules/core/components-tsx-only.js +37 -0
  8. package/dist/core/rules/core/hoist-intl.d.ts +2 -0
  9. package/dist/core/rules/core/hoist-intl.js +32 -0
  10. package/dist/core/rules/core/index.d.ts +2 -0
  11. package/dist/core/rules/core/index.js +18 -0
  12. package/dist/core/rules/core/no-comments.d.ts +2 -0
  13. package/dist/core/rules/core/no-comments.js +194 -0
  14. package/dist/core/rules/core/no-naming-convention.d.ts +2 -0
  15. package/dist/core/rules/core/no-naming-convention.js +143 -0
  16. package/dist/core/rules/core/use-design-system.d.ts +2 -0
  17. package/dist/core/rules/core/use-design-system.js +147 -0
  18. package/dist/core/rules/zod/index.d.ts +2 -0
  19. package/dist/core/rules/zod/index.js +12 -0
  20. package/dist/core/rules/zod/prefer-enum.d.ts +2 -0
  21. package/dist/core/rules/zod/prefer-enum.js +44 -0
  22. package/dist/index.d.ts +4 -0
  23. package/dist/index.js +3 -0
  24. package/dist/lib/ast.d.ts +44 -0
  25. package/dist/lib/ast.js +162 -0
  26. package/dist/lib/detect.d.ts +9 -0
  27. package/dist/lib/detect.js +42 -0
  28. package/dist/lib/merge.d.ts +9 -0
  29. package/dist/lib/merge.js +18 -0
  30. package/dist/lib/module.d.ts +19 -0
  31. package/dist/lib/module.js +49 -0
  32. package/dist/lib/types.d.ts +114 -0
  33. package/dist/lib/types.js +1 -0
  34. package/dist/react/index.d.ts +9 -0
  35. package/dist/react/index.js +126 -0
  36. package/dist/react/rules/i18n/index.d.ts +2 -0
  37. package/dist/react/rules/i18n/index.js +16 -0
  38. package/dist/react/rules/i18n/no-bare-attrs.d.ts +2 -0
  39. package/dist/react/rules/i18n/no-bare-attrs.js +38 -0
  40. package/dist/react/rules/i18n/no-bare-text.d.ts +2 -0
  41. package/dist/react/rules/i18n/no-bare-text.js +26 -0
  42. package/dist/react/rules/i18n/no-bare-toast.d.ts +2 -0
  43. package/dist/react/rules/i18n/no-bare-toast.js +38 -0
  44. package/dist/react/rules/query/index.d.ts +2 -0
  45. package/dist/react/rules/query/index.js +20 -0
  46. package/dist/react/rules/query/next-page-param-undefined.d.ts +2 -0
  47. package/dist/react/rules/query/next-page-param-undefined.js +26 -0
  48. package/dist/react/rules/query/no-deprecated-filters.d.ts +2 -0
  49. package/dist/react/rules/query/no-deprecated-filters.js +63 -0
  50. package/dist/react/rules/query/no-fetch-in-query-fn.d.ts +2 -0
  51. package/dist/react/rules/query/no-fetch-in-query-fn.js +22 -0
  52. package/dist/react/rules/query/no-inline-keys.d.ts +2 -0
  53. package/dist/react/rules/query/no-inline-keys.js +107 -0
  54. package/dist/react/rules/query/require-destructured-hooks.d.ts +2 -0
  55. package/dist/react/rules/query/require-destructured-hooks.js +41 -0
  56. package/dist/react/rules/query/shared.d.ts +2 -0
  57. package/dist/react/rules/query/shared.js +10 -0
  58. package/dist/react/rules/zustand/index.d.ts +2 -0
  59. package/dist/react/rules/zustand/index.js +12 -0
  60. package/dist/react/rules/zustand/require-selector.d.ts +2 -0
  61. package/dist/react/rules/zustand/require-selector.js +62 -0
  62. package/dist/react-native/index.d.ts +11 -0
  63. package/dist/react-native/index.js +113 -0
  64. package/dist/react-native/rules/keyboard/index.d.ts +2 -0
  65. package/dist/react-native/rules/keyboard/index.js +18 -0
  66. package/dist/react-native/rules/legend-list/index.d.ts +2 -0
  67. package/dist/react-native/rules/legend-list/index.js +51 -0
  68. package/dist/react-native/rules/legend-list/no-flex-in-content-container.d.ts +2 -0
  69. package/dist/react-native/rules/legend-list/no-flex-in-content-container.js +77 -0
  70. package/dist/react-native/rules/legend-list/no-index-key-extractor.d.ts +2 -0
  71. package/dist/react-native/rules/legend-list/no-index-key-extractor.js +26 -0
  72. package/dist/react-native/rules/legend-list/no-inline-data.d.ts +2 -0
  73. package/dist/react-native/rules/legend-list/no-inline-data.js +25 -0
  74. package/dist/react-native/rules/legend-list/no-inline-extra-data.d.ts +2 -0
  75. package/dist/react-native/rules/legend-list/no-inline-extra-data.js +21 -0
  76. package/dist/react-native/rules/legend-list/no-inline-render-item-props.d.ts +2 -0
  77. package/dist/react-native/rules/legend-list/no-inline-render-item-props.js +35 -0
  78. package/dist/react-native/rules/legend-list/no-mixed-children.d.ts +2 -0
  79. package/dist/react-native/rules/legend-list/no-mixed-children.js +24 -0
  80. package/dist/react-native/rules/legend-list/no-remount-key.d.ts +2 -0
  81. package/dist/react-native/rules/legend-list/no-remount-key.js +18 -0
  82. package/dist/react-native/rules/legend-list/no-scrollview-map.d.ts +2 -0
  83. package/dist/react-native/rules/legend-list/no-scrollview-map.js +27 -0
  84. package/dist/react-native/rules/legend-list/no-unsupported-props.d.ts +2 -0
  85. package/dist/react-native/rules/legend-list/no-unsupported-props.js +29 -0
  86. package/dist/react-native/rules/legend-list/required-props.d.ts +2 -0
  87. package/dist/react-native/rules/legend-list/required-props.js +23 -0
  88. package/dist/react-native/rules/legend-list/shared.d.ts +19 -0
  89. package/dist/react-native/rules/legend-list/shared.js +25 -0
  90. package/dist/react-native/rules/legend-list/typed-items-need-item-type.d.ts +2 -0
  91. package/dist/react-native/rules/legend-list/typed-items-need-item-type.js +49 -0
  92. package/dist/react-native/rules/legend-state/index.d.ts +2 -0
  93. package/dist/react-native/rules/legend-state/index.js +35 -0
  94. package/dist/react-native/rules/legend-state/naming.d.ts +2 -0
  95. package/dist/react-native/rules/legend-state/naming.js +26 -0
  96. package/dist/react-native/rules/legend-state/no-assignment.d.ts +2 -0
  97. package/dist/react-native/rules/legend-state/no-assignment.js +31 -0
  98. package/dist/react-native/rules/legend-state/no-nested-observable.d.ts +2 -0
  99. package/dist/react-native/rules/legend-state/no-nested-observable.js +23 -0
  100. package/dist/react-native/rules/legend-state/no-object-selector.d.ts +2 -0
  101. package/dist/react-native/rules/legend-state/no-object-selector.js +47 -0
  102. package/dist/react-native/rules/legend-state/no-observable-in-component.d.ts +2 -0
  103. package/dist/react-native/rules/legend-state/no-observable-in-component.js +46 -0
  104. package/dist/react-native/rules/legend-state/no-peek-in-selector.d.ts +2 -0
  105. package/dist/react-native/rules/legend-state/no-peek-in-selector.js +67 -0
  106. package/dist/react-native/rules/legend-state/no-react-mirror.d.ts +2 -0
  107. package/dist/react-native/rules/legend-state/no-react-mirror.js +33 -0
  108. package/dist/react-native/rules/legend-state/no-untracked-get-in-jsx.d.ts +2 -0
  109. package/dist/react-native/rules/legend-state/no-untracked-get-in-jsx.js +52 -0
  110. package/dist/react-native/rules/legend-state/shared.d.ts +9 -0
  111. package/dist/react-native/rules/legend-state/shared.js +23 -0
  112. package/dist/react-native/rules/react-native/hoist-stateless-function.d.ts +2 -0
  113. package/dist/react-native/rules/react-native/hoist-stateless-function.js +59 -0
  114. package/dist/react-native/rules/react-native/index.d.ts +2 -0
  115. package/dist/react-native/rules/react-native/index.js +50 -0
  116. package/dist/react-native/rules/react-native/no-conditional-style-array.d.ts +2 -0
  117. package/dist/react-native/rules/react-native/no-conditional-style-array.js +23 -0
  118. package/dist/react-native/rules/react-native/no-dynamic-import.d.ts +2 -0
  119. package/dist/react-native/rules/react-native/no-dynamic-import.js +18 -0
  120. package/dist/react-native/rules/react-native/no-keyboard-will-events.d.ts +2 -0
  121. package/dist/react-native/rules/react-native/no-keyboard-will-events.js +18 -0
  122. package/dist/react-native/rules/react-native/no-leaked-render.d.ts +2 -0
  123. package/dist/react-native/rules/react-native/no-leaked-render.js +43 -0
  124. package/dist/react-native/rules/react-native/no-manual-memo.d.ts +2 -0
  125. package/dist/react-native/rules/react-native/no-manual-memo.js +87 -0
  126. package/dist/react-native/rules/react-native/no-redundant-view-nesting.d.ts +2 -0
  127. package/dist/react-native/rules/react-native/no-redundant-view-nesting.js +36 -0
  128. package/dist/react-native/rules/react-native/no-rn-image-network-source.d.ts +2 -0
  129. package/dist/react-native/rules/react-native/no-rn-image-network-source.js +58 -0
  130. package/dist/react-native/rules/react-native/no-rn-namespace-import.d.ts +2 -0
  131. package/dist/react-native/rules/react-native/no-rn-namespace-import.js +38 -0
  132. package/dist/react-native/rules/react-native/no-scroll-position-state.d.ts +2 -0
  133. package/dist/react-native/rules/react-native/no-scroll-position-state.js +26 -0
  134. package/dist/react-native/rules/react-native/no-unlabeled-icon-pressable.d.ts +2 -0
  135. package/dist/react-native/rules/react-native/no-unlabeled-icon-pressable.js +62 -0
  136. package/dist/react-native/rules/reanimated/animated-reaction-safety.d.ts +2 -0
  137. package/dist/react-native/rules/reanimated/animated-reaction-safety.js +110 -0
  138. package/dist/react-native/rules/reanimated/animated-style-needs-animated-component.d.ts +2 -0
  139. package/dist/react-native/rules/reanimated/animated-style-needs-animated-component.js +72 -0
  140. package/dist/react-native/rules/reanimated/animated-updater-purity.d.ts +2 -0
  141. package/dist/react-native/rules/reanimated/animated-updater-purity.js +38 -0
  142. package/dist/react-native/rules/reanimated/gpu-properties-only.d.ts +2 -0
  143. package/dist/react-native/rules/reanimated/gpu-properties-only.js +80 -0
  144. package/dist/react-native/rules/reanimated/hoist-layout-animation-builder.d.ts +2 -0
  145. package/dist/react-native/rules/reanimated/hoist-layout-animation-builder.js +43 -0
  146. package/dist/react-native/rules/reanimated/index.d.ts +2 -0
  147. package/dist/react-native/rules/reanimated/index.js +51 -0
  148. package/dist/react-native/rules/reanimated/interpolate-needs-clamp.d.ts +2 -0
  149. package/dist/react-native/rules/reanimated/interpolate-needs-clamp.js +41 -0
  150. package/dist/react-native/rules/reanimated/no-react-state-from-continuous-worklet.d.ts +2 -0
  151. package/dist/react-native/rules/reanimated/no-react-state-from-continuous-worklet.js +86 -0
  152. package/dist/react-native/rules/reanimated/no-shared-value-dot-value.d.ts +2 -0
  153. package/dist/react-native/rules/reanimated/no-shared-value-dot-value.js +112 -0
  154. package/dist/react-native/rules/reanimated/prefer-lazy-shared-value-initializer.d.ts +2 -0
  155. package/dist/react-native/rules/reanimated/prefer-lazy-shared-value-initializer.js +24 -0
  156. package/dist/react-native/rules/reanimated/schedule-on-rn-scope.d.ts +2 -0
  157. package/dist/react-native/rules/reanimated/schedule-on-rn-scope.js +21 -0
  158. package/dist/react-native/rules/reanimated/shared-value-usage.d.ts +2 -0
  159. package/dist/react-native/rules/reanimated/shared-value-usage.js +105 -0
  160. package/dist/react-native/rules/reanimated/shared.d.ts +5 -0
  161. package/dist/react-native/rules/reanimated/shared.js +13 -0
  162. package/dist/react-native/rules/skia/canvas-opaque.d.ts +2 -0
  163. package/dist/react-native/rules/skia/canvas-opaque.js +49 -0
  164. package/dist/react-native/rules/skia/index.d.ts +2 -0
  165. package/dist/react-native/rules/skia/index.js +21 -0
  166. package/dist/react-native/rules/turbo-image/index.d.ts +2 -0
  167. package/dist/react-native/rules/turbo-image/index.js +14 -0
  168. package/dist/react-native/rules/turbo-image/require-cache-policy.d.ts +2 -0
  169. package/dist/react-native/rules/turbo-image/require-cache-policy.js +21 -0
  170. package/dist/react-native/rules/turbo-image/require-resize.d.ts +2 -0
  171. package/dist/react-native/rules/turbo-image/require-resize.js +22 -0
  172. package/dist/react-native/rules/unistyles/animated-theme.d.ts +2 -0
  173. package/dist/react-native/rules/unistyles/animated-theme.js +37 -0
  174. package/dist/react-native/rules/unistyles/content-container.d.ts +2 -0
  175. package/dist/react-native/rules/unistyles/content-container.js +73 -0
  176. package/dist/react-native/rules/unistyles/in-sheet.d.ts +2 -0
  177. package/dist/react-native/rules/unistyles/in-sheet.js +116 -0
  178. package/dist/react-native/rules/unistyles/index.d.ts +2 -0
  179. package/dist/react-native/rules/unistyles/index.js +58 -0
  180. package/dist/react-native/rules/unistyles/insets.d.ts +2 -0
  181. package/dist/react-native/rules/unistyles/insets.js +92 -0
  182. package/dist/react-native/rules/unistyles/no-hardcoded-color.d.ts +2 -0
  183. package/dist/react-native/rules/unistyles/no-hardcoded-color.js +30 -0
  184. package/dist/react-native/rules/unistyles/no-hardcoded-spacing.d.ts +2 -0
  185. package/dist/react-native/rules/unistyles/no-hardcoded-spacing.js +78 -0
  186. package/dist/react-native/rules/unistyles/no-margin.d.ts +2 -0
  187. package/dist/react-native/rules/unistyles/no-margin.js +19 -0
  188. package/dist/react-native/rules/unistyles/no-style-spread.d.ts +2 -0
  189. package/dist/react-native/rules/unistyles/no-style-spread.js +41 -0
  190. package/dist/react-native/rules/unistyles/no-unused-styles.d.ts +2 -0
  191. package/dist/react-native/rules/unistyles/no-unused-styles.js +99 -0
  192. package/dist/react-native/rules/unistyles/rtl-style-call.d.ts +2 -0
  193. package/dist/react-native/rules/unistyles/rtl-style-call.js +42 -0
  194. package/dist/react-native/rules/unistyles/shared.d.ts +16 -0
  195. package/dist/react-native/rules/unistyles/shared.js +70 -0
  196. package/dist/react-native/rules/unistyles/theme-screen-component.d.ts +2 -0
  197. package/dist/react-native/rules/unistyles/theme-screen-component.js +22 -0
  198. package/dist/react-native/rules/unistyles/theme-style-attr.d.ts +2 -0
  199. package/dist/react-native/rules/unistyles/theme-style-attr.js +18 -0
  200. package/dist/react-native/stylesheet.d.ts +11 -0
  201. package/dist/react-native/stylesheet.js +44 -0
  202. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ali Alshehri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @ashstack/lint
2
+
3
+ Strict shared [oxlint](https://oxc.rs) config: 147 rules on plain TypeScript, 227 with React, 238 on React Native, over 70 of them custom-built. Three entries, each containing the one before it: `core()`, `react()`, `react-native()`.
4
+
5
+ Library-specific rules ship only when you depend on that library, so nothing fires about code you don't have.
6
+
7
+ The strictness is aimed at agents. One writes more code in an hour than anyone reviews line by line, and the linter is the only thing that reads all of it. Every message names the fix, so an agent can act on it without a second prompt.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ bun add -d oxlint oxlint-tsgolint @ashstack/lint
13
+ ```
14
+
15
+ ```ts
16
+ // oxlint.config.mts (JSON configs can't resolve npm packages, so TS config only)
17
+ import { core } from "@ashstack/lint"; // or: react, reactNative
18
+ import { defineConfig } from "oxlint";
19
+
20
+ export default defineConfig({
21
+ extends: [core()],
22
+ rules: { "@ashstack/query/no-inline-keys": "off" }, // your overrides always win
23
+ });
24
+ ```
25
+
26
+ ```sh
27
+ oxlint --type-aware --deny-warnings .
28
+ ```
29
+
30
+ Type-aware rules need the `oxlint-tsgolint` peer. Node 22.18+.
31
+
32
+ ## What each entry adds
33
+
34
+ `core()` is a strict eslint / typescript / unicorn / promise / import base plus the `@ashstack/core/` convention rules. `react()` adds react, jsx-a11y, React Compiler and you-might-not-need-an-effect. `react-native()` adds the generic `@ashstack/react-native/` rules: leaked renders, view nesting, iOS-only keyboard events, remote images.
35
+
36
+ ## Library-specific rules, auto-detected
37
+
38
+ One module per library: one rule namespace, one toggle. A module turns on when its library is in your `package.json`, searched up to the repo root.
39
+
40
+ `@ashstack/zod` · `@ashstack/query` · `@ashstack/zustand` · `@ashstack/i18n` · `@ashstack/unistyles` · `@ashstack/legend-list` · `@ashstack/legend-state` · `@ashstack/reanimated` · `@ashstack/turbo-image` · `@ashstack/skia` · `@ashstack/keyboard`
41
+
42
+ Detection only sets the default. Turn any module on or off yourself, whatever your dependencies say:
43
+
44
+ ```ts
45
+ reactNative({ unistyles: false, i18n: true });
46
+ ```
47
+
48
+ Import bans follow detection only; disable one by rule name.
49
+
50
+ ## Opt-in rules
51
+
52
+ Off by default, since they need a team decision first: `@ashstack/core/no-comments`, `use-design-system` and `components-tsx-only`.
53
+
54
+ ## Rule reference
55
+
56
+ [RULES.md](./RULES.md) covers every rule, with options and examples. It ships in this package, generated from the rules and CI-checked.
57
+
58
+ ## License
59
+
60
+ MIT