Add configs for better support of different development environments (#1092)

* Add prettierrc and editorconfig

* Updated README with `npm run cf` steps & also a git command that will fix a line ending error

* Added reference

* Prettier ;_;

* Add gitattributes to make sure git uses core.autocrlf on windows

Co-authored-by: William Lam <w.lam@honteam.com>
This commit is contained in:
Remmy Cat Stock 2022-11-05 22:45:00 +01:00 committed by GitHub
parent 222529b454
commit cc396b8ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

6
.prettierrc.js Normal file
View File

@ -0,0 +1,6 @@
/**
* @type {import('prettier').Config}
*/
module.exports = {
// defaults only so far
};

View File

@ -118,3 +118,16 @@ Note: This is only useful if you have access to a production running on Render.c
2. Copy generated files from output folder to gear-ids.ts file
3. Get .png from Lean's repository
4. Generate .avif image
### Fix errors from the CI Pipeline
If you change any files and the CI pipeline errors out on certain formatting/linting steps (e.g. the `Prettier` or `Stylelint` step), run this command in the repo's root directory:
```sh
npm run cf
```
Before committing, if for some reason you see an abnormally high amount of files changed, simply run `git add --renormalize .` and it will fix the error.
- Background info: this is caused by the line endings on your local repo not matching those with the remote repo's, which should remove the vast majority of unstaged files that appears to have no changes at all.
- Reference: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings