Skip to content

Commit aac4f41

Browse files
authored
PB-1603: add stylelint
add stylelint configuration
2 parents 0dc4935 + 64bb147 commit aac4f41

Some content is hidden

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

49 files changed

+1157
-387
lines changed

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"dev": "pnpm run -r --filter=web-mapviewer dev ",
1111
"format": "prettier --write .",
1212
"format:check": "prettier --check .",
13-
"lint": "eslint --fix",
14-
"lint:no-fix": "eslint",
13+
"lint": "eslint --fix || stylelint \"**/*.{vue,scss}\" --fix",
14+
"lint:no-fix": "eslint && stylelint \"**/*.{vue,scss}\"",
15+
"lint:styles": "stylelint \"**/*.{vue,scss}\" --fix",
16+
"lint:styles:no-fix": "stylelint \"**/*.{vue,scss}\"",
1517
"preview": "pnpm run -r --filter=!web-mapviewer build && pnpm run -r --filter=web-mapviewer preview",
1618
"preview:dev": "pnpm run -r build:dev && pnpm run -r --filter=web-mapviewer preview:dev ",
1719
"preview:int": "pnpm run -r build:int && pnpm run -r --filter=web-mapviewer preview:int",
@@ -45,10 +47,16 @@
4547
"eslint-plugin-prettier": "catalog:",
4648
"eslint-plugin-vue": "catalog:",
4749
"globals": "catalog:",
50+
"postcss-html": "catalog:",
4851
"prettier": "catalog:",
4952
"prettier-plugin-jsdoc": "catalog:",
5053
"prettier-plugin-packagejson": "catalog:",
5154
"prettier-plugin-tailwindcss": "catalog:",
55+
"stylelint": "catalog:",
56+
"stylelint-config-recommended-scss": "catalog:",
57+
"stylelint-config-recommended-vue": "catalog:",
58+
"stylelint-order": "catalog:",
59+
"stylelint-scss": "catalog:",
5260
"typescript": "catalog:",
5361
"typescript-eslint": "catalog:",
5462
"vite": "catalog:",

