Skip to content

Commit 432d3b5

Browse files
authored
Merge pull request #1 from bqfan/eslint-upgrade
Eslint upgrade
2 parents aca9468 + efdea98 commit 432d3b5

File tree

27 files changed

+1450
-1866
lines changed

27 files changed

+1450
-1866
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.

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"cSpell.words": ["Flashlist", "Lato"],
2828
"i18n-ally.localesPaths": ["src/translations/"],
2929
"i18n-ally.keystyle": "nested",
30-
"i18n-ally.disabled": false, // make sure to disable i18n-ally in your global setting and only enable it for such projects
30+
"i18n-ally.disabled": false,
3131
"tailwindCSS.experimental.classRegex": [
3232
["tv\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
3333
]

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')
77
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '35')
88
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
9-
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.24'
9+
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.25'
1010

1111
ndkVersion = "26.1.10909125"
1212
}

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pluginManagement {
2-
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile().toString())
2+
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().toString())
33
}
44
plugins { id("com.facebook.react.settings") }
55

app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable max-lines-per-function */
1+
22
import type { ConfigContext, ExpoConfig } from '@expo/config';
33
import type { AppIconBadgeConfig } from 'app-icon-badge/types';
44

docs/astro.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { defineConfig } from 'astro/config';
21
import starlight from '@astrojs/starlight';
3-
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers';
2+
import { defineConfig } from 'astro/config';
43
import starlightLlmsTxt from 'starlight-llms-txt';
54

65
const site = 'https://starter.obytes.com/';

docs/ec.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
2-
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers';
31

42
/** @type {import('@astrojs/starlight/expressive-code').StarlightExpressiveCodeOptions} */
53
export default {

docs/src/content/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineCollection } from 'astro:content';
21
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
2+
import { defineCollection } from 'astro:content';
33

44
export const collections = {
55
docs: defineCollection({ schema: docsSchema() }),

eslint.config.mjs

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import path from 'node:path';
2+
3+
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
4+
import typescriptEslintParser from '@typescript-eslint/parser';
5+
import eslintPluginI18nJson from 'eslint-plugin-i18n-json';
6+
import jsonPlugin from 'eslint-plugin-json';
7+
import reactPlugin from 'eslint-plugin-react';
8+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
9+
import reactNativePlugin from 'eslint-plugin-react-native';
10+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
11+
import testingLibraryPlugin from 'eslint-plugin-testing-library';
12+
import unicorn from 'eslint-plugin-unicorn';
13+
import unusedImports from 'eslint-plugin-unused-imports';
14+
15+
export default [
16+
{
17+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
18+
ignores: ['.expo/**/*'],
19+
languageOptions: {
20+
ecmaVersion: 'latest',
21+
sourceType: 'module',
22+
parser: typescriptEslintParser,
23+
parserOptions: {
24+
ecmaFeatures: { jsx: true },
25+
},
26+
},
27+
plugins: {
28+
react: reactPlugin,
29+
'react-hooks': reactHooksPlugin,
30+
'react-native': reactNativePlugin,
31+
'@typescript-eslint': typescriptEslintPlugin,
32+
'unused-imports': unusedImports,
33+
'simple-import-sort': simpleImportSort,
34+
unicorn,
35+
},
36+
rules: {
37+
'prettier/prettier': [
38+
0,
39+
{
40+
singleQuote: true,
41+
endOfLine: 'auto',
42+
},
43+
],
44+
45+
// Core React rules
46+
'react/jsx-uses-react': 'error',
47+
'react/jsx-uses-vars': 'error',
48+
'react/react-in-jsx-scope': 'off',
49+
50+
// React Hooks
51+
'react-hooks/rules-of-hooks': 'error',
52+
'react-hooks/exhaustive-deps': 'warn',
53+
54+
// React Native specific
55+
'react-native/no-unused-styles': 'error',
56+
'react-native/split-platform-components': 'warn',
57+
'react-native/no-inline-styles': 'warn',
58+
'react-native/no-color-literals': 'warn',
59+
60+
// Import management
61+
'unused-imports/no-unused-imports': 'error',
62+
'simple-import-sort/imports': 'error',
63+
'simple-import-sort/exports': 'error',
64+
65+
// File naming convention
66+
'unicorn/filename-case': [
67+
'error',
68+
{
69+
case: 'kebabCase',
70+
ignore: ['\\.(ios|android)\\.(js|ts)x?$'], // Ignore platform-specific files
71+
},
72+
],
73+
},
74+
settings: {
75+
react: {
76+
version: 'detect',
77+
},
78+
},
79+
},
80+
{
81+
// JSON configuration
82+
files: ['**/*.json'],
83+
processor: jsonPlugin.processors['.json'],
84+
plugins: {
85+
json: jsonPlugin,
86+
'i18n-json': eslintPluginI18nJson,
87+
},
88+
rules: {
89+
...jsonPlugin.configs.recommended.rules,
90+
'i18n-json/valid-message-syntax': [
91+
2,
92+
{
93+
syntax: path.resolve('./scripts/i18next-syntax-validation.js'),
94+
},
95+
],
96+
'i18n-json/valid-json': 2,
97+
'i18n-json/sorted-keys': [
98+
2,
99+
{
100+
order: 'asc',
101+
indentSpaces: 2,
102+
},
103+
],
104+
'i18n-json/identical-keys': [
105+
2,
106+
{
107+
filePath: path.resolve('./src/translations/en.json'),
108+
},
109+
],
110+
'prettier/prettier': [
111+
0,
112+
{
113+
singleQuote: true,
114+
endOfLine: 'auto',
115+
},
116+
],
117+
},
118+
},
119+
// Testing Library configuration
120+
{
121+
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
122+
plugins: {
123+
'testing-library': testingLibraryPlugin,
124+
},
125+
rules: {
126+
...testingLibraryPlugin.configs.react.rules,
127+
// Add any custom testing rules here
128+
},
129+
},
130+
];

0 commit comments

Comments
 (0)