Skip to content

Commit

Permalink
chore: update typescript-eslint (#2698)
Browse files Browse the repository at this point in the history
* wip: update typescript-eslint

* do not run lint on json files and add exceptions

* avoid no-unused-expressions

* use project level config override

* remove unused rule
  • Loading branch information
dai-shi authored Aug 8, 2024
1 parent 20e0cde commit 7d4da51
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 56 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)})\"",
Expand Down Expand Up @@ -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",
Expand Down
136 changes: 97 additions & 39 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/react/types.test.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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)', () => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -134,5 +134,5 @@ it('useAtom should handle primitive atom with one type argeument', () => {
>
>(true)
}
Component
expect(Component).toBeDefined()
})
4 changes: 2 additions & 2 deletions tests/react/utils/types.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it } from 'vitest'
import { expect, it } from 'vitest'
import { useHydrateAtoms } from 'jotai/react/utils'
import { atom } from 'jotai/vanilla'

Expand Down Expand Up @@ -31,5 +31,5 @@ it('useHydrateAtoms should not allow invalid atom types when array is passed', (
[activeAtom, false],
])
}
Component
expect(Component).toBeDefined()
})
Loading

0 comments on commit 7d4da51

Please sign in to comment.