diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-05-07 15:23:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-07 15:23:48 +0200 |
| commit | f98f92fdaf66db8bde12b960c66429c19c0ec7e8 (patch) | |
| tree | 1e6ff386b2089264d5a6899c5c0789e3b323ea3b /src | |
| parent | 27a2bae89ced19bee662c5caccd20f9e111a7d54 (diff) | |
| parent | a8ede1248d837bc2ecdc99b00e45ec378c3fd156 (diff) | |
| download | rust-f98f92fdaf66db8bde12b960c66429c19c0ec7e8.tar.gz rust-f98f92fdaf66db8bde12b960c66429c19c0ec7e8.zip | |
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``
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/docker/host-x86_64/mingw-check/Dockerfile | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/.eslintrc.js | 5 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/externs.js | 3 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/scrape-examples.js | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/settings.js | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/source-script.js | 5 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/storage.js | 5 |
9 files changed, 5 insertions, 31 deletions
diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 66333e2b992..7a34a7daaec 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -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 diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index c7af41ac969..e118ee5d5ed 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -16,6 +16,9 @@ module.exports = { "semi": [ "error", "always" - ] + ], + "no-var": ["error"], + "prefer-const": ["error"], + "prefer-arrow-callback": ["error"], } }; diff --git a/src/librustdoc/html/static/js/externs.js b/src/librustdoc/html/static/js/externs.js index de881dbd081..defdc20132e 100644 --- a/src/librustdoc/html/static/js/externs.js +++ b/src/librustdoc/html/static/js/externs.js @@ -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; diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 2d8339e8394..ea20f6e28ec 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -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 */ diff --git a/src/librustdoc/html/static/js/scrape-examples.js b/src/librustdoc/html/static/js/scrape-examples.js index 70fcef52212..544bced4c5a 100644 --- a/src/librustdoc/html/static/js/scrape-examples.js +++ b/src/librustdoc/html/static/js/scrape-examples.js @@ -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"; diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 2eafa540a1a..3d8cfeecbed 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -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 */ diff --git a/src/librustdoc/html/static/js/settings.js b/src/librustdoc/html/static/js/settings.js index e447d09ab6b..a7b60a49689 100644 --- a/src/librustdoc/html/static/js/settings.js +++ b/src/librustdoc/html/static/js/settings.js @@ -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 */ diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index f788d41d2de..92ecd200081 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -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 */ diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index 052731e99ae..69940bb89df 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -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"]; |
