pdf.js/web
Jonas Jenwald 2f3805efbc Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*

ESLint has a number of advantageous properties, compared to JSHint. Among those are:
 - The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
 - Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
 - Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
 - The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
 - More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.

By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.

I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.

Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).

A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
 - `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
 - `object-curly-spacing`, controls spacing inside of Objects.
 - `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)

Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.

Useful links:
 - http://eslint.org/docs/user-guide/configuring
 - http://eslint.org/docs/rules/
2016-12-16 21:06:36 +01:00
..
images optimize png images using zopflipng 2016-07-10 17:49:16 +08:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Choice widget annotations: core and display layer implementation 2016-10-05 21:25:29 +02:00
annotation_layer_builder.js Interactive forms: remove global PDFJS usage 2016-09-19 00:12:42 +02:00
app.js Convert the only remaining consumer (in hand_tool.js) of the 'localized' event to use the localized Promise instead, and only re-dispatch the 'localized' event on the eventBus for GENERIC builds 2016-12-14 16:19:10 +01:00
chrome-i18n-allow-access-to-file-urls.json Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
chromecom.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
compatibility.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
default_preferences.js Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
default_preferences.json Adds SVG rendering capabilities to the PDFViewer. 2016-11-18 13:03:49 -06:00
dom_events.js Remove the previousPageNumber parameter from the pagechanging/pagechange` events, and stop dispatching the events if the input is out of bounds 2016-07-25 10:08:53 +02:00
download_manager.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
firefox_print_service.js Removes mozPrintCallback polyfill, converts canvas to PNG. 2016-10-11 10:08:13 -05:00
firefoxcom.js Fix errors reported by the no-extra-bind ESLint rule 2016-12-12 20:35:50 +01:00
grab_to_pan.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
hand_tool.js Convert the only remaining consumer (in hand_tool.js) of the 'localized' event to use the localized Promise instead, and only re-dispatch the 'localized' event on the eventBus for GENERIC builds 2016-12-14 16:19:10 +01:00
interfaces.js Interactive forms: remove global PDFJS usage 2016-09-19 00:12:42 +02:00
overlay_manager.js Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
password_prompt.js Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
pdf_attachment_viewer.js Adds EventBus. 2016-04-28 06:57:24 -05:00
pdf_document_properties.js Fix errors reported by the comma-spacing ESLint rule 2016-12-12 20:35:53 +01:00
pdf_find_bar.js Added multiple term search functionality (with default phrase search) 2016-05-26 18:24:58 +05:00
pdf_find_controller.js Prevent destinations with bad left/top values from scrolling the wrong page into view (bug 874482) 2016-08-07 16:20:18 +02:00
pdf_history.js Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
pdf_link_service.js Remove/deprecate specifying a pageNumber directly after the hash symbol (#), to improve compatibility since other PDF viewers don't support this form (issue 7746) 2016-10-27 23:25:53 +02:00
pdf_outline_viewer.js Update PDFOutlineViewer_bindLink to look more like LinkAnnotationElement_bindLink 2016-10-23 16:08:26 +02:00
pdf_page_view.js Return a mock object in paintOnSvg when SVG rendering is not supported, to prevent TypeErrors in the addons 2016-11-19 13:32:17 +01:00
pdf_presentation_mode.js Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
pdf_print_service.js Refactor printing: startPrint -> performPrint 2016-10-30 12:03:24 +01:00
pdf_rendering_queue.js Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
pdf_sidebar.js Adds EventBus. 2016-04-28 06:57:24 -05:00
pdf_thumbnail_view.js Add PageLabels to PDFPageView and PDFThumbnailView 2016-10-26 13:30:37 +02:00
pdf_thumbnail_viewer.js Add PageLabels to PDFPageView and PDFThumbnailView 2016-10-26 13:30:37 +02:00
pdf_viewer.component.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
pdf_viewer.css Better components examples. 2016-04-28 13:30:03 -05:00
pdf_viewer.js Adds SVG rendering capabilities to the PDFViewer. 2016-11-18 13:03:49 -06:00
pdfjs.js Replace pdfjsLib with module that represents pdf.js. 2016-04-13 10:11:34 -05:00
preferences.js Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
secondary_toolbar.js Fix errors reported by the no-extra-bind ESLint rule 2016-12-12 20:35:50 +01:00
text_layer_builder.css Use default line height for the text layer 2015-12-02 23:00:12 +01:00
text_layer_builder.js Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
toolbar.js Refactor toolbar (and secondary toolbar). 2016-11-18 12:51:15 -06:00
ui_utils.js Fix errors reported by the keyword-spacing ESLint rule 2016-12-12 20:35:56 +01:00
view_history.js Rename the ViewHistory localStorage (and sessionStorage) key from database to pdfjs.history, and migrate existing data on read (issue 7760) 2016-11-21 21:03:37 +01:00
viewer-snippet-chrome-extension.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer-snippet-chrome-overlays.html Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
viewer-snippet-firefox-extension.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer.css Viewer: remove unused CSS rule 2016-11-24 23:44:57 +01:00
viewer.html Make the customScaleOption disabled to prevent it being keyboard accessible (bug 1315608) 2016-11-08 12:04:55 +01:00
viewer.js Fix errors reported by the key-spacing ESLint rule 2016-12-12 20:35:55 +01:00