Skip to content

Commit

Permalink
fix: add support for missing prettier option jsxBracketSameLine
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmckenley authored and zimme committed Dec 12, 2017
1 parent cb160a6 commit a5f3d98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ const getPrettierOptionsFromESLintRulesTests = [
rules: { "comma-dangle": [2, "always-multiline"] },
options: { trailingComma: "es5" }
},
{
rules: {},
options: { jsxBracketSameLine: true },
fallbackPrettierOptions: { jsxBracketSameLine: true }
},

// If an ESLint rule is disabled fall back to prettier defaults.
{ rules: { "max-len": [0, { code: 120 }] }, options: {} },
Expand Down
9 changes: 9 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const OPTION_GETTERS = {
useTabs: {
ruleValue: rules => getRuleValue(rules, "indent"),
ruleValueToPrettierOption: getUseTabs
},
jsxBracketSameLine: {
ruleValue: () => RULE_NOT_CONFIGURED,
ruleValueToPrettierOption: getJsxBracketSameLine
}
};

Expand Down Expand Up @@ -264,6 +268,11 @@ function getUseTabs(eslintValue, fallbacks) {
return makePrettierOption("useTabs", prettierValue, fallbacks);
}

function getJsxBracketSameLine(eslintValue, fallbacks) {
// TODO: add support for setting jsxBracketSameLine based on eslint config
return makePrettierOption("jsxBracketSameLine", eslintValue, fallbacks);
}

function extractRuleValue(objPath, name, value) {
if (objPath) {
logger.trace(
Expand Down

0 comments on commit a5f3d98

Please sign in to comment.