Skip to content
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

Redundant quotes added #645

Open
coderaiser opened this issue Oct 28, 2021 · 2 comments
Open

Redundant quotes added #645

coderaiser opened this issue Oct 28, 2021 · 2 comments
Labels

Comments

@coderaiser
Copy link

const yaml = require('js-yaml');

const file = `
  name: Node CI
  on:
    - push
`;

const json = yaml.load(file);
console.log(yaml.dump(json));

Output:

name: Node CI
'on':
  - push
@rlidwka
Copy link
Member

rlidwka commented May 9, 2022

on without quotes is a boolean true value in YAML 1.0, old version of the spec: https://yaml.org/type/bool.html

so it's intentional, but we probably should drop support for that at some point

@abitrolly
Copy link

The solution for now is to use noCompatMode as explained in other issue.

yaml.dump(json, {noCompatMode: true});

https://runkit.com/abitrolly/62f3a3ccbc61df0008be5b4e

abitrolly added a commit to abitrolly/travis-to-github-actions that referenced this issue Aug 10, 2022
abitrolly added a commit to abitrolly/travis-to-github-actions that referenced this issue Aug 10, 2022
akx pushed a commit to akx/travis-to-github-actions that referenced this issue Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants