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"
steps:
- name: Set up Node.js
uses: actions/setup-node@v1.4.6
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: "16"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps
run: npm ci

View file

@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup and validate themes
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: [
* {
* tagRenderings:[
*
* {id: "some-tr",
* question:{
* en:"Question?"
@ -59,7 +58,6 @@ export class AddContextToTranslations<T> extends DesugaringStep<T> {
* layers: [
* {
* tagRenderings:[
*
* {id: "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);
// @ts-ignore
const startpoint = (range.startDate - startOfDay) / 1000 - earliestOpen;
// prettier-ignore
// @ts-ignore
const width = (100 * (range.endDate - range.startDate) / 1000) / (latestclose - earliestOpen);
const startPercentage = (100 * startpoint / availableArea);

View file

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

View file

@ -1,15 +1,16 @@
<html>
<body>
The custom generator has moved (temporarily), go to <a
href='https://pietervdvn.github.io/mc/legacy/070/customGenerator.html'</a>
Redirecting you to the development version
The custom generator has moved (temporarily), go to
<a href="https://pietervdvn.github.io/mc/legacy/070/customGenerator.html">
Redirecting you to the development version</a
>
<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>
</body>
</html>

28
package-lock.json generated
View file

@ -9,7 +9,6 @@
"version": "0.0.5",
"license": "GPL",
"dependencies": {
"@parcel/service-worker": "^2.6.0",
"@turf/boolean-intersects": "^6.5.0",
"@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0",
@ -49,6 +48,7 @@
"devDependencies": {
"@babel/polyfill": "^7.10.4",
"@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.6.0",
"@types/chai": "^4.3.0",
"@types/geojson": "^7946.0.10",
"@types/leaflet-markercluster": "^1.0.3",
@ -66,6 +66,7 @@
"fs": "0.0.1-security",
"mocha": "^9.2.2",
"parcel": "^1.2.4",
"prettier": "2.7.1",
"read-file": "^0.2.0",
"sharp": "^0.30.5",
"ts-node": "^10.9.1",
@ -1542,6 +1543,7 @@
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz",
"integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==",
"dev": true,
"engines": {
"node": ">= 12.0.0",
"parcel": "^2.6.0"
@ -12630,6 +12632,21 @@
"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": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -17943,7 +17960,8 @@
"@parcel/service-worker": {
"version": "2.6.0",
"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": {
"version": "1.11.0",
@ -26760,6 +26778,12 @@
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"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": {
"version": "0.11.10",
"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 -",
"prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh",
"gittag": "ts-node scripts/printVersion.ts | bash",
"format": "npx prettier --write '**/*.ts'",
"lint": "tslint --project . -c tslint.json '**.ts' ",
"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)",
@ -51,7 +52,7 @@
"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-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",
"steal": "ts-node scripts/thieves/stealLanguages.ts"
},
@ -68,7 +69,6 @@
"not op_mini all"
],
"dependencies": {
"@parcel/service-worker": "^2.6.0",
"@turf/boolean-intersects": "^6.5.0",
"@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0",
@ -108,6 +108,7 @@
"devDependencies": {
"@babel/polyfill": "^7.10.4",
"@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.6.0",
"@types/chai": "^4.3.0",
"@types/geojson": "^7946.0.10",
"@types/leaflet-markercluster": "^1.0.3",
@ -125,6 +126,7 @@
"fs": "0.0.1-security",
"mocha": "^9.2.2",
"parcel": "^1.2.4",
"prettier": "2.7.1",
"read-file": "^0.2.0",
"sharp": "^0.30.5",
"ts-node": "^10.9.1",