terriajs
terriajs copied to clipboard
Prettier v2
What this PR does
Enables fix of #5420
This is pretty big change for terriajs codebase but version 2 of prettier came out 2 and half years and it would be pretty good to upgrade to it. It also allows us to use import just type and some other modern syntax that was erroring on old versions.
If decided to merge it should be done the same way as the last time, by creating two new tags pre-prettier-v2 and post-prettier-v2
Checklist
- ~[ ] There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)~
- ~[ ] I've updated relevant documentation in
doc/
.~ - [ ] I've updated CHANGES.md with what I changed.
- ~[ ] I've provided instructions in the PR description on how to test this PR.~
We should extend this to also apply prettier to more files in the repo (e.g. gulpfile.js, everything in buildprocess, markdown files). Maybe even change our prettierignore file to ignore certain files rather than only include some directories.
@steve9164 I have updated prettierignore to include more files
That's better. I think we should also format:
-
*.yml
files -
architecture
- plenty of things in
wwwroot/
(probably most things that aren't.gitignore
d, third party code or generated files that are never partially modified) -
.github
I was thinking of changing .prettierignore
to almost match .gitignore
, plus add a few extra lines.
.prettierignore
:
# =====================
# From .gitignore. Update this list when .gitignore changes
docs/
node_modules/
.idea/
build/
error.log
output.log
npm-debug.log
.DS_Store
terria.lib.js
terriajs-server.log
terriajs.pid
/wwwroot/doc/
/wwwroot/schema/
/wwwroot/user-guide/
/coverage/
package-lock.json
*.swp
dist
.history/
# Catalog index generation files
catalog-index*.json
# End of .gitignore copy
# =====================
# These are auto-generated by css-modules-typescript-loader
**/*.scss.d.ts
# Generated files
/wwwroot/data/regionids
/wwwroot/third_party
# Reignore some files
doc/acknowledgements/attributions.md
And change the package.json scripts to "prettier --write ."
and "prettier --check ."
. That'll circumvent the problem where prettier is trying to format files it doesn't recognise when the ignore file is reversed.
Merging on 22nd August.