Skip to content

Commit

Permalink
feat(#323): typescript and module support (#359)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
coston authored Aug 9, 2024
1 parent 21e0af9 commit 3ffdfbb
Show file tree
Hide file tree
Showing 22 changed files with 2,017 additions and 2,466 deletions.
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint", "prettier"],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error"
},
"ignorePatterns": ["node_modules/", "lib/", ".next/", "out/"]
}
6 changes: 3 additions & 3 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js lts
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
node-version: "lts/*"
- run: npm install --frozen-lockfile
- run: npm run build
- run: npm run test
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
node-version: "lts/*"
- name: Install dependencies
run: npm install --frozen-lockfile
- name: Release
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ typings/
# ignore dev and docs sites
.next
out

dist
lib
dist
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

15 changes: 9 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{js,jsx}'],
coverageDirectory: 'coverage',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
preset: "ts-jest",
testEnvironment: "jsdom",
globals: {
"ts-jest": {
tsconfig: "tsconfig.test.json",
},
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], // Add this line
};
1 change: 0 additions & 1 deletion jest.setup.js

This file was deleted.

1 change: 1 addition & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "@testing-library/jest-dom";
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
typescript: {
tsconfigPath: "./tsconfig.next.json",
},
};
Loading

0 comments on commit 3ffdfbb

Please sign in to comment.