Rollup merge of #109052 - GuillaumeGomez:rustdoc-gui-tester-eslint, r=notriddle
Add eslint check for rustdoc-gui tester r? `@notriddle`
This commit is contained in:
commit
5dc0113725
@ -53,4 +53,5 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
|
||||
# Runs checks to ensure that there are no ES5 issues in our JS code.
|
||||
es-check es6 ../src/librustdoc/html/static/js/*.js && \
|
||||
eslint -c ../src/librustdoc/html/static/.eslintrc.js ../src/librustdoc/html/static/js/*.js && \
|
||||
eslint -c ../src/tools/rustdoc-js/.eslintrc.js ../src/tools/rustdoc-js/tester.js
|
||||
eslint -c ../src/tools/rustdoc-js/.eslintrc.js ../src/tools/rustdoc-js/tester.js && \
|
||||
eslint -c ../src/tools/rustdoc-gui/.eslintrc.js ../src/tools/rustdoc-gui/tester.js
|
||||
|
96
src/tools/rustdoc-gui/.eslintrc.js
Normal file
96
src/tools/rustdoc-gui/.eslintrc.js
Normal file
@ -0,0 +1,96 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"no-trailing-spaces": "error",
|
||||
"no-var": ["error"],
|
||||
"prefer-const": ["error"],
|
||||
"prefer-arrow-callback": ["error"],
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs",
|
||||
{ "allowSingleLine": false }
|
||||
],
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{ "before": true, "after": true }
|
||||
],
|
||||
"arrow-spacing": [
|
||||
"error",
|
||||
{ "before": true, "after": true }
|
||||
],
|
||||
"key-spacing": [
|
||||
"error",
|
||||
{ "beforeColon": false, "afterColon": true, "mode": "strict" }
|
||||
],
|
||||
"func-call-spacing": ["error", "never"],
|
||||
"space-infix-ops": "error",
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"space-before-blocks": "error",
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-style": ["error", "last"],
|
||||
"max-len": ["error", { "code": 100, "tabWidth": 4 }],
|
||||
"eol-last": ["error", "always"],
|
||||
"arrow-parens": ["error", "as-needed"],
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"eqeqeq": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-debugger": "error",
|
||||
"no-dupe-args": "error",
|
||||
"no-dupe-else-if": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-ex-assign": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-invalid-regexp": "error",
|
||||
"no-import-assign": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"block-scoped-var": "error",
|
||||
"guard-for-in": "error",
|
||||
"no-alert": "error",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-label-var": "error",
|
||||
"no-lonely-if": "error",
|
||||
"no-mixed-operators": "error",
|
||||
"no-multi-assign": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-script-url": "error",
|
||||
"no-sequences": "error",
|
||||
"no-div-regex": "error",
|
||||
}
|
||||
};
|
@ -6,8 +6,8 @@
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const os = require('os');
|
||||
const {Options, runTest} = require('browser-ui-test');
|
||||
const os = require("os");
|
||||
const {Options, runTest} = require("browser-ui-test");
|
||||
|
||||
// If a test fails or errors, we will retry it two more times in case it was a flaky failure.
|
||||
const NB_RETRY = 3;
|
||||
@ -200,7 +200,7 @@ async function main(argv) {
|
||||
const framework_options = new Options();
|
||||
try {
|
||||
// This is more convenient that setting fields one by one.
|
||||
let args = [
|
||||
const args = [
|
||||
"--variable", "DOC_PATH", opts["doc_folder"], "--enable-fail-on-js-error",
|
||||
"--allow-file-access-from-files",
|
||||
];
|
||||
@ -234,7 +234,7 @@ async function main(argv) {
|
||||
} else {
|
||||
files = opts["files"];
|
||||
}
|
||||
files = files.filter(file => path.extname(file) == ".goml");
|
||||
files = files.filter(file => path.extname(file) === ".goml");
|
||||
if (files.length === 0) {
|
||||
console.error("rustdoc-gui: No test selected");
|
||||
process.exit(2);
|
||||
@ -259,7 +259,7 @@ async function main(argv) {
|
||||
|
||||
// We catch this "event" to display a nicer message in case of unexpected exit (because of a
|
||||
// missing `--no-sandbox`).
|
||||
const exitHandling = (code) => {
|
||||
const exitHandling = () => {
|
||||
if (!opts["no_sandbox"]) {
|
||||
console.log("");
|
||||
console.log(
|
||||
@ -268,10 +268,10 @@ async function main(argv) {
|
||||
console.log("");
|
||||
}
|
||||
};
|
||||
process.on('exit', exitHandling);
|
||||
process.on("exit", exitHandling);
|
||||
|
||||
const originalFilesLen = files.length;
|
||||
let results = createEmptyResults();
|
||||
const results = createEmptyResults();
|
||||
const status_bar = char_printer(files.length);
|
||||
|
||||
let new_results;
|
||||
@ -281,7 +281,7 @@ async function main(argv) {
|
||||
Array.prototype.push.apply(results.successful, new_results.successful);
|
||||
// We generate the new list of files with the previously failing tests.
|
||||
files = Array.prototype.concat(new_results.failed, new_results.errored).map(
|
||||
f => f['file_name']);
|
||||
f => f["file_name"]);
|
||||
if (files.length > originalFilesLen / 2) {
|
||||
// If we have too many failing tests, it's very likely not flaky failures anymore so
|
||||
// no need to retry.
|
||||
|
Loading…
Reference in New Issue
Block a user