Skip to content

Commit 709a0d4

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 276f39e commit 709a0d4

File tree

141 files changed

+4171
-4915
lines changed

Some content is hidden

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

141 files changed

+4171
-4915
lines changed

.eslintrc-ts

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"extends": [
3+
"@visionappscz/eslint-config-visionapps",
4+
"airbnb-typescript",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
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+
"project": "./tsconfig.json"
28+
},
29+
"plugins": [
30+
"@typescript-eslint"
31+
],
32+
"rules": {
33+
"import/prefer-default-export": "off",
34+
"no-console": "error"
35+
}
36+
}

jest.config-ts.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
transformIgnorePatterns: [
34+
'node_modules/(?!(@react-ui-org))',
35+
],
36+
verbose: true,
37+
};

0 commit comments

Comments
 (0)