Commit Graph

7 Commits

Author SHA1 Message Date
Jonas Jenwald
426945b480 Update Prettier to version 2.0
Please note that these changes were done automatically, using `gulp lint --fix`.

Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html
In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
2020-04-14 12:28:14 +02:00
Jonas Jenwald
de36b2aaba Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).

Prettier is being used for a couple of reasons:

 - To be consistent with `mozilla-central`, where Prettier is already in use across the tree.

 - To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.

Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.

*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.

(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-26 12:34:24 +01:00
Jonas Jenwald
4a906955c4 Fix the remaining cases of inconsistent spacing and trailing commas in objects, and enable the comma-dangle and object-curly-spacing ESLint rules
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing

*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.

```diff
diff --git a/gulpfile.js b/gulpfile.js
index d18b9c58..7d47fd8d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1247,7 +1247,8 @@ gulp.task('gh-pages-git', ['gh-pages-prepare', 'wintersmith'], function () {
   var reason = process.env['PDFJS_UPDATE_REASON'];

   safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, });
-  safeSpawnSync('git', ['remote', 'add', 'origin', REPO], { cwd: GH_PAGES_DIR, });
+  safeSpawnSync('git', ['remote', 'add', 'origin', REPO],
+                { cwd: GH_PAGES_DIR, });
   safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, });
   safeSpawnSync('git', [
     'commit', '-am', 'gh-pages site created via gulpfile.js script',
```
2017-06-03 23:35:37 +02:00
Yury Delendik
66c8893815 Removes last UMDs from the modules. 2017-05-31 07:14:17 -05:00
Yury Delendik
c9d3c20e2c Fix esprima tests. 2017-05-04 08:24:44 -05:00
Jonas Jenwald
fe9a561d45 Actually increment the errors counter on failures in test-fixtures.js/test_fixtures_esprima.js, so that the test runners won't incorrectly report that the tests passed 2017-01-10 14:45:36 +01:00
Jonas Jenwald
cf00516f04 Rename the external/builder/test*.js files to make it more obvious what they test
Currently you have to open the files to be certain which tests each one will run, which we can avoid by appending the directory names to the file names of the tests themselves.
2017-01-10 14:27:05 +01:00