Closed MurkyMeow closed 10 months ago
I'm using the eslint plugin and i don't get how to configure the putout's printer in this case. Creating a putout.json
doesn't help.
Just fixed in @putout/printer@6.3.0 🎉 . Please re-install 🐊Putout. Is it works for you?
Configuration file name starts from .
is .putout.json
, and you can override any options, for example to use double quotes set:
{
"printer": ["putout", {
"format": {
"quote": "\""
},
"semantics": {
"encodeSingleQuote": false
}
}]
}
Or you can set recast
as a printer (it is slower and not maintained, but tries to preserve style of code):
{
"printer": "recast"
}
@coderaiser, I think this problem still exists.
POC for putout
CLI tool / putout's astexplorer website:
Tested with Putout version: 33.12.0
(CLI tool) and 33.10.0
(website)
alert("This is text \\' but this will be code")
// ->
alert('This is text \\' but this will be code');
POC for @putout/printer
package:
Tested with version 6.4.1
const printer = require('@putout/printer')
const { parse } = require('@babel/parser')
const input = `alert("'")`
alert({ actual: printer.print(parse(input)) })
// -> { actual: "alert(''');\n" }
Outputs this code:
Which is obviously broken as it now has an unmatched single quote