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

Upgrade: js-yaml to v4 #14890

Merged
merged 2 commits into from Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile.js
Expand Up @@ -43,7 +43,7 @@ const { cat, cd, cp, echo, exec, exit, find, ls, mkdir, pwd, rm, test } = requir
const PERF_MULTIPLIER = 13e6;

const OPEN_SOURCE_LICENSES = [
/MIT/u, /BSD/u, /Apache/u, /ISC/u, /WTF/u, /Public Domain/u, /LGPL/u
/MIT/u, /BSD/u, /Apache/u, /ISC/u, /WTF/u, /Public Domain/u, /LGPL/u, /Python/u
];

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -213,7 +213,7 @@ function generateRuleIndexPage() {
// `.rules` will be `undefined` if all rules in category are deprecated.
categoriesData.categories = categoriesData.categories.filter(category => !!category.rules);

const output = yaml.safeDump(categoriesData, { sortKeys: true });
const output = yaml.dump(categoriesData, { sortKeys: true });

output.to(outputFile);
}
Expand Down Expand Up @@ -389,7 +389,7 @@ function getFirstVersionOfDeletion(filePath) {
* @private
*/
function lintMarkdown(files) {
const config = yaml.safeLoad(fs.readFileSync(path.join(__dirname, "./.markdownlint.yml"), "utf8")),
const config = yaml.load(fs.readFileSync(path.join(__dirname, "./.markdownlint.yml"), "utf8")),
result = markdownlint.sync({
files,
config,
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-engine/formatters/tap.js
Expand Up @@ -31,7 +31,7 @@ function outputDiagnostics(diagnostic) {
const prefix = " ";
let output = `${prefix}---\n`;

output += prefix + yaml.safeDump(diagnostic).split("\n").join(`\n${prefix}`);
output += prefix + yaml.dump(diagnostic).split("\n").join(`\n${prefix}`);
output += "...\n";
return output;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/init/config-file.js
Expand Up @@ -63,7 +63,7 @@ function writeYAMLConfigFile(config, filePath) {
// lazy load YAML to improve performance when not used
const yaml = require("js-yaml");

const content = yaml.safeDump(config, { sortKeys: true });
const content = yaml.dump(config, { sortKeys: true });

fs.writeFileSync(filePath, content, "utf8");
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -72,7 +72,7 @@
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"js-yaml": "^3.13.1",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash.merge": "^4.6.2",
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/init/config-file.js
Expand Up @@ -60,8 +60,8 @@ describe("ConfigFile", () => {
[
["JavaScript", "foo.js", espree.parse],
["JSON", "bar.json", JSON.parse],
["YAML", "foo.yaml", yaml.safeLoad],
["YML", "foo.yml", yaml.safeLoad]
["YAML", "foo.yaml", yaml.load],
["YML", "foo.yml", yaml.load]
].forEach(([fileType, filename, validate]) => {

it(`should write a file through fs when a ${fileType} path is passed`, () => {
Expand Down