diff options
author | cjihrig <cjihrig@gmail.com> | 2019-07-21 00:15:32 -0400 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-22 22:32:11 -0700 |
commit | e5736d817c93ff9ac88c24d9e6a247a0f057a266 (patch) | |
tree | ca899e9f333880f500f060c424d37992b2b63fd2 /tools/node_modules/eslint/node_modules/external-editor/main/index.js | |
parent | 9949fbda469e70acc45975f5e50eedd2a3cde57d (diff) | |
download | android-node-v8-e5736d817c93ff9ac88c24d9e6a247a0f057a266.tar.gz android-node-v8-e5736d817c93ff9ac88c24d9e6a247a0f057a266.tar.bz2 android-node-v8-e5736d817c93ff9ac88c24d9e6a247a0f057a266.zip |
tools: update ESLint to 6.1.0
Update ESLint to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/28793
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/node_modules/external-editor/main/index.js')
-rw-r--r-- | tools/node_modules/eslint/node_modules/external-editor/main/index.js | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/node_modules/eslint/node_modules/external-editor/main/index.js b/tools/node_modules/eslint/node_modules/external-editor/main/index.js index 3fa210e4b3..258f31964b 100644 --- a/tools/node_modules/eslint/node_modules/external-editor/main/index.js +++ b/tools/node_modules/eslint/node_modules/external-editor/main/index.js @@ -3,7 +3,7 @@ * Node External Editor * * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 + * MIT 2019 */ Object.defineProperty(exports, "__esModule", { value: true }); var chardet_1 = require("chardet"); @@ -19,17 +19,17 @@ var ReadFileError_1 = require("./errors/ReadFileError"); exports.ReadFileError = ReadFileError_1.ReadFileError; var RemoveFileError_1 = require("./errors/RemoveFileError"); exports.RemoveFileError = RemoveFileError_1.RemoveFileError; -function edit(text) { +function edit(text, fileOptions) { if (text === void 0) { text = ""; } - var editor = new ExternalEditor(text); + var editor = new ExternalEditor(text, fileOptions); editor.run(); editor.cleanup(); return editor.text; } exports.edit = edit; -function editAsync(text, callback) { +function editAsync(text, callback, fileOptions) { if (text === void 0) { text = ""; } - var editor = new ExternalEditor(text); + var editor = new ExternalEditor(text, fileOptions); editor.runAsync(function (err, result) { if (err) { setImmediate(callback, err, null); @@ -47,10 +47,14 @@ function editAsync(text, callback) { } exports.editAsync = editAsync; var ExternalEditor = /** @class */ (function () { - function ExternalEditor(text) { + function ExternalEditor(text, fileOptions) { if (text === void 0) { text = ""; } this.text = ""; + this.fileOptions = {}; this.text = text; + if (fileOptions) { + this.fileOptions = fileOptions; + } this.determineEditor(); this.createTemporaryFile(); } @@ -124,8 +128,12 @@ var ExternalEditor = /** @class */ (function () { }; ExternalEditor.prototype.createTemporaryFile = function () { try { - this.tempFile = tmp_1.tmpNameSync({}); - fs_1.writeFileSync(this.tempFile, this.text, { encoding: "utf8" }); + this.tempFile = tmp_1.tmpNameSync(this.fileOptions); + var opt = { encoding: "utf8" }; + if (this.fileOptions.hasOwnProperty("mode")) { + opt.mode = this.fileOptions.mode; + } + fs_1.writeFileSync(this.tempFile, this.text, opt); } catch (createFileError) { throw new CreateFileError_1.CreateFileError(createFileError); |