Skip to content

Commit 1d4e403

Browse files
authored
Merge pull request #2014 from HSLdevcom/feature/66222-integrate-prettier-autoformatter
feat(66222): integrate prettier autoformatter
2 parents 91cdfbf + 1063ee6 commit 1d4e403

File tree

321 files changed

+30591
-30040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+30591
-30040
lines changed

.github/workflows/ci-cd.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: "CI/CD: Continuous integration and continuous deployment"
3+
on: [pull_request]
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
build-check:
9+
name: 'Build & check format'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Install Node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "lts/*"
19+
cache: "npm"
20+
21+
- name: Install NPM dependencies
22+
run: yarn install --frozen-lockfile
23+
24+
- name: Check code formatting
25+
run: yarn run format:check

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
build
4+
coverage

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 95,
5+
"arrowParens": "always",
6+
"bracketSpacing": true,
7+
"trailingComma": "es5",
8+
"tabWidth": 2
9+
}

package.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"graphql": "^14.5.8",
2828
"graphql-tag": "^2.9.2",
2929
"history": "^4.7.2",
30+
"husky": "^1.3.1",
3031
"html-webpack-plugin": "2.29.0",
3132
"jest": "26.4.0",
3233
"leaflet": "1.6.0",
@@ -89,7 +90,8 @@
8990
"cypress": "CYPRESS_E2E=true cypress",
9091
"cypress:run:dev": "CYPRESS_E2E=true cypress run --env configFile=dev",
9192
"cypress:run:stage": "CYPRESS_E2E=true cypress run --env configFile=stage",
92-
"prettify-all-files": "npx prettier --write '**/*.ts'"
93+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
94+
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\""
9395
},
9496
"devDependencies": {
9597
"@types/chroma-js": "^1.3.5",
@@ -115,9 +117,10 @@
115117
"bumped": "^0.10.11",
116118
"bumped-changelog": "0.3.13",
117119
"bumped-terminal": "^0.7.6",
118-
"cypress": "5.5.0",
120+
"cypress": "^15.3.0",
119121
"cypress-commands": "^0.3.1",
120122
"cypress-wait-until": "^1.6.1",
123+
"lint-staged": "^9.0.0",
121124
"mobx-react-devtools": "^6.0.1",
122125
"react-dev-utils": "^5.0.1",
123126
"sass": "^1.26.1",
@@ -186,11 +189,15 @@
186189
"eslintConfig": {
187190
"extends": "react-app"
188191
},
189-
"prettier": {
190-
"printWidth": 100,
191-
"tabWidth": 4,
192-
"semi": true,
193-
"singleQuote": true,
194-
"jsxSingleQuote": true
192+
"lint-staged": {
193+
"*.{ts,js}": [
194+
"prettier --write",
195+
"git add"
196+
]
197+
},
198+
"husky": {
199+
"hooks": {
200+
"pre-commit": "lint-staged"
201+
}
195202
}
196203
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const httpStatusDescriptionCodeList = {
2-
403: 'Tämä toimenpide on kieletty, ohjaamme sinut sisäänkirjautumiseen. Istuntosi on myös saattanut vanhentua.',
3-
409: 'Tallennus ei onnistunut, sillä karttakäyttöliittymän sisäinen tietokanta ei ollut ajantasalla jore tietokannan kanssa. Päivitä sivu ja yritä tallentaa uudelleen.',
4-
500: 'Tallentaminen epäonnistui, palvelimen päässä tapahtui virhe. Yritä tallentaa uudestaan.',
5-
550: 'Tallennus estetty, infopoiminta käynnissä.',
6-
};
2+
403: 'Tämä toimenpide on kieletty, ohjaamme sinut sisäänkirjautumiseen. Istuntosi on myös saattanut vanhentua.',
3+
409: 'Tallennus ei onnistunut, sillä karttakäyttöliittymän sisäinen tietokanta ei ollut ajantasalla jore tietokannan kanssa. Päivitä sivu ja yritä tallentaa uudelleen.',
4+
500: 'Tallentaminen epäonnistui, palvelimen päässä tapahtui virhe. Yritä tallentaa uudestaan.',
5+
550: 'Tallennus estetty, infopoiminta käynnissä.',
6+
}
77

8-
export default httpStatusDescriptionCodeList;
8+
export default httpStatusDescriptionCodeList

0 commit comments

Comments
 (0)