Skip to content

Commit 017e34a

Browse files
committed
feat(typescript): convert to typescript
update tests to tsx match types version with dep versions generic type change to main/types to exports change build to dist change target to es6 update types/react to 18 to provide modern context type switched to vitest and react-testing-library updated to stricter eslint update to react@17
1 parent 95702fd commit 017e34a

File tree

17 files changed

+23430
-17942
lines changed

17 files changed

+23430
-17942
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"presets": [
3-
"amex"
3+
"amex",
4+
"@babel/preset-typescript"
45
]
56
}

.eslintrc.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
11
{
2-
"extends": "amex"
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": ["amex/test", "plugin:@typescript-eslint/recommended", "prettier"],
15+
"rules": {
16+
"import/extensions": [
17+
"error",
18+
"ignorePackages",
19+
{
20+
"ts": "never",
21+
"tsx": "never",
22+
"js": "never",
23+
"jsx": "never"
24+
}
25+
]
26+
}
27+
},
28+
{
29+
"files": ["src/**"],
30+
"extends": [
31+
"amex",
32+
"plugin:@typescript-eslint/recommended",
33+
"plugin:@typescript-eslint/strict-type-checked",
34+
"prettier"
35+
],
36+
"rules": {
37+
"import/extensions": [
38+
"error",
39+
"ignorePackages",
40+
{
41+
"ts": "never",
42+
"tsx": "never",
43+
"js": "never",
44+
"jsx": "never"
45+
}
46+
]
47+
}
48+
}
49+
]
350
}

.github/workflows/health-check.yml

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
test-results
3-
.jest-cache
3+
coverage
4+
.jest-cache
5+
dist

__tests__/.eslintrc.json

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

__tests__/__snapshots__/index.spec.jsx.snap

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

__tests__/index.spec.jsx

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

__tests__/setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { afterEach } from 'vitest';
2+
import { cleanup } from '@testing-library/react';
3+
4+
// Use locked timezone for predictable testing environment
5+
process.env.TZ = 'UTC';
6+
7+
afterEach(() => {
8+
cleanup();
9+
});

0 commit comments

Comments
 (0)