Skip to content

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

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions