Skip to content

feat: adopt granular eslint-plugin-jsdoc configs #1624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -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"],
@@ -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",
@@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
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
@@ -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"],
@@ -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",
@@ -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
15 changes: 4 additions & 11 deletions src/steps/writing/creation/createESLintConfig.ts
Original file line number Diff line number Diff line change
@@ -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 &&
@@ -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
? ""
@@ -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",