-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy patheslint.config.mjs
88 lines (83 loc) · 2.33 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// @ts-check
/* Globals */
import globals from 'globals';
import rnGlobals from 'eslint-plugin-react-native-globals';
/* Plugins */
import js from '@eslint/js';
import ts from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import-x';
import reactPlugin from 'eslint-plugin-react';
import rnPlugin from 'eslint-plugin-react-native';
import hooksPlugin from 'eslint-plugin-react-hooks';
import kitsuPlugin from './eslint/index.js';
export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
reactPlugin.configs.flat.recommended,
prettierConfig,
// Application files
{
plugins: {
'react-native': rnPlugin,
'react-hooks': hooksPlugin,
kitsu: kitsuPlugin,
},
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
globals: {
...globals.browser,
...rnGlobals.environments.all.globals,
},
},
settings: {
react: { version: 'detect' },
},
rules: {
'kitsu/fix-kitsu-imports': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
minimumDescriptionLength: 3,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'import-x/no-absolute-path': 'error',
'import-x/no-cycle': ['error', { ignoreExternal: true }],
'import-x/no-duplicates': ['error',
{
'prefer-inline': true,
considerQueryString: true,
}
],
'react/prop-types': 'off',
'react-native/no-unused-styles': 2,
'react-native/no-inline-styles': 1,
'react-native/no-color-literals': 2,
'react-native/no-raw-text': 2,
'react-native/no-single-element-style-arrays': 1,
},
},
// Node-based config files
{
files: ['**/*.config.{js,ts}'],
languageOptions: {
globals: globals.node,
ecmaVersion: 2015,
sourceType: 'commonjs',
},
},
);