How to have prettier format imports on multiple lines?

by hal.littel , in category: Third Party Scripts , 10 days ago

How to have prettier format imports on multiple lines?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by orpha , 9 days 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.