From 56ace3e870352f1b6c49426b1e40a6260b94b260 Mon Sep 17 00:00:00 2001 From: John Heitmann Date: Tue, 4 Dec 2018 13:59:27 -0800 Subject: [PATCH 1/2] Added a bare-bones eslint config (removing jslint) This change removes the small bit of jslint config, replacing it with eslint. I've currently configured eslint to mostly only report the more serious of lints, although there are still some style nits turned on. Upcoming changes will start fixing lints. --- src/librustdoc/html/static/.eslintrc.js | 21 +++++++++++++++++++++ src/librustdoc/html/static/main.js | 8 ++++++-- src/librustdoc/html/static/source-script.js | 6 ++++++ src/librustdoc/html/static/storage.js | 3 +++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/librustdoc/html/static/.eslintrc.js diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js new file mode 100644 index 0000000000000..fbfb0e76494b4 --- /dev/null +++ b/src/librustdoc/html/static/.eslintrc.js @@ -0,0 +1,21 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2015, + "sourceType": "module" + }, + "rules": { + "linebreak-style": [ + "error", + "unix" + ], + "semi": [ + "error", + "always" + ] + } +}; \ No newline at end of file diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 781f99cd6932f..c82d171b69f70 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -10,8 +10,12 @@ * except according to those terms. */ -/*jslint browser: true, es5: true */ -/*globals $: true, rootPath: true */ +// From rust: +/* global ALIASES, currentCrate, rootPath */ + +// Local js definitions: +/* global addClass, getCurrentValue, hasClass */ +/* global isHidden onEach, removeClass, updateLocalStorage */ if (!String.prototype.startsWith) { String.prototype.startsWith = function(searchString, position) { diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js index 1db8218dae6f2..03b0955a34c31 100644 --- a/src/librustdoc/html/static/source-script.js +++ b/src/librustdoc/html/static/source-script.js @@ -10,6 +10,12 @@ * except according to those terms. */ +// From rust: +/* global sourcesIndex */ + +// Local js definitions: +/* global addClass, getCurrentValue, hasClass, removeClass, updateLocalStorage */ + function getCurrentFilePath() { var parts = window.location.pathname.split("/"); var rootPathParts = window.rootPath.split("/"); diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index 150001a751445..e8f0c03d91aa6 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -10,6 +10,9 @@ * except according to those terms. */ +// From rust: +/* global resourcesSuffix */ + var currentTheme = document.getElementById("themeStyle"); var mainTheme = document.getElementById("mainThemeStyle"); From 5d7cf59e94ea1ee5480ac083e5b6949deec9fb2f Mon Sep 17 00:00:00 2001 From: John Heitmann Date: Tue, 4 Dec 2018 16:13:04 -0800 Subject: [PATCH 2/2] Added trailing newline --- src/librustdoc/html/static/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index fbfb0e76494b4..c7af41ac969ce 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -18,4 +18,4 @@ module.exports = { "always" ] } -}; \ No newline at end of file +};