Skip to content

Commit 12dcdf7

Browse files
AliyanHprushfor
andauthored
Format Code - prettier (#790)
* initial prettier setup * update jshint options, and grunt task * Add test, update src files subject to prettier formatting Add replace jshint with format task in default build to include prettier Replace jshint single line hint with hint block to support prettier * remove trailing commas * Add formatted files --------- Co-authored-by: prushfor <prushfor@L-BSC-A146390.nrn.nrcan.gc.ca>
1 parent 3bbc255 commit 12dcdf7

137 files changed

Lines changed: 22064 additions & 16185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"overrides": [
5+
{
6+
"files": ".firebaserc",
7+
"options": { "parser": "json" }
8+
}
9+
]
10+
}

Gruntfile.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module.exports = function(grunt) {
4949
},
5050
// ensure that jshint keeps processing after an error
5151
force: true,
52-
esversion: 11
53-
52+
esversion: 11,
53+
laxbreak: true // used to fix differences with prettier
5454
}
5555
},
5656
watch: {
@@ -188,6 +188,18 @@ module.exports = function(grunt) {
188188
dest: 'dist/mapml.js',
189189
src: 'src/mapml/index.js' // Only one source file is permitted
190190
}
191+
},
192+
prettier: {
193+
options: {
194+
// https://prettier.io/docs/en/options.html
195+
progress: true
196+
},
197+
files: {
198+
src: [
199+
"src/**/*.js",
200+
"test/**/*.js"
201+
]
202+
}
191203
}
192204
});
193205

@@ -198,9 +210,10 @@ module.exports = function(grunt) {
198210
grunt.loadNpmTasks('grunt-contrib-cssmin');
199211
grunt.loadNpmTasks('grunt-contrib-clean');
200212
grunt.loadNpmTasks('grunt-rollup');
213+
grunt.loadNpmTasks('grunt-prettier');
201214

202-
grunt.registerTask('test', ['jshint']);
203-
grunt.registerTask('default', ['clean:dist', 'copy:main', 'copy:images', 'jshint', 'rollup',
215+
grunt.registerTask('format', ['prettier', 'jshint']);
216+
grunt.registerTask('default', ['clean:dist', 'copy:main', 'copy:images', 'format', 'rollup',
204217
'uglify', 'cssmin','clean:tidyup']);
205218
grunt.registerTask('experiments',['clean:experiments','default','copy:experiments']);
206219
grunt.registerTask('extension',['clean:extension','default','copy:extension']);

package-lock.json

Lines changed: 60 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"grunt-contrib-uglify": "~5.0.0",
4848
"grunt-contrib-watch": "~1.1.0",
4949
"grunt-html": "^15.2.2",
50+
"grunt-prettier": "^2.2.0",
5051
"grunt-rollup": "^11.3.0",
5152
"jest": "^26.6.3",
5253
"jest-circus": "^26.6.3",

0 commit comments

Comments
 (0)