Skip to content

newline-after-imports: new option exactCount bug with following comments #2882

@dhorkin

Description

@dhorkin

I checked out the main branch to try out the new exactCount option for newline-after-imports. This does not work properly if there are comments following an import.

Regardless of whether I use
'import/newline-after-import': ['error', { count: 1, considerComments: false, exactCount: true }],
or
'import/newline-after-import': ['error', { count: 1, considerComments: true, exactCount: true }],

The following code snippets produce an error:

import _ from 'lodash';

/**
 * A comment is here
 */
import _ from 'lodash';

// A comment is here

Expected 1 empty line after import statement not followed by another import

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions