DEV: Update eslint-config-discourse, use prettier for hbs (#163)

This commit is contained in:
David Taylor 2023-01-04 12:34:08 +00:00 committed by GitHub
parent dc48bea931
commit c519b4bc92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 2365 additions and 926 deletions

View File

@ -41,8 +41,8 @@ jobs:
shell: bash shell: bash
run: | run: |
yarn prettier -v yarn prettier -v
if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" -or -name "*.hbs" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "assets/**/*.{scss,js,es6}" yarn prettier --list-different "assets/**/*.{scss,js,es6,hbs}"
fi fi
if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "test/**/*.{js,es6}" yarn prettier --list-different "test/**/*.{js,es6}"
@ -50,7 +50,12 @@ jobs:
- name: Ember template lint - name: Ember template lint
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts admin/assets/javascripts run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts
# Separated due to https://github.com/ember-template-lint/ember-template-lint/issues/2758
- name: Ember template lint (admin)
if: ${{ !cancelled() }}
run: yarn ember-template-lint --no-error-on-unmatched-pattern admin/assets/javascripts
- name: Rubocop - name: Rubocop
if: ${{ !cancelled() }} if: ${{ !cancelled() }}

View File

@ -24,9 +24,8 @@ export default AdComponent.extend({
const placement = this.get("placement"); const placement = this.get("placement");
if (!mobileView && this.siteSettings.amazon_topic_list_top_src_code) { if (!mobileView && this.siteSettings.amazon_topic_list_top_src_code) {
data["topic-list-top"][ data["topic-list-top"]["user_input"] =
"user_input" this.siteSettings.amazon_topic_list_top_src_code;
] = this.siteSettings.amazon_topic_list_top_src_code;
data["topic-list-top"]["amazon_width"] = parseInt( data["topic-list-top"]["amazon_width"] = parseInt(
this.siteSettings.amazon_topic_list_top_ad_width_code, this.siteSettings.amazon_topic_list_top_ad_width_code,
10 10
@ -38,9 +37,8 @@ export default AdComponent.extend({
} }
if (mobileView && this.siteSettings.amazon_mobile_topic_list_top_src_code) { if (mobileView && this.siteSettings.amazon_mobile_topic_list_top_src_code) {
data["topic-list-top"][ data["topic-list-top"]["user_input_mobile"] =
"user_input_mobile" this.siteSettings.amazon_mobile_topic_list_top_src_code;
] = this.siteSettings.amazon_mobile_topic_list_top_src_code;
data["topic-list-top"]["mobile_amazon_width"] = parseInt( data["topic-list-top"]["mobile_amazon_width"] = parseInt(
this.siteSettings.amazon_mobile_topic_list_top_ad_width_code, this.siteSettings.amazon_mobile_topic_list_top_ad_width_code,
10 10
@ -55,9 +53,8 @@ export default AdComponent.extend({
!mobileView && !mobileView &&
this.siteSettings.amazon_topic_above_post_stream_src_code this.siteSettings.amazon_topic_above_post_stream_src_code
) { ) {
data["topic-above-post-stream"][ data["topic-above-post-stream"]["user_input"] =
"user_input" this.siteSettings.amazon_topic_above_post_stream_src_code;
] = this.siteSettings.amazon_topic_above_post_stream_src_code;
data["topic-above-post-stream"]["amazon_width"] = parseInt( data["topic-above-post-stream"]["amazon_width"] = parseInt(
this.siteSettings.amazon_topic_above_post_stream_ad_width_code, this.siteSettings.amazon_topic_above_post_stream_ad_width_code,
10 10
@ -72,9 +69,8 @@ export default AdComponent.extend({
mobileView && mobileView &&
this.siteSettings.amazon_mobile_topic_above_post_stream_src_code this.siteSettings.amazon_mobile_topic_above_post_stream_src_code
) { ) {
data["topic-above-post-stream"][ data["topic-above-post-stream"]["user_input_mobile"] =
"user_input_mobile" this.siteSettings.amazon_mobile_topic_above_post_stream_src_code;
] = this.siteSettings.amazon_mobile_topic_above_post_stream_src_code;
data["topic-above-post-stream"]["mobile_amazon_width"] = parseInt( data["topic-above-post-stream"]["mobile_amazon_width"] = parseInt(
this.siteSettings.amazon_mobile_topic_above_post_stream_ad_width_code, this.siteSettings.amazon_mobile_topic_above_post_stream_ad_width_code,
10 10
@ -89,9 +85,8 @@ export default AdComponent.extend({
!mobileView && !mobileView &&
this.siteSettings.amazon_topic_above_suggested_src_code this.siteSettings.amazon_topic_above_suggested_src_code
) { ) {
data["topic-above-suggested"][ data["topic-above-suggested"]["user_input"] =
"user_input" this.siteSettings.amazon_topic_above_suggested_src_code;
] = this.siteSettings.amazon_topic_above_suggested_src_code;
data["topic-above-suggested"]["amazon_width"] = parseInt( data["topic-above-suggested"]["amazon_width"] = parseInt(
this.siteSettings.amazon_topic_above_suggested_ad_width_code, this.siteSettings.amazon_topic_above_suggested_ad_width_code,
10 10
@ -106,9 +101,8 @@ export default AdComponent.extend({
mobileView && mobileView &&
this.siteSettings.amazon_mobile_topic_above_suggested_src_code this.siteSettings.amazon_mobile_topic_above_suggested_src_code
) { ) {
data["topic-above-suggested"][ data["topic-above-suggested"]["user_input_mobile"] =
"user_input_mobile" this.siteSettings.amazon_mobile_topic_above_suggested_src_code;
] = this.siteSettings.amazon_mobile_topic_above_suggested_src_code;
data["topic-above-suggested"]["mobile_amazon_width"] = parseInt( data["topic-above-suggested"]["mobile_amazon_width"] = parseInt(
this.siteSettings.amazon_mobile_topic_above_suggested_ad_width_code, this.siteSettings.amazon_mobile_topic_above_suggested_ad_width_code,
10 10
@ -120,9 +114,8 @@ export default AdComponent.extend({
} }
if (!mobileView && this.siteSettings.amazon_post_bottom_src_code) { if (!mobileView && this.siteSettings.amazon_post_bottom_src_code) {
data["post-bottom"][ data["post-bottom"]["user_input"] =
"user_input" this.siteSettings.amazon_post_bottom_src_code;
] = this.siteSettings.amazon_post_bottom_src_code;
data["post-bottom"]["amazon_width"] = parseInt( data["post-bottom"]["amazon_width"] = parseInt(
this.siteSettings.amazon_post_bottom_ad_width_code, this.siteSettings.amazon_post_bottom_ad_width_code,
10 10
@ -134,9 +127,8 @@ export default AdComponent.extend({
} }
if (mobileView && this.siteSettings.amazon_mobile_post_bottom_src_code) { if (mobileView && this.siteSettings.amazon_mobile_post_bottom_src_code) {
data["post-bottom"][ data["post-bottom"]["user_input_mobile"] =
"user_input_mobile" this.siteSettings.amazon_mobile_post_bottom_src_code;
] = this.siteSettings.amazon_mobile_post_bottom_src_code;
data["post-bottom"]["mobile_amazon_width"] = parseInt( data["post-bottom"]["mobile_amazon_width"] = parseInt(
this.siteSettings.amazon_mobile_post_bottom_ad_width_code, this.siteSettings.amazon_mobile_post_bottom_ad_width_code,
10 10

View File

@ -1,4 +1,5 @@
import MultiSelectComponent from "select-kit/components/multi-select"; import MultiSelectComponent from "select-kit/components/multi-select";
import Ember from "ember";
const { makeArray } = Ember; const { makeArray } = Ember;
import { computed } from "@ember/object"; import { computed } from "@ember/object";

View File

@ -3,17 +3,43 @@
{{#if houseAds.length}} {{#if houseAds.length}}
<form class="form-horizontal"> <form class="form-horizontal">
{{house-ads-list-setting name="topic_list_top" value=adSettings.topic_list_top allAds=houseAds adSettings=adSettings}} {{house-ads-list-setting
{{house-ads-list-setting name="topic_above_post_stream" value=adSettings.topic_above_post_stream allAds=houseAds adSettings=adSettings}} name="topic_list_top"
{{house-ads-list-setting name="topic_above_suggested" value=adSettings.topic_above_suggested allAds=houseAds adSettings=adSettings}} value=adSettings.topic_list_top
{{house-ads-list-setting name="post_bottom" value=adSettings.post_bottom allAds=houseAds adSettings=adSettings}} allAds=houseAds
{{house-ads-list-setting name="topic_list_between" value=adSettings.topic_list_between allAds=houseAds adSettings=adSettings}} adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_above_post_stream"
value=adSettings.topic_above_post_stream
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_above_suggested"
value=adSettings.topic_above_suggested
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="post_bottom"
value=adSettings.post_bottom
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_list_between"
value=adSettings.topic_list_between
allAds=houseAds
adSettings=adSettings
}}
{{d-button label="admin.adplugin.house_ads.more_settings" {{d-button
icon="cog" label="admin.adplugin.house_ads.more_settings"
class="btn-default" icon="cog"
action=(route-action "moreSettings") class="btn-default"
}} action=(route-action "moreSettings")
}}
</form> </form>
{{else}} {{else}}
<p> <p>
@ -22,4 +48,4 @@
{{/link-to}} {{/link-to}}
</p> </p>
{{/if}} {{/if}}
{{/d-section}} {{/d-section}}

View File

@ -8,7 +8,8 @@
action=(action "save") action=(action "save")
disabled=disableSave disabled=disableSave
class="btn-primary" class="btn-primary"
label="admin.adplugin.house_ads.save"}} label="admin.adplugin.house_ads.save"
}}
{{#if saving}} {{#if saving}}
{{savingStatus}} {{savingStatus}}
@ -21,6 +22,7 @@
{{d-button {{d-button
action=(action "destroy") action=(action "destroy")
class="btn-danger delete-button" class="btn-danger delete-button"
label="admin.adplugin.house_ads.delete"}} label="admin.adplugin.house_ads.delete"
}}
</div> </div>
{{/d-section}} {{/d-section}}

View File

@ -24,4 +24,4 @@
</div> </div>
{{/if}} {{/if}}
{{outlet}} {{outlet}}
</div> </div>

View File

@ -1,5 +1,6 @@
{{#each adComponents as |adComponent|}} {{#each adComponents as |adComponent|}}
{{component adComponent {{component
adComponent
placement=placement placement=placement
refreshOnChange=refreshOnChange refreshOnChange=refreshOnChange
category=category category=category
@ -8,4 +9,4 @@
indexNumber=indexNumber indexNumber=indexNumber
tagName=childTagName tagName=childTagName
}} }}
{{/each}} {{/each}}

View File

@ -1,3 +1,3 @@
{{#if showAd}} {{#if showAd}}
<div id={{divId}} class={{className}}></div> <div id={{divId}} class={{className}}></div>
{{/if}} {{/if}}

View File

@ -1,6 +1,7 @@
{{#if showAd}} {{#if showAd}}
{{#if site.mobileView}} {{#if site.mobileView}}
<div class="amazon-product-links-label" style={{adTitleStyleMobile}}><h2>{{i18n "adplugin.advertisement_label"}}</h2></div> <div class="amazon-product-links-label" style={{adTitleStyleMobile}}><h2
>{{i18n "adplugin.advertisement_label"}}</h2></div>
<iframe <iframe
style={{adWrapperStyleMobile}} style={{adWrapperStyleMobile}}
marginwidth="0" marginwidth="0"
@ -12,7 +13,9 @@
> >
</iframe> </iframe>
{{else}} {{else}}
<div class="amazon-product-links-label"><h2>{{i18n "adplugin.advertisement_label"}}</h2></div> <div class="amazon-product-links-label"><h2>{{i18n
"adplugin.advertisement_label"
}}</h2></div>
<div class="container" align="center"> <div class="container" align="center">
<iframe <iframe
style={{adWrapperStyle}} style={{adWrapperStyle}}
@ -26,4 +29,4 @@
</iframe> </iframe>
</div> </div>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -1,4 +1,5 @@
{{#if showAd}} {{#if showAd}}
{{! template-lint-disable no-forbidden-elements }}
<script src={{url}} id="_carbonads_js" async type="text/javascript"> <script src={{url}} id="_carbonads_js" async type="text/javascript">
</script> </script>
{{/if}} {{/if}}

View File

@ -1,11 +1,15 @@
{{#if showAd}} {{#if showAd}}
<div class="google-adsense-label"><h2>{{i18n "adplugin.advertisement_label"}}</h2></div> <div class="google-adsense-label"><h2>{{i18n
"adplugin.advertisement_label"
}}</h2></div>
<div class="google-adsense-content" style={{adWrapperStyle}}> <div class="google-adsense-content" style={{adWrapperStyle}}>
<ins class="adsbygoogle" <ins
class="adsbygoogle"
style={{adInsStyle}} style={{adInsStyle}}
data-ad-client="ca-pub-{{publisher_id}}" data-ad-client="ca-pub-{{publisher_id}}"
data-ad-slot={{ad_code}} data-ad-slot={{ad_code}}
data-ad-format={{autoAdFormat}}> data-ad-format={{autoAdFormat}}
>
</ins> </ins>
</div> </div>
{{/if}} {{/if}}

View File

@ -1,9 +1,23 @@
{{#if showAd}} {{#if showAd}}
{{#if site.mobileView}} {{#if site.mobileView}}
<div class="google-dfp-ad-label" style={{adTitleStyleMobile}}><h2>{{i18n "adplugin.advertisement_label"}}</h2></div> <div class="google-dfp-ad-label" style={{adTitleStyleMobile}}><h2>{{i18n
<div id={{divId}} style={{adWrapperStyle}} class="dfp-ad-unit" align="center"></div> "adplugin.advertisement_label"
}}</h2></div>
<div
id={{divId}}
style={{adWrapperStyle}}
class="dfp-ad-unit"
align="center"
></div>
{{else}} {{else}}
<div class="google-dfp-ad-label"><h2>{{i18n "adplugin.advertisement_label"}}</h2></div> <div class="google-dfp-ad-label"><h2>{{i18n
<div id={{divId}} style={{adWrapperStyle}} class="dfp-ad-unit" align="center"></div> "adplugin.advertisement_label"
}}</h2></div>
<div
id={{divId}}
style={{adWrapperStyle}}
class="dfp-ad-unit"
align="center"
></div>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -1,3 +1,3 @@
{{#if showAd}} {{#if showAd}}
{{html-safe adHtml}} {{html-safe adHtml}}
{{/if}} {{/if}}

View File

@ -10,4 +10,4 @@
{{d-button class="cancel" action=(action "cancel") icon="times"}} {{d-button class="cancel" action=(action "cancel") icon="times"}}
{{/if}} {{/if}}
</div> </div>
<p class="help">{{help}}</p> <p class="help">{{help}}</p>

View File

@ -6,4 +6,4 @@
{{d-button class="cancel" action=(action "cancel") icon="times"}} {{d-button class="cancel" action=(action "cancel") icon="times"}}
{{/if}} {{/if}}
</div> </div>
<p class="help">{{help}}</p> <p class="help">{{help}}</p>

View File

@ -1 +1,5 @@
{{ad-slot placement="post-bottom" category=model.topic.category.slug postNumber=model.post_number}} {{ad-slot
placement="post-bottom"
category=model.topic.category.slug
postNumber=model.post_number
}}

View File

@ -5,4 +5,4 @@
listLoading=listLoading listLoading=listLoading
indexNumber=index indexNumber=index
childTagName="td" childTagName="td"
}} }}

View File

@ -1 +1,6 @@
{{ad-slot placement="topic-list-top" refreshOnChange=listLoading category=category.slug listLoading=listLoading}} {{ad-slot
placement="topic-list-top"
refreshOnChange=listLoading
category=category.slug
listLoading=listLoading
}}

View File

@ -1 +1 @@
{{post-bottom-ad model=this}} {{post-bottom-ad model=this}}

View File

@ -1 +1,5 @@
{{ad-slot placement="topic-above-post-stream" refreshOnChange=model.id category=model.category.slug}} {{ad-slot
placement="topic-above-post-stream"
refreshOnChange=model.id
category=model.category.slug
}}

View File

@ -1 +1,5 @@
{{ad-slot placement="topic-above-suggested" refreshOnChange=model.id category=model.category.slug}} {{ad-slot
placement="topic-above-suggested"
refreshOnChange=model.id
category=model.category.slug
}}

3093
yarn.lock

File diff suppressed because it is too large Load Diff