Skip to content

Commit

Permalink
Autoformat out-wpt/ using prettier (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x authored Jun 10, 2020
1 parent ad7831f commit 8ffa354
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ module.exports = function (grunt) {
cmd: 'node',
args: ['node_modules/eslint/bin/eslint', 'src/**/*.ts', '--fix'],
},
'autoformat-out-wpt': {
cmd: 'node',
args: ['node_modules/.bin/prettier', '--write', 'out-wpt/**/*.js'],
}
},

watch: {
Expand Down Expand Up @@ -160,6 +164,7 @@ module.exports = function (grunt) {
]);
grunt.registerTask('build-wpt', 'Build out/ (no checks)', [
'run:build-out-wpt',
'run:autoformat-out-wpt',
'run:generate-version',
'run:generate-listings',
'copy:out-wpt-generated',
Expand Down
5 changes: 4 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module.exports = function (api) {
],
],
compact: false,
retainLines: true, // Keeps code *and comments* on ~the same line as in the source
// Keeps comments from getting hoisted to the end of the previous line of code.
// (Also keeps lines close to their original line numbers - but for WPT we
// reformat with prettier anyway.)
retainLines: true,
shouldPrintComment: val => !/eslint|prettier-ignore/.test(val),
};
};

0 comments on commit 8ffa354

Please sign in to comment.