Skip to content

Commit aa705a4

Browse files
authored
chore: unify jest.config.ts and .eslintrc.json (#881)
1 parent bb149bd commit aa705a4

32 files changed

+367
-3704
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/dist/**

packages/schema/.eslintrc.json renamed to .eslintrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
"rules": {
1616
"jest/expect-expect": "off",
1717
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }]
18-
},
19-
"ignorePatterns": ["src/language-server/generated/*"]
18+
}
2019
}

jest.config.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property and type check, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
export default {
7+
// Automatically clear mock calls, instances, contexts and results before every test
8+
clearMocks: true,
9+
10+
// Indicates whether the coverage information should be collected while executing the test
11+
collectCoverage: true,
12+
13+
// The directory where Jest should output its coverage files
14+
coverageDirectory: 'tests/coverage',
15+
16+
// An array of regexp pattern strings used to skip coverage collection
17+
coveragePathIgnorePatterns: ['/node_modules/', '/tests/'],
18+
19+
// Indicates which provider should be used to instrument code for coverage
20+
coverageProvider: 'v8',
21+
22+
// A list of reporter names that Jest uses when writing coverage reports
23+
coverageReporters: ['json', 'text', 'lcov', 'clover'],
24+
25+
// A map from regular expressions to paths to transformers
26+
transform: { '^.+\\.tsx?$': 'ts-jest' },
27+
28+
testTimeout: 300000,
29+
};

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",
7+
"lint": "pnpm -r lint",
78
"test": "ZENSTACK_TEST=1 pnpm -r run test --silent --forceExit",
89
"test-ci": "ZENSTACK_TEST=1 pnpm -r run test --silent --forceExit",
9-
"lint": "pnpm -r lint",
1010
"publish-all": "pnpm --filter \"./packages/**\" -r publish --access public",
1111
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --force --registry https://preview.registry.zenstack.dev/",
1212
"unpublish-preview": "pnpm --recursive --shell-mode exec -- npm unpublish -f --registry https://preview.registry.zenstack.dev/ \"\\$PNPM_PACKAGE_NAME\""
@@ -16,8 +16,20 @@
1616
"license": "MIT",
1717
"devDependencies": {
1818
"@changesets/cli": "^2.26.0",
19+
"@types/jest": "^29.5.10",
20+
"@types/node": "^20.10.2",
21+
"@typescript-eslint/eslint-plugin": "^6.13.1",
22+
"@typescript-eslint/parser": "^6.13.1",
1923
"concurrently": "^7.4.0",
24+
"copyfiles": "^2.4.1",
25+
"eslint": "^8.55.0",
26+
"eslint-plugin-jest": "^27.6.0",
27+
"jest": "^29.7.0",
2028
"replace-in-file": "^7.0.1",
21-
"tsup": "^7.1.0"
29+
"rimraf": "^3.0.2",
30+
"ts-jest": "^29.1.1",
31+
"ts-node": "^10.9.1",
32+
"tsup": "^8.0.1",
33+
"typescript": "^5.3.2"
2234
}
2335
}

packages/language/.eslintrc.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
{
2-
"root": true,
3-
"parser": "@typescript-eslint/parser",
4-
"parserOptions": {
5-
"ecmaVersion": 6,
6-
"sourceType": "module"
7-
},
8-
"plugins": ["@typescript-eslint"],
92
"ignorePatterns": "src/generated/*",
10-
"extends": [
11-
"eslint:recommended",
12-
"plugin:@typescript-eslint/eslint-recommended",
13-
"plugin:@typescript-eslint/recommended"
14-
]
3+
"extends": ["../../.eslintrc.json"]
154
}

packages/language/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
"author": "ZenStack Team",
2020
"license": "MIT",
2121
"devDependencies": {
22-
"concurrently": "^7.4.0",
23-
"copyfiles": "^2.4.1",
24-
"langium-cli": "1.2.0",
25-
"rimraf": "^3.0.2",
26-
"typescript": "^4.9.4"
22+
"langium-cli": "1.2.0"
2723
},
2824
"dependencies": {
2925
"langium": "1.2.0"

packages/plugins/openapi/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/plugins/openapi/jest.config.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../jest.config.ts

packages/plugins/openapi/package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,11 @@
4040
},
4141
"devDependencies": {
4242
"@readme/openapi-parser": "^2.4.0",
43-
"@types/jest": "^29.5.0",
44-
"@types/node": "^18.0.0",
4543
"@types/pluralize": "^0.0.29",
4644
"@types/tmp": "^0.2.3",
47-
"@typescript-eslint/eslint-plugin": "^5.54.0",
48-
"@typescript-eslint/parser": "^5.54.0",
4945
"@zenstackhq/testtools": "workspace:*",
50-
"copyfiles": "^2.4.1",
51-
"eslint": "^8.35.0",
52-
"jest": "^29.5.0",
5346
"pluralize": "^8.0.0",
54-
"rimraf": "^3.0.2",
5547
"tmp": "^0.2.1",
56-
"ts-jest": "^29.0.5",
57-
"typescript": "^4.9.5",
5848
"zenstack": "workspace:*"
5949
}
6050
}

packages/plugins/swr/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/plugins/swr/jest.config.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/plugins/swr/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../jest.config.ts

packages/plugins/swr/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,12 @@
3838
"devDependencies": {
3939
"@tanstack/react-query": "^4.28.0",
4040
"@testing-library/react": "^14.0.0",
41-
"@types/jest": "^29.5.0",
42-
"@types/node": "^18.0.0",
4341
"@types/react": "18.2.0",
4442
"@types/semver": "^7.3.13",
4543
"@types/tmp": "^0.2.3",
4644
"@zenstackhq/testtools": "workspace:*",
47-
"copyfiles": "^2.4.1",
48-
"jest": "^29.5.0",
4945
"nock": "^13.3.6",
5046
"react": "18.2.0",
51-
"rimraf": "^3.0.2",
52-
"swr": "^2.2.4",
53-
"ts-jest": "^29.0.5",
54-
"typescript": "^4.9.4"
47+
"swr": "^2.2.4"
5548
}
5649
}

packages/plugins/tanstack-query/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/plugins/tanstack-query/jest.config.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../jest.config.ts

packages/plugins/tanstack-query/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,18 @@
9999
"@tanstack/svelte-query-v5": "npm:@tanstack/svelte-query@^5.0.0",
100100
"@tanstack/vue-query": "^4.37.0",
101101
"@testing-library/react": "^14.0.0",
102-
"@types/jest": "^29.5.0",
103102
"@types/nock": "^11.1.0",
104-
"@types/node": "^18.0.0",
105103
"@types/react": "18.2.0",
106104
"@types/semver": "^7.3.13",
107105
"@types/tmp": "^0.2.3",
108106
"@zenstackhq/testtools": "workspace:*",
109-
"copyfiles": "^2.4.1",
110-
"jest": "^29.7.0",
111107
"jest-environment-jsdom": "^29.7.0",
112108
"nock": "^13.3.6",
113109
"react": "18.2.0",
114110
"react-test-renderer": "^18.2.0",
115111
"replace-in-file": "^7.0.1",
116-
"rimraf": "^3.0.2",
117112
"svelte": "^4.2.1",
118113
"swr": "^2.0.3",
119-
"ts-jest": "^29.0.5",
120-
"tsup": "^8.0.0",
121-
"typescript": "^4.9.4",
122114
"vue": "^3.3.4"
123115
}
124116
}

packages/plugins/trpc/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/plugins/trpc/jest.config.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/plugins/trpc/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../jest.config.ts

packages/plugins/trpc/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,8 @@
3838
"@trpc/next": "^10.32.0",
3939
"@trpc/react-query": "^10.32.0",
4040
"@trpc/server": "^10.32.0",
41-
"@types/jest": "^29.5.0",
42-
"@types/node": "^18.0.0",
4341
"@types/prettier": "^2.7.2",
4442
"@zenstackhq/testtools": "workspace:*",
45-
"copyfiles": "^2.4.1",
46-
"jest": "^29.5.0",
47-
"next": "^13.4.7",
48-
"rimraf": "^3.0.2",
49-
"ts-jest": "^29.0.5",
50-
"typescript": "^4.9.4"
43+
"next": "^13.4.7"
5144
}
5245
}

packages/runtime/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)