Skip to content

Commit 4ec69d9

Browse files
committed
Upgrade lint libraries
1 parent f902050 commit 4ec69d9

File tree

11 files changed

+900
-733
lines changed

11 files changed

+900
-733
lines changed

.eslintrc

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

eslint.config.ts

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import js from '@eslint/js';
2+
import tseslint from '@typescript-eslint/eslint-plugin';
3+
import tsparser from '@typescript-eslint/parser';
4+
import importPlugin from 'eslint-plugin-import';
5+
import prettier from 'eslint-plugin-prettier';
6+
import react from 'eslint-plugin-react';
7+
import reactHooks from 'eslint-plugin-react-hooks';
8+
import prettierConfig from 'eslint-config-prettier';
9+
import type { Linter } from 'eslint';
10+
11+
const config: Linter.FlatConfig[] = [
12+
js.configs.recommended,
13+
{
14+
files: ['src/**/*.{js,jsx,ts,tsx}'],
15+
languageOptions: {
16+
parser: tsparser,
17+
parserOptions: {
18+
ecmaVersion: 'latest',
19+
sourceType: 'module',
20+
ecmaFeatures: {
21+
jsx: true,
22+
},
23+
},
24+
globals: {
25+
React: 'writable',
26+
console: 'readonly',
27+
process: 'readonly',
28+
Buffer: 'readonly',
29+
__dirname: 'readonly',
30+
__filename: 'readonly',
31+
module: 'readonly',
32+
require: 'readonly',
33+
exports: 'readonly',
34+
global: 'readonly',
35+
window: 'readonly',
36+
document: 'readonly',
37+
navigator: 'readonly',
38+
HTMLElement: 'readonly',
39+
Element: 'readonly',
40+
Node: 'readonly',
41+
Event: 'readonly',
42+
EventTarget: 'readonly',
43+
jest: 'readonly',
44+
describe: 'readonly',
45+
it: 'readonly',
46+
test: 'readonly',
47+
expect: 'readonly',
48+
beforeEach: 'readonly',
49+
afterEach: 'readonly',
50+
beforeAll: 'readonly',
51+
afterAll: 'readonly',
52+
},
53+
},
54+
plugins: {
55+
'@typescript-eslint': tseslint as any,
56+
react: react as any,
57+
'react-hooks': reactHooks as any,
58+
import: importPlugin as any,
59+
prettier: prettier as any,
60+
},
61+
settings: {
62+
react: {
63+
version: 'detect',
64+
},
65+
},
66+
rules: {
67+
// Core ESLint rules
68+
'no-unused-vars': 'off', // Replaced by TypeScript version
69+
'no-undef': 'off', // TypeScript handles this
70+
71+
// TypeScript ESLint rules
72+
'@typescript-eslint/no-unused-vars': 'error',
73+
'@typescript-eslint/explicit-function-return-type': 'off',
74+
'@typescript-eslint/explicit-module-boundary-types': 'off',
75+
'@typescript-eslint/ban-ts-comment': 'off',
76+
'@typescript-eslint/no-explicit-any': 'warn',
77+
78+
// React rules
79+
'react/react-in-jsx-scope': 'off',
80+
'react/prop-types': 'off',
81+
82+
// React Hooks rules
83+
'react-hooks/rules-of-hooks': 'error',
84+
'react-hooks/exhaustive-deps': 'error',
85+
86+
// Import rules
87+
'import/order': [
88+
'error',
89+
{
90+
groups: ['builtin', 'external', 'internal'],
91+
pathGroups: [
92+
{
93+
pattern: 'react',
94+
group: 'external',
95+
position: 'before',
96+
},
97+
],
98+
pathGroupsExcludedImportTypes: ['react'],
99+
'newlines-between': 'always',
100+
alphabetize: {
101+
order: 'asc',
102+
caseInsensitive: true,
103+
},
104+
},
105+
],
106+
107+
// Prettier rules
108+
'prettier/prettier': 'error',
109+
},
110+
},
111+
];
112+
113+
export default config;

0 commit comments

Comments
 (0)