import-js / import-js/eslint-plugin-import

import/newline-after-import doesn't warn comments

Open
#981 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Hello!

This specific code doesn't warn about the need of a new line after import:

```js
import { NamedExport } from 'path/to/module';
/**
* Doc bla bla
*/
const defaultExport = () => ('bla bla');
```

I expect to get a warn about the import not having a new line. Is this behaviour correct? By the way, if I delete the comment the warn appears.

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the JavaScript example with the import/newline-after-import rule, then compare the warning with and without the intervening comment. Trace the rule's handling of comments and add a regression test if the reported behavior is confirmed; done means the rule consistently reports the expected missing newline.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.