Skip to content

Issue with eslint-plugin-jsdoc plugin auto fix 'jsdoc/require-param' #1302

Closed
@BartaG512

Description

@BartaG512

Tell us about your environment

Node version: v14.17.0
npm version: v6.14.13
Local ESLint version: v7.28.0
Operating System: win32 10.0.19042
Vscode version: v1.57.1
Vscode Eslint Extension: v2.1.23

Please show your full configuration:

eslintrc.js configuration
module.exports = {
	root: true,
	env: {
		es6: true,
		node: true,
	},
	plugins: [
		'eslint-plugin-jsdoc'
	],
	parserOptions: { ecmaVersion: 2020 },
	rules: {
		'jsdoc/require-param': 1, // Recommended
	}
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Test code:

class ClassName {
	constructor() {

	}
	/**
	 *
	 * @returns
	 */
	async anyFunction({ hello }, { world }) {
		return undefined;
	}
}

Run:

I use vscode Eslint plugin and format on save option.

What did you expect to happen?

To fix properly like this:

class ClassName {
	constructor() {

	}
	/**
	 *
	 * @param root0
	 * @param root0.hello
	 * @param root1
	 * @param root1.world
	 * @returns
	 */
	async anyFunction({ hello }, { world }) {
		return undefined;
	}
}

What actually happened? Please copy-paste the actual, raw output from ESLint.

class ClassName {
	constructor() {

	}
	/**
	 *
	 * @param root0
	 * @param root0.hello
	 * @param root1
	 * @param root1.world
	 * @param root0
	 * @param root0.hello
	 * @param root1
	 * @param root1.world
	 * @param root0
	 * @param root0.hello
	 * @param root1
	 * @param root1.world
	 * @param root0
	 * @param root0.hello
	 * @param root1
	 * @param root1.world
	 * @returns
	 */
	async anyFunction({ hello }, { world }) {
		return undefined;
	}
}

If I use command line eslint --fix it works as expected.

Demo repository:
https://github.com/BartaG512/eslint-demo/blob/jsdoc/

My vscode configuration

{
	"eslint.debug": true,
	"eslint.onIgnoredFiles": "warn",
	"editor.codeActionsOnSave": {
		"source.fixAll.eslint": true
	},
	"eslint.probe": [
		"javascript"
	],
	"eslint.runtime": "node",
	"eslint.validate": [
		"javascript"
	],
	"eslint.workingDirectories": [
		{
			"mode": "location"
		}
	],
	"[javascript]": {
		"editor.defaultFormatter": "dbaeumer.vscode-eslint", 
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions