|
| 1 | +import path from 'node:path'; |
| 2 | +import { fileURLToPath } from 'node:url'; |
| 3 | + |
| 4 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 5 | +import js from '@eslint/js'; |
| 6 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 7 | +import tsParser from '@typescript-eslint/parser'; |
| 8 | +import simpleImportSort from 'eslint-plugin-simple-import-sort'; |
| 9 | +import unicorn from 'eslint-plugin-unicorn'; |
| 10 | +import globals from 'globals'; |
| 11 | + |
| 12 | +const __filename = fileURLToPath(import.meta.url); |
| 13 | +const __dirname = path.dirname(__filename); |
| 14 | +const compat = new FlatCompat({ |
| 15 | + baseDirectory: __dirname, |
| 16 | + recommendedConfig: js.configs.recommended, |
| 17 | + allConfig: js.configs.all |
| 18 | +}); |
| 19 | + |
| 20 | +export default [ |
| 21 | + { |
| 22 | + ignores: [ |
| 23 | + '**/.DS_Store', |
| 24 | + '**/node_modules', |
| 25 | + '**/bin', |
| 26 | + '**/dist', |
| 27 | + '**/svelte', |
| 28 | + '**/.env', |
| 29 | + '**/.env.*', |
| 30 | + '!**/.env.example', |
| 31 | + '**/pnpm-lock.yaml', |
| 32 | + '**/package-lock.json', |
| 33 | + '**/yarn.lock' |
| 34 | + ] |
| 35 | + }, |
| 36 | + ...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:unicorn/all', 'prettier'), |
| 37 | + { |
| 38 | + plugins: { |
| 39 | + '@typescript-eslint': typescriptEslint, |
| 40 | + 'simple-import-sort': simpleImportSort, |
| 41 | + unicorn |
| 42 | + }, |
| 43 | + |
| 44 | + languageOptions: { |
| 45 | + globals: { |
| 46 | + ...globals.browser, |
| 47 | + ...globals.node |
| 48 | + }, |
| 49 | + |
| 50 | + parser: tsParser, |
| 51 | + ecmaVersion: 2020, |
| 52 | + sourceType: 'module' |
| 53 | + }, |
| 54 | + |
| 55 | + rules: { |
| 56 | + 'simple-import-sort/imports': 'error', |
| 57 | + 'simple-import-sort/exports': 'error', |
| 58 | + 'unicorn/filename-case': 'off', |
| 59 | + 'unicorn/no-process-exit': 'off', |
| 60 | + 'unicorn/switch-case-braces': 'off', |
| 61 | + 'unicorn/no-array-reduce': 'off', |
| 62 | + 'no-alert': 'error', |
| 63 | + 'no-debugger': 'error' |
| 64 | + } |
| 65 | + } |
| 66 | +]; |
0 commit comments