Skip to content

Commit 1331df0

Browse files
committed
feat(eslint-config-react-native): add config
chore: rename package fix: disable slow rules
1 parent a7e4463 commit 1331df0

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import expoConfig from 'eslint-config-expo/flat.js'
2+
import { defineConfig, globalIgnores } from 'eslint/config'
3+
4+
/** Globally ignored */
5+
const ignores = globalIgnores(['.expo/'])
6+
7+
/** @type {import("eslint").Linter.Config} */
8+
const common = {
9+
rules: {
10+
// Very expensive check
11+
'import/namespace': 'off',
12+
// Very expensive check
13+
'import/no-duplicates': 'off',
14+
},
15+
}
16+
17+
/** @type {import("eslint").Linter.Config} */
18+
const react = {
19+
rules: {
20+
'react/jsx-sort-props': [
21+
'warn',
22+
{
23+
multiline: 'first',
24+
reservedFirst: ['key'],
25+
callbacksLast: true,
26+
shorthandLast: true,
27+
},
28+
],
29+
'react/display-name': 'off',
30+
},
31+
}
32+
33+
/** @type {import("eslint").Linter.Config} */
34+
const typescript = {
35+
rules: {
36+
// Handled by TypeScript, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals
37+
'@typescript-eslint/no-unused-vars': 'off',
38+
// Its common in React Native to import types using require syntax, see https://reactnative.dev/docs/images#static-image-resources
39+
'@typescript-eslint/no-require-imports': 'off',
40+
41+
// '@typescript-eslint/consistent-type-imports': [
42+
// 'warn',
43+
// { prefer: 'type-imports', fixStyle: 'inline-type-imports' },
44+
// ],
45+
},
46+
}
47+
48+
export default defineConfig([
49+
expoConfig,
50+
ignores,
51+
common,
52+
typescript,
53+
react,
54+
])

packages/eslint-config-react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@strv/react-native",
2+
"name": "@strv/eslint-config-react-native",
33
"description": "STRV's ESLint config for React Native projects",
44
"version": "1.0.0",
55
"author": "Petr Chalupa <[email protected]>",

0 commit comments

Comments
 (0)