11import expoConfig from 'eslint-config-expo/flat.js'
22import { defineConfig , globalIgnores } from 'eslint/config'
3+ import typeScriptPlugin from '@typescript-eslint/eslint-plugin'
4+ import typeScriptParser from '@typescript-eslint/parser'
35
46/** Globally ignored */
57const 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 } */
1824const 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 } */
3440const 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
0 commit comments