Skip to content

Commit 6bbd765

Browse files
authored
Run prettier on all Explorer files (#1267)
## High Level Overview of Change This PR runs `prettier` on all Explorer files (it seems that it wasn't properly run on non-JS/TS files before). It also configures CI and CLI scripts to check `prettier` as well, and sets up some basic pre-commit settings. This PR does not make any code changes, only linting changes. ### Context of Change General repo cleanup ### Type of Change - [x] Chore ### Codebase Modernization N/A ## Before / After <!-- If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level. If a UI change, screenshots should be included. --> ## Test Plan Works locally. CI passes.
1 parent db3a01f commit 6bbd765

File tree

39 files changed

+2699
-1042
lines changed

39 files changed

+2699
-1042
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
4-
directory: "/"
5-
schedule:
6-
interval: monthly
7-
time: "15:00"
8-
open-pull-requests-limit: 10
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: monthly
7+
time: '15:00'
8+
open-pull-requests-limit: 10

.github/workflows/nodejs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v5
1818
- name: Use Node.js ${{ env.NODE_VERSION }}
1919
uses: actions/setup-node@v4
2020
with:
@@ -37,13 +37,17 @@ jobs:
3737
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
3838
run: npm ci
3939

40-
- run: npm run lint:ci
40+
- run: |
41+
npm run lint:ci
42+
43+
# This runs the pre-commit hooks defined in .pre-commit-config.yaml
44+
- uses: pre-commit/action@v3.0.1
4145

4246
test:
4347
runs-on: ubuntu-latest
4448

4549
steps:
46-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
4751
- name: Use Node.js ${{ env.NODE_VERSION }}
4852
uses: actions/setup-node@v4
4953
with:
@@ -80,7 +84,7 @@ jobs:
8084
runs-on: ubuntu-latest
8185

8286
steps:
83-
- uses: actions/checkout@v4
87+
- uses: actions/checkout@v5
8488
- name: Use Node.js ${{ env.NODE_VERSION }}
8589
uses: actions/setup-node@v4
8690
with:
@@ -109,7 +113,7 @@ jobs:
109113
runs-on: ubuntu-latest
110114

111115
steps:
112-
- uses: actions/checkout@v4
116+
- uses: actions/checkout@v5
113117
- name: Use Node.js ${{ env.NODE_VERSION }}
114118
uses: actions/setup-node@v4
115119
with:

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .pre-commit-config.yaml
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: check-case-conflict
7+
- id: check-illegal-windows-names
8+
- id: check-json
9+
- id: check-merge-conflict
10+
- id: check-symlinks
11+
- id: check-yaml
12+
- id: detect-private-key
13+
- id: end-of-file-fixer
14+
- id: fix-byte-order-marker
15+
- id: forbid-submodules
16+
- id: mixed-line-ending
17+
- id: trailing-whitespace
18+
19+
- repo: https://github.com/rbubley/mirrors-prettier
20+
rev: 5ba47274f9b181bce26a5150a725577f3c336011 # frozen: v3.6.2
21+
hooks:
22+
- id: prettier
23+
args: [--no-semi]

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
build/
22
coverage/
33
node_modules/
4-
src/**/*.{css}

.vscode/extensions.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"recommendations": [
3-
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode",
5-
"stylelint.vscode-stylelint",
6-
"vespa-dev-works.jestrunit",
7-
]
8-
}
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"stylelint.vscode-stylelint",
6+
"vespa-dev-works.jestrunit"
7+
]
8+
}

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
88

99
Examples of behavior that contributes to creating a positive environment include:
1010

11-
* Using welcoming and inclusive language
12-
* Being respectful of differing viewpoints and experiences
13-
* Gracefully accepting constructive criticism
14-
* Focusing on what is best for the community
15-
* Showing empathy towards other community members
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
1616

1717
Examples of behavior that does not contribute to creating a positive environment include:
1818

