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

bug: import { ,ofSubject } from 'rxjs'; #33

Closed
chimurai opened this issue Dec 8, 2019 · 13 comments · Fixed by typescript-eslint/typescript-eslint#1487
Closed

bug: import { ,ofSubject } from 'rxjs'; #33

chimurai opened this issue Dec 8, 2019 · 13 comments · Fixed by typescript-eslint/typescript-eslint#1487
Labels
bug Something isn't working

Comments

@chimurai
Copy link

chimurai commented Dec 8, 2019

Thanks for this awesome plugin.

Ran into this bug...
Using version 5.0.0

Input:

import { Subject, of } from 'rxjs';

Output:

import { ,ofSubject } from 'rxjs';
@lydell
Copy link
Owner

lydell commented Dec 8, 2019

Hi!

When I tried to reproduce your issue, I got this:

import { of,Subject } from 'rxjs';

There must be something different in your environment.

@chimurai
Copy link
Author

chimurai commented Dec 8, 2019

Thanks for the fast reply.

That's interesting.

Using this eslint config:

{
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint", "simple-import-sort", "prettier"],
  "extends": ["plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
  "rules": {
    "simple-import-sort/sort": "error",
    "prettier/prettier": "error"
  }
}

@chimurai chimurai closed this as completed Dec 8, 2019
lydell added a commit that referenced this issue Dec 8, 2019
@lydell
Copy link
Owner

lydell commented Dec 8, 2019

This seems to only happen when using the TypeScript parser.

This test case fails: https://github.com/lydell/eslint-plugin-simple-import-sort/compare/typescript-issue

@lydell lydell reopened this Dec 8, 2019
@lydell lydell added the bug Something isn't working label Dec 8, 2019
@chimurai
Copy link
Author

chimurai commented Dec 8, 2019

I reduced it to this minimal typescript eslint config to reproduce it:

{
  "plugins": ["@typescript-eslint", "simple-import-sort"],
  "extends": ["plugin:@typescript-eslint/recommended"],
  "rules": {
    "simple-import-sort/sort": "error"
  }
}

@lydell
Copy link
Owner

lydell commented Dec 8, 2019

Change plugin:@typescript-eslint/recommended into plugin:@typescript-eslint/base to make it even more minimal ;)

@chimurai
Copy link
Author

chimurai commented Dec 8, 2019

Just tested it with the even more minimal config (plugin:@typescript-eslint/base).

Still got the issue ...

Output:

import { ,ofSubject } from 'rxjs';
{
  "plugins": ["@typescript-eslint", "simple-import-sort"],
  "extends": ["plugin:@typescript-eslint/base"],
  "rules": {
    "simple-import-sort/sort": "error"
  }
}

@lydell
Copy link
Owner

lydell commented Dec 8, 2019

Yes, that’s what I meant.

@runspired
Copy link

Also using the typescript parser and ending up with imports like this:

import { attr, belongsTo,hasMany } from Model from '@ember-data/model';

starting from:

import Model from '@ember-data/model';
import { attr, hasMany, belongsTo } from '@ember-data/model';

@lydell
Copy link
Owner

lydell commented Dec 10, 2019

@runspired I get this output:

import Model from '@ember-data/model';
import { attr, belongsTo,hasMany } from '@ember-data/model';

There must be something different in your environment.

@runspired
Copy link

@lydell I realized it was likely a similar parser issue but with a related plugin: turning off import/no-duplicates resolved the issue and resulted in the output you pasted above.

@lydell
Copy link
Owner

lydell commented Jan 21, 2020

This is due to a bug in @typescript-eslint/parser. PR to fix it here: typescript-eslint/typescript-eslint#1487

Once that’s merged and released, you should be able to update @typescript-eslint/parser to fix the problem, and I’ll add a test for it and close this issue.

@lydell lydell closed this as completed in 7bff768 Jan 28, 2020
@lydell
Copy link
Owner

lydell commented Jan 28, 2020

Upgrade to @typescript-eslint/parser 2.18.0 and your problem should be gone!

@chimurai
Copy link
Author

chimurai commented Feb 3, 2020

Issue is resolved. Thanks for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants