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

fix: Don't specify any jsxBracketSameLine parameter if none is specified #430

Merged
merged 2 commits into from
May 11, 2022

Conversation

gwhitney
Copy link
Contributor

By removing the default value for jsx-bracket-same-line (which is just
undefined anyway), no option value at all for jsxBracketSameLine will
be generated if none is specified. Then if a recent version of prettier
is in use for which that option is deprecated, it won't complain.

Resolves #428.

  By removing the default value for jsx-bracket-same-line (which is just
  `undefined` anyway), no option value at all for jsxBracketSameLine will
  be generated if none is specified. Then if a recent version of prettier
  is in use for which that option is deprecated, it won't complain.

  Resolves prettier#428.
@idahogurl idahogurl merged commit 04a8e04 into prettier:master May 11, 2022
Copy link
Collaborator

@idahogurl idahogurl left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

🎉 This PR is included in version 6.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@prettier prettier deleted a comment from chrisbobbe May 12, 2022
@chrisbobbe
Copy link

chrisbobbe commented May 12, 2022

Hmm, I'm still seeing

jsxBracketSameLine is deprecated.

with 6.0.1, and prettier-eslint 14.0.3 (and prettier 2.6.2)—not yet quite sure why, or what's the right fix.

I find that I don't get that output if I remove the lines corresponding to these in my node_modules/prettier-eslint/dist/utils.js. I intend to investigate more and hopefully report back tomorrow with my findings. 🙂

@chrisbobbe
Copy link

chrisbobbe commented May 12, 2022

Ah, here's what I think is happening.

react/jsx-closing-bracket-location is active (not off) in my ESLint config. The specific setting (according to eslint --print-config .eslintrc.yaml) is:

"react/jsx-closing-bracket-location": [
  "error",
  "line-aligned"
],

prettier-eslint (since prettier/prettier-eslint@59ef52b) notices that ESLint setting and uses it to set an appropriate value for the Prettier setting jsxBracketSameLine. But Prettier deprecated that setting in prettier/prettier@4992d97 (released in Prettier 2.4.0, it looks like), so I'm getting the deprecation warning.

In fact, for my specific choice of react/jsx-closing-bracket-location ('line-aligned'), prettier-eslint is choosing false for jsxBracketSameLine, to turn the setting off. But, I guess understandably, newer Prettier prefers that people don't touch the setting at all, even to say "turn it off".

Should prettier-eslint solve this by no longer trying to set jsxBracketSameLine? prettier/prettier@4992d97 proposed bracketSameLine as a replacement, but I'd guess that's only available in Prettier 2.4.0+.

@idahogurl
Copy link
Collaborator

@chrisbobbe I'm thinking we use their proposed solution of bracketSameLine, prettier-eslint currently uses ^2.5.1 anyway as seen here https://github.com/prettier/prettier-eslint/blob/3746d674f3810d19156c3060c401adf536d999b8/package.json#L28

@chrisbobbe
Copy link

Great, that sounds good to me! Shall I make a PR?

@idahogurl
Copy link
Collaborator

@chrisbobbe That would be wonderful!

chrisbobbe added a commit to chrisbobbe/prettier-eslint that referenced this pull request May 12, 2022
…meLine

prettier/prettier@4992d9720, released in 2.4.0, deprecated the
`jsxBracketSameLine` option in favor of a new, more generic option,
`bracketSameLine`. See docs:
  https://prettier.io/docs/en/options.html#bracket-line

This has caused a warning

  jsxBracketSameLine is deprecated.

for people using Prettier 2.4.0+, if their ESLint config leads us to
infer and use a value for jsxBracketSameLine.

So, instead of inferring and using a value for jsxBracketSameLine,
do so for the new bracketSameLine.

In d8bf1e3, which we released in 14.0.0, we stopped supporting
Prettier versions older than 2.5.1. That means we don't need to
maintain backward-compatible code for users with Prettier <2.4.0,
which doesn't have bracketSameLine.

See discussion:
  prettier/prettier-eslint-cli#430 (comment)
@chrisbobbe
Copy link

Just sent prettier/prettier-eslint#749 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Still reports "jsxBracketSameLine is deprecated." even when option is not used
3 participants