19-
* Using sexualized language or imagery and unwelcome sexual attention or advances
20-
* Trolling, insulting/derogatory comments, and personal or political attacks
21-
* Public or private harassment
22-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23-
* Other conduct which could reasonably be considered inappropriate in a professional setting
19+
- Using sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
2424

2525
## Our Responsibilities
2626

docs/routing.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The explorer uses some enhancements to `react-router` to provide type checking t
99
In the future these objects can provide a common way to support legacy routes.
1010

1111
ex.
12+
1213
```
1314
export const ACCOUNT_ROUTE: RouteDefinition<{
1415
id?: string
@@ -21,7 +22,7 @@ export const ACCOUNT_ROUTE: RouteDefinition<{
2122

2223
### `useRouteParams`
2324

24-
A new hook which takes a `RouteDefinition` and wraps `react-router`'s `useRouteParams`. This will derive the type of the params from the definition.
25+
A new hook which takes a `RouteDefinition` and wraps `react-router`'s `useRouteParams`. This will derive the type of the params from the definition.
2526

2627
ex. `const { id = '', assetType = 'issued' } = useRouteParams(ACCOUNT_ROUTE)`
2728

docs/translating.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
1. Add the new language code and language name to the map `supportedLanguages` in [/src/i18n/baseConfig.ts](../src/i18n/baseConfig.ts)
66
2. Create a folder in [/public/locales/](../public/locales) with the language code as its name.
77
3. Add a new file, `translations.json`, to the new folder.
8-
4. Translate all the entries. If you prefer to use the English version just set the value to `null`.
8+
4. Translate all the entries. If you prefer to use the English version just set the value to `null`.
99

1010
Example file: [/public/locales/ja-JP/translations.json](../public/locales/ja-JP/translations.json)
1111

@@ -14,12 +14,13 @@
1414
When making changes to the base (English) language file follow the guide based on the type and scope of the change.
1515

1616
### New Entry
17+
1718
1. Create entry in `en-US/translations.json`
1819
2. Add an entry to all other `translation.json` files. Set the value to be `null` (which means it will default to using the English version).
1920

2021
## Existing Entry
22+
2123
1. Update the entry in `en-US/translations.json`
2224
2. If the meaning does **NOT** change materially, you can leave them as is. Ex. "Please check your transaction hash" => "Please check your transaction hash or CTID."
2325
3. If the entry has a new meaning than before, set the value to `null` in all other `translation.json` files.
24-
25-
*Note that changing a translation to `null` causes it to fall back to the English version, and is a signal to language contributors that they may want to provide a fresh localization.*
26+
_Note that changing a translation to `null` causes it to fall back to the English version, and is a signal to language contributors that they may want to provide a fresh localization._

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@
126126
"build-ts": "tsc --build",
127127
"dev-client": "vite serve",
128128
"dev-server": "NODE_ENV=development PORT=5001 nodemon --watch server --watch build server|bunyan || true",
129-
"lint": "run-s \"lint:js -- --fix\" \"lint:css -- --fix\"",
130-
"lint:ci": "run-s lint:js lint:css",
129+
"lint": "run-s \"lint:js -- --fix\" \"lint:css -- --fix\" \"format -- --log-level error\"",
130+
"lint:ci": "run-s lint:js lint:css \"format:check -- --log-level error\"",
131131
"lint:css": "node_modules/.bin/stylelint src/**/*.scss",
132132
"lint:js": "node_modules/.bin/eslint --ext=js --ext=jsx --ext=ts --ext=tsx --color --max-warnings 0 .",
133+
"format": "prettier --write .",
134+
"format:check": "prettier --check .",
133135
"precommit": "lint-staged",
134136
"prod-server": "node server|bunyan",
135137
"start": "run-p dev-server dev-client",

public/.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Options -MultiViews
22
RewriteEngine On
33
RewriteCond %{REQUEST_FILENAME} !-f
4-
RewriteRule ^ index.html [QSA,L]
4+
RewriteRule ^ index.html [QSA,L]

0 commit comments

Comments
 (0)