Bug 1811820 - Change prettier config file from json to common js format. r=cmkm,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D167530
This commit is contained in:
Mark Banner 2023-01-24 22:53:55 +00:00
parent 6b81196ea8
commit 1a90b9c57b
4 changed files with 20 additions and 13 deletions

View File

@ -8,6 +8,7 @@
# - build directories and other items that we need to ignore # - build directories and other items that we need to ignore
!.eslintrc*.js !.eslintrc*.js
!.prettierrc.js
# Always ignore node_modules. # Always ignore node_modules.
**/node_modules/ **/node_modules/

View File

@ -1,6 +0,0 @@
{
"endOfLine": "lf",
"printWidth": 80,
"tabWidth": 2,
"trailingComma": "es5"
}

12
.prettierrc.js Normal file
View File

@ -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",
};

View File

@ -2,23 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 = { module.exports = {
...JSON.parse(fs.readFileSync(__dirname + "/../../../.prettierrc")), ...topLevelPrettier,
overrides: [ overrides: [
{ {
files: [ files: ["src/**/*.js", "packages/*/src/**/*.js"],
"src/**/*.js",
"packages/*/src/**/*.js",
],
options: { options: {
// The debugger uses Babel 7 and some newer Flow features. // The debugger uses Babel 7 and some newer Flow features.
// Unfortunately, Prettier has not yet adopted a version of Babel's // Unfortunately, Prettier has not yet adopted a version of Babel's
// parser with this fix: https://github.com/babel/babel/pull/9891 // parser with this fix: https://github.com/babel/babel/pull/9891
// That necessitates us to override to config to explicitly tell // That necessitates us to override to config to explicitly tell
// Prettier that our files contain Flowtype annotations. // Prettier that our files contain Flowtype annotations.
"parser": "babel-flow" parser: "babel-flow",
}, },
}, },
], ],