Skip to content

chore: updates code formatting configs #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 4
indent_style = tab
indent_size = 2
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
24 changes: 20 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
node_modules
.DS_Store
api-cache
# compiled output
tmp
.vscode
api-cache

# dependencies
node_modules

# auto-gen PHP files/logs
php_errors.log


# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/launch.json
!.vscode/extensions.json

# System Files
.DS_Store

# misc
npm-debug.log
yarn-error.log
package-lock.json
38 changes: 18 additions & 20 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
{
"phpVersion": "8.1",
"plugins": ["@prettier/plugin-php"],
"tabWidth": 4,
"bracketSameLine": true,
"printWidth": 80,
"singleQuote": false,
"overrides": [
{
"files": ["*.js"],
"options": {
"singleQuote": true
}
},
{
"files": ["*.md", "package.json", "package-lock.json"],
"options": {
"tabWidth": 2
}
}
]
"phpVersion": "8.1",
"plugins": ["@prettier/plugin-php"],
"bracketSameLine": false,
"bracketSpacing": true,
"printWidth": 80,
"singleQuote": false,
"semi": true,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": true,
"overrides": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the package-lock.json is created using an indentation of 2 spaces by default. Do we want to add the package-lock.json file to .prettierignore file so that it doesn't override the default formatting?

{
"files": ["*.js"],
"options": {
"singleQuote": true
}
}
]
}
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"stylelint.vscode-stylelint",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that stylelint is a completely separate package/dependency that we aren't using in this repo. Is this still an extension that we should be recommending?
We may also want to recommend bmewburn.vscode-intelephense-client to allow formatting and code intelligence for the PHP files.

"eamodio.gitlens",
"wix.vscode-import-cost",
"christian-kohler.path-intellisense",
"formulahendry.auto-rename-tag",
"deque-systems.vscode-axe-linter"
]
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/node_modules/.bin/jest",
"cwd": "${workspaceFolder}",
"args": [
"test",
"--testPathPattern=${FileBasenameNoExtension}",
"--runInBand"
],
"console": "internalConsole",
"internalConsoleOptions": "neverOpen"
}
]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
{
}
"eslint.validate": ["json"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
Comment on lines +3 to +4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when a developer tries to save a file and they don't have the prettier extension installed?

"editor.formatOnSave": true
}
Loading