@ospm/eslint-plugin-react-signals-hooks
Version:
ESLint plugin for React Signals hooks - enforces best practices, performance optimizations, and integration patterns for @preact/signals-react usage in React projects
41 lines • 1.82 kB
text/typescript
import { ESLintUtils } from '@typescript-eslint/utils';
import type { PerformanceBudget } from './utils/types.mjs';
type MessageIds = 'preferComputedWithSignal' | 'preferComputedWithSignals' | 'suggestComputed' | 'addComputedImport' | 'suggestAddComputedImport';
type Severity = {
[key in MessageIds]?: 'error' | 'warn' | 'off';
};
type Option = {
performance?: PerformanceBudget;
severity?: Severity;
suffix?: string;
/**
* Additional module specifiers that may export `computed`.
* The rule will recognize `computed` when imported from these modules too.
*/
extraCreatorModules?: Array<string>;
/**
* Controls whether the fixer renames the resulting computed variable and updates references.
* Default: true
*/
rename?: boolean;
/**
* Controls how accessors are applied when updating references to the computed variable.
*/
accessors?: {
/**
* Accessor strategy within JSX (excluding attributes and call args which still require `.value`).
* - 'auto' => no accessor for general JSX expressions, '.value' for attributes/call args
* - 'value' => force '.value' in all JSX contexts
* - 'none' => never add accessor in JSX contexts (attributes/call args still use '.value')
*/
jsx?: 'auto' | 'value' | 'none';
/** Accessor to use in non-JSX contexts within component/hook bodies. Default: 'value' */
inComponent?: 'value' | 'peek';
/** Accessor to use outside component scope. Default: 'peek' */
outsideComponent?: 'peek' | 'value';
};
};
type Options = [Option?];
export declare const preferComputedRule: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
export {};
//# sourceMappingURL=prefer-computed.d.ts.map