diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 5e0f6a8d..701f7526 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -52,8 +52,6 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/; var emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links var linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; -// readFile options for reading with the UTF-8 encoding -module.exports.utf8Encoding = "utf8"; // All punctuation characters (normal and full-width) var allPunctuation = ".,;:!?。,;:!?"; module.exports.allPunctuation = allPunctuation; @@ -1423,10 +1421,10 @@ function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, n // Make a/synchronous call to read file if (synchronous) { // @ts-ignore - lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding)); + lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { - fs.readFile(file, helpers.utf8Encoding, lintContentWrapper); + fs.readFile(file, "utf8", lintContentWrapper); } } /** @@ -1643,7 +1641,7 @@ function readConfig(file, parsers, callback) { parsers = null; } // Read file - fs.readFile(file, helpers.utf8Encoding, function (err, content) { + fs.readFile(file, "utf8", function (err, content) { if (err) { return callback(err); } @@ -1690,7 +1688,7 @@ function readConfigPromise(file, parsers) { function readConfigSync(file, parsers) { // Read file // @ts-ignore - var content = fs.readFileSync(file, helpers.utf8Encoding); + var content = fs.readFileSync(file, "utf8"); // Try to parse file var _a = parseConfiguration(file, content, parsers), config = _a.config, message = _a.message; if (!config) { diff --git a/helpers/helpers.js b/helpers/helpers.js index 52ca1470..bcec394f 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -31,9 +31,6 @@ const emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; -// readFile options for reading with the UTF-8 encoding -module.exports.utf8Encoding = "utf8"; - // All punctuation characters (normal and full-width) const allPunctuation = ".,;:!?。,;:!?"; module.exports.allPunctuation = allPunctuation; diff --git a/lib/markdownlint.js b/lib/markdownlint.js index 165a144b..f327364c 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -710,9 +710,9 @@ function lintFile( // Make a/synchronous call to read file if (synchronous) { // @ts-ignore - lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding)); + lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { - fs.readFile(file, helpers.utf8Encoding, lintContentWrapper); + fs.readFile(file, "utf8", lintContentWrapper); } } @@ -967,7 +967,7 @@ function readConfig(file, parsers, callback) { parsers = null; } // Read file - fs.readFile(file, helpers.utf8Encoding, (err, content) => { + fs.readFile(file, "utf8", (err, content) => { if (err) { return callback(err); } @@ -1020,7 +1020,7 @@ function readConfigPromise(file, parsers) { function readConfigSync(file, parsers) { // Read file // @ts-ignore - const content = fs.readFileSync(file, helpers.utf8Encoding); + const content = fs.readFileSync(file, "utf8"); // Try to parse file const { config, message } = parseConfiguration(file, content, parsers); if (!config) {