Skip to content

Do not break long it calls - #842

Merged
jlongster merged 1 commit into
prettier:masterfrom
vjeux:it
Mar 3, 2017
Merged

jlongster merged 1 commit into
prettier:masterfrom
vjeux:it

Conversation

@vjeux

@vjeux vjeux commented Mar 1, 2017 •

Copy link
Copy Markdown
Contributor

This happens very frequently that naming a test makes the entire line go > 80 columns and requires to indent everything which takes a lot more space. We've had this being reported multiple times and it also affects a lot of tests inside of fb.

Fixes #159

(Note, this is built on-top of #841 but github doesn't handle stacked pull requests well... You want to look at the second commit here: a4bab0c )

@vjeux vjeux changed the title It Do not break long it calls Mar 1, 2017
Comment thread src/printer.js Outdated
n.arguments.length === 2 &&
(n.arguments[0].type === "StringLiteral" || n.arguments[0].type === "Literal" && typeof n.arguments[0].value === "string") &&
(n.arguments[1].type === "FunctionExpression" || n.arguments[1].type === "ArrowFunctionExpression") &&
n.arguments[1].params.length <= 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little hesitant not restrict it to a whitelist of names. Although it would be super rare, this would make it surprisingly ignore a few other places in the codebase that happen to call a function with the same signature.

What do you think about just whitelisting it and xit just like we do require? I'm pretty sure that would solve 99% of the problems. All of the other names like describe and others are used minimally and wouldn't break as often because those are at the top of the files, and don't have long descriptive names. I think just detecting it would be ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm down. I'll add it and test. If you are using something else, too bad for you, it's going to indent you!

This happens very frequently that naming a test makes the entire line go > 80 columns and requires to indent everything which takes a lot more space. We've had this being reported multiple times and it also affects a lot of tests inside of fb.

Fixes prettier#159

(Note, this is built on-top of prettier#841 but github doesn't handle stacked pull requests well...)
@vjeux

vjeux commented Mar 3, 2017

Copy link
Copy Markdown
Contributor Author

I whitelisted it and test.

@jlongster

Copy link
Copy Markdown
Member

Awesome, thanks!

@jlongster
jlongster merged commit 184382d into prettier:master Mar 3, 2017
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 21, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 21, 2019
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants