Skip to content

Commit

Permalink
[Chore] Fix VSCode formatting and prettier precommit (#501)
Browse files Browse the repository at this point in the history
- Fix VSCode prettier format on save
- Add lint-staged to fix prettier precommit hook
- Show root folder in vscode monorepo view
- Format vscode settings files
  • Loading branch information
jmrossy authored May 27, 2022
1 parent b0475af commit 7caaa4e
Show file tree
Hide file tree
Showing 10 changed files with 389 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn prettier
yarn lint-staged
7 changes: 7 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"*.js": "prettier --write",
"*.ts": "prettier --write",
"*.md": "prettier --write",
"*.sol": "prettier --write",
"*.rs": "prettier --write"
}
14 changes: 11 additions & 3 deletions mono.code-workspace
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
{
"settings": {
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications", // only formats git changes
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.configPath": ".prettierrc",
"prettier.configPath": "../.prettierrc",
"workbench.editor.labelFormat": "medium",
"npm.autoDetect": "on",
"npm.packageManager": "yarn",
"npm.enableRunFromFolder": true,
"npm.scriptExplorerAction": "run",
"npm.fetchOnlinePackageInfo": true,
"scm.diffDecorationsGutterPattern": {
"added": true
},
"npm.autoDetect": "on",
"files.watcherExclude": {
"**/.git/**": true,
"**/node_modules/*/**": true
},
},
"folders": [
{
"name": "ROOT",
"path": "./"
},
{
"path": "./typescript"
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"husky": "^8.0.0",
"lint-staged": "^12.4.2",
"prettier": "^2.2.1",
"typescript": "^4.3.5"
}
Expand Down
6 changes: 3 additions & 3 deletions rust/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"files.exclude": {
"target": true,
},
"files.exclude": {
"target": true,
},
}
20 changes: 9 additions & 11 deletions solidity/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"JuanBlanco.solidity",
"tintinweb.vscode-ethover",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"JuanBlanco.solidity",
"tintinweb.vscode-ethover",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
18 changes: 9 additions & 9 deletions solidity/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"files.exclude": {
"**/node_modules": true,
"**/*.js": {"when": "$(basename).ts"},
"**/*.map": {"when": "$(basename).map"},
"**/artifacts": true,
"**/cache": true,
"**/dist": true,
"**/types": true,
},
"files.exclude": {
"**/node_modules": true,
"**/*.js": {"when": "$(basename).ts"},
"**/*.map": {"when": "$(basename).map"},
"**/artifacts": true,
"**/cache": true,
"**/dist": true,
"**/types": true,
},
}
18 changes: 9 additions & 9 deletions typescript/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"tintinweb.vscode-ethover",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
]
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint",
"tintinweb.vscode-ethover",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
12 changes: 6 additions & 6 deletions typescript/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"files.exclude": {
"**/node_modules": true,
"**/*.js": {"when": "$(basename).ts"},
"**/*.map": {"when": "$(basename).map"},
"**/dist": true,
},
"files.exclude": {
"**/node_modules": true,
"**/*.js": {"when": "$(basename).ts"},
"**/*.map": {"when": "$(basename).map"},
"**/dist": true,
},
}
Loading

0 comments on commit 7caaa4e

Please sign in to comment.