Skip to content

Add more eslint rules #97394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/librustdoc/html/static/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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
@@ -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");
@@ -929,7 +929,7 @@ function loadCss(cssFileName) {
searchState.setup();
}());

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

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

"use strict";

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

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

"use strict";

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

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

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

const set_fragment = name => {
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
@@ -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;
@@ -163,7 +163,7 @@ function useSystemTheme(value) {
}
}

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