-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trailing comma creates non-descript error #2848
Comments
Maybe you should try
|
Another trick is to close your
I think END should be the default. I'm fixing this here: #2849 |
Cool! I didn't know this and it was always a small frustration. Maybe something to document as tips and tricks? |
yes, i did that and it works, but i find it rather ugly. |
thanks for the fix, will it also work if a commented line is just above the END ? |
Hmmm... a comment the line before the END should work, assuming the line above it ends in a comma.
|
I think this issue should still be open: the issue is still present and is rather frustrating when the trailing comma is added by an editor's on-save formatting. Both Fortunately it seems as though a possible fix has been merged in otto, so after its next release and a dependency update here, this won't be an issue any more. I worked around it in the meantime by reconfiguring prettier: /**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
}
export default config |
Hi there! I've reopened the bug as requested. Can you give an example of how |
source: commands/test_data/ds.com.js before: var DSP_BIND = NewDnsProvider("bind", "BIND");
var REG_CHANGEME = NewRegistrar("none");
D("ds.com", REG_CHANGEME,
DnsProvider(DSP_BIND),
//SOA("@", "ns3.serverfault.com.", "sysadmin.stackoverflow.com.", 2020022300, 3600, 600, 604800, 1440),
DS("geo", 14480, 13, 2, "BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B"),
END); after var DSP_BIND = NewDnsProvider("bind", "BIND");
var REG_CHANGEME = NewRegistrar("none");
D(
"ds.com",
REG_CHANGEME,
DnsProvider(DSP_BIND),
//SOA("@", "ns3.serverfault.com.", "sysadmin.stackoverflow.com.", 2020022300, 3600, 600, 604800, 1
440),
DS(
"geo",
14480,
13,
2,
"BB1C4B615CDED2B34347CF23710471934D972F1E34F53B54ED8D5F786202C73B",
),
END,
); |
Oh! I see! The editor is adding a Yeah, that's not good. Which editor does this? Can that feature be disabled? |
It's not the editor itself (in my case Emacs), it's any editor or language server that uses prettier or deno (possibly others?) to format code automatically on save. Format on save can be disabled, but I think the better workaround is to reconfigure prettier so that it understands that otto can only parse es5-style trailing commas (as of 0.4.0), which is the workaround in my previous comment and even this repository. Deno doesn't appear to have a setting for trailing commas, because it is both an interpreter and formatter (so the formatter knows what the interpreter supports) and new enough that trailing commas were always supported everywhere. Fortunately, prettier is the common choice. |
Describe the bug
when using format=js if there is a trailing comma, an error is thrown.
Can happen when the commented //NAMESERVER line is after a normal record with a trailing comma
To Reproduce
dnscontrol preview
Expected behavior
Tolerate trailing commas (especially if they are produced by get-zones
DNS Provider
The text was updated successfully, but these errors were encountered: