Rollup merge of #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).
This commit is contained in:
Pietro Albini 2018-12-05 23:54:38 +01:00 committed by GitHub
commit 0fb90f372e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 2 deletions

View file

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

View file

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

View file

@ -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("/");

View file

@ -10,6 +10,9 @@
* except according to those terms.
*/
// From rust:
/* global resourcesSuffix */
var currentTheme = document.getElementById("themeStyle");
var mainTheme = document.getElementById("mainThemeStyle");