Skip to content

Commit

Permalink
chore(prettier): Take Prettier 2.4.0's jsxBracketSameLine → bracketSa…
Browse files Browse the repository at this point in the history
…meLine (#749)

BREAKING CHANGE: Support Prettier 2.4.0+
  • Loading branch information
chrisbobbe authored May 15, 2022
1 parent b271486 commit 26a574c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@
"contributions": [
"code"
]
},
{
"login": "chrisbobbe",
"name": "Chris Bobbe",
"avatar_url": "https://avatars.githubusercontent.com/u/22248748?v=4",
"profile": "https://github.com/chrisbobbe",
"contributions": [
"bug",
"code"
]
}
],
"repoType": "github",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fall back to the `prettier` defaults:
// prettier-eslint doesn't currently support
// inferring these two (Pull Requests welcome):
parser: 'babylon',
jsxBracketSameLine: false,
bracketSameLine: false,
}
```

Expand Down Expand Up @@ -305,12 +305,12 @@ Thanks goes to these people ([emoji key][emojis]):
<tr>
<td align="center"><a href="https://github.com/cy6erskunk"><img src="https://avatars3.githubusercontent.com/u/754849?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Igor</b></sub></a><br /><a href="#maintenance-cy6erskunk" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://campcode.dev/"><img src="https://avatars.githubusercontent.com/u/10620169?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rebecca Vest</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint/commits?author=idahogurl" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/chrisbobbe"><img src="https://avatars.githubusercontent.com/u/22248748?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Bobbe</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint/issues?q=author%3Achrisbobbe" title="Bug reports">🐛</a> <a href="https://github.com/prettier/prettier-eslint/commits?author=chrisbobbe" title="Code">💻</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors][all-contributors] specification.
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ const getPrettierOptionsFromESLintRulesTests = [
},
{
rules: {},
options: { jsxBracketSameLine: true },
fallbackPrettierOptions: { jsxBracketSameLine: true }
options: { bracketSameLine: true },
fallbackPrettierOptions: { bracketSameLine: true }
},
{
rules: { 'react/jsx-closing-bracket-location': [2, 'after-props'] },
options: { jsxBracketSameLine: true }
options: { bracketSameLine: true }
},
{
rules: { 'react/jsx-closing-bracket-location': [2, 'tag-aligned'] },
options: { jsxBracketSameLine: false }
options: { bracketSameLine: false }
},
{
rules: {
Expand All @@ -133,7 +133,7 @@ const getPrettierOptionsFromESLintRulesTests = [
}
]
},
options: { jsxBracketSameLine: true }
options: { bracketSameLine: true }
},
{
rules: {
Expand Down
8 changes: 4 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const OPTION_GETTERS = {
ruleValue: rules => getRuleValue(rules, 'indent'),
ruleValueToPrettierOption: getUseTabs
},
jsxBracketSameLine: {
bracketSameLine: {
ruleValue: rules =>
getRuleValue(rules, 'react/jsx-closing-bracket-location', 'nonEmpty'),
ruleValueToPrettierOption: getJsxBracketSameLine
ruleValueToPrettierOption: getBracketSameLine
},
arrowParens: {
ruleValue: rules => getRuleValue(rules, 'arrow-parens'),
Expand Down Expand Up @@ -263,7 +263,7 @@ function getUseTabs(eslintValue, fallbacks) {
return makePrettierOption('useTabs', prettierValue, fallbacks);
}

function getJsxBracketSameLine(eslintValue, fallbacks) {
function getBracketSameLine(eslintValue, fallbacks) {
let prettierValue;

if (eslintValue === 'after-props') {
Expand All @@ -278,7 +278,7 @@ function getJsxBracketSameLine(eslintValue, fallbacks) {
prettierValue = eslintValue;
}

return makePrettierOption('jsxBracketSameLine', prettierValue, fallbacks);
return makePrettierOption('bracketSameLine', prettierValue, fallbacks);
}

function getArrowParens(eslintValue, fallbacks) {
Expand Down

0 comments on commit 26a574c

Please sign in to comment.