Skip to content

Commit

Permalink
run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
David Maskasky committed Sep 10, 2024
1 parent 212a4bf commit 216e00e
Show file tree
Hide file tree
Showing 37 changed files with 671 additions and 868 deletions.
15 changes: 14 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,46 @@
}
},
"rules": {
"no-shadow": "off",
"no-return-await": "off",
"consistent-return": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"react/button-has-type": "off",
"react/jsx-filename-extension": [
"error",
{ "extensions": [".js", ".tsx"] }
],
"react/prop-types": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-no-useless-fragment": "off",
"import/extensions": ["error", "never"],
"import/prefer-default-export": "off",
"import/no-unresolved": ["error", { "ignore": ["jotai-scope"] }],
"no-param-reassign": "off",
"no-promise-executor-return": "off",
"no-plusplus": "off",
"no-bitwise": "off",
"symbol-description": "off",
"prefer-object-spread": "off",
"no-return-assign": "off",
"no-use-before-define": "off",
"no-unused-vars": "off",
"no-redeclare": "off",
"camelcase": ["error", { "allow": ["^INTERNAL_"] }],
"camelcase": ["error", { "allow": ["^INTERNAL_", "^unstable_"] }],
"react/function-component-definition": [
"error",
{ "namedComponents": "function-declaration" }
],
"react/no-unescaped-entities": "off",
"react/no-array-index-key": "off",
"react/require-default-props": "off",
"react/destructuring-assignment": "off",
"react/jsx-no-constructed-context-values": "off",
Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/01_basic_spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
atom,
type WritableAtom,
type SetStateAction,
} from 'jotai';
import { atomWithReducer } from 'jotai/vanilla/utils';
} from '../../jotai';
import { atomWithReducer } from '../../jotai/vanilla/utils';
import { ScopeProvider } from '../../src/index';
import { clickButton, getTextContents } from '../utils';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/02_removeScope.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render } from '@testing-library/react';
import type { PropsWithChildren } from 'react';
import { atom, useAtom, useAtomValue } from 'jotai';
import { atomWithReducer } from 'jotai/vanilla/utils';
import { atom, useAtom, useAtomValue } from '../../jotai';
import { atomWithReducer } from '../../jotai/vanilla/utils';
import { ScopeProvider } from '../../src/index';
import { clickButton, getTextContents } from '../utils';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/03_nested.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import { atom, useAtom, useAtomValue, useSetAtom } from 'jotai';
import { atomWithReducer } from 'jotai/vanilla/utils';
import { atom, useAtom, useAtomValue, useSetAtom } from '../../jotai';
import { atomWithReducer } from '../../jotai/vanilla/utils';
import { clickButton, getTextContents } from '../utils';

import { ScopeProvider } from '../../src/index';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ScopeProvider/04_derived.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '@testing-library/react';
import { atom, useAtom } from 'jotai';
import { atom, useAtom } from '../../jotai';
import { clickButton, getTextContents } from '../utils';
import { ScopeProvider } from '../../src/index';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/05_derived_self.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import { atom, useAtom } from 'jotai';
import { useHydrateAtoms } from 'jotai/utils';
import { atom, useAtom } from '../../jotai';
import { useHydrateAtoms } from '../../jotai/utils';
import { getTextContents } from '../utils';
import { ScopeProvider } from '../../src/index';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/06_implicit_parent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC } from 'react';
import { render } from '@testing-library/react';
import { atom, useAtom, useAtomValue } from 'jotai';
import { atomWithReducer } from 'jotai/vanilla/utils';
import { atom, useAtom, useAtomValue } from '../../jotai';
import { atomWithReducer } from '../../jotai/vanilla/utils';
import { clickButton, getTextContents } from '../utils';
import { ScopeProvider } from '../../src/index';

Expand Down
7 changes: 6 additions & 1 deletion __tests__/ScopeProvider/07_writable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { render } from '@testing-library/react';
import { type WritableAtom, type PrimitiveAtom, atom, useAtom } from 'jotai';
import {
type WritableAtom,
type PrimitiveAtom,
atom,
useAtom,
} from '../../jotai';
import { clickButton, getTextContents } from '../utils';
import { ScopeProvider } from '../../src/index';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/ScopeProvider/08_family.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, act } from '@testing-library/react';
import { useAtom, atom, useSetAtom } from 'jotai';
import { atomFamily, atomWithReducer } from 'jotai/utils';
import { useAtom, atom, useSetAtom } from '../../jotai';
import { atomFamily, atomWithReducer } from '../../jotai/utils';
import { ScopeProvider } from '../../src/index';
import { clickButton, getTextContents } from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/ScopeProvider/09_scope_provider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { render, act } from '@testing-library/react';
import { atom, useAtomValue } from 'jotai';
import { atom, useAtomValue } from '../../jotai';
import { ScopeProvider } from '../../src/index';
import { clickButton } from '../utils';

Expand Down
54 changes: 22 additions & 32 deletions __tests__/derive/baseTests/react/abortable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,24 @@ describe('abortable atom test', () => {
const resolve: (() => void)[] = [];
const derivedAtom = atom(async (get, { signal }) => {
const count = get(countAtom);
await new Promise<void>((r) => resolve.push(r));
await new Promise<void>((r) => {
resolve.push(r);
});
if (signal.aborted) {
++abortedCount;
}
return count;
});

const Component = () => {
function Component() {
const count = useAtomValue(derivedAtom);
return <div>count: {count}</div>;
};
}

const Controls = () => {
function Controls() {
const setCount = useSetAtom(countAtom);
return (
<>
<button onClick={() => setCount((c) => c + 1)}>button</button>
</>
);
};
return <button onClick={() => setCount((c) => c + 1)}>button</button>;
}

const { findByText, getByText } = render(
<StrictMode>
Expand Down Expand Up @@ -75,19 +73,15 @@ describe('abortable atom test', () => {
return count;
});

const Component = () => {
function Component() {
const count = useAtomValue(derivedAtom);
return <div>count: {count}</div>;
};
}

const Controls = () => {
function Controls() {
const setCount = useSetAtom(countAtom);
return (
<>
<button onClick={() => setCount((c) => c + 1)}>button</button>
</>
);
};
return <button onClick={() => setCount((c) => c + 1)}>button</button>;
}

const { findByText, getByText } = render(
<StrictMode>
Expand Down Expand Up @@ -131,12 +125,12 @@ describe('abortable atom test', () => {
return count;
});

const Component = () => {
function Component() {
const count = useAtomValue(derivedAtom);
return <div>count: {count}</div>;
};
}

const Parent = () => {
function Parent() {
const setCount = useSetAtom(countAtom);
const [show, setShow] = useState(true);
return (
Expand All @@ -146,7 +140,7 @@ describe('abortable atom test', () => {
<button onClick={() => setShow((x) => !x)}>toggle</button>
</>
);
};
}

const { findByText, getByText } = render(
<StrictMode>
Expand Down Expand Up @@ -183,19 +177,15 @@ describe('abortable atom test', () => {
return count;
});

const Component = () => {
function Component() {
const count = useAtomValue(derivedAtom);
return <div>count: {count}</div>;
};
}

const Controls = () => {
function Controls() {
const setCount = useSetAtom(countAtom);
return (
<>
<button onClick={() => setCount((c) => c + 1)}>button</button>
</>
);
};
return <button onClick={() => setCount((c) => c + 1)}>button</button>;
}

const { findByText, getByText } = render(
<StrictMode>
Expand Down
Loading

0 comments on commit 216e00e

Please sign in to comment.