Skip to content
Permalink
Browse files
Upgrade: js-yaml to v4 (#14890)
  • Loading branch information
bmish committed Aug 10, 2021
1 parent cbc43da commit 88db3f54988dddfbda35764ecf1ea16354c4213a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
@@ -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
];

//------------------------------------------------------------------------------
@@ -214,7 +214,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);
}
@@ -390,7 +390,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,
@@ -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;
}
@@ -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");
}
@@ -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",
@@ -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`, () => {

0 comments on commit 88db3f5

Please sign in to comment.