Rename quotes config option to

This commit is contained in:
James Long committed 2017-01-05 10:01:43 -05:00
1 parent f1feb24dff
commit 9596695a12
3 files changed
+6 -9

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ const minimist = require("minimist");
const jscodefmt = require("../index");
const argv = minimist(process.argv.slice(2), {
boolean: ["write", "useFlowParser", "bracket-spacing", "single-quotes"]
boolean: ["write", "useFlowParser", "bracket-spacing", "single-quote"]
});
const filename = argv["_"][0];
@@ -16,7 +16,7 @@ const output = jscodefmt.format(fs.readFileSync(filename, "utf8"), {
tabWidth: argv['tab-width'],
bracketSpacing: argv['bracket-spacing'],
useFlowParser: argv['flow-parser'],
quote: argv["single-quotes"] ? "single" : "double"
singleQuote: argv["single-quote"]
});
if(write) {
+2 -3
View File
@@ -7,9 +7,8 @@ var defaults = {
// Fit code within this line limit.
printWidth: 80,
// If you want to override the quotes used in string literals, specify
// either "single" or "double".
quote: "double",
// If true, will use single instead of double quotes
singleQuote: false,
// Controls the printing of trailing commas in object literals,
// array expressions and function parameters.
+2 -4
View File
@@ -1923,11 +1923,9 @@ function swapQuotes(str) {
function nodeStr(str, options) {
isString.assert(str);
switch (options.quote) {
case "single":
if(options.singleQuote) {
return swapQuotes(JSON.stringify(swapQuotes(str)));
case "double":
default:
} else {
return JSON.stringify(str);
}
}