Skip to content

Commit 6a90d40

Browse files
committed
chore: add ts plugin and parser
1 parent c15be6d commit 6a90d40

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/eslint-config-react-native/index.mjs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import expoConfig from 'eslint-config-expo/flat.js'
22
import { defineConfig, globalIgnores } from 'eslint/config'
3+
import typeScriptPlugin from '@typescript-eslint/eslint-plugin'
4+
import typeScriptParser from '@typescript-eslint/parser'
35

46
/** Globally ignored */
57
const ignores = globalIgnores(['.expo/', 'expo-env.d.ts'])
@@ -11,14 +13,18 @@ const common = {
1113
'import/namespace': 'off',
1214
// Very expensive check
1315
'import/no-duplicates': 'off',
16+
// Handled by TypeScript
17+
'import/no-unresolved': 'off',
18+
// Handled by TypeScript. Enable noUnusedLocals in your tsconfig.json, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals
19+
'no-unused-vars': 'off',
1420
},
1521
}
1622

1723
/** @type {import("eslint").Linter.Config} */
1824
const react = {
1925
rules: {
2026
'react/jsx-sort-props': [
21-
'warn',
27+
'error',
2228
{
2329
multiline: 'first',
2430
reservedFirst: ['key'],
@@ -32,16 +38,24 @@ const react = {
3238

3339
/** @type {import("eslint").Linter.Config} */
3440
const typescript = {
41+
files: ['**/*.ts', '**/*.tsx'],
42+
languageOptions: {
43+
parser: typeScriptParser,
44+
parserOptions: {
45+
projectService: true,
46+
},
47+
},
48+
plugins: { '@typescript-eslint': typeScriptPlugin },
3549
rules: {
36-
// Handled by TypeScript, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals
50+
// Handled by TypeScript. Enable noUnusedLocals in your tsconfig.json, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals
3751
'@typescript-eslint/no-unused-vars': 'off',
3852
// Its common in React Native to import types using require syntax, see https://reactnative.dev/docs/images#static-image-resources
3953
'@typescript-eslint/no-require-imports': 'off',
4054

41-
// '@typescript-eslint/consistent-type-imports': [
42-
// 'warn',
43-
// { prefer: 'type-imports', fixStyle: 'inline-type-imports' },
44-
// ],
55+
'@typescript-eslint/consistent-type-imports': [
56+
'error',
57+
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
58+
],
4559
},
4660
}
4761

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"main": "index.mjs",
1717
"type": "module",
1818
"dependencies": {
19-
"eslint-config-expo": "~10.0.0"
19+
"eslint-config-expo": "~10.0.0",
20+
"@typescript-eslint/eslint-plugin": "^8.0.0",
21+
"@typescript-eslint/parser": "^8.0.0"
2022
},
2123
"peerDependencies": {
2224
"eslint": "^9"

0 commit comments

Comments
 (0)