Skip to content
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

lines-before-block also triggers for first constituent in a union or intersection type #1343

Open
JoshuaKGoldberg opened this issue Dec 1, 2024 · 0 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Dec 1, 2024

Expected behavior

This should not report:

export type SomeType =
	/**
	 * 🍏 fruit.
	 */
	| Apple

	/**
	 * 🍌 fruit.
	 */
	| Banana;

Actual behavior

Required 1 line(s) before JSDoc blockeslint[jsdoc/lines-before-block](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header)

ESLint Config

import jsdoc from 'eslint-plugin-jsdoc';

export default [jsdoc.configs['flat/recommended']];

Additional info

I'd fixed this bug/feature for blocks in #1341, but didn't think to for union or intersection types.

The autofix puts a blank line before the JSDoc block. Prettier removes that blank line. Fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant