Skip to content

Commit

Permalink
Rollup merge of #97394 - GuillaumeGomez:more-eslint-rules, r=notriddle
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
GuillaumeGomez authored May 25, 2022
2 parents b792741 + bb29d5d commit d932610
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/librustdoc/html/static/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@ module.exports = {
{ "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"],
}
};
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function showMain() {
removeClass(document.getElementById(MAIN_ID), "hidden");
}

(function () {
(function() {
window.rootPath = getVar("root-path");
window.currentCrate = getVar("current-crate");
window.searchJS = resourcePath("search", ".js");
Expand Down Expand Up @@ -929,7 +929,7 @@ function loadCss(cssFileName) {
searchState.setup();
}());

(function () {
(function() {
let reset_button_timeout = null;

window.copy_path = but => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/scrape-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"use strict";

(function () {
(function() {
// Number of lines shown when code viewer is not expanded
const MAX_LINES = 10;

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

(function () {
(function() {
const isSettingsPage = window.location.pathname.endsWith("/settings.html");

function changeSetting(settingName, value) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/source-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function highlightSourceLines(match) {
}
}

const handleSourceHighlight = (function () {
const handleSourceHighlight = (function() {
let prev_line_id = 0;

const set_fragment = name => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const darkThemes = ["dark", "ayu"];
window.currentTheme = document.getElementById("themeStyle");
window.mainTheme = document.getElementById("mainThemeStyle");

const settingsDataset = (function () {
const settingsDataset = (function() {
const settingsElement = document.getElementById("default-settings");
if (settingsElement === null) {
return null;
Expand Down Expand Up @@ -163,7 +163,7 @@ function useSystemTheme(value) {
}
}

const updateSystemTheme = (function () {
const updateSystemTheme = (function() {
if (!window.matchMedia) {
// fallback to the CSS computed value
return () => {
Expand Down

0 comments on commit d932610

Please sign in to comment.