Skip to content

Commit d932610

Browse files
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`
2 parents b792741 + bb29d5d commit d932610

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

src/librustdoc/html/static/.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,12 @@ module.exports = {
4747
{ "beforeColon": false, "afterColon": true, "mode": "strict" }
4848
],
4949
"func-call-spacing": ["error", "never"],
50+
"space-infix-ops": "error",
51+
"space-before-function-paren": ["error", "never"],
52+
"space-before-blocks": "error",
53+
"comma-dangle": ["error", "always-multiline"],
54+
"comma-style": ["error", "last"],
55+
"max-len": ["error", { "code": 100, "tabWidth": 4 }],
56+
"eol-last": ["error", "always"],
5057
}
5158
};

src/librustdoc/html/static/js/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function showMain() {
6363
removeClass(document.getElementById(MAIN_ID), "hidden");
6464
}
6565

66-
(function () {
66+
(function() {
6767
window.rootPath = getVar("root-path");
6868
window.currentCrate = getVar("current-crate");
6969
window.searchJS = resourcePath("search", ".js");
@@ -929,7 +929,7 @@ function loadCss(cssFileName) {
929929
searchState.setup();
930930
}());
931931

932-
(function () {
932+
(function() {
933933
let reset_button_timeout = null;
934934

935935
window.copy_path = but => {

src/librustdoc/html/static/js/scrape-examples.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"use strict";
44

5-
(function () {
5+
(function() {
66
// Number of lines shown when code viewer is not expanded
77
const MAX_LINES = 10;
88

src/librustdoc/html/static/js/settings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"use strict";
77

8-
(function () {
8+
(function() {
99
const isSettingsPage = window.location.pathname.endsWith("/settings.html");
1010

1111
function changeSetting(settingName, value) {

src/librustdoc/html/static/js/source-script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function highlightSourceLines(match) {
187187
}
188188
}
189189

190-
const handleSourceHighlight = (function () {
190+
const handleSourceHighlight = (function() {
191191
let prev_line_id = 0;
192192

193193
const set_fragment = name => {

src/librustdoc/html/static/js/storage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const darkThemes = ["dark", "ayu"];
44
window.currentTheme = document.getElementById("themeStyle");
55
window.mainTheme = document.getElementById("mainThemeStyle");
66

7-
const settingsDataset = (function () {
7+
const settingsDataset = (function() {
88
const settingsElement = document.getElementById("default-settings");
99
if (settingsElement === null) {
1010
return null;
@@ -163,7 +163,7 @@ function useSystemTheme(value) {
163163
}
164164
}
165165

166-
const updateSystemTheme = (function () {
166+
const updateSystemTheme = (function() {
167167
if (!window.matchMedia) {
168168
// fallback to the CSS computed value
169169
return () => {

0 commit comments

Comments
 (0)