diff --git a/apps/mobile/.eslintrc.js b/apps/mobile/.eslintrc.js index 7eb0515e1..d440a4ae9 100644 --- a/apps/mobile/.eslintrc.js +++ b/apps/mobile/.eslintrc.js @@ -1,8 +1,42 @@ module.exports = { - ...require('@sd/config/eslint-react-native.js'), - parserOptions: { - tsconfigRootDir: __dirname, - project: './tsconfig.json' + env: { + 'react-native/react-native': true }, - ignorePatterns: ['**/*.js', '**/*.json', 'android', 'ios', '.expo'] + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true + }, + ecmaVersion: 12, + sourceType: 'module' + }, + extends: [ + 'eslint:recommended', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + 'plugin:@typescript-eslint/recommended' + ], + plugins: ['react', 'react-native'], + rules: { + 'react/display-name': 'off', + 'react/prop-types': 'off', + 'react/no-unescaped-entities': 'off', + 'react/react-in-jsx-scope': 'off', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'no-control-regex': 'off', + 'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'] + }, + ignorePatterns: ['**/*.js', '**/*.json', 'node_modules', 'android', 'ios', '.expo'], + settings: { + react: { + version: 'detect' + } + } }; diff --git a/apps/mobile/package.json b/apps/mobile/package.json index cccdaf41b..9fe4e2594 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "expo start --dev-client", "android": "expo run:android", - "ios": "expo run:ios" + "ios": "expo run:ios", + "lint": "eslint src/**/*.{ts,tsx} && tsc --noEmit" }, "dependencies": { "@expo/vector-icons": "^13.0.0", @@ -41,16 +42,23 @@ "zustand": "^4.0.0" }, "devDependencies": { - "@sd/config": "file:../../packages/config", "@babel/core": "^7.12.9", "@babel/runtime": "^7.18.9", "@rnx-kit/metro-config": "^1.2.36", "@rnx-kit/metro-resolver-symlinks": "^0.1.21", "@types/react": "~18.0.15", "@types/react-native": "~0.69.5", + "@typescript-eslint/eslint-plugin": "^5.30.7", + "@typescript-eslint/parser": "^5.30.7", + "eslint": "^8.21.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-react": "^7.30.1", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-native": "^4.0.0", "metro-minify-terser": "^0.72.0", "react-native-svg": "^12.4.3", - "react-native-svg-transformer": "^1.0.0" + "react-native-svg-transformer": "^1.0.0", + "typescript": "^4.7.4" }, "private": true } diff --git a/apps/mobile/pnpm-lock.yaml b/apps/mobile/pnpm-lock.yaml index 6fc817ce2..1cf083f98 100644 Binary files a/apps/mobile/pnpm-lock.yaml and b/apps/mobile/pnpm-lock.yaml differ diff --git a/apps/mobile/src/types/declarations.d.ts b/apps/mobile/src/types/declarations.d.ts index 9784ae9de..793f67889 100644 --- a/apps/mobile/src/types/declarations.d.ts +++ b/apps/mobile/src/types/declarations.d.ts @@ -8,6 +8,7 @@ declare module '*.svg' { // This declaration is used by useNavigation, Link, ref etc. declare global { namespace ReactNavigation { + // eslint-disable-next-line @typescript-eslint/no-empty-interface interface RootParamList extends RootStackParamList {} } } diff --git a/packages/config/eslint-react-native.js b/packages/config/eslint-react-native.js deleted file mode 100644 index f275951ff..000000000 --- a/packages/config/eslint-react-native.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = { - env: { - 'react-native/react-native': true - }, - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true - }, - ecmaVersion: 12, - sourceType: 'module' - }, - extends: [ - 'eslint:recommended', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:@typescript-eslint/recommended' - ], - plugins: ['react', 'react-native'], - rules: { - 'react/display-name': 'off', - 'react/prop-types': 'off', - 'react/no-unescaped-entities': 'off', - 'react/react-in-jsx-scope': 'off', - 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'warn', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'no-control-regex': 'off', - 'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'] - }, - ignorePatterns: ['**/*.js', '**/*.json', 'node_modules'], - settings: { - react: { - version: 'detect' - } - } -}; diff --git a/packages/config/package.json b/packages/config/package.json index 79110a252..6d9f656ba 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -4,8 +4,7 @@ "main": "index.js", "license": "GPL-3.0-only", "files": [ - "eslint-react.js", - "eslint-react-native.js" + "eslint-react.js" ], "devDependencies": { "eslint": "^8.21.0", @@ -13,7 +12,6 @@ "@typescript-eslint/parser": "^5.30.7", "eslint-config-prettier": "^8.5.0", "eslint-plugin-react": "^7.30.1", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-native": "^4.0.0" + "eslint-plugin-react-hooks": "^4.6.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3abc0487..27c6b5734 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