Skip to content

Commit 2d43fbb

Browse files
Enable TypesScript for Playwright (#587)
Transform Playwright related files to Typescript and introduce temporary configuration files `.eslintrc-ts`, `jest.config-ts.js` and `tsconfig.json` that must be removed when whole package is transformed into Playwright. Due to missing TypeScript support in the rest of the package, `*.spec.tsx` and `*.story.tsx` file do not have complete types and might not be compatible with strict type checking that should be introduced in #394. The reason for such change is parallel work on transformation to TypeScript and on Playwright tests.
1 parent 6bab2a9 commit 2d43fbb

File tree

140 files changed

+4158
-4902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+4158
-4902
lines changed

.eslintrc-ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": [
3+
"@visionappscz/eslint-config-visionapps",
4+
"airbnb-typescript",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:@typescript-eslint/recommended-type-checked",
7+
"plugin:deprecation/recommended",
8+
"plugin:typescript-sort-keys/recommended",
9+
],
10+
"env": {
11+
"browser": true,
12+
"jest": true
13+
},
14+
"overrides": [
15+
{
16+
"files": [
17+
"*.spec.tsx",
18+
"*.story.tsx",
19+
],
20+
"rules": {
21+
"@typescript-eslint/unbound-method": "off"
22+
}
23+
}
24+
],
25+
"parser": "@typescript-eslint/parser",
26+
"parserOptions": {
27+
"projectService": true,
28+
"project": "./tsconfig.json"
29+
},
30+
"plugins": [
31+
"@typescript-eslint"
32+
],
33+
"rules": {
34+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
35+
"@typescript-eslint/consistent-type-exports": ["error"],
36+
"@typescript-eslint/consistent-type-imports": ["error"],
37+
"import/prefer-default-export": "off",
38+
"no-console": ["error"]
39+
}
40+
}

jest.config-ts.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
module.exports = {
3+
extensionsToTreatAsEsm: [
4+
'.ts',
5+
'.tsx',
6+
],
7+
moduleFileExtensions: [
8+
'js',
9+
'jsx',
10+
'ts',
11+
'tsx',
12+
],
13+
moduleNameMapper: {
14+
'\\.scss$': 'identity-obj-proxy',
15+
'\\.svg$': '<rootDir>/tests/jest/mocks/svgrMock.jsx',
16+
},
17+
preset: 'ts-jest',
18+
setupFiles: [
19+
'<rootDir>/tests/jest/setupJest.js',
20+
],
21+
setupFilesAfterEnv: [
22+
],
23+
testEnvironment: '@happy-dom/jest-environment',
24+
testMatch: [
25+
'**/*.test.{ts,tsx}',
26+
],
27+
transform: {
28+
'^.+\\.(ts|tsx)$': [
29+
'ts-jest',
30+
{ useESM: true },
31+
],
32+
},
33+
verbose: true,
34+
};

0 commit comments

Comments
 (0)