fx-compat: Scaffold: Read ESLint output from stdin

Need to update your zotero/translators clone to get linting working again.
This commit is contained in:
Abe Jellinek 2022-07-19 16:26:17 -04:00
parent 14f79018ad
commit 5e6dc290b6
2 changed files with 15 additions and 13 deletions

View file

@ -25,6 +25,7 @@
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { E10SUtils } = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
var { Subprocess } = ChromeUtils.import("resource://gre/modules/Subprocess.jsm");
import FilePicker from 'zotero/modules/filePicker';
@ -2147,22 +2148,23 @@ var Scaffold = new function () {
let eslintPath = await getESLintPath();
if (!eslintPath) return [];
let outputFile = OS.Path.join(
Zotero.getTempDirectory().path,
`lint_output_${Zotero.Utilities.randomString()}.json`
);
Zotero.debug(`Running ESLint`);
Zotero.debug('Running ESLint');
try {
await Zotero.Utilities.Internal.exec(eslintPath, ['-o', outputFile, '--', translatorPath]);
let proc = await Subprocess.call({
command: eslintPath,
arguments: ['-o', '-', '--', translatorPath],
});
let lintOutput = '';
let chunk;
while ((chunk = await proc.stdout.readString())) {
lintOutput += chunk;
}
return JSON.parse(lintOutput);
}
catch (e) {
// ignore non-zero exit code (which just means that there were lint errors in the translator)
Zotero.logError(e);
}
let lintOutput = await Zotero.File.getContentsAsync(outputFile);
Zotero.File.removeIfExists(outputFile);
return JSON.parse(lintOutput);
return [];
}
function eslintOutputToModelMarkers(output) {

@ -1 +1 @@
Subproject commit a41195e2f833ae6a66ccec66cdd70aff911dffd5
Subproject commit 75eb338759d2d99897d2f29e4be5fc6f3165b3a5