|
| 1 | +import js from '@eslint/js' |
| 2 | +import eslintPluginVitest from '@vitest/eslint-plugin' |
| 3 | +import eslintConfigPrettier from 'eslint-config-prettier' |
| 4 | +import eslintPluginJestDom from 'eslint-plugin-jest-dom' |
| 5 | +import eslintPluginPromise from 'eslint-plugin-promise' |
| 6 | +import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort' |
| 7 | +import eslintPluginSvelte from 'eslint-plugin-svelte' |
| 8 | +import eslintPluginTestingLibrary from 'eslint-plugin-testing-library' |
| 9 | +import eslintPluginUnicorn from 'eslint-plugin-unicorn' |
| 10 | +import globals from 'globals' |
| 11 | +import tseslint from 'typescript-eslint' |
| 12 | + |
| 13 | +export default tseslint.config( |
| 14 | + js.configs.recommended, |
| 15 | + tseslint.configs.strict, |
| 16 | + tseslint.configs.stylistic, |
| 17 | + eslintPluginUnicorn.configs['flat/recommended'], |
| 18 | + eslintPluginPromise.configs['flat/recommended'], |
| 19 | + eslintPluginSvelte.configs['flat/recommended'], |
| 20 | + eslintPluginSvelte.configs['flat/prettier'], |
| 21 | + eslintConfigPrettier, |
| 22 | + { |
| 23 | + name: 'settings', |
| 24 | + languageOptions: { |
| 25 | + ecmaVersion: 'latest', |
| 26 | + sourceType: 'module', |
| 27 | + parserOptions: { |
| 28 | + parser: tseslint.parser, |
| 29 | + extraFileExtensions: ['.svelte'], |
| 30 | + }, |
| 31 | + globals: { |
| 32 | + ...globals.browser, |
| 33 | + ...globals.node, |
| 34 | + ...globals.jest, |
| 35 | + }, |
| 36 | + }, |
| 37 | + }, |
| 38 | + { |
| 39 | + name: 'ignores', |
| 40 | + ignores: ['coverage', 'types'], |
| 41 | + }, |
| 42 | + { |
| 43 | + name: 'simple-import-sort', |
| 44 | + plugins: { |
| 45 | + 'simple-import-sort': eslintPluginSimpleImportSort, |
| 46 | + }, |
| 47 | + rules: { |
| 48 | + 'simple-import-sort/imports': 'error', |
| 49 | + 'simple-import-sort/exports': 'error', |
| 50 | + }, |
| 51 | + }, |
| 52 | + { |
| 53 | + name: 'tests', |
| 54 | + files: ['**/*.test.js'], |
| 55 | + extends: [ |
| 56 | + eslintPluginVitest.configs.recommended, |
| 57 | + eslintPluginJestDom.configs['flat/recommended'], |
| 58 | + eslintPluginTestingLibrary.configs['flat/dom'], |
| 59 | + ], |
| 60 | + rules: { |
| 61 | + 'testing-library/no-node-access': [ |
| 62 | + 'error', |
| 63 | + { allowContainerFirstChild: true }, |
| 64 | + ], |
| 65 | + }, |
| 66 | + }, |
| 67 | + { |
| 68 | + name: 'extras', |
| 69 | + rules: { |
| 70 | + 'unicorn/prevent-abbreviations': 'off', |
| 71 | + }, |
| 72 | + }, |
| 73 | + { |
| 74 | + name: 'svelte-extras', |
| 75 | + files: ['**/*.svelte'], |
| 76 | + rules: { |
| 77 | + 'svelte/no-unused-svelte-ignore': 'off', |
| 78 | + 'unicorn/filename-case': ['error', { case: 'pascalCase' }], |
| 79 | + 'unicorn/no-useless-undefined': 'off', |
| 80 | + }, |
| 81 | + }, |
| 82 | + { |
| 83 | + name: 'ts-extras', |
| 84 | + files: ['**/*.ts'], |
| 85 | + extends: [ |
| 86 | + tseslint.configs.strictTypeChecked, |
| 87 | + tseslint.configs.stylisticTypeChecked, |
| 88 | + ], |
| 89 | + languageOptions: { |
| 90 | + parserOptions: { |
| 91 | + projectService: true, |
| 92 | + }, |
| 93 | + }, |
| 94 | + } |
| 95 | +) |
0 commit comments