diff --git a/.eslintrc.json b/.eslintrc.json index e39168d9aa..7648daf60b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -111,13 +111,14 @@ { "files": ["tests/**/*.ts", "tests/**/*.tsx"], "rules": { - "import/extensions": ["error", "never"] + "import/extensions": ["error", "never"], + "@typescript-eslint/no-unused-vars": "off" } }, { "files": ["./*.js"], "rules": { - "@typescript-eslint/no-var-requires": "off" + "@typescript-eslint/no-require-imports": "off" } } ] diff --git a/package.json b/package.json index 984fa59fa7..faa374fa83 100644 --- a/package.json +++ b/package.json @@ -74,11 +74,11 @@ "build:react:utils": "rollup -c --config-react_utils --client-only", "postbuild": "pnpm patch-d-ts && pnpm copy && pnpm patch-ts3.8 && pnpm patch-old-ts && pnpm patch-esm-ts && pnpm patch-readme", "prettier": "prettier '*.{js,json,md}' '{src,tests,benchmarks,docs}/**/*.{ts,tsx,md,mdx}' --write", - "eslint": "eslint --fix --no-eslintrc --c .eslintrc.json '*.{js,json,ts}' '{src,tests,benchmarks}/**/*.{ts,tsx}'", + "eslint": "eslint --fix --no-eslintrc --c .eslintrc.json '*.{js,ts}' '{src,tests,benchmarks}/**/*.{ts,tsx}'", "test": "pnpm run '/^test:.*/'", "test:format": "prettier '*.{js,json,md}' '{src,tests,benchmarks,docs}/**/*.{ts,tsx,md,mdx}' --list-different", "test:types": "tsc --noEmit", - "test:lint": "eslint --no-eslintrc --c .eslintrc.json '*.{js,json,ts}' '{src,tests,benchmarks}/**/*.{ts,tsx}'", + "test:lint": "eslint --no-eslintrc --c .eslintrc.json '*.{js,ts}' '{src,tests,benchmarks}/**/*.{ts,tsx}'", "test:spec": "vitest run", "test-build:spec": "vitest run", "patch-d-ts": "node -e \"var {entries}=require('./rollup.config.js');require('shelljs').find('dist/**/*.d.ts').forEach(f=>{entries.forEach(({find,replacement})=>require('shelljs').sed('-i',new RegExp(' from \\''+find.source.slice(0,-1)+'\\';$'),' from \\''+replacement+'\\';',f));require('shelljs').sed('-i',/ from '(\\.[^']+)\\.ts';$/,' from \\'\\$1\\';',f)})\"", @@ -137,8 +137,8 @@ "@types/node": "^22.1.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/parser": "^8.0.1", "@vitest/coverage-v8": "^2.0.5", "@vitest/ui": "^2.0.5", "benny": "^3.7.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a00c42d778..1ff135d1c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,11 +69,11 @@ devDependencies: specifier: ^18.3.0 version: 18.3.0 '@typescript-eslint/eslint-plugin': - specifier: ^7.18.0 - version: 7.18.0(@typescript-eslint/parser@7.18.0)(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.0.1 + version: 8.0.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/parser': - specifier: ^7.18.0 - version: 7.18.0(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.0.1 + version: 8.0.1(eslint@8.57.0)(typescript@5.5.4) '@vitest/coverage-v8': specifier: ^2.0.5 version: 2.0.5(vitest@2.0.5) @@ -100,7 +100,7 @@ devDependencies: version: 1.1.2(eslint-plugin-import@2.29.1) eslint-plugin-import: specifier: ^2.29.1 - version: 2.29.1(@typescript-eslint/parser@7.18.0)(eslint@8.57.0) + version: 2.29.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0) eslint-plugin-prettier: specifier: ^5.2.1 version: 5.2.1(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.3.3) @@ -115,7 +115,7 @@ devDependencies: version: 4.6.2(eslint@8.57.0) eslint-plugin-vitest: specifier: ^0.5.4 - version: 0.5.4(@typescript-eslint/eslint-plugin@7.18.0)(eslint@8.57.0)(typescript@5.5.4)(vitest@2.0.5) + version: 0.5.4(@typescript-eslint/eslint-plugin@8.0.1)(eslint@8.57.0)(typescript@5.5.4)(vitest@2.0.5) jest-leak-detector: specifier: ^29.7.0 version: 29.7.0 @@ -2493,23 +2493,23 @@ packages: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: true - /@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0)(eslint@8.57.0)(typescript@5.5.4): - resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==} - engines: {node: ^18.18.0 || >=20.0.0} + /@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0)(typescript@5.5.4): + resolution: {integrity: sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/type-utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.1 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -2520,20 +2520,20 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4): - resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==} - engines: {node: ^18.18.0 || >=20.0.0} + /@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4): + resolution: {integrity: sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.1 debug: 4.3.6 eslint: 8.57.0 typescript: 5.5.4 @@ -2549,23 +2549,30 @@ packages: '@typescript-eslint/visitor-keys': 7.18.0 dev: true - /@typescript-eslint/type-utils@7.18.0(eslint@8.57.0)(typescript@5.5.4): - resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==} - engines: {node: ^18.18.0 || >=20.0.0} + /@typescript-eslint/scope-manager@8.0.1: + resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + dev: true + + /@typescript-eslint/type-utils@8.0.1(eslint@8.57.0)(typescript@5.5.4): + resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) debug: 4.3.6 - eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.5.4) typescript: 5.5.4 transitivePeerDependencies: + - eslint - supports-color dev: true @@ -2574,6 +2581,11 @@ packages: engines: {node: ^18.18.0 || >=20.0.0} dev: true + /@typescript-eslint/types@8.0.1: + resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true + /@typescript-eslint/typescript-estree@7.18.0(typescript@5.5.4): resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} engines: {node: ^18.18.0 || >=20.0.0} @@ -2596,6 +2608,28 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@8.0.1(typescript@5.5.4): + resolution: {integrity: sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + debug: 4.3.6 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.5.4) + typescript: 5.5.4 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@7.18.0(eslint@8.57.0)(typescript@5.5.4): resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} engines: {node: ^18.18.0 || >=20.0.0} @@ -2612,6 +2646,22 @@ packages: - typescript dev: true + /@typescript-eslint/utils@8.0.1(eslint@8.57.0)(typescript@5.5.4): + resolution: {integrity: sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/visitor-keys@7.18.0: resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} engines: {node: ^18.18.0 || >=20.0.0} @@ -2620,6 +2670,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@8.0.1: + resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + '@typescript-eslint/types': 8.0.1 + eslint-visitor-keys: 3.4.3 + dev: true + /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -3538,7 +3596,7 @@ packages: peerDependencies: eslint-plugin-import: '>=1.4.0' dependencies: - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.18.0)(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0) dev: true /eslint-import-resolver-node@0.3.9: @@ -3551,7 +3609,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.18.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + /eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: @@ -3572,7 +3630,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -3580,7 +3638,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.18.0)(eslint@8.57.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -3590,7 +3648,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4) array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 array.prototype.flat: 1.3.2 @@ -3599,7 +3657,7 @@ packages: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.18.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.0 is-glob: 4.0.3 @@ -3689,7 +3747,7 @@ packages: string.prototype.repeat: 1.0.0 dev: true - /eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@7.18.0)(eslint@8.57.0)(typescript@5.5.4)(vitest@2.0.5): + /eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@8.0.1)(eslint@8.57.0)(typescript@5.5.4)(vitest@2.0.5): resolution: {integrity: sha512-um+odCkccAHU53WdKAw39MY61+1x990uXjSPguUCq3VcEHdqJrOb8OTMrbYlY6f9jAKx7x98kLVlIe3RJeJqoQ==} engines: {node: ^18.0.0 || >= 20.0.0} peerDependencies: @@ -3702,7 +3760,7 @@ packages: vitest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0)(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1)(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 vitest: 2.0.5(@types/node@22.1.0)(@vitest/ui@2.0.5)(jsdom@24.1.1) diff --git a/tests/react/types.test.tsx b/tests/react/types.test.tsx index e4ab39a434..380ff30f92 100644 --- a/tests/react/types.test.tsx +++ b/tests/react/types.test.tsx @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect' import type { TypeEqual } from 'ts-expect' -import { it } from 'vitest' +import { expect, it } from 'vitest' import { useAtom, useSetAtom } from 'jotai/react' import { atom } from 'jotai/vanilla' @@ -29,7 +29,7 @@ it('useAtom should return the correct types', () => { }) expectType<[null, (arg: number) => void]>(useAtom(writeonlyDerivedAtom)) } - Component + expect(Component).toBeDefined() }) it('useAtom should handle inference of atoms (#1831 #1387)', () => { @@ -67,7 +67,7 @@ it('useAtom should handle inference of atoms (#1831 #1387)', () => { > >(true) } - Component + expect(Component).toBeDefined() }) it('useAtom should handle inference of read-only atoms', () => { @@ -84,7 +84,7 @@ it('useAtom should handle inference of read-only atoms', () => { expectType<[number, never]>(useField('age')) expectType<[boolean, never]>(useField('checked')) } - Component + expect(Component).toBeDefined() }) it('useSetAtom should handle inference of atoms', () => { @@ -119,7 +119,7 @@ it('useSetAtom should handle inference of atoms', () => { > >(true) } - Component + expect(Component).toBeDefined() }) it('useAtom should handle primitive atom with one type argeument', () => { @@ -134,5 +134,5 @@ it('useAtom should handle primitive atom with one type argeument', () => { > >(true) } - Component + expect(Component).toBeDefined() }) diff --git a/tests/react/utils/types.test.tsx b/tests/react/utils/types.test.tsx index 8b777dc015..8b00576711 100644 --- a/tests/react/utils/types.test.tsx +++ b/tests/react/utils/types.test.tsx @@ -1,4 +1,4 @@ -import { it } from 'vitest' +import { expect, it } from 'vitest' import { useHydrateAtoms } from 'jotai/react/utils' import { atom } from 'jotai/vanilla' @@ -31,5 +31,5 @@ it('useHydrateAtoms should not allow invalid atom types when array is passed', ( [activeAtom, false], ]) } - Component + expect(Component).toBeDefined() }) diff --git a/tests/vanilla/types.test.tsx b/tests/vanilla/types.test.tsx index 3c89725bc7..8d1b45767a 100644 --- a/tests/vanilla/types.test.tsx +++ b/tests/vanilla/types.test.tsx @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect' import type { TypeOf } from 'ts-expect' -import { it } from 'vitest' +import { expect, it } from 'vitest' import { atom } from 'jotai/vanilla' import type { Atom, @@ -45,7 +45,7 @@ it('atom() should return the correct types', () => { }) expectType>(writeonlyDerivedAtom) } - Component + expect(Component).toBeDefined() }) it('type utils should work', () => { @@ -64,5 +64,5 @@ it('type utils should work', () => { const result: ExtractAtomResult = Promise.resolve() expectType>(result) } - Component + expect(Component).toBeDefined() })