|
1 | | -import eslint from "@eslint/js"; |
2 | 1 | import comments from "@eslint-community/eslint-plugin-eslint-comments/configs"; |
| 2 | +import eslint from "@eslint/js"; |
3 | 3 | import jsdoc from "eslint-plugin-jsdoc"; |
4 | 4 | import jsonc from "eslint-plugin-jsonc"; |
5 | 5 | import markdown from "eslint-plugin-markdown"; |
6 | 6 | import n from "eslint-plugin-n"; |
7 | 7 | import packageJson from "eslint-plugin-package-json/configs/recommended"; |
8 | | -import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural"; |
| 8 | +import perfectionist from "eslint-plugin-perfectionist"; |
9 | 9 | import * as regexp from "eslint-plugin-regexp"; |
10 | 10 | import yml from "eslint-plugin-yml"; |
11 | 11 | import tseslint from "typescript-eslint"; |
12 | 12 |
|
13 | 13 | export default tseslint.config( |
14 | | - { |
15 | | - ignores: ["cases", "node_modules", "projects"], |
16 | | - }, |
17 | | - { |
18 | | - linterOptions: { |
19 | | - reportUnusedDisableDirectives: "error", |
20 | | - }, |
21 | | - }, |
| 14 | + { ignores: ["cases", "node_modules", "projects"] }, |
| 15 | + { linterOptions: { reportUnusedDisableDirectives: "error" } }, |
22 | 16 | eslint.configs.recommended, |
23 | | - ...jsonc.configs["flat/recommended-with-json"], |
24 | | - ...markdown.configs.recommended, |
25 | | - ...yml.configs["flat/recommended"], |
26 | | - ...yml.configs["flat/prettier"], |
27 | 17 | comments.recommended, |
28 | | - jsdoc.configs["flat/recommended-typescript-error"], |
| 18 | + jsdoc.configs["flat/contents-typescript-error"], |
| 19 | + jsdoc.configs["flat/logical-typescript-error"], |
| 20 | + jsdoc.configs["flat/stylistic-typescript-error"], |
| 21 | + jsonc.configs["flat/recommended-with-json"], |
| 22 | + markdown.configs.recommended, |
29 | 23 | n.configs["flat/recommended"], |
30 | 24 | packageJson, |
31 | | - perfectionistNatural, |
| 25 | + perfectionist.configs["recommended-natural"], |
32 | 26 | regexp.configs["flat/recommended"], |
33 | | - ...tseslint.config({ |
| 27 | + { |
34 | 28 | extends: [ |
35 | | - ...tseslint.configs.strictTypeChecked, |
36 | | - ...tseslint.configs.stylisticTypeChecked, |
| 29 | + tseslint.configs.strictTypeChecked, |
| 30 | + tseslint.configs.stylisticTypeChecked, |
37 | 31 | ], |
38 | 32 | files: ["**/*.js", "**/*.ts"], |
39 | 33 | languageOptions: { |
40 | 34 | parserOptions: { |
41 | 35 | projectService: { |
42 | | - allowDefaultProjectForFiles: ["./*.*s", "eslint.config.js"], |
43 | | - defaultProject: "./tsconfig.json", |
| 36 | + allowDefaultProject: ["./*.*s", "eslint.config.js"], |
44 | 37 | }, |
| 38 | + tsconfigRootDir: import.meta.dirname, |
45 | 39 | }, |
46 | 40 | }, |
47 | 41 | rules: { |
48 | | - // These off-by-default rules work well for this repo and we like them on. |
49 | | - "jsdoc/informative-docs": "error", |
50 | | - "logical-assignment-operators": [ |
51 | | - "error", |
52 | | - "always", |
53 | | - { enforceForIfStatements: true }, |
54 | | - ], |
55 | | - "operator-assignment": "error", |
56 | | - |
57 | | - // These on-by-default rules don't work well for this repo and we like them off. |
58 | | - "jsdoc/require-jsdoc": "off", |
59 | | - "jsdoc/require-param": "off", |
60 | | - "jsdoc/require-property": "off", |
61 | | - "jsdoc/require-returns": "off", |
62 | | - "no-constant-condition": "off", |
63 | | - |
64 | 42 | // These on-by-default rules work well for this repo if configured |
65 | | - "@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "all" }], |
66 | 43 | "@typescript-eslint/restrict-template-expressions": [ |
67 | 44 | "error", |
68 | 45 | { allowNumber: true }, |
69 | 46 | ], |
70 | | - "perfectionist/sort-objects": [ |
71 | | - "error", |
72 | | - { |
73 | | - order: "asc", |
74 | | - "partition-by-comment": true, |
75 | | - type: "natural", |
76 | | - }, |
77 | | - ], |
78 | 47 |
|
79 | 48 | // Stylistic concerns that don't interfere with Prettier |
| 49 | + "logical-assignment-operators": [ |
| 50 | + "error", |
| 51 | + "always", |
| 52 | + { enforceForIfStatements: true }, |
| 53 | + ], |
80 | 54 | "no-useless-rename": "error", |
81 | 55 | "object-shorthand": "error", |
| 56 | + "operator-assignment": "error", |
82 | 57 | }, |
83 | | - }), |
84 | | - { |
85 | | - files: ["*.jsonc"], |
86 | | - rules: { |
87 | | - "jsonc/comma-dangle": "off", |
88 | | - "jsonc/no-comments": "off", |
89 | | - "jsonc/sort-keys": "error", |
90 | | - }, |
91 | | - }, |
92 | | - { |
93 | | - extends: [tseslint.configs.disableTypeChecked], |
94 | | - files: ["**/*.md/*.ts"], |
95 | | - rules: { |
96 | | - "n/no-missing-import": ["error", { allowModules: ["performance"] }], |
97 | | - }, |
| 58 | + settings: { perfectionist: { partitionByComment: true, type: "natural" } }, |
98 | 59 | }, |
99 | 60 | { |
| 61 | + extends: [yml.configs["flat/recommended"], yml.configs["flat/prettier"]], |
100 | 62 | files: ["**/*.{yml,yaml}"], |
101 | 63 | rules: { |
102 | 64 | "yml/file-extension": ["error", { extension: "yml" }], |
103 | 65 | "yml/sort-keys": [ |
104 | 66 | "error", |
105 | | - { |
106 | | - order: { type: "asc" }, |
107 | | - pathPattern: "^.*$", |
108 | | - }, |
| 67 | + { order: { type: "asc" }, pathPattern: "^.*$" }, |
109 | 68 | ], |
110 | 69 | "yml/sort-sequence-values": [ |
111 | 70 | "error", |
112 | | - { |
113 | | - order: { type: "asc" }, |
114 | | - pathPattern: "^.*$", |
115 | | - }, |
| 71 | + { order: { type: "asc" }, pathPattern: "^.*$" }, |
116 | 72 | ], |
117 | 73 | }, |
118 | 74 | }, |
|
0 commit comments