generated from JoshuaKGoldberg/create-typescript-app
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patheslint.config.js
128 lines (124 loc) Β· 3.55 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// https://github.com/typescript-eslint/typescript-eslint/issues/10508
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import js from "@eslint/js";
import vitest from "@vitest/eslint-plugin";
import jsdoc from "eslint-plugin-jsdoc";
import jsonc from "eslint-plugin-jsonc";
import markdown from "eslint-plugin-markdown";
import packageJson from "eslint-plugin-package-json";
import perfectionist from "eslint-plugin-perfectionist";
import * as regexp from "eslint-plugin-regexp";
import yml from "eslint-plugin-yml";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
ignores: [
"**/*.snap",
"coverage",
"lib",
"node_modules",
"packages/*/dist",
"packages/*/lib",
"packages/*/tsconfig.tsbuildinfo",
"packages/*/src/**/*.d.ts",
"packages/*/src/**/*.js",
"packages/site/.astro",
"packages/site/src/content",
"packages/site/src/env.d.ts",
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
],
},
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
js.configs.recommended,
// https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/214
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
comments.recommended,
jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],
...jsonc.configs["flat/recommended-with-json"],
...markdown.configs.recommended,
packageJson.configs.recommended,
perfectionist.configs["recommended-natural"],
regexp.configs["flat/recommended"],
{
extends: [...tseslint.configs.strict, ...tseslint.configs.stylistic],
files: ["**/*.js", "**/*.ts"],
rules: {
// These off-by-default rules work well for this repo and we like them on.
"jsdoc/informative-docs": "error",
// https://github.com/gajus/eslint-plugin-jsdoc/issues/1343
"jsdoc/lines-before-block": "off",
// Stylistic concerns that don't interfere with Prettier
"logical-assignment-operators": [
"error",
"always",
{ enforceForIfStatements: true },
],
"no-useless-rename": "error",
"object-shorthand": "error",
"operator-assignment": "error",
},
settings: { perfectionist: { partitionByComment: true, type: "natural" } },
},
{
extends: [
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
files: ["**/*.js", "**/*.ts"],
ignores: ["**/*.md/*", "packages/*/bin/*.js", "packages/*/*.config.*"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// These on-by-default rules work well for this repo if configured
"@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "all" }],
},
},
{
files: ["*.jsonc"],
rules: {
"jsonc/comma-dangle": "off",
"jsonc/no-comments": "off",
"jsonc/sort-keys": "error",
},
},
{
extends: [vitest.configs.recommended],
files: ["**/*.test.*"],
rules: {
"@typescript-eslint/no-unsafe-assignment": "off",
},
},
{
extends: [
...yml.configs["flat/recommended"],
...yml.configs["flat/prettier"],
],
files: ["**/*.{yml,yaml}"],
rules: {
"yml/file-extension": ["error", { extension: "yml" }],
"yml/sort-keys": [
"error",
{
order: { type: "asc" },
pathPattern: "^.*$",
},
],
"yml/sort-sequence-values": [
"error",
{
order: { type: "asc" },
pathPattern: "^.*$",
},
],
},
},
);