Skip to content

Commit a04a9ab

Browse files
authored
Add lint check (#587)
Changes: - Added ESLint v9 - Added typescript-eslint (note: I chose to use an v8 alpha version because this is [the only that supports ESLint v9](typescript-eslint/typescript-eslint#8211 (comment)). I think this was preferable than using ESLint v8, which is going to be deprecated sooner than v9) - Added eslint-config-prettier to avoid lint conflicts with Prettier - Replaced custom `throttle` and `debounce` utility function with lodash functions to fix typing issues - Added lint step to CI workflow
1 parent 9d3f6f5 commit a04a9ab

File tree

13 files changed

+2695
-163
lines changed

13 files changed

+2695
-163
lines changed

.github/workflows/test-js.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name: CI
33
on:
44
push:
55
branches:
6-
- 'main'
6+
- "main"
77
pull_request:
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

13-
1413
jobs:
1514
lint-and-test:
1615
runs-on: ubuntu-latest
@@ -39,10 +38,10 @@ jobs:
3938
run: npm install
4039

4140
- name: Prettier check
42-
run: npm run fmt:check
41+
run: npm run prettier:check
4342

44-
- name: Type check
45-
run: npm run typecheck
43+
- name: Lint check
44+
run: npm run lint
4645

4746
- name: Test
4847
run: npm run test

eslint.config.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import globals from "globals";
2+
import pluginJs from "@eslint/js";
3+
import tseslint from "typescript-eslint";
4+
import pluginReact from "eslint-plugin-react";
5+
import eslintConfigPrettier from "eslint-config-prettier";
6+
7+
export default [
8+
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
9+
{ languageOptions: { globals: globals.browser } },
10+
pluginJs.configs.recommended,
11+
...tseslint.configs.recommended,
12+
pluginReact.configs.flat.recommended,
13+
{
14+
settings: {
15+
react: {
16+
version: "detect",
17+
},
18+
},
19+
},
20+
eslintConfigPrettier,
21+
];

0 commit comments

Comments
 (0)