Skip to content

Commit 6ea503c

Browse files
feat: remove now-unnecessary disable of jsdoc/lines-before-block (#1701)
## PR Checklist - [x] Addresses an existing open issue: fixes #1698 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview 🔪
1 parent 98bba53 commit 6ea503c

File tree

6 files changed

+15
-34
lines changed

6 files changed

+15
-34
lines changed

eslint.config.js

-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ export default tseslint.config(
6464
},
6565
},
6666
rules: {
67-
// These on-by-default rules don't work well for this repo and we like them off.
68-
"jsdoc/lines-before-block": "off",
69-
7067
// These on-by-default rules work well for this repo if configured
7168
"@typescript-eslint/no-unnecessary-condition": [
7269
"error",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"console-fail-test": "^0.5.0",
7878
"cspell": "^8.14.2",
7979
"eslint": "^9.9.0",
80-
"eslint-plugin-jsdoc": "^50.5.0",
80+
"eslint-plugin-jsdoc": "^50.6.0",
8181
"eslint-plugin-jsonc": "^2.16.0",
8282
"eslint-plugin-markdown": "^5.1.0",
8383
"eslint-plugin-n": "^17.12.0",

pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/__snapshots__/migrate-test-e2e.ts.snap

+2-4
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ exports[`expected file changes > eslint.config.js 1`] = `
134134
},
135135
tsconfigRootDir: import.meta.dirname,
136136
},
137-
@@ ... @@ export default tseslint.config(
138-
// These on-by-default rules don't work well for this repo and we like them off.
139-
"jsdoc/lines-before-block": "off",
140-
137+
},
138+
rules: {
141139
- // These on-by-default rules work well for this repo if configured
142140
- "@typescript-eslint/no-unnecessary-condition": [
143141
- "error",

src/steps/writing/creation/createESLintConfig.test.ts

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ describe("createESLintConfig", () => {
148148
},
149149
},
150150
rules: {
151-
// These on-by-default rules don't work well for this repo and we like them off.
152-
"jsdoc/lines-before-block": "off",
153-
154151
// Stylistic concerns that don't interfere with Prettier
155152
"logical-assignment-operators": [
156153
"error",

src/steps/writing/creation/createESLintConfig.ts

+7-18
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,9 @@ export async function createESLintConfig(options: Options) {
4242
!options.excludeLintRegex && ` regexp.configs["flat/recommended"],`,
4343
].filter(Boolean);
4444

45-
const rules = `{
46-
${
47-
options.excludeLintJSDoc
48-
? ""
49-
: `
50-
51-
// These on-by-default rules don't work well for this repo and we like them off.
52-
"jsdoc/lines-before-block": "off",`
53-
}${
54-
options.excludeLintStylistic
55-
? ""
56-
: `
57-
45+
const rules =
46+
!options.excludeLintStylistic &&
47+
`{
5848
// Stylistic concerns that don't interfere with Prettier
5949
"logical-assignment-operators": [
6050
"error",
@@ -63,8 +53,7 @@ export async function createESLintConfig(options: Options) {
6353
],
6454
"no-useless-rename": "error",
6555
"object-shorthand": "error",
66-
"operator-assignment": "error",`
67-
}
56+
"operator-assignment": "error",
6857
}`;
6958

7059
return await formatTypeScript(`${imports.join("\n")}
@@ -111,10 +100,10 @@ export default tseslint.config(
111100
tsconfigRootDir: import.meta.dirname
112101
},
113102
},${
114-
rules.replaceAll(/\s+/g, "") === "{}"
115-
? ""
116-
: `
103+
rules
104+
? `
117105
rules: ${rules},`
106+
: ""
118107
}${
119108
options.excludeLintPerfectionist
120109
? ""

0 commit comments

Comments
 (0)