Add EditorConfig and Prettier for basic global formatting config/validation #7788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
EditorConfig covers basic rules for most files/languages. Most editors will automatically utilize
.editorconfigto provide committed project-level rules for formatting without individual/manual configuration.Introduced to cover consistent formatting for things like JSON and XML files, without introducing more language specific tools.
More advanced language dependent formatting can still use things like
gofmt,yamllint,ruff, etc.Prettier is one way to use those EditorConfig rules, which can validate and/or automatically fix. Most editors will reformat on save without a third-party tool though.
Changes of note:
db/functions/js_runnerchanges to allow the invalid javascript.jsfile to be ignoredcom.couchbase.mobile.sync_gateway.plistto make the file valid XML (verified withplutil)package.json- is a convenient way to specify a list of non-critical dev tools: Prettier and redocly-cli, which can be installed simply vianpm installoryarn installActual formatting fixes off the back of these rules can be made in a follow-up PR just for isolating them.
I've added a preview below either way - it is mostly indentation changes.
diff after
prettier --write .: