Commit Graph

238 Commits

Author SHA1 Message Date
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
Jonas Jenwald
ad915f8af1 Fix errors reported by the comma-spacing ESLint rule
http://eslint.org/docs/rules/comma-spacing
2016-12-12 20:35:53 +01:00
Adhika Setya Pramudita
906b8ea907 Make: include minified library files for the distribution target
Fixes #5487.
2016-11-23 17:35:19 +01:00
Yury Delendik
1369997bbf Properly invoke 'gulp' in make.js and fail when it fails. 2016-10-17 08:47:05 -05:00
Tim van der Meij
224e3a42a2 Gulp: port the all, extension and jsdoc targets
This requires the `run-sequence` dependency because Gulp does not have a
way to run sequences of tasks inside a Gulp task. Gulp 4.0 will have
support for this, but until that is released this is the recommended way
to implement it.
2016-10-16 22:17:25 +02:00
Yury Delendik
0576c9c6c6 Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
Tim van der Meij
79db293c36 Stop building the AMO extension
The AMO extension is no longer supported as PDF.js is integrated in
Firefox. It was already removed from the bot's preview messages around a
year ago and has not been used or updated since.
2016-08-03 14:44:18 +02:00
Tim van der Meij
b25bc27498 Remove B2G extension building target 2016-07-27 17:31:52 +02:00
klemens
6f03f62327 trivial spelling fixes 2016-07-17 14:33:41 +02:00
Jonas Jenwald
a69e862bc4 [Firefox addon] Remove compatibility.js
This was added in PR 4865, but hasn't been necessary for quite some time now (and the minimum version is currently Firefox 38 for the addon).
2016-07-09 17:59:06 +02:00
Tim van der Meij
6a7012aaca Remove unused variables
These have been found using `gulp lint` in combination with the `unused:
true` parameter for JSHint. Unfortunately there are too many false
positives to enable this feature, but now that most globals have been
removed because of the conversion to UMD the results are much more
useful than before.
2016-05-11 16:11:13 +02:00
Yury Delendik
fe6001363d Moves all testing into gulpfile. 2016-05-02 09:58:29 -05:00
Tim van der Meij
5166b46a1c Port the publish target to Gulp 2016-04-27 12:54:57 +02:00
Yury Delendik
5568a19ee3 Moves bundle target/task to gulpfile.js 2016-04-24 08:37:39 -05:00
Yury Delendik
3132941948 Removes app.js dependency on mozPrintCallback_polyfill.js. 2016-04-24 08:25:55 -05:00
Yury Delendik
81fc46e666 Refactors FindController dependencies. 2016-04-24 08:25:55 -05:00
Yury Delendik
6282ec24d1 Merge pull request #7172 from yurydelendik/umd-web
Introduces UMD headers to the web/ folder.
2016-04-13 10:23:23 -05:00
Yury Delendik
006e8fb59d Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
Yury Delendik
ae415f9e80 Removing "entry-loader" dependency from webpack. 2016-04-13 08:24:25 -05:00
Brendan Dahl
68e8f5fff5 Merge pull request #7126 from yurydelendik/rm-pdfjs-display
Move all PDFJS display/ usages into global.js file.
2016-04-07 11:47:58 -07:00
Yury Delendik
1d12aed5ca Move all PDFJS.xxx settings into display/global. 2016-04-07 13:46:07 -05:00
Yury Delendik
38c41d86c6 Specifies package format for jspm. 2016-04-07 11:52:56 -05:00
Yury Delendik
d7d7935648 Initial browserify example. 2016-04-04 11:32:01 -05:00
Jonas Jenwald
8f097abb46 Allow unit-tests to use linked PDF files, by having the unittest command download unavailable ones (issue 7117) 2016-03-27 13:17:55 +02:00
Tim van der Meij
2b6d7ba3ec Gulp: allow passing parameters and revert one node make renaming 2016-03-13 21:53:17 +01:00
Tim van der Meij
96cca2b37a Migrate clean and importl10n target to gulp 2016-03-04 21:14:56 +01:00
Tim van der Meij
b8aaa24257 Convert all node make instances to gulp 2016-03-04 20:30:36 +01:00
Yury Delendik
9798e1007e Introducing gulp. 2016-03-04 09:36:46 -06:00
Timothy Gu
e403f52722 Use UglifyJS to minify files in minified target
It is written in JavaScript, is less buggy, and compresses better.
2016-01-31 13:55:23 -08:00
Yury Delendik
f340dd5cd5 Adds pdfjs/main_loader module to better mirror pdfjs-dist/build/pdf. 2015-12-30 13:28:57 -06:00
Yury Delendik
cbbb9bb82d Adds UMD header to pdf.js and pdf.worker.js files. 2015-12-29 18:15:14 -06:00
Yury Delendik
2f8ae38276 Use UMD headers to detect module loading order. 2015-12-29 09:20:53 -06:00
Yury Delendik
fc3282db56 Adds RequireJS to worker. 2015-12-29 09:20:52 -06:00
Yury Delendik
79c2f69c32 Adds/modifies examples for node.js and webpack. 2015-12-21 13:46:50 -06:00
Yury Delendik
65de3d6268 Merge pull request #6765 from timvandermeij/unused
Remove unused variables
2015-12-18 10:43:40 -06:00
Tim van der Meij
df81b832bb Remove unused variables 2015-12-16 23:52:16 +01:00
Yury Delendik
2f704f5957 Collapses UMD headers in bundled files. 2015-12-16 07:42:54 -06:00
Yury Delendik
450edc95cc UMD validation and generation tools. 2015-12-15 13:24:39 -06:00
Yury Delendik
6b60c8f4db Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
Tim van der Meij
1b5940edd2 Merge pull request #6714 from timvandermeij/annotation-web-to-src
[api-minor] Move annotation DOM manipulation logic to src/display/annotation_layer.js
2015-12-15 19:06:48 +01:00
Jonas Jenwald
d6c2ced9e6 Let Travis lint using node make lint, instead of a hard-coded command 2015-12-10 10:06:32 +01:00
Tim van der Meij
91274d6d2d Rename annotation_helper.js to annotation_layer.js 2015-12-02 23:30:28 +01:00
Jonas Jenwald
c310a3790e Make stripCommentHeaders less greedy, to ensure that it doesn't eat 'use strict' directive at the top of files (PR 6627 follow-up)
While browsing through the latest PDF.js update on mozilla-central, see https://hg.mozilla.org/integration/fx-team/rev/aef06cd725fc, I noticed that the `'use strict';` directives were missing at the top of a number of files.
This is fallout from the changes made in `make.js` in PR 6627, since `stripCommentHeaders` previously relied on the existence of the mode-lines.

I'm assuming that we do want *all* of the code (e.g. the viewer too) to execute in strict mode, hence this patch tweaks `stripCommentHeaders` to make it less greedy.
2015-11-22 14:17:37 +01:00
Yury Delendik
56ccaea99b Move text layer building logic into src/display/text_layer.js 2015-11-19 10:50:27 -06:00
Yury Delendik
2f34fd46cb Move CustomStyle. 2015-11-19 10:47:17 -06:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Yury Delendik
4c9f6741ae Remove mozcentral test files. 2015-11-11 15:54:17 -06:00
Yury Delendik
2b5fde1259 Pushing update reason for gh-pages and bower.
e.g. mozilla/pdf.js@eabbfd78d1
2015-10-23 10:56:40 -05:00
Dhole
de83de0a58 Set TZ=UTC before calls to zip
This change allows to make the package build reproducible.

Bug-Debian: https://bugs.debian.org/793127
2015-08-29 14:52:19 -04:00
Yury Delendik
4f3f983a21 Removes PdfRedirector.js and PlayPreview support. 2015-08-06 10:38:45 -05:00