How to have prettier format imports on multiple lines?

by hal.littel , in category: Third Party Scripts , a year ago

How to have prettier format imports on multiple lines?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by orpha , a year ago

@hal.littel 

One way to have prettier format imports on multiple lines is to use the following format:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import { 
  Function1,
  Function2,
  Function3 
} from 'moduleName';

import {
  Class1,
  Class2,
  Class3
} from 'anotherModuleName';


This will make the code easier to read and maintain. Additionally, you can use a code formatter tool such as Prettier to automatically format your code according to a specific style guide.

Related Threads:

How to format a dart file with prettier?
How to draw multiple lines in chart.js?
How to exclude multiple lines between separators in regex?
How to transition multiple lines in d3.js plot?
How to tree-shake lodash and mui imports in storybook?
How to use multiple user provider in symfony 5?