|
| 1 | +import { fixupConfigRules, fixupPluginRules } from '@eslint/compat' |
| 2 | +import react from 'eslint-plugin-react' |
| 3 | +import typescriptEslint from '@typescript-eslint/eslint-plugin' |
| 4 | +import globals from 'globals' |
| 5 | +import tsParser from '@typescript-eslint/parser' |
| 6 | +import path from 'node:path' |
| 7 | +import { fileURLToPath } from 'node:url' |
| 8 | +import js from '@eslint/js' |
| 9 | +import { FlatCompat } from '@eslint/eslintrc' |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url) |
| 12 | +const __dirname = path.dirname(__filename) |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all |
| 17 | +}) |
| 18 | + |
| 19 | +export default [ |
| 20 | + { |
| 21 | + ignores: [ |
| 22 | + '**/.*', |
| 23 | + '**/*.js', |
| 24 | + '**/*.json', |
| 25 | + '**/node_modules', |
| 26 | + '**/dist', |
| 27 | + '**/coverage', |
| 28 | + '**/.DS_Store', |
| 29 | + '**/node_modules', |
| 30 | + 'build', |
| 31 | + 'dist', |
| 32 | + '.next', |
| 33 | + '**/.env', |
| 34 | + '**/.env.*', |
| 35 | + '**/generated', |
| 36 | + '**/pnpm-lock.yaml' |
| 37 | + ] |
| 38 | + }, |
| 39 | + ...fixupConfigRules( |
| 40 | + compat.extends( |
| 41 | + 'eslint:recommended', |
| 42 | + 'plugin:react/recommended', |
| 43 | + 'plugin:react-hooks/recommended', |
| 44 | + 'plugin:@typescript-eslint/recommended', |
| 45 | + 'prettier' |
| 46 | + ) |
| 47 | + ), |
| 48 | + { |
| 49 | + plugins: { |
| 50 | + 'react': fixupPluginRules(react), |
| 51 | + '@typescript-eslint': fixupPluginRules(typescriptEslint) |
| 52 | + }, |
| 53 | + |
| 54 | + languageOptions: { |
| 55 | + globals: { |
| 56 | + ...globals.browser, |
| 57 | + ...globals.node |
| 58 | + }, |
| 59 | + |
| 60 | + parser: tsParser, |
| 61 | + ecmaVersion: 2020, |
| 62 | + sourceType: 'commonjs', |
| 63 | + |
| 64 | + parserOptions: { |
| 65 | + ecmaFeatures: { |
| 66 | + jsx: true |
| 67 | + } |
| 68 | + } |
| 69 | + }, |
| 70 | + |
| 71 | + settings: { |
| 72 | + react: { |
| 73 | + version: 'detect' |
| 74 | + }, |
| 75 | + |
| 76 | + next: { |
| 77 | + rootDir: './packages/wallet/frontend/src' |
| 78 | + } |
| 79 | + }, |
| 80 | + |
| 81 | + rules: { |
| 82 | + 'react/prop-types': 'off', |
| 83 | + 'react/react-in-jsx-scope': 'off', |
| 84 | + |
| 85 | + '@typescript-eslint/no-unused-vars': [ |
| 86 | + 'warn', |
| 87 | + { |
| 88 | + argsIgnorePattern: '^_', |
| 89 | + destructuredArrayIgnorePattern: '^_' |
| 90 | + } |
| 91 | + ], |
| 92 | + 'no-redeclare': ['error', { builtinGlobals: false }] |
| 93 | + } |
| 94 | + } |
| 95 | +] |
0 commit comments