Skip to content

Commit 5b1a898

Browse files
committed
chore: updated eslint
1 parent c209cc8 commit 5b1a898

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+933
-354
lines changed

eslint.config.mjs

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { fixupConfigRules } from '@eslint/compat';
22
import { FlatCompat } from '@eslint/eslintrc';
33
import js from '@eslint/js';
4-
import prettier from 'eslint-plugin-prettier';
5-
import { defineConfig } from 'eslint/config';
64
import path from 'node:path';
75
import { fileURLToPath } from 'node:url';
6+
import { defineConfig } from 'eslint/config';
7+
8+
import importPlugin from 'eslint-plugin-import';
9+
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
10+
import prettierPlugin from 'eslint-plugin-prettier';
811

912
const __filename = fileURLToPath(import.meta.url);
1013
const __dirname = path.dirname(__filename);
14+
1115
const compat = new FlatCompat({
1216
baseDirectory: __dirname,
1317
recommendedConfig: js.configs.recommended,
@@ -17,10 +21,63 @@ const compat = new FlatCompat({
1721
export default defineConfig([
1822
{
1923
extends: fixupConfigRules(compat.extends('@react-native', 'prettier')),
20-
plugins: { prettier },
24+
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
25+
plugins: {
26+
'import': importPlugin,
27+
'unused-imports': unusedImportsPlugin,
28+
'prettier': prettierPlugin,
29+
},
2130
rules: {
22-
'react/react-in-jsx-scope': 'off',
2331
'prettier/prettier': 'error',
32+
'react/react-in-jsx-scope': 'off',
33+
'unused-imports/no-unused-imports': 'error',
34+
'unused-imports/no-unused-vars': [
35+
'error',
36+
{
37+
vars: 'all',
38+
varsIgnorePattern: '^_',
39+
args: 'after-used',
40+
argsIgnorePattern: '^_',
41+
},
42+
],
43+
'import/order': [
44+
'error',
45+
{
46+
'groups': [
47+
'builtin',
48+
'external',
49+
'internal',
50+
'parent',
51+
'sibling',
52+
'index',
53+
'object',
54+
'type',
55+
],
56+
'pathGroups': [
57+
{
58+
pattern: 'react',
59+
group: 'external',
60+
position: 'before',
61+
},
62+
{
63+
pattern: 'react-native',
64+
group: 'external',
65+
position: 'before',
66+
},
67+
{
68+
pattern: '@src/**',
69+
group: 'internal',
70+
position: 'after',
71+
},
72+
],
73+
'pathGroupsExcludedImportTypes': ['react', 'react-native'],
74+
'newlines-between': 'always',
75+
'alphabetize': {
76+
order: 'asc',
77+
caseInsensitive: true,
78+
},
79+
},
80+
],
2481
'no-restricted-imports': [
2582
'error',
2683
{
@@ -38,9 +95,11 @@ export default defineConfig([
3895
ignores: [
3996
'node_modules/',
4097
'lib/',
41-
'expoConfig/build',
42-
'.yarn',
43-
'eslint.config.mjs',
98+
'.yarn/',
99+
'expoConfig/build/',
100+
'dist/',
101+
'android/',
102+
'ios/',
44103
],
45104
},
46105
]);

example/babel.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
const path = require('path');
2+
23
const { getConfig } = require('react-native-builder-bob/babel-config');
4+
35
const pkg = require('../package.json');
46

57
const root = path.resolve(__dirname, '..');
68

79
module.exports = getConfig(
810
{
911
presets: ['module:@react-native/babel-preset'],
10-
plugins: ['react-native-worklets/plugin'],
12+
plugins: [
13+
[
14+
'module-resolver',
15+
{
16+
root: ['./'],
17+
alias: {
18+
'@src': './src',
19+
},
20+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
21+
},
22+
],
23+
'react-native-worklets/plugin',
24+
],
1125
},
1226
{ root, pkg }
1327
);

example/eslint.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import rootConfig from '../eslint.config.mjs';
2+
3+
export default [
4+
...rootConfig,
5+
{
6+
files: ['**/*.{js,jsx,ts,tsx}'],
7+
rules: {
8+
'import/no-relative-parent-imports': 'error',
9+
},
10+
},
11+
];

example/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { AppRegistry } from 'react-native';
2-
import App from './src/App';
3-
import { name as appName } from './app.json';
42
import { LogBox } from 'react-native';
53

4+
import { name as appName } from './app.json';
5+
import App from './src/App';
6+
67
LogBox.ignoreLogs(['InteractionManager has been deprecated']);
78

89
AppRegistry.registerComponent(appName, () => App);

example/metro.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
23
const { getDefaultConfig } = require('@react-native/metro-config');
34
const { withMetroConfig } = require('react-native-monorepo-config');
45

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@react-native/metro-config": "0.82.1",
3939
"@react-native/typescript-config": "0.82.1",
4040
"@types/react": "19.1.1",
41+
"babel-plugin-module-resolver": "5.0.2",
4142
"react-native-builder-bob": "0.40.15",
4243
"react-native-monorepo-config": "0.3.0"
4344
},

example/react-native.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
23
const pkg = require('../package.json');
34

45
module.exports = {

example/src/App.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
import React from 'react';
2+
3+
import { useColorScheme } from 'react-native';
4+
25
import {
36
DarkTheme,
47
DefaultTheme,
58
NavigationContainer,
69
} from '@react-navigation/native';
710
import { createStackNavigator } from '@react-navigation/stack';
8-
9-
import HomeScreen from './screens/HomeScreen';
10-
import BasicMapScreen from './screens/BasicMapScreen';
11-
import MarkersScreen from './screens/MarkersScreen';
12-
import PolygonsScreen from './screens/PolygonsScreen';
13-
import PolylinesScreen from './screens/PolylinesScreen';
14-
import CirclesScreen from './screens/CirclesScreen';
15-
import HeatmapScreen from './screens/HeatmapScreen';
16-
import KmlLayerScreen from './screens/KmlLayerScreen';
17-
import LocationScreen from './screens/LocationScreen';
18-
import CustomStyleScreen from './screens/CustomStyleScreen';
19-
import StressTestScreen from './screens/StressTestScreen';
2011
import { GestureHandlerRootView } from 'react-native-gesture-handler';
21-
import { useColorScheme } from 'react-native';
22-
import BlankScreen from './screens/BlankScreen';
23-
import IndoorLevelMapScreen from './screens/IndoorLevelMapScreen';
24-
import CameraTestScreen from './screens/CameraTestScreen';
25-
import type { RootStackParamList } from './types/navigation';
26-
import SnapshotTestScreen from './screens/SnaptshotTestScreen';
27-
import ClusteringScreen from './screens/ClsuteringScreen';
28-
import SvgMarkersScreen from './screens/SvgMarkersScreen';
29-
import UrlTileOverlay from './screens/UrlTileOverlay';
12+
13+
import BasicMapScreen from '@src/screens/BasicMapScreen';
14+
import BlankScreen from '@src/screens/BlankScreen';
15+
import CameraTestScreen from '@src/screens/CameraTestScreen';
16+
import CirclesScreen from '@src/screens/CirclesScreen';
17+
import ClusteringScreen from '@src/screens/ClsuteringScreen';
18+
import CustomStyleScreen from '@src/screens/CustomStyleScreen';
19+
import HeatmapScreen from '@src/screens/HeatmapScreen';
20+
import HomeScreen from '@src/screens/HomeScreen';
21+
import IndoorLevelMapScreen from '@src/screens/IndoorLevelMapScreen';
22+
import KmlLayerScreen from '@src/screens/KmlLayerScreen';
23+
import LocationScreen from '@src/screens/LocationScreen';
24+
import MarkersScreen from '@src/screens/MarkersScreen';
25+
import PolygonsScreen from '@src/screens/PolygonsScreen';
26+
import PolylinesScreen from '@src/screens/PolylinesScreen';
27+
import SnapshotTestScreen from '@src/screens/SnaptshotTestScreen';
28+
import StressTestScreen from '@src/screens/StressTestScreen';
29+
import SvgMarkersScreen from '@src/screens/SvgMarkersScreen';
30+
import UrlTileOverlay from '@src/screens/UrlTileOverlay';
31+
import type { RootStackParamList } from '@src/types/navigation';
3032

3133
const Stack = createStackNavigator<RootStackParamList>();
3234

example/src/components/ControlPanel.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
import React, { useMemo } from 'react';
2+
23
import {
34
ScrollView,
45
StyleSheet,
56
Text,
67
TouchableOpacity,
78
View,
89
} from 'react-native';
10+
11+
import { useNavigation } from '@react-navigation/native';
912
import Animated, {
1013
Extrapolation,
1114
interpolate,
1215
useAnimatedStyle,
1316
useSharedValue,
1417
withTiming,
1518
} from 'react-native-reanimated';
16-
import type { GoogleMapsViewRef } from 'react-native-google-maps-plus';
17-
import { useAppTheme } from '../hooks/useAppTheme';
18-
import { useNavigation } from '@react-navigation/native';
19-
import type { RootNavigationProp } from '../types/navigation';
2019
import {
2120
type EdgeInsets,
2221
useSafeAreaInsets,
2322
} from 'react-native-safe-area-context';
24-
import type { AppTheme } from '../theme';
23+
24+
import { useAppTheme } from '@src/hooks/useAppTheme';
25+
import type { AppTheme } from '@src/theme';
26+
import type { RootNavigationProp } from '@src/types/navigation';
27+
28+
import type { GoogleMapsViewRef } from 'react-native-google-maps-plus';
2529

2630
export type ButtonItem = { title: string; onPress: () => void };
2731

example/src/components/HeaderButton.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React, { useMemo } from 'react';
2+
23
import { Pressable, StyleSheet, Text } from 'react-native';
3-
import { useAppTheme } from '../hooks/useAppTheme';
4-
import type { AppTheme } from '../theme';
4+
5+
import { useAppTheme } from '@src/hooks/useAppTheme';
6+
import type { AppTheme } from '@src/theme';
57

68
type Props = {
79
title: string;

0 commit comments

Comments
 (0)