@ashstack/lint 0.9.1 → 0.10.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ashstack/lint
2
2
 
3
- Strict shared [oxlint](https://oxc.rs) config: <!-- rule-counts -->117 rules on plain TypeScript, 201 with React, 258 on React Native, 77 of them custom-built<!-- /rule-counts -->. Three entries, each containing the one before it: `core()`, `react()`, `react-native()`.
3
+ Strict shared [oxlint](https://oxc.rs) config: <!-- rule-counts -->116 rules on plain TypeScript, 210 with React, 267 on React Native, 81 of them custom-built<!-- /rule-counts -->. Three entries, each containing the one before it: `core()`, `react()`, `react-native()`.
4
4
 
5
5
  Library-specific rules ship only when you depend on that library, so nothing fires about code you don't have.
6
6
 
@@ -77,7 +77,7 @@ diagnostic that the rest are gone.
77
77
 
78
78
  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.
79
79
 
80
- `@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`
80
+ `@ashstack/zod` · `@ashstack/query` · `@ashstack/zustand` · `@ashstack/i18n` · `@ashstack/stylex` · `@ashstack/unistyles` · `@ashstack/legend-list` · `@ashstack/legend-state` · `@ashstack/reanimated` · `@ashstack/turbo-image` · `@ashstack/skia` · `@ashstack/keyboard`
81
81
 
82
82
  Detection only sets the default. Turn any module on or off yourself, whatever your dependencies say:
83
83
 
@@ -1 +1 @@
1
- import{composeModules as o}from"../lib/module.js";import{coreRegistry as n}from"../lib/registry.js";const s={"array-callback-return":["error",{allowImplicit:!0}],"constructor-super":"error","default-param-last":"error",eqeqeq:["error","always",{null:"ignore"}],"for-direction":"error","getter-return":"error","func-style":["error","expression"],"no-array-constructor":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-negated-condition":"error","no-nested-ternary":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-param-reassign":"error","no-prototype-builtins":"error","no-redeclare":"off","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-undef":"off","no-unreachable":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-useless-catch":"error","no-useless-constructor":"error","no-useless-escape":"error","no-var":"error","no-with":"error","object-shorthand":["error","methods"],"prefer-rest-params":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error","no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",varsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,fix:{imports:"safe-fix"}}],"no-use-before-define":"off","max-depth":["error",3],"max-params":["error",4],"max-lines-per-function":["error",{max:250,skipBlankLines:!0,skipComments:!0}],"eslint/no-await-in-loop":"error","eslint/no-console":"off","eslint/no-constant-binary-expression":"off","eslint/no-control-regex":"error","eslint/no-else-return":"error","eslint/no-empty":"error","eslint/no-empty-function":"error","eslint/no-new":"off","eslint/no-self-compare":"error","eslint/no-shadow":"error","eslint/no-template-curly-in-string":"error","eslint/no-unassigned-vars":"off","eslint/no-underscore-dangle":"off","eslint/no-unmodified-loop-condition":"off","eslint/no-unused-expressions":"off","eslint/no-useless-concat":"off","eslint/preserve-caught-error":"off","eslint/prefer-arrow-callback":"error","eslint/prefer-const":"error","eslint/prefer-template":"error","typescript/consistent-type-imports":"error","typescript/dot-notation":"error","typescript/no-confusing-void-expression":"error","typescript/no-empty-object-type":["error",{allowInterfaces:"with-single-extends"}],"typescript/no-explicit-any":"error","typescript/no-extra-non-null-assertion":"error","typescript/no-extraneous-class":"error","typescript/no-floating-promises":"off","typescript/no-import-type-side-effects":"error","typescript/no-misused-new":"error","typescript/no-misused-promises":["error",{checksVoidReturn:!1}],"typescript/no-namespace":"error","typescript/no-non-null-asserted-optional-chain":"error","typescript/no-non-null-assertion":"error","typescript/no-unnecessary-boolean-literal-compare":"error","typescript/no-unnecessary-condition":"error","typescript/no-unnecessary-type-assertion":"error","typescript/no-unnecessary-type-constraint":"error","typescript/no-unsafe-declaration-merging":"error","typescript/no-unsafe-function-type":"error","typescript/no-unsafe-type-assertion":"error","typescript/no-wrapper-object-types":"error","typescript/prefer-as-const":"error","typescript/prefer-namespace-keyword":"error","typescript/prefer-nullish-coalescing":"error","typescript/require-await":"error","typescript/switch-exhaustiveness-check":["error",{considerDefaultExhaustiveForUnions:!0}],"import/no-commonjs":"off","import/no-cycle":"error","import/no-duplicates":"error","import/no-named-as-default":"off","import/no-named-as-default-member":"off","import/no-self-import":"off","import/no-unassigned-import":"off","unicorn/consistent-function-scoping":"off","unicorn/no-array-reverse":"off","unicorn/no-array-sort":"off","unicorn/no-empty-file":"off","unicorn/no-new-array":"off","unicorn/no-useless-fallback-in-spread":"off","unicorn/no-useless-spread":"off","unicorn/prefer-add-event-listener":"off","unicorn/prefer-array-flat-map":"error","unicorn/prefer-date-now":"error","unicorn/prefer-logical-operator-over-ternary":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-optional-catch-binding":"error","unicorn/require-module-specifiers":"off","unicorn/throw-new-error":"error","promise/always-return":"off","promise/no-callback-in-promise":"off","promise/no-multiple-resolved":"off","promise/no-promise-in-callback":"off","oxc/no-async-endpoint-handlers":"off"};export const TEST_FILES=["**/*.test.ts","**/*.test.tsx","**/*.spec.ts","**/*.spec.tsx","**/__tests__/**","**/tests/**"];const core=(e={})=>{const r=o(n,e);return{plugins:["eslint","typescript","import","unicorn","promise","oxc"],jsPlugins:r.jsPlugins,env:{builtin:!0,es2024:!0},categories:{correctness:"error",suspicious:"error",perf:"error",pedantic:"off",style:"off",restriction:"off",nursery:"off"},rules:{...s,...r.rules},overrides:[{files:["**/*.tsx"],rules:{"func-style":"off"}},{files:["**/*.d.ts"],rules:{"typescript/no-explicit-any":"off"}},{files:TEST_FILES,rules:{"@ashstack/core/max-lines":"off","max-lines-per-function":"off","typescript/await-thenable":"off","typescript/no-non-null-assertion":"off","typescript/no-unsafe-type-assertion":"off","typescript/require-await":"off","typescript/unbound-method":"off"}}]}};export{core};export default core;
1
+ import{composeModules as o}from"../lib/module.js";import{coreRegistry as n}from"../lib/registry.js";const s={"array-callback-return":["error",{allowImplicit:!0}],"constructor-super":"error","default-param-last":"error",eqeqeq:["error","always",{null:"ignore"}],"for-direction":"error","getter-return":"error","func-style":["error","expression"],"no-array-constructor":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-negated-condition":"error","no-nested-ternary":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-param-reassign":"error","no-prototype-builtins":"error","no-redeclare":"off","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-undef":"off","no-unreachable":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-useless-catch":"error","no-useless-constructor":"error","no-useless-escape":"error","no-var":"error","no-with":"error","object-shorthand":["error","methods"],"prefer-rest-params":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error","no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",varsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,fix:{imports:"safe-fix"}}],"no-use-before-define":"off","max-depth":["error",3],"max-params":["error",4],"max-lines-per-function":["error",{max:250,skipBlankLines:!0,skipComments:!0}],"eslint/no-await-in-loop":"error","eslint/no-console":"off","eslint/no-constant-binary-expression":"off","eslint/no-control-regex":"error","eslint/no-else-return":"error","eslint/no-empty":"error","eslint/no-empty-function":"error","eslint/no-new":"off","eslint/no-self-compare":"error","eslint/no-shadow":"error","eslint/no-template-curly-in-string":"error","eslint/no-unassigned-vars":"off","eslint/no-underscore-dangle":"off","eslint/no-unmodified-loop-condition":"off","eslint/no-unused-expressions":"off","eslint/no-useless-concat":"off","eslint/preserve-caught-error":"off","eslint/prefer-arrow-callback":"error","eslint/prefer-const":"error","eslint/prefer-template":"error","typescript/consistent-type-imports":"error","typescript/dot-notation":"error","typescript/no-confusing-void-expression":"off","typescript/no-empty-object-type":["error",{allowInterfaces:"with-single-extends"}],"typescript/no-explicit-any":"error","typescript/no-extra-non-null-assertion":"error","typescript/no-extraneous-class":"error","typescript/no-floating-promises":"off","typescript/no-import-type-side-effects":"error","typescript/no-misused-new":"error","typescript/no-misused-promises":["error",{checksVoidReturn:!1}],"typescript/no-namespace":"error","typescript/no-non-null-asserted-optional-chain":"error","typescript/no-non-null-assertion":"error","typescript/no-unnecessary-boolean-literal-compare":"error","typescript/no-unnecessary-condition":"error","typescript/no-unnecessary-type-assertion":"error","typescript/no-unnecessary-type-constraint":"error","typescript/no-unsafe-declaration-merging":"error","typescript/no-unsafe-function-type":"error","typescript/no-unsafe-type-assertion":"error","typescript/no-wrapper-object-types":"error","typescript/prefer-as-const":"error","typescript/prefer-namespace-keyword":"error","typescript/prefer-nullish-coalescing":"error","typescript/require-await":"error","typescript/switch-exhaustiveness-check":["error",{considerDefaultExhaustiveForUnions:!0}],"import/no-commonjs":"off","import/no-cycle":"error","import/no-duplicates":"error","import/no-named-as-default":"off","import/no-named-as-default-member":"off","import/no-self-import":"off","import/no-unassigned-import":"off","unicorn/consistent-function-scoping":"off","unicorn/no-array-reverse":"off","unicorn/no-array-sort":"off","unicorn/no-empty-file":"off","unicorn/no-new-array":"off","unicorn/no-useless-fallback-in-spread":"off","unicorn/no-useless-spread":"off","unicorn/prefer-add-event-listener":"off","unicorn/prefer-array-flat-map":"error","unicorn/prefer-date-now":"error","unicorn/prefer-logical-operator-over-ternary":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-optional-catch-binding":"error","unicorn/require-module-specifiers":"off","unicorn/throw-new-error":"error","promise/always-return":"off","promise/no-callback-in-promise":"off","promise/no-multiple-resolved":"off","promise/no-promise-in-callback":"off","oxc/no-async-endpoint-handlers":"off"};export const TEST_FILES=["**/*.test.ts","**/*.test.tsx","**/*.spec.ts","**/*.spec.tsx","**/__tests__/**","**/tests/**"];const core=(e={})=>{const r=o(n,e);return{plugins:["eslint","typescript","import","unicorn","promise","oxc"],jsPlugins:r.jsPlugins,env:{builtin:!0,es2024:!0},categories:{correctness:"error",suspicious:"error",perf:"error",pedantic:"off",style:"off",restriction:"off",nursery:"off"},rules:{...s,...r.rules},overrides:[{files:["**/*.tsx"],rules:{"func-style":"off"}},{files:["**/*.d.ts"],rules:{"typescript/no-explicit-any":"off"}},{files:TEST_FILES,rules:{"@ashstack/core/max-lines":"off","max-lines-per-function":"off","typescript/await-thenable":"off","typescript/no-non-null-assertion":"off","typescript/no-unsafe-type-assertion":"off","typescript/require-await":"off","typescript/unbound-method":"off"}}]}};export{core};export default core;
@@ -1 +1 @@
1
- const e=(t)=>new URL(t,import.meta.url).href;export const coreRegistry=[{meta:{name:"@ashstack/core"},url:e("../core/rules/core/index.js"),rules:{"no-comments":{},"no-naming-convention":{},"no-packed-condition":{},"max-lines":{},"max-complexity":{}}},{meta:{name:"@ashstack/zod"},url:e("../core/rules/zod/index.js"),option:"zod",packages:["zod"],rules:{"prefer-enum":{}}}],reactRegistry=[{meta:{name:"@ashstack/react"},url:e("../react/rules/react/index.js"),rules:{"no-unlabeled-icon-button":{},"no-svg-without-title":{},"hoist-intl":{},"prefer-design-system":{defaultOff:!0},"components-tsx-only":{defaultOff:!0}}},{meta:{name:"@ashstack/query"},url:e("../react/rules/query/index.js"),option:"query",packages:["@tanstack/react-query"],rules:{"no-inline-keys":{},"no-deprecated-filters":{},"require-destructured-hooks":{},"no-fetch-in-query-fn":{},"next-page-param-undefined":{}}},{meta:{name:"@ashstack/zustand"},url:e("../react/rules/zustand/index.js"),option:"zustand",packages:["zustand"],rules:{"require-selector":{}}},{meta:{name:"@ashstack/i18n"},url:e("../react/rules/i18n/index.js"),option:"i18n",packages:["i18next","react-i18next","@lingui/core","react-intl","use-intl","next-intl","expo-localization"],rules:{"no-bare-text":{},"no-bare-attrs":{},"no-bare-toast":{}}},{meta:{name:"@ashstack/tailwind"},url:e("../react/rules/tailwind/index.js"),option:"tailwind",packages:["tailwindcss"],rules:{"prefer-cn":{},"use-logical-classes":{}}},{meta:{name:"@ashstack/tanstack-router"},url:e("../react/rules/tanstack-router/index.js"),option:"tanstackRouter",packages:["@tanstack/react-router"],rules:{"require-selector":{},"no-search-casts":{}}}],reactNativeRegistry=[{meta:{name:"@ashstack/react-native"},url:e("../react-native/rules/react-native/index.js"),restrictedImports:{paths:[{name:"react",importNames:["forwardRef"],message:"Accept `ref` as a regular prop and delete the `forwardRef` wrapper — React 19 passes `ref` like any other prop."},{name:"react",importNames:["useContext"],message:"Call `use(Context)` instead of `useContext(Context)`; React 19 replaces the hook with it."}],patterns:[{group:["expo-linear-gradient","react-native-linear-gradient"],message:"Apply the gradient through the `experimental_backgroundImage` style property instead of a gradient component."}]},rules:{"no-keyboard-will-events":{},"no-scroll-position-state":{},"no-conditional-style-array":{},"no-leaked-render":{},"no-rn-image-network-source":{},"no-redundant-view-nesting":{},"no-rn-namespace-import":{},"no-unlabeled-icon-pressable":{},"hoist-stateless-function":{},"no-manual-memo":{},"no-dynamic-import":{}}},{meta:{name:"@ashstack/unistyles"},url:e("../react-native/rules/unistyles/index.js"),option:"unistyles",packages:["react-native-unistyles"],restrictedImports:{paths:[{name:"react-native",importNames:["StyleSheet"],message:"Import `StyleSheet` from `react-native-unistyles` instead of `react-native`."},{name:"react-native",importNames:["useWindowDimensions","Dimensions"],message:"Read screen size from `rt.screen` inside `StyleSheet.create`, or `UnistylesRuntime.screen` outside it, instead of the `Dimensions` APIs."},{name:"react-native",importNames:["SafeAreaView"],message:'Set `contentInsetAdjustmentBehavior="automatic"` on the scroll view, or apply `rt.insets` from `react-native-unistyles`, instead of `SafeAreaView`.'},{name:"react-native-safe-area-context",importNames:["useSafeAreaInsets","useSafeAreaFrame","SafeAreaView"],message:"Read safe-area values from `rt.insets`, or `UnistylesRuntime.insets` outside a stylesheet, in `react-native-unistyles`."}]},rules:{"animated-theme":{},"content-container":{},"in-sheet":{},insets:{},"no-hardcoded-color":{},"no-hardcoded-spacing":{},"no-margin":{},"no-paramless-dynamic-function":{},"no-style-spread":{},"no-unused-styles":{},"rtl-style-call":{},"theme-screen-component":{},"theme-style-attr":{}}},{meta:{name:"@ashstack/legend-list"},url:e("../react-native/rules/legend-list/index.js"),option:"legendList",packages:["@legendapp/list"],restrictedImports:{paths:[{name:"react-native",importNames:["FlatList","SectionList","VirtualizedList"],message:"Render this list with `LegendList` from `@legendapp/list/react-native`; a `ScrollView` plus `map` is fine for fewer than 20 static items."},{name:"@shopify/flash-list",message:"Import `LegendList` from `@legendapp/list/react-native` — Legend List replaced FlashList in this stack."}],patterns:[{group:["@legendapp/list"],message:"Import from the platform entrypoint `@legendapp/list/react-native`, not the package root."}]},rules:{"required-props":{},"no-index-key-extractor":{},"no-remount-key":{},"no-inline-render-item-props":{},"no-mixed-children":{},"no-flex-in-content-container":{},"typed-items-need-item-type":{},"no-scrollview-map":{},"no-unsupported-props":{}}},{meta:{name:"@ashstack/legend-state"},url:e("../react-native/rules/legend-state/index.js"),option:"legendState",packages:["@legendapp/state"],restrictedImports:{paths:[{name:"@legendapp/state/react",importNames:["use$","useSelector"],message:"Use `useValue` from `@legendapp/state/react`; `use$` and `useSelector` are deprecated."}]},rules:{"no-assignment":{},naming:{},"no-nested-observable":{},"no-react-mirror":{},"no-untracked-get-in-jsx":{},"no-peek-in-selector":{},"no-object-selector":{},"no-observable-in-component":{}}},{meta:{name:"@ashstack/reanimated"},url:e("../react-native/rules/reanimated/index.js"),option:"reanimated",packages:["react-native-reanimated"],restrictedImports:{paths:[{name:"react-native",importNames:["Animated"],message:"Use `react-native-reanimated` instead of React Native's `Animated` API."},{name:"react-native-reanimated",importNames:["runOnJS","runOnUI"],message:"Use `scheduleOnRN` and `scheduleOnUI` from `react-native-worklets`; `runOnJS` and `runOnUI` are deprecated."},{name:"react-native-worklets",importNames:["runOnJS","runOnUI"],message:"Use `scheduleOnRN` and `scheduleOnUI` from `react-native-worklets`; `runOnJS` and `runOnUI` are deprecated."}]},rules:{"animated-reaction-safety":{},"animated-style-needs-animated-component":{},"animated-updater-purity":{},"gpu-properties-only":{},"hoist-layout-animation-builder":{},"interpolate-needs-clamp":{},"no-shared-value-dot-value":{},"no-react-state-from-continuous-worklet":{},"prefer-lazy-shared-value-initializer":{},"schedule-on-rn-scope":{},"shared-value-usage":{}}},{meta:{name:"@ashstack/turbo-image"},url:e("../react-native/rules/turbo-image/index.js"),option:"turboImage",packages:["react-native-turbo-image"],rules:{"require-resize":{},"require-cache-policy":{}}},{meta:{name:"@ashstack/skia"},url:e("../react-native/rules/skia/index.js"),option:"skia",packages:["@shopify/react-native-skia"],restrictedImports:{paths:[{name:"@shopify/react-native-skia",importNames:["usePathValue","usePathInterpolation"],message:"Keep one stable `SkPath` buffer and mutate it inside `useDerivedValue`, with consumers reading the driving shared value."}]},rules:{"canvas-opaque":{}}},{meta:{name:"@ashstack/keyboard"},url:e("../react-native/rules/keyboard/index.js"),option:"keyboard",packages:["react-native-keyboard-controller"],restrictedImports:{paths:[{name:"react-native",importNames:["KeyboardAvoidingView"],message:"Import `KeyboardAvoidingView` from `react-native-keyboard-controller` — same props, tracked per frame. For a scrolling form, its `KeyboardAwareScrollView`."}]},rules:{}}];
1
+ const e=(t)=>new URL(t,import.meta.url).href;export const coreRegistry=[{meta:{name:"@ashstack/core"},url:e("../core/rules/core/index.js"),rules:{"no-comments":{},"no-naming-convention":{},"no-packed-condition":{},"max-lines":{},"max-complexity":{}}},{meta:{name:"@ashstack/zod"},url:e("../core/rules/zod/index.js"),option:"zod",packages:["zod"],rules:{"prefer-enum":{}}}],reactRegistry=[{meta:{name:"@ashstack/react"},url:e("../react/rules/react/index.js"),rules:{"no-unlabeled-icon-button":{},"no-svg-without-title":{},"hoist-intl":{},"prefer-design-system":{defaultOff:!0},"components-tsx-only":{defaultOff:!0}}},{meta:{name:"@ashstack/query"},url:e("../react/rules/query/index.js"),option:"query",packages:["@tanstack/react-query"],rules:{"no-inline-keys":{},"no-deprecated-filters":{},"require-destructured-hooks":{},"no-fetch-in-query-fn":{},"next-page-param-undefined":{}}},{meta:{name:"@ashstack/zustand"},url:e("../react/rules/zustand/index.js"),option:"zustand",packages:["zustand"],rules:{"require-selector":{}}},{meta:{name:"@ashstack/i18n"},url:e("../react/rules/i18n/index.js"),option:"i18n",packages:["i18next","react-i18next","@lingui/core","react-intl","use-intl","next-intl","expo-localization"],rules:{"no-bare-text":{},"no-bare-attrs":{},"no-bare-toast":{}}},{meta:{name:"@ashstack/stylex"},url:e("../react/rules/stylex/index.js"),option:"stylex",packages:["@stylexjs/stylex"],rules:{"inline-props":{},"no-conflicting-props":{},"no-duplicate-styles":{},"require-tokens":{}}},{meta:{name:"@ashstack/tailwind"},url:e("../react/rules/tailwind/index.js"),option:"tailwind",packages:["tailwindcss"],rules:{"prefer-cn":{},"use-logical-classes":{}}},{meta:{name:"@ashstack/tanstack-router"},url:e("../react/rules/tanstack-router/index.js"),option:"tanstackRouter",packages:["@tanstack/react-router"],rules:{"require-selector":{},"no-search-casts":{}}}],reactNativeRegistry=[{meta:{name:"@ashstack/react-native"},url:e("../react-native/rules/react-native/index.js"),restrictedImports:{paths:[{name:"react",importNames:["forwardRef"],message:"Accept `ref` as a regular prop and delete the `forwardRef` wrapper — React 19 passes `ref` like any other prop."},{name:"react",importNames:["useContext"],message:"Call `use(Context)` instead of `useContext(Context)`; React 19 replaces the hook with it."}],patterns:[{group:["expo-linear-gradient","react-native-linear-gradient"],message:"Apply the gradient through the `experimental_backgroundImage` style property instead of a gradient component."}]},rules:{"no-keyboard-will-events":{},"no-scroll-position-state":{},"no-conditional-style-array":{},"no-leaked-render":{},"no-rn-image-network-source":{},"no-redundant-view-nesting":{},"no-rn-namespace-import":{},"no-unlabeled-icon-pressable":{},"hoist-stateless-function":{},"no-manual-memo":{},"no-dynamic-import":{}}},{meta:{name:"@ashstack/unistyles"},url:e("../react-native/rules/unistyles/index.js"),option:"unistyles",packages:["react-native-unistyles"],restrictedImports:{paths:[{name:"react-native",importNames:["StyleSheet"],message:"Import `StyleSheet` from `react-native-unistyles` instead of `react-native`."},{name:"react-native",importNames:["useWindowDimensions","Dimensions"],message:"Read screen size from `rt.screen` inside `StyleSheet.create`, or `UnistylesRuntime.screen` outside it, instead of the `Dimensions` APIs."},{name:"react-native",importNames:["SafeAreaView"],message:'Set `contentInsetAdjustmentBehavior="automatic"` on the scroll view, or apply `rt.insets` from `react-native-unistyles`, instead of `SafeAreaView`.'},{name:"react-native-safe-area-context",importNames:["useSafeAreaInsets","useSafeAreaFrame","SafeAreaView"],message:"Read safe-area values from `rt.insets`, or `UnistylesRuntime.insets` outside a stylesheet, in `react-native-unistyles`."}]},rules:{"animated-theme":{},"content-container":{},"in-sheet":{},insets:{},"no-hardcoded-color":{},"no-hardcoded-spacing":{},"no-margin":{},"no-paramless-dynamic-function":{},"no-style-spread":{},"no-unused-styles":{},"rtl-style-call":{},"theme-screen-component":{},"theme-style-attr":{}}},{meta:{name:"@ashstack/legend-list"},url:e("../react-native/rules/legend-list/index.js"),option:"legendList",packages:["@legendapp/list"],restrictedImports:{paths:[{name:"react-native",importNames:["FlatList","SectionList","VirtualizedList"],message:"Render this list with `LegendList` from `@legendapp/list/react-native`; a `ScrollView` plus `map` is fine for fewer than 20 static items."},{name:"@shopify/flash-list",message:"Import `LegendList` from `@legendapp/list/react-native` — Legend List replaced FlashList in this stack."}],patterns:[{group:["@legendapp/list"],message:"Import from the platform entrypoint `@legendapp/list/react-native`, not the package root."}]},rules:{"required-props":{},"no-index-key-extractor":{},"no-remount-key":{},"no-inline-render-item-props":{},"no-mixed-children":{},"no-flex-in-content-container":{},"typed-items-need-item-type":{},"no-scrollview-map":{},"no-unsupported-props":{}}},{meta:{name:"@ashstack/legend-state"},url:e("../react-native/rules/legend-state/index.js"),option:"legendState",packages:["@legendapp/state"],restrictedImports:{paths:[{name:"@legendapp/state/react",importNames:["use$","useSelector"],message:"Use `useValue` from `@legendapp/state/react`; `use$` and `useSelector` are deprecated."}]},rules:{"no-assignment":{},naming:{},"no-nested-observable":{},"no-react-mirror":{},"no-untracked-get-in-jsx":{},"no-peek-in-selector":{},"no-object-selector":{},"no-observable-in-component":{}}},{meta:{name:"@ashstack/reanimated"},url:e("../react-native/rules/reanimated/index.js"),option:"reanimated",packages:["react-native-reanimated"],restrictedImports:{paths:[{name:"react-native",importNames:["Animated"],message:"Use `react-native-reanimated` instead of React Native's `Animated` API."},{name:"react-native-reanimated",importNames:["runOnJS","runOnUI"],message:"Use `scheduleOnRN` and `scheduleOnUI` from `react-native-worklets`; `runOnJS` and `runOnUI` are deprecated."},{name:"react-native-worklets",importNames:["runOnJS","runOnUI"],message:"Use `scheduleOnRN` and `scheduleOnUI` from `react-native-worklets`; `runOnJS` and `runOnUI` are deprecated."}]},rules:{"animated-reaction-safety":{},"animated-style-needs-animated-component":{},"animated-updater-purity":{},"gpu-properties-only":{},"hoist-layout-animation-builder":{},"interpolate-needs-clamp":{},"no-shared-value-dot-value":{},"no-react-state-from-continuous-worklet":{},"prefer-lazy-shared-value-initializer":{},"schedule-on-rn-scope":{},"shared-value-usage":{}}},{meta:{name:"@ashstack/turbo-image"},url:e("../react-native/rules/turbo-image/index.js"),option:"turboImage",packages:["react-native-turbo-image"],rules:{"require-resize":{},"require-cache-policy":{}}},{meta:{name:"@ashstack/skia"},url:e("../react-native/rules/skia/index.js"),option:"skia",packages:["@shopify/react-native-skia"],restrictedImports:{paths:[{name:"@shopify/react-native-skia",importNames:["usePathValue","usePathInterpolation"],message:"Keep one stable `SkPath` buffer and mutate it inside `useDerivedValue`, with consumers reading the driving shared value."}]},rules:{"canvas-opaque":{}}},{meta:{name:"@ashstack/keyboard"},url:e("../react-native/rules/keyboard/index.js"),option:"keyboard",packages:["react-native-keyboard-controller"],restrictedImports:{paths:[{name:"react-native",importNames:["KeyboardAvoidingView"],message:"Import `KeyboardAvoidingView` from `react-native-keyboard-controller` — same props, tracked per frame. For a scrolling form, its `KeyboardAwareScrollView`."}]},rules:{}}];
@@ -2,7 +2,7 @@ import type { AllowWarnDeny } from "oxlint";
2
2
  /** A severity, or a severity followed by as many of the rule's options as you want to set. */
3
3
  type RuleSetting<Options extends unknown[] = []> = AllowWarnDeny | [AllowWarnDeny, ...Partial<Options>];
4
4
  /** Every rule id `react()` adds on top of the entry below it. */
5
- export type ReactRuleId = "@ashstack/react/no-unlabeled-icon-button" | "@ashstack/react/no-svg-without-title" | "@ashstack/react/hoist-intl" | "@ashstack/react/prefer-design-system" | "@ashstack/react/components-tsx-only" | "@ashstack/query/no-inline-keys" | "@ashstack/query/no-deprecated-filters" | "@ashstack/query/require-destructured-hooks" | "@ashstack/query/no-fetch-in-query-fn" | "@ashstack/query/next-page-param-undefined" | "@ashstack/zustand/require-selector" | "@ashstack/i18n/no-bare-text" | "@ashstack/i18n/no-bare-attrs" | "@ashstack/i18n/no-bare-toast" | "@ashstack/tailwind/prefer-cn" | "@ashstack/tailwind/use-logical-classes" | "@ashstack/tanstack-router/require-selector" | "@ashstack/tanstack-router/no-search-casts" | "@ashstack/effects/no-derived-state" | "@ashstack/effects/no-chain-state-updates" | "@ashstack/effects/no-event-handler" | "@ashstack/effects/no-adjust-state-on-prop-change" | "@ashstack/effects/no-reset-all-state-on-prop-change" | "@ashstack/effects/no-pass-live-state-to-parent" | "@ashstack/effects/no-pass-data-to-parent" | "@ashstack/effects/no-external-store-subscription" | "@ashstack/effects/no-initialize-state";
5
+ export type ReactRuleId = "@ashstack/react/no-unlabeled-icon-button" | "@ashstack/react/no-svg-without-title" | "@ashstack/react/hoist-intl" | "@ashstack/react/prefer-design-system" | "@ashstack/react/components-tsx-only" | "@ashstack/query/no-inline-keys" | "@ashstack/query/no-deprecated-filters" | "@ashstack/query/require-destructured-hooks" | "@ashstack/query/no-fetch-in-query-fn" | "@ashstack/query/next-page-param-undefined" | "@ashstack/zustand/require-selector" | "@ashstack/i18n/no-bare-text" | "@ashstack/i18n/no-bare-attrs" | "@ashstack/i18n/no-bare-toast" | "@ashstack/stylex/inline-props" | "@ashstack/stylex/no-conflicting-props" | "@ashstack/stylex/no-duplicate-styles" | "@ashstack/stylex/require-tokens" | "@ashstack/tailwind/prefer-cn" | "@ashstack/tailwind/use-logical-classes" | "@ashstack/tanstack-router/require-selector" | "@ashstack/tanstack-router/no-search-casts" | "@ashstack/effects/no-derived-state" | "@ashstack/effects/no-chain-state-updates" | "@ashstack/effects/no-event-handler" | "@ashstack/effects/no-adjust-state-on-prop-change" | "@ashstack/effects/no-reset-all-state-on-prop-change" | "@ashstack/effects/no-pass-live-state-to-parent" | "@ashstack/effects/no-pass-data-to-parent" | "@ashstack/effects/no-external-store-subscription" | "@ashstack/effects/no-initialize-state";
6
6
  declare module "oxlint" {
7
7
  interface DummyRuleMap {
8
8
  /**
@@ -133,6 +133,41 @@ declare module "oxlint" {
133
133
  * @see https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstacki18nno-bare-toast
134
134
  */
135
135
  "@ashstack/i18n/no-bare-toast"?: RuleSetting;
136
+ /**
137
+ * Use `stylex.props(...)` as JSX props or return/store its result.
138
+ *
139
+ * **Default: on**, when `@stylexjs/stylex` is a dependency.
140
+ *
141
+ * @see https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstackstylexinline-props
142
+ */
143
+ "@ashstack/stylex/inline-props"?: RuleSetting;
144
+ /**
145
+ * Report className overrides and inline CSS that overlaps StyleX declarations.
146
+ *
147
+ * **Default: on**, when `@stylexjs/stylex` is a dependency.
148
+ *
149
+ * @see https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstackstylexno-conflicting-props
150
+ */
151
+ "@ashstack/stylex/no-conflicting-props"?: RuleSetting;
152
+ /**
153
+ * Reuse identical static styles within one `stylex.create` call.
154
+ *
155
+ * **Default: on**, when `@stylexjs/stylex` is a dependency.
156
+ *
157
+ * @see https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstackstylexno-duplicate-styles
158
+ */
159
+ "@ashstack/stylex/no-duplicate-styles"?: RuleSetting;
160
+ /**
161
+ * Use configured color and radius groups in `stylex.create`; defaults are `colors` and `radii`.
162
+ *
163
+ * **Default: on**, when `@stylexjs/stylex` is a dependency.
164
+ *
165
+ * @see https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstackstylexrequire-tokens
166
+ */
167
+ "@ashstack/stylex/require-tokens"?: RuleSetting<[{
168
+ colors?: string | false;
169
+ radii?: string | false;
170
+ }]>;
136
171
  /**
137
172
  * Require a dynamic class value to go through `cn(...)` before it reaches a `class`, `className` or `*ClassName` prop. Reports both where the value reaches the prop and where a variable named after classes is declared.
138
173
  *
@@ -0,0 +1 @@
1
+ import{fileURLToPath as e}from"node:url";export const STYLEX_SPECIFIER=e(new URL("../../vendor/stylex/index.mjs",import.meta.url)),stylexPlugin={name:"@stylexjs",specifier:STYLEX_SPECIFIER},STYLEX_RULES={"@stylexjs/valid-styles":"error","@stylexjs/valid-shorthands":"error","@stylexjs/no-unused":"error","@stylexjs/enforce-extension":"error","@stylexjs/no-legacy-contextual-styles":"error","@stylexjs/no-nonstandard-styles":"error"};
@@ -114,6 +114,8 @@ export type ReactOptions = CoreOptions & {
114
114
  zustand?: boolean;
115
115
  /** [`@ashstack/i18n/` rules](https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstacki18n) — detected from i18next/lingui/react-intl/use-intl/next-intl/expo-localization */
116
116
  i18n?: boolean;
117
+ /** [`@ashstack/stylex/` rules](https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstackstylex) — detected from `@stylexjs/stylex` */
118
+ stylex?: boolean;
117
119
  /** [`@ashstack/tailwind/` rules](https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstacktailwind) — detected from `tailwindcss` */
118
120
  tailwind?: boolean;
119
121
  /** [`@ashstack/tanstack-router/` rules](https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#ashstacktanstack-router) — detected from `@tanstack/react-router` */
package/dist/modules.js CHANGED
@@ -1 +1 @@
1
- import o from"./core/rules/core/index.js";import r from"./core/rules/zod/index.js";import e from"./react-native/rules/keyboard/index.js";import t from"./react-native/rules/legend-list/index.js";import m from"./react-native/rules/legend-state/index.js";import d from"./react-native/rules/react-native/index.js";import i from"./react-native/rules/reanimated/index.js";import u from"./react-native/rules/skia/index.js";import l from"./react-native/rules/turbo-image/index.js";import p from"./react-native/rules/unistyles/index.js";import M from"./react/rules/i18n/index.js";import a from"./react/rules/query/index.js";import f from"./react/rules/react/index.js";import s from"./react/rules/tailwind/index.js";import n from"./react/rules/tanstack-router/index.js";import c from"./react/rules/zustand/index.js";export const coreModules=[o,r],reactModules=[f,a,c,M,s,n],reactNativeModules=[d,p,t,m,i,l,u,e];
1
+ import o from"./core/rules/core/index.js";import r from"./core/rules/zod/index.js";import e from"./react-native/rules/keyboard/index.js";import t from"./react-native/rules/legend-list/index.js";import m from"./react-native/rules/legend-state/index.js";import d from"./react-native/rules/react-native/index.js";import i from"./react-native/rules/reanimated/index.js";import l from"./react-native/rules/skia/index.js";import u from"./react-native/rules/turbo-image/index.js";import p from"./react-native/rules/unistyles/index.js";import M from"./react/rules/i18n/index.js";import f from"./react/rules/query/index.js";import a from"./react/rules/react/index.js";import s from"./react/rules/stylex/index.js";import n from"./react/rules/tailwind/index.js";import c from"./react/rules/tanstack-router/index.js";import x from"./react/rules/zustand/index.js";export const coreModules=[o,r],reactModules=[a,f,x,M,s,n,c],reactNativeModules=[d,p,t,m,i,u,l,e];
@@ -18,7 +18,7 @@ export declare const COMPONENT_MAX_COMPLEXITY = 10;
18
18
  /**
19
19
  * React (web) entry — everything in core plus react, jsx-a11y, React Compiler
20
20
  * diagnostics, you-might-not-need-an-effect, and the auto-detected library
21
- * modules (query, zustand, i18n).
21
+ * modules (query, zustand, i18n, StyleX).
22
22
  *
23
23
  * @see [every rule `react()` sets](https://github.com/AlshehriAli0/ashStack/blob/main/packages/lint/RULES.md#react)
24
24
  */
@@ -1 +1 @@
1
- import o from"../core/index.js";import{EFFECT_RULES as t,effectPlugin as a}from"../lib/effect-plugin.js";import{mergeConfigs as s}from"../lib/merge.js";import{composeModules as n}from"../lib/module.js";import{coreRegistry as c,reactRegistry as i}from"../lib/registry.js";const p={"eslint/no-empty":"off","eslint/no-empty-function":"off"},l={"react/error-boundaries":"error","react/globals":"error","react/immutability":"error","react/incompatible-library":"error","react/preserve-manual-memoization":"error","react/purity":"error","react/refs":"error","react/set-state-in-effect":"off","react/set-state-in-render":"error","react/static-components":"error","react/use-memo":"error","react/void-use-memo":"error","react/capitalized-calls":"error","react/exhaustive-effect-dependencies":"error","react/hooks":"error","react/memo-dependencies":"error","react/no-deriving-state-in-effects":"off","react/invariant":"error","react/rule-suppression":"error","react/syntax":"error","react/todo":"error","react/unsupported-syntax":"error"},f=(e)=>{const r=e?"off":"error";return{"react-perf/jsx-no-jsx-as-prop":r,"react-perf/jsx-no-new-array-as-prop":r,"react-perf/jsx-no-new-function-as-prop":r,"react-perf/jsx-no-new-object-as-prop":r,"react/jsx-no-constructed-context-values":r,"react/no-object-type-as-default-prop":r}},u=["**/routes/**","**/src/app/**","**/app/**/_layout.tsx","**/app/**/+*.tsx"];export const COMPONENT_MAX_LINES=250,COMPONENT_MAX_COMPLEXITY=10;const x={...p,"max-lines-per-function":["error",{max:120,skipBlankLines:!0,skipComments:!0}],"react/react-in-jsx-scope":"off","react/style-prop-object":"off","react/only-export-components":"off","react/rules-of-hooks":"error","react/exhaustive-deps":"error","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-useless-fragment":"error","react/no-array-index-key":"error","react/no-children-prop":"error","react/no-danger":"error","react/no-danger-with-children":"error","react/no-direct-mutation-state":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-this-in-sfc":"error","react/no-unsafe":"error","react/no-unescaped-entities":"error","react/no-unstable-nested-components":["error",{allowAsProps:!0}],"react/require-render-return":"error","react/self-closing-comp":"error","react/void-dom-elements-no-children":"error",...l,"jsx-a11y/alt-text":"error","jsx-a11y/anchor-has-content":"error","jsx-a11y/anchor-is-valid":"error","jsx-a11y/click-events-have-key-events":"off","jsx-a11y/control-has-associated-label":"off","jsx-a11y/heading-has-content":"error","jsx-a11y/img-redundant-alt":"error","jsx-a11y/interactive-supports-focus":"error","jsx-a11y/label-has-associated-control":"error","jsx-a11y/no-aria-hidden-on-focusable":"error","jsx-a11y/no-autofocus":["error",{ignoreNonDOM:!0}],"jsx-a11y/no-noninteractive-element-interactions":"off","jsx-a11y/no-noninteractive-tabindex":"error","jsx-a11y/no-redundant-roles":"error","jsx-a11y/no-static-element-interactions":"error","jsx-a11y/prefer-tag-over-role":"off","jsx-a11y/role-has-required-aria-props":"error","jsx-a11y/role-supports-aria-props":"error","unicorn/filename-case":["error",{cases:{kebabCase:!0,pascalCase:!0}}]},react=(e={})=>{const r=n([...c,...i],e);return s(o(e),{plugins:["react","jsx-a11y","react-perf"],jsPlugins:[a,...r.jsPlugins],rules:{...x,...f(e.reactCompiler??!0),...t,...r.rules,"@ashstack/core/max-lines":["error",COMPONENT_MAX_LINES],"@ashstack/core/max-complexity":["error",COMPONENT_MAX_COMPLEXITY]},overrides:[{files:u,rules:{"unicorn/filename-case":"off"}}]})};export{react};export default react;
1
+ import t from"../core/index.js";import{EFFECT_RULES as a,effectPlugin as s}from"../lib/effect-plugin.js";import{mergeConfigs as n}from"../lib/merge.js";import{composeModules as c}from"../lib/module.js";import{coreRegistry as i,reactRegistry as p}from"../lib/registry.js";import{STYLEX_RULES as l,stylexPlugin as u}from"../lib/stylex-plugin.js";const f={"eslint/no-empty":"off","eslint/no-empty-function":"off"},x={"react/error-boundaries":"error","react/globals":"error","react/immutability":"error","react/incompatible-library":"error","react/preserve-manual-memoization":"error","react/purity":"error","react/refs":"error","react/set-state-in-effect":"off","react/set-state-in-render":"error","react/static-components":"error","react/use-memo":"error","react/void-use-memo":"error","react/capitalized-calls":"error","react/exhaustive-effect-dependencies":"error","react/hooks":"error","react/memo-dependencies":"error","react/no-deriving-state-in-effects":"off","react/invariant":"error","react/rule-suppression":"error","react/syntax":"error","react/todo":"error","react/unsupported-syntax":"error"},m=(e)=>{const r=e?"off":"error";return{"react-perf/jsx-no-jsx-as-prop":r,"react-perf/jsx-no-new-array-as-prop":r,"react-perf/jsx-no-new-function-as-prop":r,"react-perf/jsx-no-new-object-as-prop":r,"react/jsx-no-constructed-context-values":r,"react/no-object-type-as-default-prop":r}},d=["**/routes/**","**/src/app/**","**/app/**/_layout.tsx","**/app/**/+*.tsx"];export const COMPONENT_MAX_LINES=250,COMPONENT_MAX_COMPLEXITY=10;const y={...f,"max-lines-per-function":["error",{max:120,skipBlankLines:!0,skipComments:!0}],"react/react-in-jsx-scope":"off","react/style-prop-object":"off","react/only-export-components":"off","react/rules-of-hooks":"error","react/exhaustive-deps":"error","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-useless-fragment":"error","react/no-array-index-key":"error","react/no-children-prop":"error","react/no-danger":"error","react/no-danger-with-children":"error","react/no-direct-mutation-state":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-this-in-sfc":"error","react/no-unsafe":"error","react/no-unescaped-entities":"error","react/no-unstable-nested-components":["error",{allowAsProps:!0}],"react/require-render-return":"error","react/self-closing-comp":"error","react/void-dom-elements-no-children":"error",...x,"jsx-a11y/alt-text":"error","jsx-a11y/anchor-has-content":"error","jsx-a11y/anchor-is-valid":"error","jsx-a11y/click-events-have-key-events":"off","jsx-a11y/control-has-associated-label":"off","jsx-a11y/heading-has-content":"error","jsx-a11y/img-redundant-alt":"error","jsx-a11y/interactive-supports-focus":"error","jsx-a11y/label-has-associated-control":"error","jsx-a11y/no-aria-hidden-on-focusable":"error","jsx-a11y/no-autofocus":["error",{ignoreNonDOM:!0}],"jsx-a11y/no-noninteractive-element-interactions":"off","jsx-a11y/no-noninteractive-tabindex":"error","jsx-a11y/no-redundant-roles":"error","jsx-a11y/no-static-element-interactions":"error","jsx-a11y/prefer-tag-over-role":"off","jsx-a11y/role-has-required-aria-props":"error","jsx-a11y/role-supports-aria-props":"error","unicorn/filename-case":["error",{cases:{kebabCase:!0,pascalCase:!0}}]},react=(e={})=>{const r=c([...i,...p],e),o=r.rules["@ashstack/stylex/inline-props"]==="error";return n(t(e),{plugins:["react","jsx-a11y","react-perf"],jsPlugins:[s,...r.jsPlugins,...o?[u]:[]],rules:{...y,...m(e.reactCompiler??!0),...a,...r.rules,...o?l:{},"@ashstack/core/max-lines":["error",COMPONENT_MAX_LINES],"@ashstack/core/max-complexity":["error",COMPONENT_MAX_COMPLEXITY]},overrides:[{files:d,rules:{"unicorn/filename-case":"off"}}]})};export{react};export default react;
@@ -0,0 +1 @@
1
+ const c=new Set(["@stylexjs/stylex","stylex"]);export const collectImports=(n,s,p)=>{for(const r of n){if(r.type!=="ImportDeclaration"||!c.has(r.source.value))continue;for(const e of r.specifiers){if(e.type==="ImportNamespaceSpecifier")p.namespaces.add(e.local.name);if(e.type==="ImportSpecifier"&&e.imported.type==="Identifier"&&e.imported.name===s)p.named.add(e.local.name)}}},isStylexCall=(n,s,p,r)=>{if(s.type!=="CallExpression")return!1;const{callee:e}=s;let t=null;if(e.type==="Identifier")t=e;if(e.type==="MemberExpression")t=e.object;if(t?.type!=="Identifier")return!1;if(!(e.type==="Identifier"&&r.named.has(t.name)||e.type==="MemberExpression"&&!e.computed&&r.namespaces.has(t.name)&&e.property.type==="Identifier"&&e.property.name===p))return!1;let i=n.sourceCode.getScope(t);while(i){const o=i.set.get(t.name);if(o)return o.defs.some((a)=>a.type==="ImportBinding");i=i.upper}return!1};
@@ -0,0 +1 @@
1
+ import{defineModule as e}from"../../../lib/module.js";import{inlineProps as o}from"./inline-props.js";import{noConflictingProps as t}from"./no-conflicting-props.js";import{noDuplicateStyles as r}from"./no-duplicate-styles.js";import{requireTokens as s}from"./require-tokens.js";export default e({meta:{name:"@ashstack/stylex"},url:import.meta.url,packages:["@stylexjs/stylex"],option:"stylex",docsWhen:"auto-enabled by `react()` when `@stylexjs/stylex` is a dependency",rules:{"inline-props":o,"no-conflicting-props":t,"no-duplicate-styles":r,"require-tokens":s}});
@@ -0,0 +1 @@
1
+ import{problem as o}from"../../../lib/ast.js";import{collectImports as n,isStylexCall as p}from"./imports.js";const s="Use `stylex.props(...)` as JSX props or return/store its result.";export const inlineProps=o(s,{createOnce(t){const r={namespaces:new Set,named:new Set};return{before(){r.namespaces.clear();r.named.clear();return t.sourceCode.text.includes("stylex")},Program(e){n(e.body,"props",r)},CallExpression(e){if(!p(t,e,"props",r))return;if(["JSXSpreadAttribute","VariableDeclarator","ReturnStatement","ArrowFunctionExpression"].includes(e.parent.type))return;t.report({node:e,message:s})}}}});
@@ -0,0 +1 @@
1
+ import{attributeName as C,problem as N,propertyKeyName as u,propertyValue as X,subtreeHas as v}from"../../../lib/ast.js";import{collectImports as S,isStylexCall as y}from"./imports.js";const I=(t,a,n)=>{if(t.type!=="MemberExpression"||t.computed)return;if(t.object.type!=="Identifier"||t.property.type!=="Identifier")return;const p=X(a.get(t.object.name),t.property.name);if(p?.type!=="ObjectExpression")return;for(const m of p.properties){const c=u(m);if(c)n.add(c)}},f=(t,a,n)=>{if(t.type==="MemberExpression")I(t,a,n);else if(t.type==="ArrayExpression"){for(const p of t.elements)if(p)f(p,a,n)}else if(t.type==="LogicalExpression")f(t.right,a,n);else if(t.type==="ConditionalExpression"){f(t.consequent,a,n);f(t.alternate,a,n)}};export const noConflictingProps=N("Report className overrides and inline CSS that overlaps StyleX declarations.",{createOnce(t){const a={namespaces:new Set,named:new Set},n={namespaces:new Set,named:new Set},p=new Map,m=new Map,c=[],g=(e)=>{if(e.type!=="JSXSpreadAttribute")return null;const r=e.argument.type==="Identifier"?e.argument.name:null,s=r?m.get(r):e.argument;return s?.type==="CallExpression"&&y(t,s,"props",n)?{call:s,storedName:r}:null},b=(e,r)=>{if(e.type!=="JSXAttribute")return;const s=e.value;if(!(s?.type==="JSXExpressionContainer"&&v(s.expression,(o)=>{if(o.type!=="MemberExpression"||o.object.type!=="Identifier")return!1;const l=o.object.name;return o.property.type==="Identifier"&&o.property.name==="className"&&r.some((d)=>d.storedName===l)})))t.report({node:e,message:"`className` overrides StyleX classes."})},E=(e,r)=>{if(e.type!=="JSXAttribute"||e.value?.type!=="JSXExpressionContainer")return;const s=e.value.expression;if(s.type!=="ObjectExpression")return;const i=new Set;for(const{call:o}of r)if(o.type==="CallExpression")for(const l of o.arguments)f(l,p,i);for(const o of s.properties){const l=u(o);if(i.has(l))t.report({node:o,message:`Inline \`${l}\` overlaps a StyleX declaration.`})}},x=(e)=>{if(e.type!=="JSXOpeningElement")return;const r=[];for(const s of e.attributes){const i=g(s);if(i)r.push(i)}if(r.length===0)return;for(const s of e.attributes){const i=C(s);if(i==="className")b(s,r);if(i==="style")E(s,r)}};return{before(){a.namespaces.clear();a.named.clear();n.namespaces.clear();n.named.clear();p.clear();m.clear();c.length=0;return t.sourceCode.text.includes("stylex")},Program(e){S(e.body,"create",a);S(e.body,"props",n)},VariableDeclarator(e){if(e.id.type!=="Identifier"||e.init?.type!=="CallExpression")return;if(y(t,e.init,"props",n))m.set(e.id.name,e.init);if(!y(t,e.init,"create",a))return;const r=e.init.arguments[0];if(r?.type==="ObjectExpression")p.set(e.id.name,r)},JSXOpeningElement(e){if(e.attributes.some((r)=>r.type==="JSXSpreadAttribute"))c.push(e)},"Program:exit"(){c.forEach(x)}}}});
@@ -0,0 +1 @@
1
+ import{problem as c,propertyKeyName as o}from"../../../lib/ast.js";import{collectImports as l,isStylexCall as u}from"./imports.js";const y=new Set(["parent","loc","range","start","end","raw"]),f=(n,r)=>{if(y.has(n))return;return typeof r==="bigint"?{bigint:r.toString()}:r},m=(n)=>{if(n.type!=="ObjectExpression")return null;const r=[];for(const t of n.properties){if(t.type!=="Property")return null;const a=o(t);if(!a)return null;r.push([a,JSON.stringify(t.value,f)])}return JSON.stringify(r.sort(([t],[a])=>t.localeCompare(a)))},g=(n,r,t)=>{if(n.type!=="ObjectExpression")return;const a=new Map;for(const e of n.properties){if(e.type!=="Property")continue;const i=o(e);if(!i)continue;const s=m(e.value);if(s===null)continue;const p=a.get(s);if(p)t.push({node:e.value,owner:r,key:i,original:p});else a.set(s,i)}};export const noDuplicateStyles=c("Reuse identical static styles within one `stylex.create` call.",{createOnce(n){const r={namespaces:new Set,named:new Set},t=new Set,a=[];return{before(){r.namespaces.clear();r.named.clear();t.clear();a.length=0;return n.sourceCode.text.includes("stylex")},Program(e){l(e.body,"create",r)},MemberExpression(e){if(e.object.type!=="Identifier")return;if(e.computed&&e.property.type!=="Literal")t.add(`${e.object.name}.*`);if(e.property.type==="Identifier"&&!e.computed)t.add(`${e.object.name}.${e.property.name}`);if(e.property.type==="Literal"&&typeof e.property.value==="string")t.add(`${e.object.name}.${e.property.value}`)},CallExpression(e){if(!u(n,e,"create",r))return;if(e.parent.type!=="VariableDeclarator"||e.parent.id.type!=="Identifier")return;if(e.parent.parent.type==="VariableDeclaration"&&e.parent.parent.parent.type==="ExportNamedDeclaration")return;const[i]=e.arguments;if(i)g(i,e.parent.id.name,a)},"Program:exit"(){for(const{node:e,owner:i,key:s,original:p}of a){if(t.has(`${i}.*`)||t.has(`${i}.${s}`)&&t.has(`${i}.${p}`))continue;n.report({node:e,message:`\`${s}\` duplicates \`${p}\`. Reuse \`${p}\`.`})}}}}});
@@ -0,0 +1 @@
1
+ import{hasAncestor as p,isMemberCall as f,optionsOf as y,problem as m,propertyKeyName as h}from"../../../lib/ast.js";import{collectImports as b,isStylexCall as v}from"./imports.js";const O=/^(?:color|.*Color|fill|stroke)$/,g=/^border(?:TopLeft|TopRight|BottomLeft|BottomRight|StartStart|StartEnd|EndStart|EndEnd)?Radius$/,E=/^(?:boxShadow|textShadow|filter|backgroundImage|borderImageSource)$/,S=/#[\da-f]{3,8}\b/i,C=/(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color)\(/i,L=new Set(["currentColor","inherit","initial","unset","revert","revert-layer","none"]),R=new Set(["inherit","initial","unset","revert","revert-layer"]),T=(e)=>{if(O.test(e))return"color";if(g.test(e))return"radius";if(E.test(e))return"composite";return null},u=(e)=>{if(e.type==="Identifier")return e.name;if(e.type!=="MemberExpression")return"";const r=u(e.object);let t="";if(!e.computed&&e.property.type==="Identifier")t=e.property.name;if(e.computed&&e.property.type==="Literal"&&typeof e.property.value==="string")t=e.property.value;return r&&t?`${r}.${t}`:""},n=(e,r)=>{if(e.type!=="MemberExpression")return!1;const t=u(e);return t.startsWith(`${r}.`)&&!t.slice(r.length+1).includes(".")},x=(e,r)=>{if(e.type==="Identifier")return e.name==="undefined";if(e.type!=="Literal")return!1;if(e.value===null)return!0;if(r==="color")return typeof e.value==="string"&&L.has(e.value);return e.value===0||e.value==="0"||typeof e.value==="string"&&R.has(e.value)},k=(e,r)=>{if(e.type!=="TemplateLiteral"||e.expressions.length===0)return!1;if(!e.expressions.every((s)=>n(s,r)))return!1;const t=e.quasis.map((s,i)=>`${s.value.cooked??s.value.raw}${i<e.expressions.length?"TOKEN":""}`).join("");return/^color-mix\(in (?:srgb|srgb-linear|oklab|oklch|lab|lch|hsl|hwb), TOKEN(?: \d+(?:\.\d+)?%)?, (?:TOKEN(?: \d+(?:\.\d+)?%)?|transparent)\)$/.test(t)},w=(e,r,t)=>{let s="";if(r.type==="TemplateLiteral")s=r.quasis.map((a)=>a.value.cooked??a.value.raw).join("");if(r.type==="Literal"&&typeof r.value==="string")s=r.value;const i=s.includes("color-mix(")&&(r.type!=="TemplateLiteral"||!r.expressions.every((a)=>n(a,t)));if(S.test(s)||C.test(s)||i)e.report({node:r,message:`Use \`${t}.*\` for colors inside CSS values.`})},l=(e,r,t,s)=>{if(r.type==="ObjectExpression"){r.properties.forEach((i)=>{if(i.type==="Property")l(e,i.value,t,s)});return}if(r.type==="ArrayExpression"){r.elements.forEach((i)=>{if(i)l(e,i,t,s)});return}if(r.type==="ConditionalExpression"){l(e,r.consequent,t,s);l(e,r.alternate,t,s);return}if(r.type==="CallExpression"&&f(r,"firstThatWorks")){r.arguments.forEach((i)=>l(e,i,t,s));return}if(t==="composite"){w(e,r,s);return}if(x(r,t))return;if(n(r,s))return;if(t==="color"&&k(r,s))return;e.report({node:r,message:`Use \`${s}.*\` for ${t}.`})};export const requireTokens=m("Use configured color and radius groups in `stylex.create`; defaults are `colors` and `radii`.",{meta:{schema:[{type:"object",properties:{colors:{anyOf:[{type:"string",minLength:1},{type:"boolean",enum:[!1]}],default:"colors",description:"Color token group, or false to disable this check."},radii:{anyOf:[{type:"string",minLength:1},{type:"boolean",enum:[!1]}],default:"radii",description:"Radius token group, or false to disable this check."}},additionalProperties:!1}]},createOnce(e){const r={namespaces:new Set,named:new Set};let t="colors",s="radii";const i=(a)=>v(e,a,"create",r);return{before(){r.namespaces.clear();r.named.clear();({colors:t="colors",radii:s="radii"}=y(e,{}));return e.sourceCode.text.includes("stylex")},Program(a){b(a.body,"create",r)},Property(a){const o=T(h(a));if(o===null)return;if(!p(a,i))return;const c=o==="radius"?s:t;if(c===!1)return;l(e,a.value,o,c)}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ashstack/lint",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "ashStack shared oxlint configuration and custom rules. Entries: core, react, react-native, with per-library rule groups auto-detected from your dependencies. Consume from oxlint.config.mts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
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.
@@ -0,0 +1,10 @@
1
+ # @stylexjs/eslint-plugin
2
+
3
+ `index.mjs` bundles `@stylexjs/eslint-plugin@0.19.1` (MIT). Licenses:
4
+ [StyleX](LICENSE), [dependencies](licenses/).
5
+
6
+ To update, install the desired version in `packages/lint`, then run:
7
+
8
+ ```sh
9
+ bun build packages/lint/node_modules/@stylexjs/eslint-plugin/lib/index.js --bundle --minify --target=node --format=esm --outfile=packages/lint/vendor/stylex/index.mjs
10
+ ```