Skip to content

Commit 03cab8d

Browse files
committed
Convert to TypeScript
1 parent c21e696 commit 03cab8d

23 files changed

+29330
-898
lines changed

.babelrc.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,19 @@ const loose = true
44

55
module.exports = {
66
presets: [
7-
[
8-
'@babel/preset-env',
9-
{
10-
loose,
11-
...(test ? { targets: { node: '8' } } : {})
12-
}
13-
],
7+
['@babel/preset-env', { modules: false }],
148
'@babel/preset-react',
15-
'@babel/preset-flow'
9+
'@babel/preset-typescript'
1610
],
1711
plugins: [
18-
'@babel/plugin-transform-flow-strip-types',
19-
'@babel/plugin-syntax-dynamic-import',
20-
'@babel/plugin-syntax-import-meta',
21-
['@babel/plugin-proposal-class-properties', { loose }],
22-
'@babel/plugin-proposal-json-strings',
23-
[
24-
'@babel/plugin-proposal-decorators',
25-
{
26-
legacy: true
27-
}
28-
],
29-
'@babel/plugin-proposal-function-sent',
12+
'@babel/plugin-proposal-class-properties',
13+
'@babel/plugin-proposal-decorators',
3014
'@babel/plugin-proposal-export-namespace-from',
15+
'@babel/plugin-proposal-function-sent',
16+
'@babel/plugin-proposal-json-strings',
3117
'@babel/plugin-proposal-numeric-separator',
3218
'@babel/plugin-proposal-throw-expressions',
33-
test && '@babel/plugin-transform-react-jsx-source'
34-
].filter(Boolean)
19+
'@babel/plugin-syntax-dynamic-import',
20+
'@babel/plugin-syntax-import-meta'
21+
]
3522
}

.eslintrc

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
{
2-
"extends": "react-app",
2+
"extends": ["react-app"],
3+
"plugins": ["babel", "react"],
34
"rules": {
4-
"jsx-a11y/href-no-hash": 0
5-
}
5+
"no-unused-vars": "off",
6+
"@typescript-eslint/no-unused-vars": [
7+
"error",
8+
{
9+
"varsIgnorePattern": "^_",
10+
"argsIgnorePattern": "^_"
11+
}
12+
],
13+
"jsx-a11y/href-no-hash": 0,
14+
"react/jsx-uses-react": "off",
15+
"react/react-in-jsx-scope": "off"
16+
},
17+
"overrides": [
18+
{
19+
"files": ["**/*.test.ts", "**/*.test.tsx"],
20+
"rules": {
21+
"@typescript-eslint/no-unused-vars": "off"
22+
}
23+
}
24+
]
625
}

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Use Node.js ${{ matrix.node_version }}
13+
uses: actions/setup-node@v2
14+
with:
15+
node-version: "22"
16+
- name: Prepare env
17+
run: yarn install --ignore-scripts --frozen-lockfile
18+
- name: Run linter
19+
run: yarn start lint
20+
21+
prettier:
22+
name: Prettier Check
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Use Node.js ${{ matrix.node_version }}
28+
uses: actions/setup-node@v2
29+
with:
30+
node-version: "22"
31+
- name: Prepare env
32+
run: yarn install --ignore-scripts --frozen-lockfile
33+
- name: Run prettier
34+
run: yarn start prettier
35+
36+
test:
37+
name: Unit Tests
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Use Node.js ${{ matrix.node_version }}
43+
uses: actions/setup-node@v2
44+
with:
45+
node-version: "22"
46+
- name: Prepare env
47+
run: yarn install --ignore-scripts --frozen-lockfile
48+
- name: Run unit tests
49+
run: yarn start test
50+
- name: Run code coverage
51+
uses: codecov/codecov-action@v2.1.0

.github/workflows/lock.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Lock Threads"
2+
3+
on:
4+
schedule:
5+
- cron: "0 * * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: lock
14+
15+
jobs:
16+
action:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: dessant/lock-threads@v3
20+
with:
21+
issue-inactive-days: "365"
22+
issue-lock-reason: "resolved"
23+
pr-inactive-days: "365"
24+
pr-lock-reason: "resolved"

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
*.iml
33
.nyc_output
44
coverage
5-
flow-coverage
65
node_modules
76
dist
87
lib
98
es
109
npm-debug.log
1110
.DS_Store
1211
.idea
13-
yarn.lock
14-
package-lock.json

eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import parser from '@typescript-eslint/parser'
2+
import plugin from '@typescript-eslint/eslint-plugin'
3+
4+
export default [
5+
{
6+
ignores: [
7+
'dist/**',
8+
'node_modules/**',
9+
'coverage/**',
10+
'*.config.js',
11+
'*.config.cjs',
12+
'*.config.mjs',
13+
'package-scripts.js',
14+
'package-scripts.cjs',
15+
'.babelrc.js'
16+
]
17+
},
18+
{
19+
files: ['src/**/*.{js,ts,tsx}', 'tests/**/*.{js,ts,tsx}'],
20+
languageOptions: {
21+
ecmaVersion: 'latest',
22+
sourceType: 'module',
23+
parser,
24+
parserOptions: {
25+
project: './tsconfig.json'
26+
}
27+
},
28+
plugins: {
29+
'@typescript-eslint': plugin
30+
},
31+
rules: {
32+
'@typescript-eslint/no-explicit-any': 'warn',
33+
'@typescript-eslint/explicit-function-return-type': 'off',
34+
'@typescript-eslint/explicit-module-boundary-types': 'off'
35+
}
36+
}
37+
]

0 commit comments

Comments
 (0)