Skip to content

Commit

Permalink
feat(typescript): convert to typescript
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xAndreiLi authored and ali589 committed Dec 10, 2024
1 parent 95702fd commit febd8ef
Show file tree
Hide file tree
Showing 17 changed files with 23,430 additions and 17,942 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"presets": [
"amex"
"amex",
"@babel/preset-typescript"
]
}
49 changes: 48 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
{
"extends": "amex"
"extends": ["amex", "plugin:@typescript-eslint/recommended", "prettier"],
"settings": { "import/resolver": { "typescript": {} } },
"parserOptions": {
"project": true,
"extraFileExtensions": [".json"]
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["dist/**/*", "commitlint.config.js"],
"overrides": [
{
"files": ["__tests__/**"],
"extends": ["amex/test", "plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never",
"js": "never",
"jsx": "never"
}
]
}
},
{
"files": ["src/**"],
"extends": [
"amex",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/strict-type-checked",
"prettier"
],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never",
"js": "never",
"jsx": "never"
}
]
}
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: npm ci
env:
NODE_ENV: development
- name: Build
run: npm run build
- name: Run Test Script
run: npm test
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Release
env:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: npm ci
env:
NODE_ENV: development
- name: Build
run: npm run build
- name: Unit Tests
run: npm run test:unit
env:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
test-results
.jest-cache
coverage
.jest-cache
dist
3 changes: 0 additions & 3 deletions __tests__/.eslintrc.json

This file was deleted.

31 changes: 0 additions & 31 deletions __tests__/__snapshots__/index.spec.jsx.snap

This file was deleted.

115 changes: 0 additions & 115 deletions __tests__/index.spec.jsx

This file was deleted.

9 changes: 9 additions & 0 deletions __tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { afterEach } from 'vitest';
import { cleanup } from '@testing-library/react';

// Use locked timezone for predictable testing environment
process.env.TZ = 'UTC';

afterEach(() => {
cleanup();
});
Loading

0 comments on commit febd8ef

Please sign in to comment.