Skip to content

Commit 430a49f

Browse files
committed
fix: Added linting, migrate jest to vitest.
1 parent 037127e commit 430a49f

24 files changed

+3183
-255
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ jobs:
2929
- run: npm ci
3030
- run: npm run build --if-present
3131
- run: npm test
32+
- run: npm run lint

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ pnpm-debug.log*
2424
.idea/
2525

2626
.history/
27+
.eslintcache

eslint.config.mjs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import eslintPluginAstro from 'eslint-plugin-astro';
2+
import reactHooks from 'eslint-plugin-react-hooks';
3+
import reactCompiler from 'eslint-plugin-react-compiler';
4+
import tseslint from 'typescript-eslint';
5+
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';
6+
import eslintPluginPrettierRecommended from 'eslint-config-prettier';
7+
8+
export default [
9+
{
10+
ignores: [
11+
'**/dist',
12+
'**/css',
13+
'.astro/*',
14+
'.history/*',
15+
'**/.cache'
16+
]
17+
},
18+
// add more generic rule sets here, such as:
19+
// js.configs.recommended,
20+
...tseslint.configs.recommended,
21+
reactRecommended,
22+
eslintPluginPrettierRecommended,
23+
...eslintPluginAstro.configs.recommended,
24+
{
25+
files: ["*.astro"],
26+
// ...
27+
processor: "astro/client-side-ts", // <- Uses the "client-side-ts" processor.
28+
rules: {
29+
// ...
30+
},
31+
},
32+
{
33+
plugins: {
34+
'react-hooks': reactHooks,
35+
'react-compiler': reactCompiler
36+
},
37+
settings: {
38+
react: {
39+
version: 'detect'
40+
}
41+
},
42+
rules: {
43+
...reactHooks.configs.recommended.rules,
44+
'@typescript-eslint/ban-ts-comment': 'off',
45+
'@typescript-eslint/adjacent-overload-signatures': 'error',
46+
'@typescript-eslint/array-type': 'error',
47+
'@typescript-eslint/ban-types': 'off',
48+
'@typescript-eslint/consistent-type-assertions': 'error',
49+
'@typescript-eslint/consistent-type-definitions': 'error',
50+
'@typescript-eslint/explicit-member-accessibility': 'off',
51+
'@typescript-eslint/explicit-module-boundary-types': 'off',
52+
'@typescript-eslint/indent': 'off',
53+
'@typescript-eslint/no-duplicate-enum-values': 'off',
54+
'@typescript-eslint/no-empty-function': 'off',
55+
'@typescript-eslint/no-empty-interface': 'off',
56+
'@typescript-eslint/no-explicit-any': 'off',
57+
'@typescript-eslint/no-inferrable-types': 'off',
58+
'@typescript-eslint/no-misused-new': 'error',
59+
'@typescript-eslint/no-namespace': 'error',
60+
'@typescript-eslint/no-unused-vars': [
61+
'error',
62+
{
63+
argsIgnorePattern: '^_'
64+
}
65+
],
66+
'@typescript-eslint/no-use-before-define': 'off',
67+
'@typescript-eslint/no-var-requires': 'off',
68+
'@typescript-eslint/prefer-for-of': 'error',
69+
'@typescript-eslint/prefer-function-type': 'error',
70+
'@typescript-eslint/prefer-namespace-keyword': 'error',
71+
'@typescript-eslint/unified-signatures': 'error',
72+
'@typescript-eslint/explicit-function-return-type': 'off',
73+
'arrow-body-style': 'error',
74+
camelcase: [
75+
'error',
76+
{
77+
ignoreDestructuring: true
78+
}
79+
],
80+
'constructor-super': 'error',
81+
curly: 'error',
82+
'dot-notation': 'error',
83+
eqeqeq: ['error', 'smart'],
84+
'guard-for-in': 'error',
85+
'max-classes-per-file': ['error', 1],
86+
'max-len': 'off',
87+
'no-nested-ternary': 'error',
88+
'no-bitwise': 'error',
89+
'no-caller': 'error',
90+
'no-cond-assign': 'error',
91+
'no-console': 'error',
92+
'no-debugger': 'error',
93+
'no-empty': 'error',
94+
'no-eval': 'error',
95+
'no-new-wrappers': 'error',
96+
'no-prototype-builtins': 'off',
97+
'no-shadow': 'off',
98+
'no-throw-literal': 'error',
99+
'no-trailing-spaces': 'off',
100+
'no-undef-init': 'error',
101+
'no-constant-binary-expression': 'off',
102+
'no-unsafe-finally': 'error',
103+
'no-unused-expressions': [
104+
'error',
105+
{
106+
allowTernary: true,
107+
allowShortCircuit: true
108+
}
109+
],
110+
'no-unused-labels': 'error',
111+
'no-var': 'error',
112+
'object-shorthand': 'error',
113+
'one-var': ['error', 'never'],
114+
'prefer-const': 'error',
115+
radix: ['error', 'as-needed'],
116+
'react/prop-types': 0,
117+
'react/display-name': 0,
118+
'react-compiler/react-compiler': 'warn',
119+
'react-hooks/exhaustive-deps': 'warn',
120+
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
121+
'spaced-comment': 'error',
122+
'use-isnan': 'error',
123+
'valid-typeof': 'off'
124+
}
125+
}
126+
];

jest.config.js

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

0 commit comments

Comments
 (0)