prettier-eslint
Advanced tools
Comparing version
@@ -58,3 +58,3 @@ "use strict"; | ||
ruleValue: function ruleValue(rules) { | ||
return getRuleValue(rules, "comma-dangle"); | ||
return getRuleValue(rules, "comma-dangle", []); | ||
}, | ||
@@ -82,6 +82,12 @@ ruleValueToPrettierOption: getTrailingComma | ||
jsxBracketSameLine: { | ||
ruleValue: function ruleValue() { | ||
return RULE_NOT_CONFIGURED; | ||
ruleValue: function ruleValue(rules) { | ||
return getRuleValue(rules, "react/jsx-closing-bracket-location", "nonEmpty"); | ||
}, | ||
ruleValueToPrettierOption: getJsxBracketSameLine | ||
}, | ||
arrowParens: { | ||
ruleValue: function ruleValue(rules) { | ||
return getRuleValue(rules, "arrow-parens"); | ||
}, | ||
ruleValueToPrettierOption: getArrowParens | ||
} | ||
@@ -204,12 +210,11 @@ }; | ||
function getTrailingComma(value, fallbacks, rules) { | ||
function getTrailingComma(eslintValue, fallbacks) { | ||
var prettierValue = void 0; | ||
var actualValue = rules["comma-dangle"]; | ||
if (value === "never") { | ||
if (eslintValue === "never") { | ||
prettierValue = "none"; | ||
} else if (typeof value === "string" && value.indexOf("always") === 0) { | ||
} else if (typeof eslintValue === "string" && eslintValue.indexOf("always") === 0) { | ||
prettierValue = "es5"; | ||
} else if (typeof actualValue === "object") { | ||
prettierValue = getValFromTrailingCommaConfig(actualValue); | ||
} else if (typeof eslintValue === "object") { | ||
prettierValue = getValFromTrailingCommaConfig(eslintValue); | ||
} else { | ||
@@ -223,10 +228,8 @@ prettierValue = RULE_NOT_CONFIGURED; | ||
function getValFromTrailingCommaConfig(objectConfig) { | ||
var _objectConfig = _slicedToArray(objectConfig, 2), | ||
_objectConfig$ = _objectConfig[1], | ||
_objectConfig$$arrays = _objectConfig$.arrays, | ||
arrays = _objectConfig$$arrays === undefined ? "" : _objectConfig$$arrays, | ||
_objectConfig$$object = _objectConfig$.objects, | ||
objects = _objectConfig$$object === undefined ? "" : _objectConfig$$object, | ||
_objectConfig$$functi = _objectConfig$.functions, | ||
functions = _objectConfig$$functi === undefined ? "" : _objectConfig$$functi; | ||
var _objectConfig$arrays = objectConfig.arrays, | ||
arrays = _objectConfig$arrays === undefined ? "" : _objectConfig$arrays, | ||
_objectConfig$objects = objectConfig.objects, | ||
objects = _objectConfig$objects === undefined ? "" : _objectConfig$objects, | ||
_objectConfig$functio = objectConfig.functions, | ||
functions = _objectConfig$functio === undefined ? "" : _objectConfig$functio; | ||
@@ -286,6 +289,27 @@ var fns = isAlways(functions); | ||
function getJsxBracketSameLine(eslintValue, fallbacks) { | ||
// TODO: add support for setting jsxBracketSameLine based on eslint config | ||
return makePrettierOption("jsxBracketSameLine", eslintValue, fallbacks); | ||
var prettierValue = void 0; | ||
if (eslintValue === "after-props") { | ||
prettierValue = true; | ||
} else if (eslintValue === "tag-aligned" || eslintValue === "line-aligned" || eslintValue === "props-aligned") { | ||
prettierValue = false; | ||
} else { | ||
prettierValue = eslintValue; | ||
} | ||
return makePrettierOption("jsxBracketSameLine", prettierValue, fallbacks); | ||
} | ||
function getArrowParens(eslintValue, fallbacks) { | ||
var prettierValue = void 0; | ||
if (eslintValue === "as-needed") { | ||
prettierValue = "avoid"; | ||
} else { | ||
prettierValue = eslintValue; | ||
} | ||
return makePrettierOption("arrowParens", prettierValue, fallbacks); | ||
} | ||
function extractRuleValue(objPath, name, value) { | ||
@@ -292,0 +316,0 @@ if (objPath) { |
{ | ||
"name": "prettier-eslint", | ||
"version": "8.2.6", | ||
"version": "8.3.0", | ||
"description": "Formats your JavaScript using prettier followed by eslint --fix", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"loglevel-colored-level-prefix": "^1.0.0", | ||
"prettier": "^1.7.1", | ||
"prettier": "^1.9.0", | ||
"pretty-format": "^21.2.1", | ||
@@ -31,0 +31,0 @@ "require-relative": "^0.8.7", |
46509
1.26%558
3.53%Updated