Skip to content

Commit 3ffdfbb

Browse files
authored
feat(#323): typescript and module support (#359)
* refactor: use typescript * chore: revert auto added tsconfig * ci: bump node * chore: ts configuration * style: linting * test: ts test configs * chore: update eslint * chore: ignore lib for eslint * style: linting * style: format * 3.6.10-0 * chore: rename files * 3.6.10-1 * chore: ts config * 3.6.10-2 * chore: remove babel
1 parent 21e0af9 commit 3ffdfbb

22 files changed

Lines changed: 2017 additions & 2466 deletions

.babelrc

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

.eslintrc.js

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

.eslintrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"prettier",
7+
"plugin:prettier/recommended"
8+
],
9+
"plugins": ["@typescript-eslint", "prettier"],
10+
"env": {
11+
"browser": true,
12+
"es6": true,
13+
"node": true
14+
},
15+
"parserOptions": {
16+
"ecmaVersion": 2020,
17+
"sourceType": "module"
18+
},
19+
"rules": {
20+
"prettier/prettier": "error"
21+
},
22+
"ignorePatterns": ["node_modules/", "lib/", ".next/", "out/"]
23+
}

.github/workflows/nodejs-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Use Node.js lts
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
17-
node-version: 'lts/*'
17+
node-version: "lts/*"
1818
- run: npm install --frozen-lockfile
1919
- run: npm run build
2020
- run: npm run test

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
- name: Setup Node.js
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version: 'lts/*'
18+
node-version: "lts/*"
1919
- name: Install dependencies
2020
run: npm install --frozen-lockfile
2121
- name: Release

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ typings/
6060
# ignore dev and docs sites
6161
.next
6262
out
63-
64-
dist
63+
lib
64+
dist

.prettierrc

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

jest.config.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
12
module.exports = {
2-
collectCoverage: true,
3-
collectCoverageFrom: ['src/**/*.{js,jsx}'],
4-
coverageDirectory: 'coverage',
5-
testEnvironment: 'jsdom',
6-
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
7-
testEnvironment: 'jest-environment-jsdom',
3+
preset: "ts-jest",
4+
testEnvironment: "jsdom",
5+
globals: {
6+
"ts-jest": {
7+
tsconfig: "tsconfig.test.json",
8+
},
9+
},
10+
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], // Add this line
811
};

jest.setup.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";

0 commit comments

Comments
 (0)