Rollup merge of #97394 - GuillaumeGomez:more-eslint-rules, r=notriddle

Add more eslint rules

This PR adds more eslint rules. Here are the explanations for each of them:

 * [space-infix-ops](https://eslint.org/docs/rules/space-infix-ops)
 * [space-before-function-paren](https://eslint.org/docs/rules/space-before-function-paren)
 * [space-before-blocks](https://eslint.org/docs/rules/space-before-blocks)
 * [comma-dangle](https://eslint.org/docs/rules/comma-dangle)
 * [comma-style](https://eslint.org/docs/rules/comma-style)
 * [max-len](https://eslint.org/docs/rules/max-len)
 * [eol-last](https://eslint.org/docs/rules/eol-last)

r? `@notriddle`
This commit is contained in:
Guillaume Gomez 2022-05-26 00:32:11 +02:00 committed by GitHub
commit d932610bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 7 deletions

View File

@ -47,5 +47,12 @@ module.exports = {
{ "beforeColon": false, "afterColon": true, "mode": "strict" } { "beforeColon": false, "afterColon": true, "mode": "strict" }
], ],
"func-call-spacing": ["error", "never"], "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"],
} }
}; };

View File

@ -63,7 +63,7 @@ function showMain() {
removeClass(document.getElementById(MAIN_ID), "hidden"); removeClass(document.getElementById(MAIN_ID), "hidden");
} }
(function () { (function() {
window.rootPath = getVar("root-path"); window.rootPath = getVar("root-path");
window.currentCrate = getVar("current-crate"); window.currentCrate = getVar("current-crate");
window.searchJS = resourcePath("search", ".js"); window.searchJS = resourcePath("search", ".js");
@ -929,7 +929,7 @@ function loadCss(cssFileName) {
searchState.setup(); searchState.setup();
}()); }());
(function () { (function() {
let reset_button_timeout = null; let reset_button_timeout = null;
window.copy_path = but => { window.copy_path = but => {

View File

@ -2,7 +2,7 @@
"use strict"; "use strict";
(function () { (function() {
// Number of lines shown when code viewer is not expanded // Number of lines shown when code viewer is not expanded
const MAX_LINES = 10; const MAX_LINES = 10;

View File

@ -5,7 +5,7 @@
"use strict"; "use strict";
(function () { (function() {
const isSettingsPage = window.location.pathname.endsWith("/settings.html"); const isSettingsPage = window.location.pathname.endsWith("/settings.html");
function changeSetting(settingName, value) { function changeSetting(settingName, value) {

View File

@ -187,7 +187,7 @@ function highlightSourceLines(match) {
} }
} }
const handleSourceHighlight = (function () { const handleSourceHighlight = (function() {
let prev_line_id = 0; let prev_line_id = 0;
const set_fragment = name => { const set_fragment = name => {

View File

@ -4,7 +4,7 @@ const darkThemes = ["dark", "ayu"];
window.currentTheme = document.getElementById("themeStyle"); window.currentTheme = document.getElementById("themeStyle");
window.mainTheme = document.getElementById("mainThemeStyle"); window.mainTheme = document.getElementById("mainThemeStyle");
const settingsDataset = (function () { const settingsDataset = (function() {
const settingsElement = document.getElementById("default-settings"); const settingsElement = document.getElementById("default-settings");
if (settingsElement === null) { if (settingsElement === null) {
return null; return null;
@ -163,7 +163,7 @@ function useSystemTheme(value) {
} }
} }
const updateSystemTheme = (function () { const updateSystemTheme = (function() {
if (!window.matchMedia) { if (!window.matchMedia) {
// fallback to the CSS computed value // fallback to the CSS computed value
return () => { return () => {