Skip to content

Commit

Permalink
Replace Prettier's jsxBracketSameLine option with bracketSameLine (
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored and devinrhode2 committed Oct 8, 2021
1 parent dbdf640 commit a56689e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/options-manager.js
Expand Up @@ -487,7 +487,7 @@ const mergeWithPrettierConfig = (options, prettierOptions) => {
{
singleQuote: true,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
trailingComma: 'all',
tabWidth: normalizeSpaces(options),
useTabs: !options.space,
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -228,7 +228,7 @@ The [Prettier options](https://prettier.io/docs/en/options.html) will be read fr
- [trailingComma](https://prettier.io/docs/en/options.html#trailing-commas): `all`
- [singleQuote](https://prettier.io/docs/en/options.html#quotes): `true`
- [bracketSpacing](https://prettier.io/docs/en/options.html#bracket-spacing): `false`
- [jsxBracketSameLine](https://prettier.io/docs/en/options.html#jsx-brackets): `false`
- [bracketSameLine](https://prettier.io/docs/en/options.html#bracket-line): `false`

If contradicting options are set for both Prettier and XO an error will be thrown.

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/prettier/package.json
Expand Up @@ -4,7 +4,7 @@
"semi": false,
"tabWidth": 4,
"bracketSpacing": false,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"singleQuote": false,
"trailingComma": "all"
}
Expand Down
22 changes: 11 additions & 11 deletions test/options-manager.js
Expand Up @@ -89,11 +89,11 @@ test('buildConfig: prettier: true', t => {

t.deepEqual(config.baseConfig.plugins, ['prettier']);
// Sets the `semi`, `useTabs` and `tabWidth` options in `prettier/prettier` based on the XO `space` and `semicolon` options
// Sets `singleQuote`, `trailingComma`, `bracketSpacing` and `jsxBracketSameLine` with XO defaults
// Sets `singleQuote`, `trailingComma`, `bracketSpacing` and `bracketSameLine` with XO defaults
t.deepEqual(config.baseConfig.rules['prettier/prettier'], ['error', {
useTabs: true,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 2,
Expand All @@ -114,11 +114,11 @@ test('buildConfig: prettier: true, typescript file', t => {

t.deepEqual(config.baseConfig.plugins, ['prettier']);
// Sets the `semi`, `useTabs` and `tabWidth` options in `prettier/prettier` based on the XO `space` and `semicolon` options
// Sets `singleQuote`, `trailingComma`, `bracketSpacing` and `jsxBracketSameLine` with XO defaults
// Sets `singleQuote`, `trailingComma`, `bracketSpacing` and `bracketSameLine` with XO defaults
t.deepEqual(config.baseConfig.rules['prettier/prettier'], ['error', {
useTabs: true,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 2,
Expand All @@ -144,7 +144,7 @@ test('buildConfig: prettier: true, semicolon: false', t => {
t.deepEqual(config.baseConfig.rules['prettier/prettier'], ['error', {
useTabs: true,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
semi: false,
singleQuote: true,
tabWidth: 2,
Expand All @@ -165,7 +165,7 @@ test('buildConfig: prettier: true, space: 4', t => {
t.deepEqual(config.baseConfig.rules['prettier/prettier'], ['error', {
useTabs: false,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 4,
Expand All @@ -186,7 +186,7 @@ test('buildConfig: prettier: true, space: true', t => {
t.deepEqual(config.baseConfig.rules['prettier/prettier'], ['error', {
useTabs: false,
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 2,
Expand Down Expand Up @@ -271,12 +271,12 @@ test('buildConfig: nodeVersion: >=8', t => {
t.deepEqual(config.baseConfig.rules['node/no-unsupported-features/node-builtins'], ['error', {version: '>=8'}]);
});

test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpacing` and `jsxBracketSameLine` from `prettier` config if defined', t => {
test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpacing` and `bracketSameLine` from `prettier` config if defined', t => {
const prettierOptions = {
singleQuote: false,
trailingComma: 'none',
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
};
const result = manager.mergeWithPrettierConfig({}, prettierOptions);
const expected = {
Expand All @@ -298,7 +298,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from xo c
const result = manager.mergeWithPrettierConfig({space: 4, semicolon: false}, {});
const expected = {
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
singleQuote: true,
trailingComma: 'all',
...prettierOptions,
Expand All @@ -315,7 +315,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from pret
const result = manager.mergeWithPrettierConfig({}, prettierOptions);
const expected = {
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
singleQuote: true,
trailingComma: 'all',
...prettierOptions,
Expand Down

0 comments on commit a56689e

Please sign in to comment.