prettier / prettier-eslint-cli

CLI for prettier-eslint
https://npm.im/prettier-eslint-cli
MIT License
539 stars 85 forks source link

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

Closed gwhitney closed 2 years ago

gwhitney commented 2 years ago

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.

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 6.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

chrisbobbe commented 2 years ago

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 commented 2 years ago

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 https://github.com/prettier/prettier-eslint/commit/59ef52be61ccbd07a3ffc734ea1ecf49c5f46918) notices that ESLint setting and uses it to set an appropriate value for the Prettier setting jsxBracketSameLine. But Prettier deprecated that setting in https://github.com/prettier/prettier/commit/4992d972034b19acce9603a8444c95250cb1be8a (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? https://github.com/prettier/prettier/commit/4992d972034b19acce9603a8444c95250cb1be8a proposed bracketSameLine as a replacement, but I'd guess that's only available in Prettier 2.4.0+.

idahogurl commented 2 years ago

@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 commented 2 years ago

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

idahogurl commented 2 years ago

@chrisbobbe That would be wonderful!

chrisbobbe commented 2 years ago

Just sent prettier/prettier-eslint#749 🙂