Skip to content

Commit 0fb90f3

Browse files
authored
Rollup merge of rust-lang#56523 - JohnHeitmann:es6, r=GuillaumeGomez
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. Eslint better supports modern js, and will be a good pre-TypeScript code quality aid. Install eslint with `npm install -g eslint`. Run with `eslint html/static/*.js`, or let your IDE do it. This requires no build step. Upcoming changes will start fixing identified bugs and other lints (mostly unused and var redef issues).
2 parents 39d4c0c + 5d7cf59 commit 0fb90f3

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": "eslint:recommended",
7+
"parserOptions": {
8+
"ecmaVersion": 2015,
9+
"sourceType": "module"
10+
},
11+
"rules": {
12+
"linebreak-style": [
13+
"error",
14+
"unix"
15+
],
16+
"semi": [
17+
"error",
18+
"always"
19+
]
20+
}
21+
};

src/librustdoc/html/static/main.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
* except according to those terms.
1111
*/
1212

13-
/*jslint browser: true, es5: true */
14-
/*globals $: true, rootPath: true */
13+
// From rust:
14+
/* global ALIASES, currentCrate, rootPath */
15+
16+
// Local js definitions:
17+
/* global addClass, getCurrentValue, hasClass */
18+
/* global isHidden onEach, removeClass, updateLocalStorage */
1519

1620
if (!String.prototype.startsWith) {
1721
String.prototype.startsWith = function(searchString, position) {

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

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
* except according to those terms.
1111
*/
1212

13+
// From rust:
14+
/* global sourcesIndex */
15+
16+
// Local js definitions:
17+
/* global addClass, getCurrentValue, hasClass, removeClass, updateLocalStorage */
18+
1319
function getCurrentFilePath() {
1420
var parts = window.location.pathname.split("/");
1521
var rootPathParts = window.rootPath.split("/");

src/librustdoc/html/static/storage.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
* except according to those terms.
1111
*/
1212

13+
// From rust:
14+
/* global resourcesSuffix */
15+
1316
var currentTheme = document.getElementById("themeStyle");
1417
var mainTheme = document.getElementById("mainThemeStyle");
1518

0 commit comments

Comments
 (0)