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

newline-after-import ignoring angular annotations. #1784

Closed
eestein opened this issue May 29, 2020 · 4 comments
Closed

newline-after-import ignoring angular annotations. #1784

eestein opened this issue May 29, 2020 · 4 comments

Comments

@eestein
Copy link

eestein commented May 29, 2020

With the following rule:

"import/newline-after-import": "error"

If I write:

import { DemoModel } from '../app/models/demo.model';
import { HomeComponent } from './views/home/home.component';
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})

No error is throw. But if I write:

import { DemoModel } from '../app/models/demo.model';
import { HomeComponent } from './views/home/home.component';
const x = 2;

it works as expected.
The way I see it, it should not care what the next line is (if not import, of course).

Here are the images:

Screen Shot 2020-05-29 at 11 50 42
Screen Shot 2020-05-29 at 11 50 26

@ljharb
Copy link
Member

ljharb commented May 29, 2020

What is an "anchor annotation"? That looks like decorators syntax, a stage 2 proposal that's on its 4th syntax/semantics iteration.

Are you saying you expect a newline above the decorator, below the imports, and it's not forcing one? If so, that is indeed a bug.

@eestein
Copy link
Author

eestein commented May 30, 2020

Are you saying you expect a newline above the decorator, below the imports, and it's not forcing one? If so, that is indeed a bug.

Exactly.

@nbitouze
Copy link

I can confirm that bug makes newline-after-imports pretty much useless in an Angular project, considering most of the typescript files in an angular project start with imports followed directly by the declaration of a decorated class.

@notaphplover
Copy link

Any updates about this?

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

No branches or pull requests

4 participants