question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add import groups configuration

See original GitHub issue

Summary

My actual use-case is that I want React to be imported as first but I also want line breaking between my imports. If in the importOrder configuration I setup the following : "importOrder": ["^react", "^(?!react)\\w+$"] (from https://github.com/trivago/prettier-plugin-sort-imports/issues/7#issuecomment-739413024) with importOrderSeparation: true, it will add a line break between my imports from node_modules.

Actual behavior

import React from 'react'

import classnames from 'classnames'

Expected behavior

import React from 'react'
import classnames from 'classnames'

For the moment, if you want to importOrderSeparation, there is no way of configuring import groups. I think it could be awesome if we could specify in the configuration where is the line breaking.

Possible solution

Create a configuration like:

{
  "importOrder": [
    // no line breaking if specified in a sub-array
    ["^react", "^(?!react)\\w+$"],
    "^[./]"
  ]
}

We could event remove the importOrderSeparation option because this way will allow you to put everything in the same block:

{
  "importOrder": [
    // no line breaking if specified in a sub-array
     [
       "^react", 
       "^(?!react)\\w+$", 
       "^[./]"
     ]
  ]
}

I’ll be glad to PR this 😉

Related to #1 & #7

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
atombrennercommented, Mar 25, 2021

I added PR #42 as implementation

4reactions
byaracommented, Nov 2, 2021

I have re-open #42 due to the fact that it can help a lot of people and solve lot’s of issues. Let’s work on it and improve the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a New Group by Importing Configuration from a Device
You can create a new group for IAPs with ArubaOS 8 architecture by importing configuration from an IAP. You can add more devices...
Read more >
import-groups - TIBCO Product Documentation
Use this command to import all groups in a given file to the user directory. The groups can be imported including membership information...
Read more >
Importing Configuration Data from Junos OS Configuration ...
Enabling Import of Configuration Group Data · Click in the Network Director banner and select Preferences. · In the Preferences window, select the...
Read more >
Import Groups - Identity Cloud Service - Oracle Help Center
If you are an identity domain administrator or a user administrator, you can batch import groups using a comma-separated values (CSV) file.
Read more >
Importing Active Directory Groups - HCL Product Documentation
After Active Directory groups are imported, an administrator must define the permissions for each group and group membership is handled inherently by Active ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found