Comments (13)
Upgrade to @typescript-eslint/parser 2.18.0 and your problem should be gone!
from eslint-plugin-simple-import-sort.
Change plugin:@typescript-eslint/recommended
into plugin:@typescript-eslint/base
to make it even more minimal ;)
from eslint-plugin-simple-import-sort.
@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.
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.
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.
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.
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.
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.
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.
Yes, that’s what I meant.
from eslint-plugin-simple-import-sort.
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.
@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.
Issue is resolved. Thanks for the great work!
from eslint-plugin-simple-import-sort.
Related Issues (20)
- Question: relative side-effect imports are placed before relative imports HOT 2
- Question: how to approach the workaround for padding-line-between-statements? HOT 2
- Please update your docs HOT 2
- Named imports with `as` aren't sure where to go HOT 2
- Using without new lines between groups HOT 2
- Error with aliased imports and eslint-plugin-import HOT 1
- Support for namespace imports HOT 8
- Prepare for ESLint 9: Deprecated methods
- sorted import specifiers missing space HOT 2
- how to make side effect always be top HOT 2
- I thought library imports were supposed to come before relative imports? HOT 4
- Error: Run autofix to sort these imports! HOT 7
- Duplicate imports are not being removed HOT 1
- Conflict between eslint-plugin-simple-import-sort and esbenp.prettier-vscode HOT 2
- TypeError: parentNode.body is not iterable in v11 HOT 6
- Import in group despite not being matched by regex expression HOT 2
- What is the difference vs eslint-plugin-import HOT 1
- Add TypeScript types HOT 7
- Explore configuration with real regex instead of strings HOT 1
- Why add empty line bettween two react imports HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-simple-import-sort.