Skip to content

Commit

Permalink
feat: remove now-unnecessary disable of jsdoc/lines-before-block (#1701)
Browse files Browse the repository at this point in the history
## 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

🔪
  • Loading branch information
JoshuaKGoldberg authored Nov 26, 2024
1 parent 98bba53 commit 6ea503c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
3 changes: 0 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export default tseslint.config(
},
},
rules: {
// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",

// These on-by-default rules work well for this repo if configured
"@typescript-eslint/no-unnecessary-condition": [
"error",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"console-fail-test": "^0.5.0",
"cspell": "^8.14.2",
"eslint": "^9.9.0",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.12.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ exports[`expected file changes > eslint.config.js 1`] = `
},
tsconfigRootDir: import.meta.dirname,
},
@@ ... @@ export default tseslint.config(
// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",
},
rules: {
- // These on-by-default rules work well for this repo if configured
- "@typescript-eslint/no-unnecessary-condition": [
- "error",
Expand Down
3 changes: 0 additions & 3 deletions src/steps/writing/creation/createESLintConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ describe("createESLintConfig", () => {
},
},
rules: {
// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",
// Stylistic concerns that don't interfere with Prettier
"logical-assignment-operators": [
"error",
Expand Down
25 changes: 7 additions & 18 deletions src/steps/writing/creation/createESLintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,9 @@ export async function createESLintConfig(options: Options) {
!options.excludeLintRegex && ` regexp.configs["flat/recommended"],`,
].filter(Boolean);

const rules = `{
${
options.excludeLintJSDoc
? ""
: `
// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",`
}${
options.excludeLintStylistic
? ""
: `
const rules =
!options.excludeLintStylistic &&
`{
// Stylistic concerns that don't interfere with Prettier
"logical-assignment-operators": [
"error",
Expand All @@ -63,8 +53,7 @@ export async function createESLintConfig(options: Options) {
],
"no-useless-rename": "error",
"object-shorthand": "error",
"operator-assignment": "error",`
}
"operator-assignment": "error",
}`;

return await formatTypeScript(`${imports.join("\n")}
Expand Down Expand Up @@ -111,10 +100,10 @@ export default tseslint.config(
tsconfigRootDir: import.meta.dirname
},
},${
rules.replaceAll(/\s+/g, "") === "{}"
? ""
: `
rules
? `
rules: ${rules},`
: ""
}${
options.excludeLintPerfectionist
? ""
Expand Down

0 comments on commit 6ea503c

Please sign in to comment.