Giter Club home page Giter Club logo

Comments (13)

lydell avatar lydell commented on May 29, 2024 2

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

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024 1

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

from eslint-plugin-simple-import-sort.

runspired avatar runspired commented on May 29, 2024 1

@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.

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024 1

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.

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024

Hi!

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

import { of,Subject } from 'rxjs';

There must be something different in your environment.

from eslint-plugin-simple-import-sort.

chimurai avatar chimurai commented on May 29, 2024

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"
  }
}

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024

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

from eslint-plugin-simple-import-sort.

chimurai avatar chimurai commented on May 29, 2024

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"
  }
}

from eslint-plugin-simple-import-sort.

chimurai avatar chimurai commented on May 29, 2024

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"
  }
}

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024

Yes, that’s what I meant.

from eslint-plugin-simple-import-sort.

runspired avatar runspired commented on May 29, 2024

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';

from eslint-plugin-simple-import-sort.

lydell avatar lydell commented on May 29, 2024

@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.

from eslint-plugin-simple-import-sort.

chimurai avatar chimurai commented on May 29, 2024

Issue is resolved. Thanks for the great work!

from eslint-plugin-simple-import-sort.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.