Skip to content

Commit e323854

Browse files
Rollup merge of rust-lang#96805 - Folyd:eslint, r=GuillaumeGomez
Change eslint rules from configuration comments to configuration file Repeatedly declaring eslint rules in source files is an annoying thing, we should move those rules into the eslint configuration file. r? `@GuillaumeGomez`
2 parents a6b5955 + a8ede12 commit e323854

File tree

9 files changed

+5
-31
lines changed

9 files changed

+5
-31
lines changed

src/ci/docker/host-x86_64/mingw-check/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
4141
/scripts/validate-error-codes.sh && \
4242
# Runs checks to ensure that there are no ES5 issues in our JS code.
4343
es-check es6 ../src/librustdoc/html/static/js/*.js && \
44-
eslint ../src/librustdoc/html/static/js/*.js
44+
eslint -c ../src/librustdoc/html/static/.eslintrc.js ../src/librustdoc/html/static/js/*.js

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ module.exports = {
1616
"semi": [
1717
"error",
1818
"always"
19-
]
19+
],
20+
"no-var": ["error"],
21+
"prefer-const": ["error"],
22+
"prefer-arrow-callback": ["error"],
2023
}
2124
};

src/librustdoc/html/static/js/externs.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// This file contains type definitions that are processed by the Closure Compiler but are
22
// not put into the JavaScript we include as part of the documentation. It is used for
33
// type checking. See README.md in this directory for more info.
4-
/* eslint-env es6 */
5-
/* eslint no-var: "error" */
6-
/* eslint prefer-const: "error" */
74

85
/* eslint-disable */
96
let searchState;

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

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
51
// Local js definitions:
62
/* global addClass, getSettingValue, hasClass, searchState */
73
/* global onEach, onEachLazy, removeClass */

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

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
51
/* global addClass, hasClass, removeClass, onEachLazy */
62

73
"use strict";

src/librustdoc/html/static/js/search.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
51
/* global addClass, getNakedUrl, getSettingValue, hasOwnPropertyRustdoc, initSearch, onEach */
62
/* global onEachLazy, removeClass, searchState, browserSupportsHistoryApi */
73

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

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
51
// Local js definitions:
62
/* global getSettingValue, getVirtualKey, updateLocalStorage, updateSystemTheme */
73
/* global addClass, removeClass, onEach, onEachLazy, NOT_DISPLAYED_ID */

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

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
5-
61
// From rust:
72
/* global search, sourcesIndex */
83

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

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/* eslint-env es6 */
2-
/* eslint no-var: "error" */
3-
/* eslint prefer-const: "error" */
4-
/* eslint prefer-arrow-callback: "error" */
5-
61
"use strict";
72

83
const darkThemes = ["dark", "ayu"];

0 commit comments

Comments
 (0)