-
-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy patheslint.config.mjs
More file actions
78 lines (73 loc) 路 1.83 KB
/
Copy patheslint.config.mjs
File metadata and controls
78 lines (73 loc) 路 1.83 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
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const rootDir = path.dirname(fileURLToPath(import.meta.url))
const compat = new FlatCompat({
baseDirectory: rootDir,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
const baseConfig = compat.config({
extends: ['@react-native', 'plugin:prettier/recommended'],
plugins: ['@typescript-eslint', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: path.join(rootDir, 'config'),
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'prettier/prettier': [
'warn',
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
semi: false,
},
],
},
})
function packageConfig(packageDir, project = true, jsx = true) {
return {
files: [`${packageDir}/**/*.{js,ts,tsx}`],
languageOptions: {
parserOptions: {
tsconfigRootDir: path.join(rootDir, packageDir),
project,
ecmaFeatures: {
jsx,
},
},
},
}
}
export default [
{
ignores: [
'**/node_modules/**',
'**/.harness/**',
'**/lib/**',
'**/.eslintrc.*',
'**/.prettierrc.*',
'**/jest.config.js',
'**/babel.config.js',
'**/metro.config.js',
'**/react-native.config.js',
'**/tsconfig.json',
],
},
...baseConfig,
packageConfig('packages/react-native-nitro-modules', ['./tsconfig.json']),
packageConfig('packages/nitrogen', true, false),
packageConfig('packages/react-native-nitro-test'),
packageConfig('packages/react-native-nitro-test-external'),
packageConfig('example'),
]