diff --git a/eslint.config.js b/eslint.config.js index c9e83e371..b9c91f7a4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,6 @@ const reactNativeConfig = require('@react-native/eslint-config/flat'); const importPlugin = require('eslint-plugin-import'); +const prettierPlugin = require('eslint-plugin-prettier'); module.exports = [ // Ignore patterns (must be first for ESLint 9 global ignores) @@ -14,8 +15,8 @@ module.exports = [ 'babel.config.js', 'metro.config.js', 'react-native.config.js', - 'index.js', - ], + 'index.js' + ] }, // Base React Native flat config (includes prettier conflict resolution) @@ -34,21 +35,21 @@ module.exports = [ 'ft-flow/no-types-missing-file-annotation': 'off', 'ft-flow/no-unused-expressions': 'off', 'ft-flow/no-weak-types': 'off', - 'ft-flow/require-valid-file-annotation': 'off', - }, + 'ft-flow/require-valid-file-annotation': 'off' + } }, // Import plugin for all files { files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'], plugins: { - import: importPlugin, + import: importPlugin }, settings: { 'import/resolver': { typescript: true, - node: true, - }, + node: true + } }, rules: { 'import/default': 'off', @@ -57,8 +58,8 @@ module.exports = [ 'import/no-duplicates': 'error', 'import/no-named-as-default': 'off', 'import/no-named-as-default-member': 'off', - 'import/no-unresolved': ['error', {commonjs: true, amd: true}], - }, + 'import/no-unresolved': ['error', { commonjs: true, amd: true }] + } }, // TypeScript-specific overrides @@ -67,12 +68,12 @@ module.exports = [ languageOptions: { parserOptions: { project: true, - tsconfigRootDir: __dirname, + tsconfigRootDir: __dirname }, globals: { JSX: 'readonly', - Buffer: 'readonly', - }, + Buffer: 'readonly' + } }, rules: { '@typescript-eslint/await-thenable': 'error', @@ -80,15 +81,18 @@ module.exports = [ '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-shadow': 'off', - '@typescript-eslint/no-unused-vars': ['error', { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - caughtErrors: 'none', - }], + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrors: 'none' + } + ], '@typescript-eslint/no-require-imports': 'off', '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - }, + '@typescript-eslint/explicit-module-boundary-types': 'off' + } }, // Global rule overrides for all files @@ -97,13 +101,13 @@ module.exports = [ languageOptions: { globals: { JSX: 'readonly', - Buffer: 'readonly', - }, + Buffer: 'readonly' + } }, rules: { 'comma-dangle': 'off', - 'curly': 'off', - 'camelcase': 'off', + curly: 'off', + camelcase: 'off', 'no-case-declarations': 'off', 'no-control-regex': 'off', 'no-undef': 'error', @@ -121,15 +125,20 @@ module.exports = [ // TODO re-evaluate 'dot-notation': 'off', - 'eqeqeq': 'off', + eqeqeq: 'off', 'no-bitwise': 'off', 'no-const-assign': 'off', 'no-div-regex': 'off', 'no-lone-blocks': 'off', 'no-void': 'off', - 'radix': 'off', - 'semi': 'off', - 'quotes': 'off', + radix: 'off', + semi: 'off', + quotes: 'off', + + 'prettier/prettier': ['error', { endOfLine: 'auto' }] }, - }, + plugins: { + prettier: prettierPlugin + } + } ]; diff --git a/package.json b/package.json index 4bcafdc75..bc4ec9918 100644 --- a/package.json +++ b/package.json @@ -192,6 +192,7 @@ "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "2.28.1", "eslint-plugin-jest": "29.0.1", + "eslint-plugin-prettier": "5.5.5", "graceful-fs": "4.2.8", "jest": "29.7.0", "pod-install": "0.1.38", diff --git a/yarn.lock b/yarn.lock index a629e13ff..73d9f6a97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2122,6 +2122,11 @@ "@scure/bip39" "1.2.1" nostr-wasm "0.1.0" +"@pkgr/core@^0.2.9": + version "0.2.9" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.9.tgz#d229a7b7f9dac167a156992ef23c7f023653f53b" + integrity sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA== + "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" @@ -5241,6 +5246,14 @@ eslint-plugin-jest@^29.0.1: dependencies: "@typescript-eslint/utils" "^8.0.0" +eslint-plugin-prettier@5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.5.tgz#9eae11593faa108859c26f9a9c367d619a0769c0" + integrity sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw== + dependencies: + prettier-linter-helpers "^1.0.1" + synckit "^0.11.12" + eslint-plugin-react-hooks@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz#66e258db58ece50723ef20cc159f8aa908219169" @@ -5522,6 +5535,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.3.1, fast-glob@^3.3.2: version "3.3.3" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818" @@ -8195,6 +8213,13 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== +prettier-linter-helpers@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.1.tgz#6a31f88a4bad6c7adda253de12ba4edaea80ebcd" + integrity sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg== + dependencies: + fast-diff "^1.1.2" + prettier@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" @@ -9685,6 +9710,13 @@ svgo@^3.0.2: csso "^5.0.5" picocolors "^1.0.0" +synckit@^0.11.12: + version "0.11.12" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.12.tgz#abe74124264fbc00a48011b0d98bdc1cffb64a7b" + integrity sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ== + dependencies: + "@pkgr/core" "^0.2.9" + tapable@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"