Is it possible to add spaces to export and import declarations?
See original GitHub issueCurrently, when I use SourceFile.addImport()
, I get such an output:
import {NetUser, User, SmthElse} from './models/User';
However, I’d like to add a space after the opening bracket and before the closing one, so that the file conforms to the style rules we use in our project:
import { NetUser, User, SmthElse } from './models/User';
The same with addExport()
.
Is this achievable somehow?
PS. I’m sorry I’ve created lots of issues in the last 2 days 😃 The project is really so awesome and I just want to use it at its full potential. Please, however, feel free to tell me if I’m misusing it and if the details of file formatting are out of scope of the project.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Adding spaces between imports and braces in WebStorm
Yes. Go to WebStorm -> Preferences -> Editor -> Code Style -> JavaScript -> Spaces (second tab), scroll to section "Within" and check...
Read more >Export and import spaces and space customization
You can export and import spaces along with their settings and data. All of the information is saved to a self-contained file with...
Read more >How to export and import multiple spaces from one
One trick that might help - consolidate your source spaces together, then de-consolidate after merge.
Read more >Basic Importing and Exporting - Customs and Border Protection
Both CBP and the importing/exporting community have a shared ... ensuring the goods that enter the U.S. marketplace are genuine, safe, and lawfully...
Read more >Understanding Modules and Import and Export Statements in ...
Note: import must always be at the top of the file before any other code, and it is also necessary to include the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This will be implemented in v10 when it’s released.
Be default it will write surrounding spaces, but you can set the
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
manipulation setting to false to make it not add surrounding spaces.An alternate move might be to suggest emitting through something like prettier? That way the stylistic formatting is a distinct task than the AST manipulation.