-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
70 lines (67 loc) · 2.25 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// @ts-check
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import configPrettier from 'eslint-config-prettier';
import n from 'eslint-plugin-n';
import tailwind from 'eslint-plugin-tailwindcss';
import unicorn from 'eslint-plugin-unicorn';
import tseslint from 'typescript-eslint';
const MAX_DEPTH = 4;
const MAX_FN_PARAMS = 3;
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
export default tseslint.config([
{ languageOptions: { globals: { React: true } }, ignores: ['node_modules'] },
...compat.extends('next/core-web-vitals', 'next/typescript'),
js.configs.recommended,
unicorn.configs.recommended,
...tailwind.configs['flat/recommended'],
{
plugins: { n },
rules: {
'prefer-const': 'error',
'max-depth': ['warn', { max: MAX_DEPTH }],
'max-params': ['error', { max: MAX_FN_PARAMS }],
'no-var': 'error',
'no-use-before-define': 'error',
'no-eval': 'error',
'no-param-reassign': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'react/button-has-type': 'error',
'react/jsx-no-constructed-context-values': 'error',
'react/no-array-index-key': 'error',
'react/self-closing-comp': 'error',
'jsx-a11y/lang': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'n/no-process-env': 'error',
'unicorn/prevent-abbreviations': [
'error',
{
allowList: {
util: true,
utils: true,
prop: true,
props: true,
param: true,
params: true,
env: true,
db: true,
},
},
],
'no-promise-executor-return': 'error',
'no-unreachable-loop': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'react/jsx-no-useless-fragment': 'error',
'react/hook-use-state': 'error',
'react/no-unstable-nested-components': 'error',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/no-noninteractive-element-interactions': 'error',
},
},
configPrettier,
]);