-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
149 lines (138 loc) · 4.13 KB
/
eslint.config.mjs
File metadata and controls
149 lines (138 loc) · 4.13 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import js from "@eslint/js";
import ts from "typescript-eslint";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import importPlugin from "eslint-plugin-import";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import lodash from "eslint-plugin-lodash";
import prettier from "eslint-plugin-prettier";
import globals from "globals";
export default [
{
files: ["**/*.{js,jsx,ts,tsx}"],
ignores: [
'**/node_modules',
'**/dist',
'**/build',
'**/vite.config.ts',
'tailwind.config.mjs',
'eslint.config.mjs',
],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
},
parser: ts.parser,
parserOptions: {
project: "./tsconfig.json",
ecmaFeatures: { jsx: true },
tsconfigRootDir: import.meta.dirname
},
},
plugins: {
react,
"react-hooks": reactHooks,
import: importPlugin,
"simple-import-sort": simpleImportSort,
lodash,
prettier,
},
settings: {
react: { version: 'detect', },
"import/resolver": { typescript: true, node: true, },
},
// Custom rules can be added here
rules: {
...js.configs.recommended.rules,
...ts.configs.recommended['rules'],
...ts.configs.strictTypeChecked.rules,
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
...importPlugin.configs.recommended['rules'],
...lodash.configs.recommended['rules'],
// Prettier integration
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',
// allow console.warn and console.error, but not console.log. personal pref
'no-console': [
'warn',
{
allow: ['error', 'warn', 'info'],
},
],
// force use of curly brackts on if statements
curly: 'error',
// force space after comments
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'simple-import-sort/imports': [
'error',
{
'groups': [
// `react` first, `next` second, then packages starting with a character
["^react$", "^react-dom$", "^react-router$", "^react-query$"],
// other react packages
["^react-[a-z]"],
// react icon package
["^react-icons/.*$"],
// Packages starting with `@`
["^@"],
// Packages starting with `@/` (path aliases)
["^@/"],
// Imports starting with `../` - parents
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Imports starting with `./` - siblings
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports
["^.+\\.s?css$"],
]
}
],
'simple-import-sort/exports': 'error',
'import/no-anonymous-default-export': 0,
'import/no-unresolved': 'error',
'max-len': [
'error',
100,
2,
{
ignoreUrls: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'func-names': ['error', 'as-needed'],
'react/function-component-definition': [
1,
{
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function',
},
],
'react/no-unstable-nested-components': 2,
'react/jsx-key': [
'error',
{checkFragmentShorthand: true, checkKeyMustBeforeSpread: true, warnOnDuplicates: true},
],
'react/jsx-curly-brace-presence': ['error', {props: 'never'}],
// NOTE: A lot of components are doing this and will need refactoring
// 'react/jsx-props-no-spreading': 1,
// NOTE: Temporarily set to 0 while strings get built in
'i18next/no-literal-string': 0,
'lodash/prefer-constant': 0,
'lodash/prefer-lodash-method': 0,
'lodash/import-scope': 0,
'lodash/chaining': 0,
},
}
];