feat: add prettier config

This commit is contained in:
Brice Maron 2022-09-03 18:00:54 +02:00
parent 7d77b0ba4c
commit d3f453a4fb
12 changed files with 159 additions and 104 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.ts]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

2
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,2 @@
# to be filled once final sha is known
# Prettier init

View file

@ -4,9 +4,11 @@ runs:
using: "composite" using: "composite"
steps: steps:
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v1.4.6 uses: actions/setup-node@v3
with: with:
node-version: '16' node-version: "16"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps - name: install deps
run: npm ci run: npm ci

View file

@ -6,7 +6,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup and validate themes - name: Setup and validate themes
uses: ./.github/actions/setup-and-validate uses: ./.github/actions/setup-and-validate

13
.prettierignore Normal file
View file

@ -0,0 +1,13 @@
node_modules
.git
langs/
vendor/
dist/
.cache
assets/generated/
assets/themes/
assets/layers/
Docs/Tools/stats/
Docs/Layers/
Docs/Schemas/
Docs/TagInfo/

4
.prettierrc.json Normal file
View file

@ -0,0 +1,4 @@
{
"semi": false,
"printWidth": 100
}

View file

@ -44,7 +44,6 @@ export class AddContextToTranslations<T> extends DesugaringStep<T> {
* layers: [ * layers: [
* { * {
* tagRenderings:[ * tagRenderings:[
*
* {id: "some-tr", * {id: "some-tr",
* question:{ * question:{
* en:"Question?" * en:"Question?"
@ -59,7 +58,6 @@ export class AddContextToTranslations<T> extends DesugaringStep<T> {
* layers: [ * layers: [
* { * {
* tagRenderings:[ * tagRenderings:[
*
* {id: "some-tr", * {id: "some-tr",
* question:{ * question:{
* _context: "prefix:context.layers.0.tagRenderings.some-tr.question" * _context: "prefix:context.layers.0.tagRenderings.some-tr.question"

View file

@ -179,6 +179,7 @@ export default class OpeningHoursVisualization extends Toggle {
startOfDay.setHours(0, 0, 0, 0); startOfDay.setHours(0, 0, 0, 0);
// @ts-ignore // @ts-ignore
const startpoint = (range.startDate - startOfDay) / 1000 - earliestOpen; const startpoint = (range.startDate - startOfDay) / 1000 - earliestOpen;
// prettier-ignore
// @ts-ignore // @ts-ignore
const width = (100 * (range.endDate - range.startDate) / 1000) / (latestclose - earliestOpen); const width = (100 * (range.endDate - range.startDate) / 1000) / (latestclose - earliestOpen);
const startPercentage = (100 * startpoint / availableArea); const startPercentage = (100 * startpoint / availableArea);

View file

@ -267,7 +267,6 @@ export default class TagRenderingQuestion extends Combine {
* freeform: { * freeform: {
* key:"key" * key:"key"
* }, * },
*
* mappings: [ * mappings: [
* { * {
* if:"x=y", * if:"x=y",
@ -298,7 +297,6 @@ export default class TagRenderingQuestion extends Combine {
* freeform: { * freeform: {
* key:"key" * key:"key"
* }, * },
*
* mappings: [ * mappings: [
* { * {
* if:"x=y", * if:"x=y",

View file

@ -1,15 +1,16 @@
<html> <html>
<body> <body>
The custom generator has moved (temporarily), go to
The custom generator has moved (temporarily), go to <a <a href="https://pietervdvn.github.io/mc/legacy/070/customGenerator.html">
href='https://pietervdvn.github.io/mc/legacy/070/customGenerator.html'</a> Redirecting you to the development version</a
Redirecting you to the development version >
<script> <script>
window.location.replace("https://pietervdvn.github.io/mc/legacy/070/customGenerator.html" + window.location.search + window.location.hash); window.location.replace(
"https://pietervdvn.github.io/mc/legacy/070/customGenerator.html" +
window.location.search +
window.location.hash
);
</script> </script>
</body> </body>
</html> </html>

28
package-lock.json generated
View file

@ -9,7 +9,6 @@
"version": "0.0.5", "version": "0.0.5",
"license": "GPL", "license": "GPL",
"dependencies": { "dependencies": {
"@parcel/service-worker": "^2.6.0",
"@turf/boolean-intersects": "^6.5.0", "@turf/boolean-intersects": "^6.5.0",
"@turf/buffer": "^6.5.0", "@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0", "@turf/collect": "^6.5.0",
@ -49,6 +48,7 @@
"devDependencies": { "devDependencies": {
"@babel/polyfill": "^7.10.4", "@babel/polyfill": "^7.10.4",
"@babel/preset-env": "7.13.8", "@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.6.0",
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",
"@types/geojson": "^7946.0.10", "@types/geojson": "^7946.0.10",
"@types/leaflet-markercluster": "^1.0.3", "@types/leaflet-markercluster": "^1.0.3",
@ -66,6 +66,7 @@
"fs": "0.0.1-security", "fs": "0.0.1-security",
"mocha": "^9.2.2", "mocha": "^9.2.2",
"parcel": "^1.2.4", "parcel": "^1.2.4",
"prettier": "2.7.1",
"read-file": "^0.2.0", "read-file": "^0.2.0",
"sharp": "^0.30.5", "sharp": "^0.30.5",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
@ -1542,6 +1543,7 @@
"version": "2.6.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz", "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz",
"integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==", "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==",
"dev": true,
"engines": { "engines": {
"node": ">= 12.0.0", "node": ">= 12.0.0",
"parcel": "^2.6.0" "parcel": "^2.6.0"
@ -12630,6 +12632,21 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/process": { "node_modules/process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -17943,7 +17960,8 @@
"@parcel/service-worker": { "@parcel/service-worker": {
"version": "2.6.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz", "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz",
"integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==" "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==",
"dev": true
}, },
"@parcel/utils": { "@parcel/utils": {
"version": "1.11.0", "version": "1.11.0",
@ -26760,6 +26778,12 @@
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
}, },
"prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true
},
"process": { "process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",

View file

@ -42,6 +42,7 @@
"generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -", "generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -",
"prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh", "prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh",
"gittag": "ts-node scripts/printVersion.ts | bash", "gittag": "ts-node scripts/printVersion.ts | bash",
"format": "npx prettier --write '**/*.ts'",
"lint": "tslint --project . -c tslint.json '**.ts' ", "lint": "tslint --project . -c tslint.json '**.ts' ",
"clean:tests": "(find . -type f -name \"*.doctest.ts\" | xargs rm)", "clean:tests": "(find . -type f -name \"*.doctest.ts\" | xargs rm)",
"clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | grep -v \"manifest.webmanifest\" | xargs rm)", "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | grep -v \"manifest.webmanifest\" | xargs rm)",
@ -51,7 +52,7 @@
"weblate-add-upstream": "git remote add weblate-github git@github.com:weblate/MapComplete.git", "weblate-add-upstream": "git remote add weblate-github git@github.com:weblate/MapComplete.git",
"weblate-fix": "git remote update weblate-github; git merge weblate-github/weblate-mapcomplete-core; git merge weblate-github/weblate-mapcomplete-layers; git merge weblate-github/weblate-mapcomplete-layer-translations", "weblate-fix": "git remote update weblate-github; git merge weblate-github/weblate-mapcomplete-core; git merge weblate-github/weblate-mapcomplete-layers; git merge weblate-github/weblate-mapcomplete-layer-translations",
"weblate-fix-heavy": "git remote rm weblate-layers; git remote add weblate-layers https://hosted.weblate.org/git/mapcomplete/layers/; git remote update weblate-layers; git merge weblate-layers/master", "weblate-fix-heavy": "git remote rm weblate-layers; git remote add weblate-layers https://hosted.weblate.org/git/mapcomplete/layers/; git remote update weblate-layers; git merge weblate-layers/master",
"housekeeping": "npm run generate && npm run generate:docs && npm run generate:contributor-list && git add Docs/* && git commit assets/ langs/ Docs/ -m 'Housekeeping...'", "housekeeping": "npm run generate && npm run generate:docs && npm run generate:contributor-list && npm run format && git add *.ts && git add Docs/* && git commit assets/ langs/ Docs/ -m 'Housekeeping...'",
"parseSchools": "ts-node scripts/schools/amendSchoolData.ts", "parseSchools": "ts-node scripts/schools/amendSchoolData.ts",
"steal": "ts-node scripts/thieves/stealLanguages.ts" "steal": "ts-node scripts/thieves/stealLanguages.ts"
}, },
@ -68,7 +69,6 @@
"not op_mini all" "not op_mini all"
], ],
"dependencies": { "dependencies": {
"@parcel/service-worker": "^2.6.0",
"@turf/boolean-intersects": "^6.5.0", "@turf/boolean-intersects": "^6.5.0",
"@turf/buffer": "^6.5.0", "@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0", "@turf/collect": "^6.5.0",
@ -108,6 +108,7 @@
"devDependencies": { "devDependencies": {
"@babel/polyfill": "^7.10.4", "@babel/polyfill": "^7.10.4",
"@babel/preset-env": "7.13.8", "@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.6.0",
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",
"@types/geojson": "^7946.0.10", "@types/geojson": "^7946.0.10",
"@types/leaflet-markercluster": "^1.0.3", "@types/leaflet-markercluster": "^1.0.3",
@ -125,6 +126,7 @@
"fs": "0.0.1-security", "fs": "0.0.1-security",
"mocha": "^9.2.2", "mocha": "^9.2.2",
"parcel": "^1.2.4", "parcel": "^1.2.4",
"prettier": "2.7.1",
"read-file": "^0.2.0", "read-file": "^0.2.0",
"sharp": "^0.30.5", "sharp": "^0.30.5",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",