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

Support "// prettier-ignore" in comment blocks #1125

Merged
merged 2 commits into from Apr 5, 2017

Conversation

ericclemmons
Copy link
Contributor

Pretty much took the example from #1109.

The important caveat is that // prettier-ignore has to be the only or last comment attached to a node.

I could update this to use a .filter(...).length check so it can exist anywhere in the comments, but felt that doesn't really make sense cosmetically to warrant it.

@vjeux
Copy link
Contributor

vjeux commented Apr 5, 2017

Thanks, I think it makes sense.

Note that it can be attached as a trailing comment as well.

function x() {
  a(  a  ); // prettier-ignore
  // something else
}

is no longer going to work with your code. So we may want to do comments.some(comment => comment.text === 'prettier-ignore') to be on the safe side, but I'm not really sure if it's worth caring about this edge case. Happy to take another PR for it.

@ericclemmons
Copy link
Contributor Author

Support for .some looks good enough to use:

http://node.green/#ES2015-built-ins-typed-arrays--TypedArray--prototype-some

I'll send another PR now.

@vjeux
Copy link
Contributor

vjeux commented Apr 5, 2017

We already have 7 usages of .some( in the printer :) Also, we run travis on node 4 to make sure it doesn't break for the lowest version of node we support.

@lydell
Copy link
Member

lydell commented Apr 5, 2017

(For the record, Array.prototype.some has been around since ES5.)

@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.

None yet

3 participants