Skip to content

Commit

Permalink
feat: adopt granular eslint-plugin-jsdoc configs (#1624)
Browse files Browse the repository at this point in the history
## PR Checklist

- [x] Addresses an existing open issue: fixes #1623
- [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

Uses the configs instead of previous manual rule configurations.

💖
  • Loading branch information
JoshuaKGoldberg authored Aug 13, 2024
1 parent e0b78be commit 41d1cac
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 38 deletions.
9 changes: 3 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default tseslint.config(
...yml.configs["flat/recommended"],
...yml.configs["flat/prettier"],
comments.recommended,
jsdoc.configs["flat/recommended-typescript-error"],
jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],
n.configs["flat/recommended"],
packageJson,
perfectionist.configs["recommended-natural"],
Expand All @@ -64,7 +66,6 @@ export default tseslint.config(
},
rules: {
// These off-by-default rules work well for this repo and we like them on.
"jsdoc/informative-docs": "error",
"logical-assignment-operators": [
"error",
"always",
Expand All @@ -74,10 +75,6 @@ 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",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-property": "off",
"jsdoc/require-returns": "off",
"no-constant-condition": "off",

// These on-by-default rules work well for this repo if configured
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"console-fail-test": "^0.4.4",
"cspell": "^8.13.1",
"eslint": "^9.8.0",
"eslint-plugin-jsdoc": "^50.0.0",
"eslint-plugin-jsdoc": "^50.2.1",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.10.2",
Expand Down
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

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

9 changes: 3 additions & 6 deletions src/steps/writing/creation/createESLintConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ describe("createESLintConfig", () => {
...yml.configs["flat/recommended"],
...yml.configs["flat/prettier"],
comments.recommended,
jsdoc.configs["flat/recommended-typescript-error"],
jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],
n.configs["flat/recommended"],
packageJson,
perfectionist.configs["recommended-natural"],
Expand All @@ -164,7 +166,6 @@ describe("createESLintConfig", () => {
},
rules: {
// These off-by-default rules work well for this repo and we like them on.
"jsdoc/informative-docs": "error",
"logical-assignment-operators": [
"error",
"always",
Expand All @@ -174,10 +175,6 @@ describe("createESLintConfig", () => {
// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/lines-before-block": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-property": "off",
"jsdoc/require-returns": "off",
"no-constant-condition": "off",
// These on-by-default rules work well for this repo if configured
Expand Down
15 changes: 4 additions & 11 deletions src/steps/writing/creation/createESLintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export async function createESLintConfig(options: Options) {
!options.excludeLintYml && ` ...yml.configs["flat/prettier"],`,
!options.excludeLintESLint && ` comments.recommended,`,
!options.excludeLintJSDoc &&
` jsdoc.configs["flat/recommended-typescript-error"],`,
` jsdoc.configs["flat/contents-typescript-error"],
jsdoc.configs["flat/logical-typescript-error"],
jsdoc.configs["flat/stylistic-typescript-error"],`,
` n.configs["flat/recommended"],`,
!options.excludeLintPackageJson && ` packageJson,`,
!options.excludeLintPerfectionist &&
Expand Down Expand Up @@ -86,11 +88,6 @@ export default tseslint.config(
!options.excludeLintJSDoc || !options.excludeLintStylistic
? "// These off-by-default rules work well for this repo and we like them on."
: ""
}${
options.excludeLintJSDoc
? ""
: `
"jsdoc/informative-docs": "error",`
}${
options.excludeLintStylistic
? ""
Expand All @@ -107,11 +104,7 @@ export default tseslint.config(
options.excludeLintJSDoc
? ""
: `
"jsdoc/lines-before-block": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-property": "off",
"jsdoc/require-returns": "off",`
"jsdoc/lines-before-block": "off",`
}
"no-constant-condition": "off",
Expand Down

0 comments on commit 41d1cac

Please sign in to comment.