-
Notifications
You must be signed in to change notification settings - Fork 337
chore(repo): Add eslint-plugin-jsdoc #5697
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
base: main
Are you sure you want to change the base?
Changes from all commits
a970a5f
17901a8
eae3024
5e38927
4ede134
908c1b7
2b54e86
98c380d
a3f014a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort'; | |
import pluginTurbo from 'eslint-plugin-turbo'; | ||
import pluginUnusedImports from 'eslint-plugin-unused-imports'; | ||
import pluginYml from 'eslint-plugin-yml'; | ||
import pluginJsDoc from 'eslint-plugin-jsdoc'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
|
@@ -419,21 +420,32 @@ export default tseslint.config([ | |
'turbo/no-undeclared-env-vars': 'off', | ||
}, | ||
}, | ||
...pluginYml.configs['flat/recommended'], | ||
{ | ||
name: 'repo/.github', | ||
// rules: { | ||
// 'regex/invalid': [ | ||
// 'error', | ||
// [ | ||
// { | ||
// regex: '^(?!.*\\$TURBO_ARGS( |$)).*turbo \\S+', | ||
// message: 'Invalid turbo CI command. Must contain `$TURBO_ARGS`', | ||
// }, | ||
// ], | ||
// ], | ||
// }, | ||
name: 'repo/jsdoc', | ||
...pluginJsDoc.configs['flat/recommended-typescript'], | ||
files: ['packages/shared/src/**/*.{ts,tsx}'], | ||
ignores: ['**/__tests__/**'], | ||
plugins: { | ||
jsdoc: pluginJsDoc, | ||
}, | ||
rules: { | ||
...pluginJsDoc.configs['flat/recommended-typescript'].rules, | ||
'jsdoc/check-examples': 'off', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want it to raise false positives in the examples, we want more control over it |
||
'jsdoc/informative-docs': 'warn', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ensures that this doesn't happen: /** The user id. */
let userId; You have to write a longer description, not restate the name |
||
'jsdoc/check-tag-names': ['warn', { definedTags: ['inline', 'unionReturnHeadings'], typed: false }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will warn when an unknown/invalid tag name is used |
||
'jsdoc/require-hyphen-before-param-description': 'warn', | ||
'jsdoc/require-description': 'warn', | ||
'jsdoc/require-description-complete-sentence': 'warn', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sentences end with fullstop and start with capital letter |
||
'jsdoc/require-param': ['warn', { ignoreWhenAllParamsMissing: true }], | ||
'jsdoc/require-param-description': 'warn', | ||
'jsdoc/require-returns': 'off', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Together with |
||
'jsdoc/tag-lines': [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ensures empty lines between tags/description, unless for multiple |
||
'warn', | ||
'always', | ||
{ count: 1, applyToEndTag: false, startLines: 1, tags: { param: { lines: 'never' } } }, | ||
], | ||
}, | ||
}, | ||
|
||
...pluginYml.configs['flat/recommended'], | ||
configPrettier, | ||
]); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed this file as an exercise and check how the rules will apply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever we add JSDoc comments to previously undocumented functions we'll need to update this snapshot as Typedoc will only generate MDX files for documented, exported functions.
You can update the snapshot by running
pnpm test:typedoc -u