Comments (9)
After upgraded to prettier 3.1.1, the error message is changed from SyntaxError: ';' expected.
to SyntaxError: '{' expected.
from prettier-plugin-sort-imports.
Another requirement is to bump @babel/generator
to >=7.22.0
:
prettier-plugin-sort-imports/package.json
Line 36 in 61d0697
Ref: https://github.com/babel/babel/releases/tag/v7.22.0
from prettier-plugin-sort-imports.
You can use
["importAttributes", { deprecatedAssertSyntax: true }]
to support both new and legacy syntax.
it is not working
from prettier-plugin-sort-imports.
You can use ["importAttributes", { deprecatedAssertSyntax: true }]
to support both new and legacy syntax.
from prettier-plugin-sort-imports.
@ayusharma @byara Could someone please review #293 or #273?
from prettier-plugin-sort-imports.
We need to allow passing the importAttributesKeyword
option to babel-generator:
If the importAttributesKeyword
option is undefined, babel unexpectedly transforms with { type: 'json' }
to with type: 'json'
(with-legacy): https://github.com/babel/babel/blob/8fa2a916e0bb601e728c3d368c1e271763880f40/packages/babel-generator/src/generators/modules.ts#L102-L106
Ref: https://babeljs.io/docs/babel-generator
from prettier-plugin-sort-imports.
I have the same problem. I tried to fiddle but the Babel parser importAttributes
isn't working, while importAssertions
does work. That is a blocker, so I had to disable the plugin altogether, so I can still continue to format the document as needed.
from prettier-plugin-sort-imports.
Is there any solution to this, even just a way to make a prettier lint check or in-IDE check not fail? I tried // prettier-ignore
, // sort-imports-ignore
, // @eslint-disable-next-line
, using importAttributes
vs importAssertions
, with
vs assert
, nothing works.
I need to have this because I'm importing some JSON into a Playwright test and it can't handle it without the assert for some reason.
from prettier-plugin-sort-imports.
@CHC383 I think I'll post a fork if it's not reviewed this week.
from prettier-plugin-sort-imports.
Related Issues (20)
- Donβt multi-line imports
- Merge same-origin imports
- CVE-2023-45133 HOT 2
- Typescript typecasting generic function reports missing semicolon
- Replace importOrderSeparation with <SEPARATOR> HOT 3
- Package is "broken" on `npm` HOT 1
- Format Selection can throw syntax errors
- Introduce a `<SIDE_EFFECT_IMPORTS>` tag
- SyntaxError: Unexpected closing tag "script" Vue-3 HOT 4
- SyntaxError: Unexpected token (React native & typescript) HOT 1
- I'm getting the `SyntaxError: Unexpected token, expected "}" (73:6)` error when formatting a `*.spec.ts` file HOT 2
- Plugin does not support TypeScript `using` keyword HOT 1
- Can't format typescript types file HOT 1
- Plugin crashes reading file: Cannot read properties of undefined (reading 'buildError') HOT 2
- import order Not Working HOT 1
- Bun could not run prettier cli, crashed with the error
- Vue SFC script block not using overrided parser
- Unexpected token for import attribute "with" HOT 1
- Not working with prettier-ignore
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 prettier-plugin-sort-imports.