Skip to content

Commit

Permalink
Rollup merge of #96805 - Folyd:eslint, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
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``
  • Loading branch information
GuillaumeGomez authored May 7, 2022
2 parents 27a2bae + a8ede12 commit f98f92f
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/mingw-check/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
/scripts/validate-error-codes.sh && \
# Runs checks to ensure that there are no ES5 issues in our JS code.
es-check es6 ../src/librustdoc/html/static/js/*.js && \
eslint ../src/librustdoc/html/static/js/*.js
eslint -c ../src/librustdoc/html/static/.eslintrc.js ../src/librustdoc/html/static/js/*.js
5 changes: 4 additions & 1 deletion src/librustdoc/html/static/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
"semi": [
"error",
"always"
]
],
"no-var": ["error"],
"prefer-const": ["error"],
"prefer-arrow-callback": ["error"],
}
};
3 changes: 0 additions & 3 deletions src/librustdoc/html/static/js/externs.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// This file contains type definitions that are processed by the Closure Compiler but are
// not put into the JavaScript we include as part of the documentation. It is used for
// type checking. See README.md in this directory for more info.
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */

/* eslint-disable */
let searchState;
Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */
// Local js definitions:
/* global addClass, getSettingValue, hasClass, searchState */
/* global onEach, onEachLazy, removeClass */
Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/js/scrape-examples.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */
/* global addClass, hasClass, removeClass, onEachLazy */

"use strict";
Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */
/* global addClass, getNakedUrl, getSettingValue, hasOwnPropertyRustdoc, initSearch, onEach */
/* global onEachLazy, removeClass, searchState, browserSupportsHistoryApi */

Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */
// Local js definitions:
/* global getSettingValue, getVirtualKey, updateLocalStorage, updateSystemTheme */
/* global addClass, removeClass, onEach, onEachLazy, NOT_DISPLAYED_ID */
Expand Down
5 changes: 0 additions & 5 deletions src/librustdoc/html/static/js/source-script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */

// From rust:
/* global search, sourcesIndex */

Expand Down
5 changes: 0 additions & 5 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/* eslint-env es6 */
/* eslint no-var: "error" */
/* eslint prefer-const: "error" */
/* eslint prefer-arrow-callback: "error" */

"use strict";

const darkThemes = ["dark", "ayu"];
Expand Down

0 comments on commit f98f92f

Please sign in to comment.