packages/mapviewer/src/modules/infobox/components/FeatureAreaInfo.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const humanReadableArea = computed(() => {
7474
$rectangle-line-width: 2px;
7575
$rectangle-line-color: $gray-600;
7676
$transparent: rgba(0, 0, 0, 0);
77+
7778
.rectangle {
7879
height: 1rem;
7980
width: 1.5rem;
@@ -90,7 +91,8 @@ $transparent: rgba(0, 0, 0, 0);
9091
$transparent 2 * $rectangle-line-width
9192
);
9293
}
94+
9395
.area-information {
94-
@extend .clear-no-ios-long-press;
96+
@extend %clear-no-ios-long-press;
9597
}
9698
</style>

packages/mapviewer/src/modules/infobox/components/FeatureList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function loadMoreResultForLayer(layerId) {
111111
112112
<style lang="scss" scoped>
113113
@import '@/scss/variables.module';
114+
114115
.feature-list {
115116
display: flex;
116117
flex-direction: column;

packages/mapviewer/src/modules/infobox/components/styling/DrawingStyleColorSelector.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ function colorCircleStyle(color) {
6767
<style lang="scss" scoped>
6868
@import '@/scss/webmapviewer-bootstrap-theme';
6969
70+
.color-select-box button {
71+
display: inline-flex;
72+
justify-content: center;
73+
}
74+
7075
.color-select-box {
7176
display: grid;
7277
grid-template-columns: 1fr 1fr 1fr 1fr;
@@ -81,11 +86,6 @@ function colorCircleStyle(color) {
8186
}
8287
}
8388
84-
button {
85-
display: inline-flex;
86-
justify-content: center;
87-
}
88-
8989
.color-circle {
9090
width: 1.25rem;
9191
height: 1.25rem;

packages/mapviewer/src/modules/map/components/MapPopover.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ defineExpose({
191191
</template>
192192
193193
<style lang="scss" scoped>
194+
/* stylelint-disable scss/operator-no-newline-after */
194195
@import '@/scss/webmapviewer-bootstrap-theme';
195196
@import '@/scss/media-query.mixin';
196197

packages/mapviewer/src/modules/map/components/footer/backgroundSelector/BackgroundSelectorSquared.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const { show, animate, getImageForBackgroundLayer, toggleShowSelector, onSelectB
8686

8787
<style lang="scss" scoped>
8888
@use 'sass:math';
89+
8990
@import './bg-selector';
9091
9192
$main-element: '.bg-selector-squared';

packages/mapviewer/src/modules/map/components/footer/backgroundSelector/bg-selector.scss

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use 'sass:math';
2+
13
@import '@/scss/webmapviewer-bootstrap-theme';
24

35
$bg-selector-transition-duration: 0.4s;
@@ -26,22 +28,16 @@ $nb-max-bg: 10;
2628
display: flex;
2729
}
2830
&-wheel {
29-
display: none;
30-
// resets the position "stack" so that absolute positioning of children is now relative to the parent
31-
position: relative;
32-
opacity: 0;
33-
z-index: $zindex-map + 1;
34-
// animate the display/opacity changes
35-
transition: all $bg-selector-transition-duration;
36-
&.show,
37-
&.animate {
38-
display: block;
39-
}
4031

4132
// as we are using this selector down in the for loop, we hit a limitation of SASS and can't use the
4233
// &- notation, but have to declare a full fledged selector (otherwise & is misinterpreted in the loop and
4334
// it fails)
4435
$buttons: '#{$main-element}-wheel-button';
36+
37+
&.show,
38+
&.animate {
39+
display: block;
40+
}
4541
#{$buttons} {
4642
// the parent is set to position relative, so this element will now be placed under the parent
4743
position: absolute;
@@ -50,14 +46,27 @@ $nb-max-bg: 10;
5046
transition-property: $spread-direction, opacity;
5147
transition-duration: $bg-selector-transition-duration;
5248
}
49+
5350
&.show:not(.animate) {
5451
// fade in/out on show/hide
5552
opacity: 1;
5653
}
5754

55+
& {
56+
display: none;
57+
// resets the position "stack" so that absolute positioning of children is now relative to the parent
58+
position: relative;
59+
opacity: 0;
60+
z-index: $zindex-map + 1;
61+
// animate the display/opacity changes
62+
transition: all $bg-selector-transition-duration;
63+
}
64+
65+
5866
@for $i from 0 through $nb-max-bg {
5967
// doubling the starting margin between the first child and the parent (hence $i + 2 when calculating margin)
6068
$spread-amount: calc($i * $button-width + $bg-selector-button-gap * ($i + 2));
69+
6170
&.show:not(.animate) {
6271
#{$buttons}-#{$i} {
6372
// move from a stacked under the main button position to a spread position (and vide-versa on hide)
@@ -81,7 +90,7 @@ $nb-max-bg: 10;
8190
$background-button-width: $map-button-diameter,
8291
$background-button-height-ratio: 1
8392
) {
84-
$background-button-height: floor($background-button-width * $background-button-height-ratio);
93+
$background-button-height: math.floor($background-button-width * $background-button-height-ratio);
8594
#{$main-element} {
8695
&-wheel-button {
8796
padding: 0;
@@ -109,7 +118,6 @@ $nb-max-bg: 10;
109118
img {
110119
// tailwind set max-width to 100% by default for img tags, but that breaks our style here
111120
max-width: unset;
112-
113121
display: inline;
114122
margin: 0 auto;
115123
}
@@ -126,13 +134,15 @@ $nb-max-bg: 10;
126134
}
127135

128136
@keyframes pulse {
129-
from {
137+
0% {
130138
transform: scale3d(1, 1, 1);
131139
}
140+
132141
20% {
133142
transform: scale3d(1.25, 1.25, 1.25);
134143
}
135-
to {
144+
145+
100% {
136146
transform: scale3d(1, 1, 1);
137147
}
138148
}

packages/mapviewer/src/modules/map/components/openlayers/OpenLayersMap.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ const { zIndexTileInfo, zIndexLayerExtents } = useLayerZIndexCalculation()
107107
<style lang="scss" scoped>
108108
@import '@/scss/webmapviewer-bootstrap-theme';
109109
110+
$dragbox-width: 3px;
111+
110112
.ol-map {
111113
top: 0;
112114
left: 0;
@@ -115,8 +117,6 @@ const { zIndexTileInfo, zIndexLayerExtents } = useLayerZIndexCalculation()
115117
position: absolute; // Element must be positioned to set a z-index
116118
z-index: $zindex-map;
117119
}
118-
119-
$dragbox-width: 3px;
120120
// Show selected area when shift click + drag on map
121121
:global(.ol-dragzoom) {
122122
border: $dragbox-width solid $malibu;

packages/mapviewer/src/modules/map/components/openlayers/OpenLayersScale.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ onBeforeUnmount(() => olMap.removeControl(scaleLine))
7474
$scaleBarPrimary: $black;
7575
$scaleBarSecondary: $light-grey;
7676
77-
position: relative;
77+
$fontSize: 8px;
7878
7979
.scale-bar-inner {
8080
display: flex;
8181
}
8282
83-
$fontSize: 8px;
8483
&.with-relative-size {
8584
$fontSize: max(max(0.8vw, 0.8vh), 8px);
8685
}
@@ -124,6 +123,10 @@ onBeforeUnmount(() => olMap.removeControl(scaleLine))
124123
.ol-scale-singlebar-odd {
125124
background-color: $scaleBarPrimary;
126125
}
126+
127+
& {
128+
position: relative;
129+
}
127130
}
128131
}
129132
</style>

packages/mapviewer/src/modules/map/components/toolbox/FullScreenButton.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function handleKeydown(event) {
6666

6767
<style lang="scss" scoped>
6868
@import '@/modules/map/scss/toolbox-buttons';
69+
6970
.fullscreen-warning {
7071
position: fixed;
7172
top: 120px;
@@ -78,20 +79,23 @@ function handleKeydown(event) {
7879
font-size: 16px;
7980
z-index: 1000;
8081
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
81-
animation: fadeInOut 3s ease-in-out forwards;
82+
animation: fade-in-out 3s ease-in-out forwards;
8283
}
8384
84-
@keyframes fadeInOut {
85+
@keyframes fade-in-out {
8586
0% {
8687
opacity: 0;
8788
visibility: visible;
8889
}
90+
8991
10% {
9092
opacity: 0.9;
9193
}
94+
9295
90% {
9396
opacity: 0.9;
9497
}
98+
9599
100% {
96100
opacity: 0;
97101
visibility: hidden;

0 commit comments

Comments
 (0)