|
1 | 1 | import eslint from "@eslint/js"; |
2 | 2 | import { defineConfig } from "eslint/config"; |
3 | | -import tseslint from "typescript-eslint"; |
4 | 3 | import eslintConfigPrettier from "eslint-config-prettier/flat"; |
| 4 | +import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"; |
| 5 | +import eslintPluginUnicorn from "eslint-plugin-unicorn"; |
5 | 6 | import globals from "globals"; |
| 7 | +import tseslint from "typescript-eslint"; |
6 | 8 |
|
7 | 9 | export default defineConfig( |
8 | | - { languageOptions: { globals: { ...globals.builtin, ...globals.node } } }, |
9 | 10 | eslint.configs.recommended, |
10 | 11 | tseslint.configs.recommended, |
| 12 | + { |
| 13 | + languageOptions: { globals: { ...globals.builtin, ...globals.node } }, |
| 14 | + plugins: { |
| 15 | + unicorn: eslintPluginUnicorn, |
| 16 | + "simple-import-sort": eslintPluginSimpleImportSort, |
| 17 | + }, |
| 18 | + }, |
11 | 19 | eslintConfigPrettier, |
12 | | - { ignores: ["build", "running", "repositories"] }, |
| 20 | + { |
| 21 | + rules: { |
| 22 | + "unicorn/template-indent": "error", |
| 23 | + |
| 24 | + /* eslint-plugin-simple-import-sort */ |
| 25 | + "simple-import-sort/imports": [ |
| 26 | + "error", |
| 27 | + { |
| 28 | + groups: [ |
| 29 | + // https://github.com/lydell/eslint-plugin-simple-import-sort/blob/20e25f3b83c713825f96b8494e2091e6600954d6/src/imports.js#L5-L19 |
| 30 | + // Side effect imports. |
| 31 | + [String.raw`^\u0000`], |
| 32 | + // Remove blank lines between groups |
| 33 | + // https://github.com/lydell/eslint-plugin-simple-import-sort#how-do-i-remove-all-blank-lines-between-imports |
| 34 | + [ |
| 35 | + // Node.js builtins prefixed with `node:`. |
| 36 | + "^node:", |
| 37 | + // Packages. |
| 38 | + // Things that start with a letter (or digit or underscore), or `@` followed by a letter. |
| 39 | + String.raw`^@?\w`, |
| 40 | + // Absolute imports and other imports such as Vue-style `@/foo`. |
| 41 | + // Anything not matched in another group. |
| 42 | + "^", |
| 43 | + // Relative imports. |
| 44 | + // Anything that starts with a dot. |
| 45 | + String.raw`^\.`, |
| 46 | + ], |
| 47 | + ], |
| 48 | + }, |
| 49 | + ], |
| 50 | + "simple-import-sort/exports": "error", |
| 51 | + }, |
| 52 | + }, |
| 53 | + { ignores: ["running", "repositories", "reports"] }, |
13 | 54 | ); |
0 commit comments