Feature Request: eslint & eslint-plugin-jsdoc integration
See original GitHub issueDescription
I’m attempting to integrate this plugin into my workflow, but it doesn’t seem the plugin is integrated with eslint-plugin-jsdoc, nor eslint itself.
Specifically, the lack of support for the tagNamePreference setting in eslint-plugin-jsdoc results in faulty errors regarding tags.
I’m not entirely sure, but I also suspect that the lack of integration with eslint (or maybe prettier-vscode?) means the following:
- Issues yielded by this plugin are only displayed by directly running
eslint- If I open a file with alleged issues, my editor (VSCode) doesn’t show any red squigglies where the plugin identified the issues; I have to run
eslintto get a full report
- If I open a file with alleged issues, my editor (VSCode) doesn’t show any red squigglies where the plugin identified the issues; I have to run
- Issues that are auto-fixable are not fixed on save
- Normally when I save a file that has auto-fixable issues (even if the file doesn’t have any changes), those issues are fixed on save. This does not happen with issues yielded by this plugin; I have to run
eslint --fixinstead
- Normally when I save a file that has auto-fixable issues (even if the file doesn’t have any changes), those issues are fixed on save. This does not happen with issues yielded by this plugin; I have to run
Example
tagNamePreference settings:
{
jsdoc: {
tagNamePreference: {
augments: 'extends',
constant: 'const',
fileoverview: 'file',
returns: 'return'
}
}
}
Take the following file:
/**
* @file Katas - tribonacci
* @module katas/tribonacci
*/
/**
* Given a starting sequence, `[a, b, c]`, the function returns an array with
* the first `n` elements of the sequence.
*
* @see https://codewars.com/kata/556deca17c58da83c00002db
*
* @example tribonacci([1, 1, 1], 10) => [1, 1, 1, 3, 5, 9, 17, 31, 57, 105]
* @example tribonacci([0, 0, 1], 10) => [0, 0, 1, 1, 2, 4, 7, 13, 24, 44]
*
* @param {[number, number, number]} args - Starting sequence
* @param {number} n - Total number of elements in sequence
* @return {number[]} First `n` elements of sequence
*/
const tribonacci = (
[a, b, c]: [number, number, number],
n: number
): number[] => {
// Base case: If n is less than or equal to zero, return empty array
if (n <= 0) return []
/** @const {number} sum - Sum of {@link a}, {@link b}, and {@link c} */
const sum: number = a + b + c
// Generate and return sequence
return [a, ...tribonacci([b, c, sum], n - 1)]
}
export default tribonacci
After running eslint ./src/katas/tribonacci.ts --exit-on-fatal-error --report-unused-disable-directives --fix:
/Users/lex/Projects/UNICORNWARE/katas/src/katas/tribonacci.ts
17:11 error Insert `s` prettier/prettier
26:12 error Insert `tan` prettier/prettier
✖ 8 problems (8 errors, 0 warnings)
8 errors and 0 warnings potentially fixable with the `--fix` option.
17:11: the plugin wants me to use@returns=> my settings dictate using@return26:12: the plugin wants me to use@constant=> my settings dictate using@const
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
eslint-plugin-jsdoc - npm
Start using eslint-plugin-jsdoc in your project by running `npm i ... features of JavaScript, one may use @babel/eslint-parser or to be able ...
Read more >1510561 - Investigate switching to eslint-plugin-jsdoc
I'd like to separate out adding the node module for eslint-plugin-jsdoc into a separate bug - I would like to generate the patch...
Read more >eslint-config-jsdoc-strict | Yarn - Package Manager
eslint -config-jsdoc-strict. ESLint shareable config for JSDoc-related rules: ESLint require-jsdoc and valid-jsdoc rules,; All eslint-plugin-jsdoc plugin ...
Read more >Configuration Files (New) - ESLint - Pluggable JavaScript Linter
This is an experimental feature. To opt-in, place an eslint.config.js file in the root of your project or set the ESLINT_USE_FLAT_CONFIG environment ...
Read more >@eslint-recommended/eslint-config-typescript - NPM Package ...
Recommended ESLint Shareable Config for TypeScript. ... Update dependency eslint-plugin-jsdoc to v39.6.4 by @renovate in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

My suggestion is, don’t use
eslint-plugin-jsdocandprettier-plugin-jsdocboth.Yes you are totaly right. but implemention is hard, some logic was hard code,