Skip to content

Commit

Permalink
fix: change the default values to match Prettier's defaults (#80)
Browse files Browse the repository at this point in the history
* fix: Changed the default values to match Prettier's defaults

Trailing commas, single quotes, and bracket spacing default values were incorrect and not matching
Prettier's default values

* test: Updated tests to correctly handle new default values
  • Loading branch information
enriquecaballero authored and Kent C. Dodds committed May 10, 2017
1 parent 34bcf55 commit fa37803
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/index.test.js
Expand Up @@ -120,8 +120,10 @@ const tests = [
// go ahead and add a test case here
{
title: 'with code that needs no fixing',
input: {text: 'var [foo, {bar}] = window.APP;', eslintConfig: {rules: {}}},
output: 'var [foo, {bar}] = window.APP;',
input: {
text: 'var [foo, { bar }] = window.APP;', eslintConfig: {rules: {}},
},
output: 'var [foo, { bar }] = window.APP;',
},
]

Expand Down Expand Up @@ -307,7 +309,7 @@ function noopOutput() {
return `
function foo() {
// stuff
console.log('Hello world!', and, stuff);
console.log("Hello world!", and, stuff);
}
`
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils.js
Expand Up @@ -195,7 +195,7 @@ function getSingleQuote(eslintValue, fallbacks) {
prettierValue = eslintValue
}

return makePrettierOption('singleQuote', prettierValue, fallbacks, true)
return makePrettierOption('singleQuote', prettierValue, fallbacks, false)
}

function getTrailingComma(value, fallbacks, rules) {
Expand All @@ -212,7 +212,7 @@ function getTrailingComma(value, fallbacks, rules) {
prettierValue = RULE_NOT_CONFIGURED
}

return makePrettierOption('trailingComma', prettierValue, fallbacks, 'es5')
return makePrettierOption('trailingComma', prettierValue, fallbacks, 'none')
}

function getValFromTrailingCommaConfig(objectConfig) {
Expand Down Expand Up @@ -240,7 +240,7 @@ function getBracketSpacing(eslintValue, fallbacks) {
prettierValue = eslintValue
}

return makePrettierOption('bracketSpacing', prettierValue, fallbacks, false)
return makePrettierOption('bracketSpacing', prettierValue, fallbacks, true)
}

function getSemi(eslintValue, fallbacks) {
Expand Down
1 change: 1 addition & 0 deletions src/utils.test.js
Expand Up @@ -100,6 +100,7 @@ const getPrettierOptionsFromESLintRulesTests = [
functions: 'always-multiline',
},
],
'object-curly-spacing': [2, 'never'],
},
options: {
printWidth: 120,
Expand Down

0 comments on commit fa37803

Please sign in to comment.