Bug 1556013 - Add prettier to the top-level eslint config, r=Standard8
authorVictor Porof <vporof@mozilla.com>
Fri, 07 Jun 2019 14:20:09 +0000
changeset 477853 894a44c472727258338f2d013243c9b821a62686
parent 477852 b50cc27685799e82400e75b7823efb90b4705808
child 477854 4c8aa3c1d1234d5c7c4ff5c8da26ff307e4e0a92
push id36125
push userapavel@mozilla.com
push dateFri, 07 Jun 2019 22:00:07 +0000
treeherdermozilla-central@d820bbb356aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1556013
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1556013 - Add prettier to the top-level eslint config, r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D33303
.eslintignore
.prettierignore
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
tools/lint/eslint/eslint-plugin-mozilla/package.json
--- a/.eslintignore
+++ b/.eslintignore
@@ -134,27 +134,16 @@ devtools/client/debugger/src/test/integr
 devtools/client/debugger/src/test/unit-sources/**
 devtools/client/debugger/src/**/fixtures/**
 devtools/client/debugger/src/test/mochitest/**
 devtools/client/debugger/bin/
 devtools/client/debugger/packages/**/fixtures/**
 devtools/client/debugger/node_modules
 devtools/client/debugger/out
 
-# Ignore devtools debugger files
-# Keep in sync with devtools/client/debugger/.prettierignore
-devtools/client/debugger/src/workers/parser/tests/fixtures/functionNames.js
-devtools/client/debugger/src/workers/parser/tests/fixtures/scopes/*.js
-devtools/client/debugger/src/workers/parser/tests/fixtures/pause/*.js
-devtools/client/debugger/src/test/mochitest/examples/babel/polyfill-bundle.js
-devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/input.js
-devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/output.js
-devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/output.js.map
-devtools/client/debugger/src/test/mochitest/examples/ember/quickstart
-
 # Ignore devtools debugger files which aren't intended for linting, and also
 # aren't included in any .eslintignore or .prettierignore file.
 # See https://github.com/firefox-devtools/debugger/blob/master/package.json#L24
 devtools/client/debugger/configs/**
 devtools/client/debugger/dist/**
 devtools/client/debugger/flow-typed/**
 devtools/client/debugger/images/**
 devtools/client/debugger/test/**
new file mode 100644
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,93 @@
+# This list automatically picks up exclusions from .eslintignore
+
+# Ignore all top-level directories for now.
+accessible/**
+browser/**
+build/**
+caps/**
+chrome/**
+config/**
+db/**
+docshell/**
+dom/**
+editor/**
+extensions/**
+gfx/**
+gradle/**
+hal/**
+image/**
+intl/**
+ipc/**
+js/**
+layout/**
+media/**
+memory/**
+mfbt/**
+mobile/**
+modules/**
+mozglue/**
+netwerk/**
+node_modules/**
+nsprpub/**
+other-licenses/**
+parser/**
+python/**
+remote/**
+security/**
+services/**
+servo/**
+startupcache/**
+storage/**
+taskcluster/**
+testing/**
+third_party/**
+toolkit/**
+tools/**
+uriloader/**
+view/**
+widget/**
+xpcom/**
+xpfe/**
+
+# Ignore all devtools directories for now, except the debugger.
+devtools/client/*.js
+devtools/client/aboutdebugging/**
+devtools/client/aboutdebugging-new/**
+devtools/client/accessibility/**
+devtools/client/application/**
+devtools/client/bin/**
+devtools/client/dom/**
+devtools/client/framework/**
+devtools/client/inspector/**
+devtools/client/jsonview/**
+devtools/client/locales/**
+devtools/client/memory/**
+devtools/client/netmonitor/**
+devtools/client/performance/**
+devtools/client/performance-new/**
+devtools/client/preferences/**
+devtools/client/responsive.html/**
+devtools/client/scratchpad/**
+devtools/client/shared/**
+devtools/client/storage/**
+devtools/client/styleeditor/**
+devtools/client/themes/**
+devtools/client/webconsole/**
+devtools/client/webide/**
+devtools/client/webreplay/**
+devtools/docs/**
+devtools/platform/**
+devtools/server/**
+devtools/shared/**
+devtools/startup/**
+
+# Ignore devtools debugger files
+# Keep in sync with devtools/client/debugger/.prettierignore
+devtools/client/debugger/src/workers/parser/tests/fixtures/functionNames.js
+devtools/client/debugger/src/workers/parser/tests/fixtures/scopes/*.js
+devtools/client/debugger/src/workers/parser/tests/fixtures/pause/*.js
+devtools/client/debugger/src/test/mochitest/examples/babel/polyfill-bundle.js
+devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/input.js
+devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/output.js
+devtools/client/debugger/src/test/mochitest/examples/babel/fixtures/*/output.js.map
+devtools/client/debugger/src/test/mochitest/examples/ember/quickstart
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -79,16 +79,17 @@ module.exports = {
     "ecmaVersion": 9,
   },
 
   // When adding items to this file please check for effects on sub-directories.
   "plugins": [
     "fetch-options",
     "mozilla",
     "no-unsanitized",
+    "prettier",
   ],
 
   // When adding items to this file please check for effects on all of toolkit
   // and browser
   "rules": {
     // Require spacing around =>
     "arrow-spacing": "error",
 
@@ -336,16 +337,19 @@ module.exports = {
     "no-with": "error",
 
     // Require object-literal shorthand with ES6 method syntax
     "object-shorthand": ["error", "always", { "avoidQuotes": true }],
 
     // Prohibit blank lines at the beginning and end of blocks.
     "padded-blocks": ["error", "never"],
 
+    // Formatting.
+    "prettier/prettier": "error",
+
     // Require double-quotes everywhere, except where quotes are escaped
     // or template literals are used.
     "quotes": ["error", "double", {
       "allowTemplateLiterals": true,
       "avoidEscape": true,
     }],
 
     // XXX Bug 1487642 - decide if we want to enable this or not.
--- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "1.2.1",
+  "version": "1.3.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "@babel/code-frame": {
       "version": "7.0.0",
       "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
       "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
       "dev": true,
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "1.2.1",
+  "version": "1.3.0",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],
@@ -25,17 +25,20 @@
     "htmlparser2": "3.10.1"
   },
   "devDependencies": {
     "eslint": "5.16.0",
     "mocha": "6.1.4"
   },
   "peerDependencies": {
     "eslint": "^5.0.1",
-    "eslint-plugin-no-unsanitized": "^3.0.0"
+    "eslint-config-prettier": "^4.2.0",
+    "eslint-plugin-prettier": "^3.0.1",
+    "eslint-plugin-no-unsanitized": "^3.0.0",
+    "prettier": "^1.17.0"
   },
   "engines": {
     "node": ">=6.9.1"
   },
   "scripts": {
     "prepack": "node scripts/createExports.js",
     "test": "mocha --reporter 'reporters/mozilla-format.js' tests",
     "postpublish": "rm -f lib/modules.json lib/environments/saved-globals.json lib/rules/saved-rules-data.json",