Rollup merge of #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``
This commit is contained in:
Guillaume Gomez 2022-05-07 15:23:48 +02:00 committed by GitHub
commit f98f92fdaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 5 additions and 31 deletions

View File

@ -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

View File

@ -16,6 +16,9 @@ module.exports = {
"semi": [
"error",
"always"
]
],
"no-var": ["error"],
"prefer-const": ["error"],
"prefer-arrow-callback": ["error"],
}
};

View File

@ -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;

View File

@ -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 */

View File

@ -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";

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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"];