Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Remove scss lang directives from Vue SFC style tags; add eslint rule #1200

Merged
merged 8 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ module.exports = {
'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/block-lang': [
'error',
{
// This confusing naming prevents the use of 'lang' directives
// entirely on Vue SFC style blocks.
style: { allowNoLang: true },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like it's allowed not to indicate the lang attribute instead of prohibiting it, a bit confusing to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krysal I added a comment to make this clearer, hopefully.

zackkrida marked this conversation as resolved.
Show resolved Hide resolved
},
],
'vue/component-name-in-template-casing': [
'error',
'PascalCase',
Expand Down
6 changes: 5 additions & 1 deletion src/components/CopyButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default {
}
</script>

<style lang="scss" scoped>
<style scoped>
/**
* Styles are applied here to 'hack' and overrule specificity.
* @todo Find a better way to handle this in the template.
**/
button {
@apply py-2 px-3 text-sr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DropdownButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const DropdownButton = defineComponent({
export default DropdownButton
</script>

<style lang="css" scoped>
<style scoped>
.dropdown-button {
@apply flex items-center justify-center bg-pink text-white font-bold transition-shadow duration-100 ease-linear disabled:opacity-70 focus:outline-none focus-visible:ring focus-visible:ring-offset-2 focus-visible:ring-pink hover:bg-dark-pink no-underline appearance-none;
}
Expand Down
11 changes: 5 additions & 6 deletions src/components/ExtensionBrowsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ export default {
}
</script>

<style scoped lang="scss">
<style scoped>
.browser-button {
background-color: $color-white;
@apply bg-white;
}

img {
height: 1.5em;
width: 1.5em;
}
.browser-button img {
@apply w-6 h-6;
}
</style>
3 changes: 2 additions & 1 deletion src/components/LoadingIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
}
</script>

<style lang="scss" scoped>
<style scoped>
.lds-ring {
display: inline-block;
position: relative;
Expand All @@ -40,6 +40,7 @@ export default {
.lds-ring div:nth-child(3) {
animation-delay: -0.15s;
}

@keyframes lds-ring {
0% {
transform: rotate(0deg);
Expand Down
150 changes: 0 additions & 150 deletions src/components/LocaleSelector.vue

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/SketchFabViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
},
}
</script>
<style lang="scss" scoped>
<style scoped>
.image {
display: block;
}
Expand Down
8 changes: 2 additions & 6 deletions src/components/VAudioDetails/VAudioDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@ export default {
}
</script>

<style lang="scss" scoped>
<style scoped>
dl {
@apply grid gap-4;
@apply grid gap-4 lg:gap-5;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));

@screen lg {
@apply gap-5;
}
}
dl div {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/components/VAudioTrack/VWaveform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export default defineComponent({
})
</script>

<style scoped lang="css">
<style scoped>
.waveform {
--v-background-color: var(
--waveform-background-color,
Expand Down
9 changes: 4 additions & 5 deletions src/components/VErrorSection/VErrorImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ export default {
}
</script>

<style scoped lang="scss">
<style scoped>
::v-deep .attribution {
@apply text-dark-charcoal-70;

a {
@apply text-current underline;
}
}
::v-deep a {
@apply text-current underline;
}
</style>
2 changes: 1 addition & 1 deletion src/components/VImageGrid/VImageGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default {
}
</script>

<style lang="scss" scoped>
<style scoped>
.image-grid:after {
/**
* This keeps the last item in the results from expanding to fill
Expand Down
4 changes: 2 additions & 2 deletions src/components/VNotificationBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const VNotificationBanner = defineComponent({
export default VNotificationBanner
</script>

<style scoped lang="scss">
// Styles from learn.wordpress.org
<style scoped>
/** Styles from learn.wordpress.org **/
.wrapper {
background-color: #fff8e5;
border-left: 0.25rem solid #ffb900;
Expand Down
2 changes: 1 addition & 1 deletion src/components/VSkeleton/VGridSkeleton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
}
</script>

<style lang="scss" scoped>
<style scoped>
.square {
aspect-ratio: 1 / 1;
}
Expand Down
11 changes: 5 additions & 6 deletions src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,24 @@ const embeddedPage = {
}
export default embeddedPage
</script>
<style lang="scss" scoped>
<style scoped>
.app {
grid-template-rows: auto 1fr;
}

@screen md {
// Logic for displaying the filter sidebar and search results
// as independently-scrolling sections.
/** Display the search filter sidebar and results as independently-scrolling. **/
.main {
height: 100%;
display: grid;
grid-template-columns: 1fr 336px;
}
// Make the main content area span both grid columns
// when the sidebar is closed...

/** Make the main content area span both grid columns when the sidebar is closed... **/
.main > *:first-child {
grid-column: span 2;
}
// ...and only one column when it is visible.
/** ...and only one column when it is visible. **/
.main.has-sidebar > *:first-child {
grid-column: 1;
}
Expand Down
3 changes: 1 addition & 2 deletions src/locales/po-files/openverse.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Openverse \n"
"Report-Msgid-Bugs-To: https://github.com/wordpress/openverse/issues \n"
"POT-Creation-Date: 2022-03-23T10:00:02+00:00\n"
"POT-Creation-Date: 2022-03-28T21:45:58+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1868,7 +1868,6 @@ msgctxt "hero.aria.search-type"
msgid "search type"
msgstr ""

#: src/components/LocaleSelector.vue:3
msgctxt "hero.locale.label"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The locale selector strings are still there in the .pot file. I guess if we delete them from the JSON file, they will be removed from .pot, too?

msgid "Languages available"
msgstr ""
Expand Down
Loading