Skip to content

Commit

Permalink
Change trailingComma option for Prettier to all (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Aug 8, 2021
1 parent 3859d06 commit 68cb5ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ const mergeWithPrettierConfig = (options, prettierOptions) => {
singleQuote: true,
bracketSpacing: false,
jsxBracketSameLine: false,
trailingComma: 'none',
trailingComma: 'all',
tabWidth: normalizeSpaces(options),
useTabs: !options.space,
semi: options.semicolon !== false,
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ The [Prettier options](https://prettier.io/docs/en/options.html) will be read fr
- [semi](https://prettier.io/docs/en/options.html#semicolons): based on [semicolon](#semicolon) option
- [useTabs](https://prettier.io/docs/en/options.html#tabs): based on [space](#space) option
- [tabWidth](https://prettier.io/docs/en/options.html#tab-width): based on [space](#space) option
- [trailingComma](https://prettier.io/docs/en/options.html#trailing-commas): `none`
- [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`
Expand Down
16 changes: 8 additions & 8 deletions test/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('buildConfig: prettier: true', t => {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
trailingComma: 'all',
}]);
// eslint-prettier-config must always be last
t.is(config.baseConfig.extends[config.baseConfig.extends.length - 1], 'prettier');
Expand All @@ -123,7 +123,7 @@ test('buildConfig: prettier: true, typescript file', t => {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
trailingComma: 'all',
}]);

// eslint-prettier-config must always be last
Expand All @@ -149,7 +149,7 @@ test('buildConfig: prettier: true, semicolon: false', t => {
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
trailingComma: 'all',
}]);
// Indent rule is not enabled
t.is(config.baseConfig.rules.indent, undefined);
Expand All @@ -170,7 +170,7 @@ test('buildConfig: prettier: true, space: 4', t => {
semi: true,
singleQuote: true,
tabWidth: 4,
trailingComma: 'none',
trailingComma: 'all',
}]);
// Indent rule is not enabled
t.is(config.baseConfig.rules.indent, undefined);
Expand All @@ -191,7 +191,7 @@ test('buildConfig: prettier: true, space: true', t => {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
trailingComma: 'all',
}]);
// Indent rule is not enabled
t.is(config.baseConfig.rules.indent, undefined);
Expand Down Expand Up @@ -275,7 +275,7 @@ test('buildConfig: nodeVersion: >=8', t => {
test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpacing` and `jsxBracketSameLine` from `prettier` config if defined', t => {
const prettierOptions = {
singleQuote: false,
trailingComma: 'all',
trailingComma: 'none',
bracketSpacing: false,
jsxBracketSameLine: false,
};
Expand All @@ -301,7 +301,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from xo c
bracketSpacing: false,
jsxBracketSameLine: false,
singleQuote: true,
trailingComma: 'none',
trailingComma: 'all',
...prettierOptions,
};
t.deepEqual(result, expected);
Expand All @@ -318,7 +318,7 @@ test('mergeWithPrettierConfig: determine `tabWidth`, `useTabs`, `semi` from pret
bracketSpacing: false,
jsxBracketSameLine: false,
singleQuote: true,
trailingComma: 'none',
trailingComma: 'all',
...prettierOptions,
};
t.deepEqual(result, expected);
Expand Down

0 comments on commit 68cb5ab

Please sign in to comment.