From a56689e8837fea5795ef823163a5d08936a6338a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 1 Oct 2021 04:40:19 +0300 Subject: [PATCH] Replace Prettier's `jsxBracketSameLine` option with `bracketSameLine` (#609) --- lib/options-manager.js | 2 +- readme.md | 2 +- test/fixtures/prettier/package.json | 2 +- test/options-manager.js | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/options-manager.js b/lib/options-manager.js index 1fc78e7a..9b4495fb 100644 --- a/lib/options-manager.js +++ b/lib/options-manager.js @@ -487,7 +487,7 @@ const mergeWithPrettierConfig = (options, prettierOptions) => { { singleQuote: true, bracketSpacing: false, - jsxBracketSameLine: false, + bracketSameLine: false, trailingComma: 'all', tabWidth: normalizeSpaces(options), useTabs: !options.space, diff --git a/readme.md b/readme.md index 09dcda48..bff4d50b 100644 --- a/readme.md +++ b/readme.md @@ -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. diff --git a/test/fixtures/prettier/package.json b/test/fixtures/prettier/package.json index 998be36f..efc2c8f6 100644 --- a/test/fixtures/prettier/package.json +++ b/test/fixtures/prettier/package.json @@ -4,7 +4,7 @@ "semi": false, "tabWidth": 4, "bracketSpacing": false, - "jsxBracketSameLine": false, + "bracketSameLine": false, "singleQuote": false, "trailingComma": "all" } diff --git a/test/options-manager.js b/test/options-manager.js index 84fc538a..e95fa334 100644 --- a/test/options-manager.js +++ b/test/options-manager.js @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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 = { @@ -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, @@ -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,