Skip to content

Commit 33cbe9e

Browse files
refactor: upgrade to Expo 53 and eslint with flat configs
1 parent 2697e06 commit 33cbe9e

File tree

12 files changed

+2741
-3335
lines changed

12 files changed

+2741
-3335
lines changed

.eslintignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 104 deletions
This file was deleted.

__mocks__/expo-localization.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const locale = 'en-US';
2+
export const locales = ['en-US'];
3+
export const timezone = 'UTC';
4+
export const isRTL = false;

android/app/src/main/java/com/obytes/development/MainApplication.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.obytes.development
2+
import com.facebook.react.common.assets.ReactFontManager
23

34
import android.app.Application
45
import android.content.res.Configuration
@@ -42,6 +43,9 @@ class MainApplication : Application(), ReactApplication {
4243

4344
override fun onCreate() {
4445
super.onCreate()
46+
// @generated begin xml-fonts-init - expo prebuild (DO NOT MODIFY) sync-da39a3ee5e6b4b0d3255bfef95601890afd80709
47+
48+
// @generated end xml-fonts-init
4549
SoLoader.init(this, OpenSourceMergedSoMapping)
4650
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4751
// If you opted-in for the New Architecture, we load the native entry point for this app.

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true
5454

5555
# Use legacy packaging to compress native libraries in the resulting APK.
5656
expo.useLegacyPackaging=false
57+
58+
# Whether the app is configured to use edge-to-edge via the app config or `react-native-edge-to-edge` plugin
59+
expo.edgeToEdgeEnabled=true

env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const z = require('zod');
1818
const packageJSON = require('./package.json');
1919
const path = require('path');
2020
const APP_ENV = process.env.APP_ENV ?? 'development';
21+
// eslint-disable-next-line no-undef
2122
const envPath = path.resolve(__dirname, `.env.${APP_ENV}`);
2223

2324
require('dotenv').config({

eslint.config.mjs

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { defineConfig, globalIgnores } from 'eslint/config';
5+
import expoConfig from 'eslint-config-expo/flat.js';
6+
import i18nJsonPlugin from 'eslint-plugin-i18n-json';
7+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
8+
import reactCompiler from 'eslint-plugin-react-compiler';
9+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
10+
import tailwind from 'eslint-plugin-tailwindcss';
11+
import testingLibrary from 'eslint-plugin-testing-library';
12+
// eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member, import/namespace
13+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
14+
import unusedImports from 'eslint-plugin-unused-imports';
15+
import { configs, parser } from 'typescript-eslint';
16+
17+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
18+
19+
export default defineConfig([
20+
globalIgnores([
21+
'dist/*',
22+
'node_modules',
23+
'__tests__/',
24+
'coverage',
25+
'.expo',
26+
'.expo-shared',
27+
'android',
28+
'ios',
29+
'.vscode',
30+
'docs/',
31+
'cli/',
32+
]),
33+
expoConfig,
34+
eslintPluginPrettierRecommended,
35+
...tailwind.configs['flat/recommended'],
36+
reactCompiler.configs.recommended,
37+
{
38+
plugins: {
39+
'simple-import-sort': simpleImportSort,
40+
unicorn: eslintPluginUnicorn,
41+
'unused-imports': unusedImports,
42+
},
43+
rules: {
44+
'max-params': ['error', 3],
45+
'max-lines-per-function': ['error', 70],
46+
'tailwindcss/classnames-order': [
47+
'warn',
48+
{
49+
officialSorting: true,
50+
},
51+
],
52+
'tailwindcss/no-custom-classname': 'off',
53+
'react/display-name': 'off',
54+
'react/no-inline-styles': 'off',
55+
'react/destructuring-assignment': 'off',
56+
'react/require-default-props': 'off',
57+
'unicorn/filename-case': [
58+
'error',
59+
{
60+
case: 'kebabCase',
61+
ignore: ['/android', '/ios'],
62+
},
63+
],
64+
'simple-import-sort/imports': 'error',
65+
'simple-import-sort/exports': 'error',
66+
'unused-imports/no-unused-imports': 'error',
67+
'unused-imports/no-unused-vars': [
68+
'error',
69+
{
70+
argsIgnorePattern: '^_',
71+
varsIgnorePattern: '^_',
72+
caughtErrorsIgnorePattern: '^_',
73+
},
74+
],
75+
'import/prefer-default-export': 'off',
76+
'import/no-cycle': ['error', { maxDepth: '∞' }],
77+
'prettier/prettier': ['error', { ignores: ['expo-env.d.ts'] }],
78+
},
79+
},
80+
{
81+
files: ['**/*.ts', '**/*.tsx'],
82+
languageOptions: {
83+
parser: parser,
84+
parserOptions: {
85+
project: './tsconfig.json',
86+
sourceType: 'module',
87+
},
88+
},
89+
rules: {
90+
...configs.recommended.rules,
91+
'@typescript-eslint/comma-dangle': 'off',
92+
'@typescript-eslint/consistent-type-imports': [
93+
'warn',
94+
{
95+
prefer: 'type-imports',
96+
fixStyle: 'inline-type-imports',
97+
disallowTypeAnnotations: true,
98+
},
99+
],
100+
},
101+
},
102+
{
103+
files: ['src/translations/*.json'],
104+
plugins: { 'i18n-json': i18nJsonPlugin },
105+
processor: {
106+
meta: { name: '.json' },
107+
...i18nJsonPlugin.processors['.json'],
108+
},
109+
rules: {
110+
...i18nJsonPlugin.configs.recommended.rules,
111+
'i18n-json/valid-message-syntax': [
112+
2,
113+
{
114+
syntax: path.resolve(
115+
__dirname,
116+
'./scripts/i18next-syntax-validation.js'
117+
),
118+
},
119+
],
120+
'i18n-json/valid-json': 2,
121+
'i18n-json/sorted-keys': [
122+
2,
123+
{
124+
order: 'asc',
125+
indentSpaces: 2,
126+
},
127+
],
128+
'i18n-json/identical-keys': [
129+
2,
130+
{
131+
filePath: path.resolve(__dirname, './src/translations/en.json'),
132+
},
133+
],
134+
'prettier/prettier': [
135+
0,
136+
{
137+
singleQuote: true,
138+
endOfLine: 'auto',
139+
},
140+
],
141+
},
142+
},
143+
{
144+
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
145+
plugins: { 'testing-library': testingLibrary },
146+
rules: {
147+
...testingLibrary.configs.react.rules,
148+
},
149+
},
150+
]);

0 commit comments

Comments
 (0)