Rename quotes config option to
parent
f1feb24dff
commit
9596695a12
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue