Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long imports and exports don't respect max line-length #19

Closed
tylergaw opened this issue Jan 10, 2017 · 5 comments
Closed

Long imports and exports don't respect max line-length #19

tylergaw opened this issue Jan 10, 2017 · 5 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@tylergaw
Copy link

tylergaw commented Jan 10, 2017

I'm not sure if this is intended or a problem, but here's an example:

Any `import {...} from 'package'; lines that exceed the max line length are not wrapped.

Was expecting something like: (or similar)

import {
  fish, 
  horse, 
  dog, 
  animal, 
  dog, 
  bird, 
  ford as dorf, 
  river, 
  etc
} from '../package.js'
@conorcussell
Copy link

Same issue with export = { name1 } style syntax.

screen shot 2017-01-10 at 16 39 06

@tylergaw tylergaw changed the title Long imports don't respect max line-length Long imports and exports don't respect max line-length Jan 10, 2017
@bnjmnt4n
Copy link
Contributor

I've been working on some changes locally which might help fix that. Will send a PR soon.

@vramana vramana added the type:bug Issues identifying ugly output, or a defect in the program label Jan 11, 2017
jlongster pushed a commit that referenced this issue Jan 12, 2017
@vramana vramana closed this as completed Jan 13, 2017
josephfrazier pushed a commit to josephfrazier/prettier that referenced this issue Jun 20, 2017
Rename obsolete `prettier-with-tabs` into `prettier-miscellaneous`
@bennyadam
Copy link

There's still an issue when one import exceeds the max line length.

As an example...

import { ExtremlyLongComponentNameWithoutSpaces } from 'extremly/long/path/to/component.ts';

...could be handled by...

import {
  ExtremlyLongComponentNameWithoutSpaces
} from 'extremly/long/path/to/component.ts';

Not too crucial though, but still it could be solved. Worked around by adding a comment, which is doing the trick and prevents the one-line formatting, if someone runs into the same issue:

import {
  ExtremlyLongComponentNameWithoutSpaces
  // won't be reset by prettier!
} from 'extremly/long/path/to/component.ts';

@duailibe
Copy link
Member

duailibe commented Mar 9, 2018

@oclyde This is intended behavior. We intentionally don't split if there's only one specifier in the import

@lydell
Copy link
Member

lydell commented Mar 9, 2018

https://prettier.io/docs/en/rationale.html#imports

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

7 participants