Skip to content

Commit 2a7dd65

Browse files
committed
chore: only ts parser for ts files during linting
1 parent 4510a95 commit 2a7dd65

File tree

3 files changed

+37
-31
lines changed

3 files changed

+37
-31
lines changed

.eslintrc.js

+32-26
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,52 @@ module.exports = {
1010
'eslint:recommended',
1111
'plugin:import/errors',
1212
'plugin:import/warnings',
13-
'plugin:import/typescript',
14-
'plugin:@typescript-eslint/recommended',
1513
'plugin:eslint-plugin/all',
1614
'plugin:prettier/recommended',
1715
],
1816
parserOptions: {
1917
ecmaVersion: 10,
20-
project: ['./tsconfig.json', './tests/tsconfig.json'],
2118
sourceType: 'module',
2219
},
2320
rules: {
2421
'no-console': 'warn',
25-
26-
'@typescript-eslint/explicit-function-return-type': 'off',
27-
'@typescript-eslint/explicit-module-boundary-types': 'off',
28-
'@typescript-eslint/ban-ts-ignore': 'off',
29-
'@typescript-eslint/no-explicit-any': 'off',
3022
},
3123
overrides: [
3224
{
33-
files: ['tests/**'],
34-
env: {
35-
jest: true,
36-
},
25+
files: ['*.ts', '*.tsx'],
26+
extends: ['plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],
27+
3728
rules: {
38-
'jest/no-disabled-tests': 'warn',
39-
'jest/no-focused-tests': 'error',
40-
'jest/no-alias-methods': 'error',
41-
'jest/no-identical-title': 'error',
42-
'jest/no-jasmine-globals': 'error',
43-
'jest/no-jest-import': 'error',
44-
'jest/no-test-prefixes': 'error',
45-
'jest/no-test-callback': 'error',
46-
'jest/no-test-return-statement': 'error',
47-
'jest/prefer-to-have-length': 'warn',
48-
'jest/prefer-spy-on': 'error',
49-
'jest/valid-expect': 'error',
50-
'jest/no-test-callback': 'off',
29+
'@typescript-eslint/explicit-function-return-type': 'off',
30+
'@typescript-eslint/explicit-module-boundary-types': 'off',
31+
'@typescript-eslint/ban-ts-ignore': 'off',
32+
'@typescript-eslint/no-explicit-any': 'off',
33+
},
34+
35+
parserOptions: {
36+
project: ['./tsconfig.json', './tests/tsconfig.json'],
5137
},
38+
overrides: [
39+
{
40+
files: ['tests/**'],
41+
env: {
42+
jest: true,
43+
},
44+
rules: {
45+
'jest/no-disabled-tests': 'warn',
46+
'jest/no-focused-tests': 'error',
47+
'jest/no-alias-methods': 'error',
48+
'jest/no-identical-title': 'error',
49+
'jest/no-jasmine-globals': 'error',
50+
'jest/no-test-prefixes': 'error',
51+
'jest/no-test-return-statement': 'error',
52+
'jest/prefer-to-have-length': 'warn',
53+
'jest/prefer-spy-on': 'error',
54+
'jest/valid-expect': 'error',
55+
'jest/no-test-callback': 'off',
56+
},
57+
},
58+
],
5259
},
5360
],
5461
settings: {
@@ -58,5 +65,4 @@ module.exports = {
5865
},
5966
},
6067
},
61-
ignorePatterns: ['.eslintrc.js'],
6268
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"husky": "~4.2.5",
7878
"jest": "~27.2.5",
7979
"lint-staged": "~10.5.4",
80-
"prettier": "~2.3.2",
80+
"prettier": "3.0.1",
8181
"rimraf": "~3.0.2",
8282
"rollup": "~2.10.5",
8383
"tmp": "~0.2.1",

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -6443,10 +6443,10 @@ prettier-linter-helpers@^1.0.0:
64436443
dependencies:
64446444
fast-diff "^1.1.2"
64456445

6446-
prettier@~2.3.2:
6447-
version "2.3.2"
6448-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
6449-
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
6446+
prettier@3.0.1:
6447+
version "3.0.1"
6448+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.1.tgz#65271fc9320ce4913c57747a70ce635b30beaa40"
6449+
integrity sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==
64506450

64516451
pretty-format@^27.0.0, pretty-format@^27.2.5:
64526452
version "27.2.5"

0 commit comments

Comments
 (0)