@ashstack/lint 0.3.1 → 0.5.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.
- package/README.md +17 -3
- package/dist/core/index.d.ts +7 -3
- package/dist/core/index.js +1 -1
- package/dist/core/rules/core/no-comments.js +1 -1
- package/dist/lib/ast.js +1 -1
- package/dist/lib/effect-plugin.js +1 -0
- package/dist/lib/module.js +1 -1
- package/dist/lib/registry.js +1 -0
- package/dist/lib/rule-types/core.d.ts +72 -0
- package/dist/lib/rule-types/core.js +1 -0
- package/dist/lib/rule-types/react-native.d.ts +333 -0
- package/dist/lib/rule-types/react-native.js +1 -0
- package/dist/lib/rule-types/react.d.ts +153 -0
- package/dist/lib/rule-types/react.js +1 -0
- package/dist/lib/types.d.ts +39 -11
- package/dist/modules.js +1 -0
- package/dist/react/index.d.ts +6 -1
- package/dist/react/index.js +1 -1
- package/dist/react/rules/query/next-page-param-undefined.js +1 -1
- package/dist/react/rules/query/no-fetch-in-query-fn.js +1 -1
- package/dist/react/rules/query/no-inline-keys.js +1 -1
- package/dist/react/rules/react/index.js +1 -0
- package/dist/react/rules/react/no-svg-without-title.js +1 -0
- package/dist/react/rules/react/no-unlabeled-icon-button.js +1 -0
- package/dist/react/rules/react/shared.js +1 -0
- package/dist/react/rules/tailwind/index.js +1 -0
- package/dist/react/rules/tailwind/prefer-cn.js +1 -0
- package/dist/react/rules/tailwind/shared.js +1 -0
- package/dist/react/rules/tailwind/use-logical-classes.js +1 -0
- package/dist/react/rules/tanstack-router/index.js +1 -0
- package/dist/react/rules/tanstack-router/no-search-casts.js +1 -0
- package/dist/react/rules/tanstack-router/require-selector.js +1 -0
- package/dist/react/rules/tanstack-router/shared.js +1 -0
- package/dist/react-native/index.d.ts +7 -1
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/rules/legend-list/index.js +1 -1
- package/dist/react-native/rules/react-native/no-manual-memo.js +1 -1
- package/package.json +6 -10
- package/vendor/react-effect/LICENSE +21 -0
- package/vendor/react-effect/README.md +25 -0
- package/vendor/react-effect/index.mjs +559 -0
- package/dist/core/rules/core/components-tsx-only.d.ts +0 -2
- package/dist/core/rules/core/hoist-intl.d.ts +0 -2
- package/dist/core/rules/core/index.d.ts +0 -2
- package/dist/core/rules/core/no-comments.d.ts +0 -2
- package/dist/core/rules/core/no-naming-convention.d.ts +0 -2
- package/dist/core/rules/core/no-packed-condition.d.ts +0 -2
- package/dist/core/rules/core/use-design-system.d.ts +0 -2
- package/dist/core/rules/zod/index.d.ts +0 -2
- package/dist/core/rules/zod/prefer-enum.d.ts +0 -2
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -1
- package/dist/lib/ast.d.ts +0 -44
- package/dist/lib/detect.d.ts +0 -9
- package/dist/lib/merge.d.ts +0 -9
- package/dist/lib/module.d.ts +0 -19
- package/dist/react/rules/i18n/index.d.ts +0 -2
- package/dist/react/rules/i18n/no-bare-attrs.d.ts +0 -2
- package/dist/react/rules/i18n/no-bare-text.d.ts +0 -2
- package/dist/react/rules/i18n/no-bare-toast.d.ts +0 -2
- package/dist/react/rules/query/index.d.ts +0 -2
- package/dist/react/rules/query/next-page-param-undefined.d.ts +0 -2
- package/dist/react/rules/query/no-deprecated-filters.d.ts +0 -2
- package/dist/react/rules/query/no-fetch-in-query-fn.d.ts +0 -2
- package/dist/react/rules/query/no-inline-keys.d.ts +0 -2
- package/dist/react/rules/query/require-destructured-hooks.d.ts +0 -2
- package/dist/react/rules/query/shared.d.ts +0 -2
- package/dist/react/rules/query/shared.js +0 -1
- package/dist/react/rules/zustand/index.d.ts +0 -2
- package/dist/react/rules/zustand/require-selector.d.ts +0 -2
- package/dist/react-native/rules/keyboard/index.d.ts +0 -2
- package/dist/react-native/rules/legend-list/index.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-flex-in-content-container.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-index-key-extractor.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-inline-data.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-inline-data.js +0 -1
- package/dist/react-native/rules/legend-list/no-inline-extra-data.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-inline-extra-data.js +0 -1
- package/dist/react-native/rules/legend-list/no-inline-render-item-props.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-mixed-children.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-remount-key.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-scrollview-map.d.ts +0 -2
- package/dist/react-native/rules/legend-list/no-unsupported-props.d.ts +0 -2
- package/dist/react-native/rules/legend-list/required-props.d.ts +0 -2
- package/dist/react-native/rules/legend-list/shared.d.ts +0 -19
- package/dist/react-native/rules/legend-list/typed-items-need-item-type.d.ts +0 -2
- package/dist/react-native/rules/legend-state/index.d.ts +0 -2
- package/dist/react-native/rules/legend-state/naming.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-assignment.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-nested-observable.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-object-selector.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-observable-in-component.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-peek-in-selector.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-react-mirror.d.ts +0 -2
- package/dist/react-native/rules/legend-state/no-untracked-get-in-jsx.d.ts +0 -2
- package/dist/react-native/rules/legend-state/shared.d.ts +0 -9
- package/dist/react-native/rules/react-native/hoist-stateless-function.d.ts +0 -2
- package/dist/react-native/rules/react-native/index.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-conditional-style-array.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-dynamic-import.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-keyboard-will-events.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-leaked-render.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-manual-memo.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-redundant-view-nesting.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-rn-image-network-source.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-rn-namespace-import.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-scroll-position-state.d.ts +0 -2
- package/dist/react-native/rules/react-native/no-unlabeled-icon-pressable.d.ts +0 -2
- package/dist/react-native/rules/reanimated/animated-reaction-safety.d.ts +0 -2
- package/dist/react-native/rules/reanimated/animated-style-needs-animated-component.d.ts +0 -2
- package/dist/react-native/rules/reanimated/animated-updater-purity.d.ts +0 -2
- package/dist/react-native/rules/reanimated/gpu-properties-only.d.ts +0 -2
- package/dist/react-native/rules/reanimated/hoist-layout-animation-builder.d.ts +0 -2
- package/dist/react-native/rules/reanimated/index.d.ts +0 -2
- package/dist/react-native/rules/reanimated/interpolate-needs-clamp.d.ts +0 -2
- package/dist/react-native/rules/reanimated/no-react-state-from-continuous-worklet.d.ts +0 -2
- package/dist/react-native/rules/reanimated/no-shared-value-dot-value.d.ts +0 -2
- package/dist/react-native/rules/reanimated/prefer-lazy-shared-value-initializer.d.ts +0 -2
- package/dist/react-native/rules/reanimated/schedule-on-rn-scope.d.ts +0 -2
- package/dist/react-native/rules/reanimated/shared-value-usage.d.ts +0 -2
- package/dist/react-native/rules/reanimated/shared.d.ts +0 -5
- package/dist/react-native/rules/skia/canvas-opaque.d.ts +0 -2
- package/dist/react-native/rules/skia/index.d.ts +0 -2
- package/dist/react-native/rules/turbo-image/index.d.ts +0 -2
- package/dist/react-native/rules/turbo-image/require-cache-policy.d.ts +0 -2
- package/dist/react-native/rules/turbo-image/require-resize.d.ts +0 -2
- package/dist/react-native/rules/unistyles/animated-theme.d.ts +0 -2
- package/dist/react-native/rules/unistyles/content-container.d.ts +0 -2
- package/dist/react-native/rules/unistyles/in-sheet.d.ts +0 -2
- package/dist/react-native/rules/unistyles/index.d.ts +0 -2
- package/dist/react-native/rules/unistyles/insets.d.ts +0 -2
- package/dist/react-native/rules/unistyles/no-hardcoded-color.d.ts +0 -2
- package/dist/react-native/rules/unistyles/no-hardcoded-spacing.d.ts +0 -2
- package/dist/react-native/rules/unistyles/no-margin.d.ts +0 -2
- package/dist/react-native/rules/unistyles/no-style-spread.d.ts +0 -2
- package/dist/react-native/rules/unistyles/no-unused-styles.d.ts +0 -2
- package/dist/react-native/rules/unistyles/rtl-style-call.d.ts +0 -2
- package/dist/react-native/rules/unistyles/shared.d.ts +0 -16
- package/dist/react-native/rules/unistyles/theme-screen-component.d.ts +0 -2
- package/dist/react-native/rules/unistyles/theme-style-attr.d.ts +0 -2
- package/dist/react-native/stylesheet.d.ts +0 -11
package/dist/lib/detect.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Should this rule group ship enabled? An explicit option wins; otherwise the
|
|
3
|
-
* group is on when one of `packages` is a dependency, and always on when
|
|
4
|
-
* `packages` is absent. Dependencies come from every package.json between the
|
|
5
|
-
* current working directory and the repo boundary — the directory holding
|
|
6
|
-
* `.git` — so in a monorepo the app package, the workspace root, or both
|
|
7
|
-
* count, and a stray package.json above the repo cannot enable anything.
|
|
8
|
-
*/
|
|
9
|
-
export declare const detect: (option: boolean | undefined, packages: string[] | undefined) => boolean;
|
package/dist/lib/merge.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { OxlintConfig } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Layer `delta` over `base` into one flat config — the way `react` is built
|
|
4
|
-
* from `core` plus a react delta. Plugin lists union, `overrides` append,
|
|
5
|
-
* `rules` and the other keyed blocks are last-wins per key. Entries compose
|
|
6
|
-
* with this rather than oxlint's `extends` so every entry is a single
|
|
7
|
-
* inspectable object and a consumer's own overrides stay trivial.
|
|
8
|
-
*/
|
|
9
|
-
export declare const mergeConfigs: (base: OxlintConfig, delta: OxlintConfig) => OxlintConfig;
|
package/dist/lib/module.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BanGroup, ModuleManifest, RestrictedImports } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Identity helper: types the manifest and keeps the shape honest. The returned
|
|
4
|
-
* object is handed to oxlint as the plugin (it ignores the manifest extras).
|
|
5
|
-
*/
|
|
6
|
-
export declare const defineModule: (manifest: ModuleManifest) => ModuleManifest;
|
|
7
|
-
declare const shortName: (module: ModuleManifest) => string;
|
|
8
|
-
export interface Composed {
|
|
9
|
-
jsPlugins: string[];
|
|
10
|
-
rules: Record<string, "error">;
|
|
11
|
-
restricted: Required<RestrictedImports>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Turn manifests + options into the config fragments an entry spreads in:
|
|
15
|
-
* which plugin files to load, which rules to enable, and the merged import
|
|
16
|
-
* bans from the enabled modules plus the enabled ban-only groups.
|
|
17
|
-
*/
|
|
18
|
-
export declare const composeModules: (modules: ModuleManifest[], options: Record<string, boolean | undefined>, banGroups?: BanGroup[]) => Composed;
|
|
19
|
-
export { shortName };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const propertyKeyName=(r)=>{if(r.type!=="Property"||r.computed)return"";const{key:e}=r;if(e.type==="Identifier")return e.name;if(e.type==="Literal")return String(e.value);return""};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{FUNCTION_TYPES as s,calleeName as i,crossesFunctionBefore as n,findInSubtree as o,gate as l,problem as c}from"../../../lib/ast.js";import{attributeNamed as d,expressionOf as u,isListElement as f,LIST as m}from"./shared.js";const p=new Set(["useMemo","useCallback"]),h=(e)=>e.type==="ArrayExpression"||e.type==="CallExpression"&&e.callee.type==="MemberExpression";export const noInlineData=c("Disallow building a Legend List's `data` inline. Each render produces a new array reference, and the list re-diffs, re-keys and drops what it had cached.",{createOnce:(e)=>({before:()=>l(e,m),JSXElement(t){if(!f(t))return;const r=d(t,"data");if(!r)return;if(p.has(i(u(r))))return;const a=o(r.value,h);if(!a||n(a,r,s))return;e.report({node:r,message:"Hoist this `data` into a `useMemo` or compute it upstream so its reference is stable. A new array each render makes the list re-diff, re-key and invalidate everything it had cached."})}})});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{attributeName as n,gate as i,problem as s}from"../../../lib/ast.js";import{expressionOf as o,isListElement as l,literalKind as u}from"./shared.js";export const noInlineExtraData=s("An inline object or array as `extraData` takes a new identity on every parent render, and every mounted row re-evaluates with it.",{createOnce:(a)=>({before:()=>i(a,"extraData"),JSXAttribute(e){if(n(e)!=="extraData")return;if(!l(e.parent.parent))return;const t=o(e),r=u(t);if(t===null||r===null)return;a.report({node:t,message:`Pass the primitive that actually changed as \`extraData\`, or hoist this ${r} when it is stable. A fresh ${r} reference each render re-evaluates every mounted row.`})}})});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AstNode } from "../../../lib/types.js";
|
|
2
|
-
/** A JSX element node, the only shape the list rules look at. */
|
|
3
|
-
export type ListElement = Extract<AstNode, {
|
|
4
|
-
type: "JSXElement";
|
|
5
|
-
}>;
|
|
6
|
-
type Attribute = Extract<AstNode, {
|
|
7
|
-
type: "JSXAttribute";
|
|
8
|
-
}>;
|
|
9
|
-
type AttributeItem = Extract<AstNode, {
|
|
10
|
-
type: "JSXAttribute" | "JSXSpreadAttribute";
|
|
11
|
-
}>;
|
|
12
|
-
export declare const LIST = "LegendList";
|
|
13
|
-
export declare const isListElement: (node: AstNode | null | undefined) => boolean;
|
|
14
|
-
export declare const attributesOf: (node: AstNode) => AttributeItem[];
|
|
15
|
-
export declare const attributeNamed: (node: AstNode, wanted: string) => Attribute | undefined;
|
|
16
|
-
export declare const hasSpread: (node: AstNode) => boolean;
|
|
17
|
-
export declare const expressionOf: (attribute: AstNode | null | undefined) => AstNode | null;
|
|
18
|
-
export declare const literalKind: (node: AstNode | null | undefined) => "object" | "array" | null;
|
|
19
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AstNode, RuleContext } from "../../../lib/types.js";
|
|
2
|
-
export declare const OBSERVABLE_FACTORIES: Set<string>;
|
|
3
|
-
/** The trailing `$` that marks an observable binding. */
|
|
4
|
-
export declare const OBS: RegExp;
|
|
5
|
-
export declare const isObservableRef: (node: AstNode | null | undefined) => boolean;
|
|
6
|
-
/** The factory name when this call is `observable(...)` or `useObservable(...)`. */
|
|
7
|
-
export declare const factoryCalled: (node: AstNode | null | undefined) => string | null;
|
|
8
|
-
/** Source text for a node, for quoting it back in a message. */
|
|
9
|
-
export declare const textOf: (context: RuleContext, node: AstNode) => string;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AstNode } from "../../../lib/types.js";
|
|
2
|
-
/** `useSharedValue(...)` and friends, under a namespace or not — decides which locals hold a shared value. */
|
|
3
|
-
export declare const isProducerCall: (node: AstNode | null | undefined) => boolean;
|
|
4
|
-
/** The hooks whose callback is an animated updater. */
|
|
5
|
-
export declare const ANIMATED_STYLE_HOOKS: Set<string>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AstNode, Rule, RuleContext, Visitor } from "../../../lib/types.js";
|
|
2
|
-
export { CREATE_MARKER, isStyleSheetCreate, propertyName, stylesObjectOf, type StylesObject, } from "../../stylesheet.js";
|
|
3
|
-
export declare const memberPath: (node: AstNode | null | undefined) => string;
|
|
4
|
-
export declare const declaresUseUnistylesTheme: (scope: AstNode) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* The enclosing function that destructures a `useUnistyles()` theme, innermost first. Walking past the
|
|
7
|
-
* innermost function matters: the read is often inside a callback the component passes down.
|
|
8
|
-
*/
|
|
9
|
-
export declare const themeConsumingComponent: (node: AstNode) => AstNode | null;
|
|
10
|
-
export declare const readsTheme: (node: AstNode) => boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Builds a rule whose visitors only fire inside `StyleSheet.create(...)`, by tracking how deeply
|
|
13
|
-
* nested the traversal currently is in such a call. The depth resets per file in `before()`, which
|
|
14
|
-
* also runs the text gate.
|
|
15
|
-
*/
|
|
16
|
-
export declare const inCreate: (description: string, visit: (context: RuleContext, inside: () => boolean) => Visitor) => Rule;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AstNode } from "../lib/types.js";
|
|
2
|
-
/** The object literal a stylesheet is built from. */
|
|
3
|
-
export type StylesObject = Extract<AstNode, {
|
|
4
|
-
type: "ObjectExpression";
|
|
5
|
-
}>;
|
|
6
|
-
/** Source-text gate for the stylesheet rules. Just the object, so `StyleSheet\n .create(...)` still counts. */
|
|
7
|
-
export declare const CREATE_MARKER = "StyleSheet";
|
|
8
|
-
export declare const isStyleSheetCreate: (node: AstNode | null | undefined) => boolean;
|
|
9
|
-
export declare const propertyName: (node: AstNode) => string;
|
|
10
|
-
/** The styles object a `StyleSheet.create` argument holds: a literal, or the one its theme function returns. */
|
|
11
|
-
export declare const stylesObjectOf: (factory: AstNode | null | undefined) => StylesObject | null;
|