feat(ts): enable jest/unbound-method (#141)

This commit is contained in:
曾明健 2022-12-15 17:04:50 +08:00 committed by GitHub
parent 559f5f43d2
commit 2ad3503022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 1 deletions

View File

@ -51,6 +51,15 @@ module.exports = {
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/unbound-method': 'error',
},
}, {
// https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
files: ['**/__tests__/**/*.ts', '**/*.spec.ts', '**/*.test.ts'],
plugins: ['jest'],
rules: {
// you should turn the original rule off *only* for test files
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
}],
),
rules: {

View File

@ -19,7 +19,8 @@
"dependencies": {
"@antfu/eslint-config-basic": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0"
"@typescript-eslint/parser": "^5.46.0",
"eslint-plugin-jest": "^27.1.6"
},
"devDependencies": {
"eslint": "^8.29.0"

View File

@ -122,10 +122,12 @@ importers:
'@typescript-eslint/eslint-plugin': ^5.46.0
'@typescript-eslint/parser': ^5.46.0
eslint: ^8.29.0
eslint-plugin-jest: ^27.1.6
dependencies:
'@antfu/eslint-config-basic': link:../basic
'@typescript-eslint/eslint-plugin': 5.46.0_jx43xxcguvnqqmtmaaygwl7cmu
'@typescript-eslint/parser': 5.46.0_eslint@8.29.0
eslint-plugin-jest: 27.1.6_az5lmaeuvswqhyu3aute3pgqim
devDependencies:
eslint: 8.29.0
@ -1849,6 +1851,27 @@ packages:
- supports-color
dev: false
/eslint-plugin-jest/27.1.6_az5lmaeuvswqhyu3aute3pgqim:
resolution: {integrity: sha512-XA7RFLSrlQF9IGtAmhddkUkBuICCTuryfOTfCSWcZHiHb69OilIH05oozH2XA6CEOtztnOd0vgXyvxZodkxGjg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
'@typescript-eslint/eslint-plugin': ^5.0.0
eslint: ^7.0.0 || ^8.0.0
jest: '*'
peerDependenciesMeta:
'@typescript-eslint/eslint-plugin':
optional: true
jest:
optional: true
dependencies:
'@typescript-eslint/eslint-plugin': 5.46.0_jx43xxcguvnqqmtmaaygwl7cmu
'@typescript-eslint/utils': 5.46.0_eslint@8.29.0
eslint: 8.29.0
transitivePeerDependencies:
- supports-color
- typescript
dev: false
/eslint-plugin-jsonc/2.5.0_eslint@8.29.0:
resolution: {integrity: sha512-G257khwkrOQ5MJpSzz4yQh5K12W4xFZRcHmVlhVFWh2GCLDX+JwHnmkQoUoFDbOieSPBMsPFZDTJScwrXiWlIg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}