121788c42f
## Summary Removes the `recoil` dependency entirely from `package.json` and `twenty-front/package.json`, completing the migration to Jotai as the sole state management library. Removes all Recoil infrastructure: `RecoilRoot` wrapper from `App.tsx` and test decorators, `RecoilDebugObserver`, Recoil-specific ESLint rules (`use-getLoadable-and-getValue-to-get-atoms`, `useRecoilCallback-has-dependency-array`), and legacy Recoil utility hooks/types (`useRecoilComponentState`, `useRecoilComponentValue`, `createComponentState`, `createFamilyState`, `getSnapshotValue`, `cookieStorageEffect`, `localStorageEffect`, etc.). Renames all `V2`-suffixed Jotai state files and types to their canonical names (e.g., `ComponentStateV2` -> `ComponentState`, `agentChatInputStateV2` -> `agentChatInputState`, `SelectorCallbacksV2` -> `SelectorCallbacks`), and removes the now-redundant V1 counterparts. Updates ~433 files across the codebase to use the renamed Jotai imports, remove Recoil imports, and clean up test wrappers (`RecoilRootDecorator` -> `JotaiRootDecorator`).
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { TSESLint } from '@typescript-eslint/utils';
|
|
import { rule, RULE_NAME } from './matching-state-variable';
|
|
|
|
const ruleTester = new TSESLint.RuleTester();
|
|
|
|
ruleTester.run(RULE_NAME, rule, {
|
|
valid: [
|
|
{
|
|
code: 'const variable = useAtomStateValue(variableState);',
|
|
},
|
|
{
|
|
code: 'const [variable, setVariable] = useAtomState(variableState);',
|
|
},
|
|
// Component/Family hooks are not checked by this rule
|
|
{
|
|
code: 'const anything = useAtomComponentStateValue(variableComponentState);',
|
|
},
|
|
{
|
|
code: 'const anything = useAtomFamilyStateValue(variableFamilyState);',
|
|
},
|
|
{
|
|
code: 'const [anything, setAnything] = useAtomComponentFamilyState(variableComponentFamilyState);',
|
|
},
|
|
],
|
|
invalid: [
|
|
{
|
|
code: 'const myValue = useAtomStateValue(variableState);',
|
|
errors: [
|
|
{
|
|
messageId: 'invalidVariableName',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
code: 'const [myValue, setMyValue] = useAtomState(variableState);',
|
|
errors: [
|
|
{
|
|
messageId: 'invalidVariableName',
|
|
},
|
|
{
|
|
messageId: 'invalidSetterName',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
code: 'const [myValue] = useAtomState(variableState);',
|
|
errors: [
|
|
{
|
|
messageId: 'invalidVariableName',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
code: 'const [, setMyValue] = useAtomState(variableState);',
|
|
errors: [
|
|
{
|
|
messageId: 'invalidSetterName',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
});
|