diff --git a/.eslintignore b/.eslintignore index 04322373a523..edaf07d30d7c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,6 +8,7 @@ # - build directories and other items that we need to ignore !.eslintrc*.js +!.prettierrc.js # Always ignore node_modules. **/node_modules/ diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b8039f84304a..000000000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "endOfLine": "lf", - "printWidth": 80, - "tabWidth": 2, - "trailingComma": "es5" -} diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000000..f80499fe0e94 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* eslint-env node */ + +module.exports = { + endOfLine: "lf", + printWidth: 80, + tabWidth: 2, + trailingComma: "es5", +}; diff --git a/devtools/client/debugger/.prettierrc.js b/devtools/client/debugger/.prettierrc.js index 71adaa1aa9e5..0740b7799711 100644 --- a/devtools/client/debugger/.prettierrc.js +++ b/devtools/client/debugger/.prettierrc.js @@ -2,23 +2,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const fs = require("fs"); +"use strict"; + +// eslint-disable-next-line mozilla/reject-relative-requires +const topLevelPrettier = require("../../../.prettierrc.js"); module.exports = { - ...JSON.parse(fs.readFileSync(__dirname + "/../../../.prettierrc")), + ...topLevelPrettier, overrides: [ { - files: [ - "src/**/*.js", - "packages/*/src/**/*.js", - ], + files: ["src/**/*.js", "packages/*/src/**/*.js"], options: { // The debugger uses Babel 7 and some newer Flow features. // Unfortunately, Prettier has not yet adopted a version of Babel's // parser with this fix: https://github.com/babel/babel/pull/9891 // That necessitates us to override to config to explicitly tell // Prettier that our files contain Flowtype annotations. - "parser": "babel-flow" + parser: "babel-flow", }, }, ],