Skip to content

Commit 967de32

Browse files
authored
feat(typescript): convert to typescript
2 parents 95702fd + 3721d02 commit 967de32

18 files changed

+23618
-18282
lines changed

.babelrc

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"presets": [
3-
"amex"
4-
]
5-
}
2+
"presets": ["amex", "@babel/preset-typescript"]
3+
}

.eslintrc.json

+53-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
11
{
2-
"extends": "amex"
3-
}
2+
"extends": ["amex", "plugin:@typescript-eslint/recommended", "prettier"],
3+
"settings": { "import/resolver": { "typescript": {} } },
4+
"parserOptions": {
5+
"project": true,
6+
"extraFileExtensions": [".json"]
7+
},
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": ["@typescript-eslint"],
10+
"ignorePatterns": ["dist/**/*", "commitlint.config.js"],
11+
"overrides": [
12+
{
13+
"files": ["__tests__/**"],
14+
"extends": [
15+
"amex/test",
16+
"plugin:@typescript-eslint/recommended",
17+
"prettier"
18+
],
19+
"rules": {
20+
"import/extensions": [
21+
"error",
22+
"ignorePackages",
23+
{
24+
"ts": "never",
25+
"tsx": "never",
26+
"js": "never",
27+
"jsx": "never"
28+
}
29+
]
30+
}
31+
},
32+
{
33+
"files": ["src/**"],
34+
"extends": [
35+
"amex",
36+
"plugin:@typescript-eslint/recommended",
37+
"plugin:@typescript-eslint/strict-type-checked",
38+
"prettier"
39+
],
40+
"rules": {
41+
"import/extensions": [
42+
"error",
43+
"ignorePackages",
44+
{
45+
"ts": "never",
46+
"tsx": "never",
47+
"js": "never",
48+
"jsx": "never"
49+
}
50+
]
51+
}
52+
}
53+
]
54+
}

.github/workflows/health-check.yml

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
run: npm ci
2626
env:
2727
NODE_ENV: development
28+
- name: Build
29+
run: npm run build
2830
- name: Run Test Script
2931
run: npm test
3032
env:

.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
node-version-file: ".nvmrc"
2727
- name: Install dependencies
2828
run: npm ci
29+
- name: Build
30+
run: npm run build
2931
- name: Release
3032
env:
3133
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}

.github/workflows/tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
run: npm ci
2626
env:
2727
NODE_ENV: development
28+
- name: Build
29+
run: npm run build
2830
- name: Unit Tests
2931
run: npm run test:unit
3032
env:

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
test-results
3-
.jest-cache
3+
coverage
4+
dist

__tests__/.eslintrc.json

-3
This file was deleted.

__tests__/__snapshots__/index.spec.jsx.snap

-31
This file was deleted.

__tests__/index.spec.jsx

-115
This file was deleted.

__tests__/setup.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { afterEach } from "vitest";
2+
import { cleanup } from "@testing-library/react";
3+
4+
afterEach(() => {
5+
cleanup();
6+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`createSharedReactContext > should not return the same context object if the key does not match 1`] = `
4+
<body>
5+
<div>
6+
<div
7+
data-testid="consumerDiv"
8+
id="value"
9+
>
10+
default
11+
</div>
12+
</div>
13+
</body>
14+
`;
15+
16+
exports[`createSharedReactContext > should return the same context object if the key matches 1`] = `
17+
<body>
18+
<div>
19+
<div
20+
data-testid="consumerDiv"
21+
id="value"
22+
>
23+
context value
24+
</div>
25+
</div>
26+
</body>
27+
`;
28+
29+
exports[`createSharedReactContext > should use the same default value from first call 1`] = `
30+
<body>
31+
<div>
32+
<div
33+
data-testid="consumerDiv"
34+
id="value"
35+
>
36+
default
37+
</div>
38+
</div>
39+
</body>
40+
`;

0 commit comments

Comments
 (0)