Skip to content

Commit

Permalink
Migration 004: Add Prettier w/ configuration (#5031)
Browse files Browse the repository at this point in the history
* Add Prettier to devDependencies

* Add .prettierrc

Co-Authored-By: ExE-Boss <3889017+ExE-Boss@users.noreply.github.com>

* Add .prettierignore

Co-Authored-By: ExE-Boss <3889017+ExE-Boss@users.noreply.github.com>

* Add Prettier to lint and fix scripts

* Remove check from lint for now (whoops)

* Limit prettier fixes to just JS/TS files

* Add migration script file
  • Loading branch information
queengooborg authored and ddbeck committed Dec 2, 2019
1 parent bb63325 commit 7a60241
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.json
!/*.json
!/schemas/*.json

LICENSE
.*ignore
.git*
.editorconfig
/package-lock.json
/CODE_OF_CONDUCT.md
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"singleQuote": true,
"trailingComma": "all"
}
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
"compare-versions": "^3.5.1",
"mdn-confluence": "^1.0.3",
"ora": "^4.0.3",
"prettier": "^1.18.2",
"yargs": "^15.0.2"
},
"scripts": {
"confluence": "node ./node_modules/mdn-confluence/main/generate.es6.js --output-dir=. --bcd-module=./index.js",
"lint": "node test/lint",
"fix": "node scripts/fix",
"fix": "node scripts/fix; prettier --write **/*.js **/*.ts",
"stats": "node scripts/statistics",
"release-notes": "node scripts/release-notes",
"show-errors": "npm test 1> /dev/null",
Expand Down
9 changes: 9 additions & 0 deletions scripts/migrations/004-prettify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

'use strict';

const { exec } = require('child_process');

exec("npx prettier --write **/*.js **/*.ts");

0 comments on commit 7a60241

Please sign in to comment.