-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
73 lines (72 loc) · 1.91 KB
/
eslint.config.js
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
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import pluginJs from '@eslint/js';
import checkFile from 'eslint-plugin-check-file';
import reactHooks from 'eslint-plugin-react-hooks';
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
import sonarjs from 'eslint-plugin-sonarjs';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
plugins: {
'check-file': checkFile,
'react-hooks': fixupPluginRules(reactHooks),
},
settings: {
react: {
version: 'detect',
},
},
},
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'.prettierrc.cjs',
],
},
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...fixupConfigRules(pluginReactConfig),
sonarjs.configs.recommended,
{
rules: {
'no-console': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'react/react-in-jsx-scope': 'off',
'check-file/filename-naming-convention': [
'error',
{
'./src/**/*.{jsx,tsx}': 'KEBAB_CASE',
'./src/**/*.{js,ts}': 'KEBAB_CASE',
},
{ ignoreMiddleExtensions: true },
],
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: 'process',
message:
"For environment variables, use `import env from '@/env';`",
},
],
},
],
'react/jsx-no-literals': [
'warn',
{
noStrings: true,
ignoreProps: true,
},
],
...reactHooks.configs.recommended.rules,
},
},
];