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:
parent
14f79018ad
commit
5e6dc290b6
2 changed files with 15 additions and 13 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
var { E10SUtils } = ChromeUtils.import("resource://gre/modules/E10SUtils.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';
|
import FilePicker from 'zotero/modules/filePicker';
|
||||||
|
|
||||||
|
@ -2147,22 +2148,23 @@ var Scaffold = new function () {
|
||||||
let eslintPath = await getESLintPath();
|
let eslintPath = await getESLintPath();
|
||||||
if (!eslintPath) return [];
|
if (!eslintPath) return [];
|
||||||
|
|
||||||
let outputFile = OS.Path.join(
|
Zotero.debug('Running ESLint');
|
||||||
Zotero.getTempDirectory().path,
|
|
||||||
`lint_output_${Zotero.Utilities.randomString()}.json`
|
|
||||||
);
|
|
||||||
|
|
||||||
Zotero.debug(`Running ESLint`);
|
|
||||||
try {
|
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) {
|
catch (e) {
|
||||||
// ignore non-zero exit code (which just means that there were lint errors in the translator)
|
Zotero.logError(e);
|
||||||
}
|
}
|
||||||
|
return [];
|
||||||
let lintOutput = await Zotero.File.getContentsAsync(outputFile);
|
|
||||||
Zotero.File.removeIfExists(outputFile);
|
|
||||||
return JSON.parse(lintOutput);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function eslintOutputToModelMarkers(output) {
|
function eslintOutputToModelMarkers(output) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a41195e2f833ae6a66ccec66cdd70aff911dffd5
|
Subproject commit 75eb338759d2d99897d2f29e4be5fc6f3165b3a5
|
Loading…
Add table
Add a link
Reference in a new issue