Skip to content

Commit

Permalink
Disable number-literal-case rule when using Prettier (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg authored and sindresorhus committed Apr 3, 2018
1 parent 7190640 commit 4fd6991
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions lib/options-manager.js
Expand Up @@ -268,6 +268,8 @@ const buildConfig = opts => {

// If the user sets the `prettier` options then add the `prettier` plugin and config
if (opts.prettier) {
// Disable formatting rules conflicting with Prettier
config.rules['unicorn/number-literal-case'] = 'off';
// The prettier plugin uses Prettier to format the code with `--fix`
config.plugins = config.plugins.concat('prettier');
// The prettier config overrides ESLint stylistic rules that are handled by Prettier
Expand Down
19 changes: 9 additions & 10 deletions test/options-manager.js
Expand Up @@ -80,16 +80,15 @@ test('buildConfig: prettier: true', t => {
t.deepEqual(config.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
t.deepEqual(config.rules, {
'prettier/prettier': ['error', {
useTabs: true,
bracketSpacing: false,
jsxBracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none'
}]});
t.deepEqual(config.rules['prettier/prettier'], ['error', {
useTabs: true,
bracketSpacing: false,
jsxBracketSameLine: false,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none'
}]);
// eslint-prettier-config must always be last
t.deepEqual(config.baseConfig.extends.slice(-1), ['prettier']);
// Indent rule is not enabled
Expand Down

0 comments on commit 4fd6991

Please sign in to comment.