-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
65 lines (63 loc) · 2.08 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
async function createConfig() {
const react = await import('eslint-plugin-react');
const reactHooks = await import('eslint-plugin-react-hooks');
const jsxA11y = await import('eslint-plugin-jsx-a11y');
const importPlugin = await import('eslint-plugin-import');
const typescript = await import('@typescript-eslint/eslint-plugin');
const typescriptParser = await import('@typescript-eslint/parser');
const reactNative = await import('eslint-plugin-react-native');
return [
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
parser: typescriptParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: {
react: react.default,
reactHooks: reactHooks.default,
jsxA11y: jsxA11y.default,
import: importPlugin.default,
'@typescript-eslint': typescript.default,
'react-native': reactNative.default,
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'no-unused-vars': 'off', // Disable no-unused-vars for @typescript-eslint/no-unused-vars
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
semi: ['error', 'always'], // Enforce semicolons
indent: ['error', 2], // Enforce 2 spaces for indentation
'react-native/no-unused-styles': 'error',
'react-native/split-platform-components': 'warn',
'react-native/no-inline-styles': 'error',
'react-native/no-color-literals': 'error',
'react-native/no-raw-text': 'error',
},
},
];
}
module.exports = createConfig().then((config) => config);