ci: 👷 lint code to MediaWiki standards

Check commit and GitHub actions for more details
This commit is contained in:
github-actions 2023-07-12 02:07:37 +00:00
parent 7f75899995
commit a7660375fc
3 changed files with 23 additions and 23 deletions

View file

@ -45,17 +45,17 @@ module.exports = exports = defineComponent( {
default: false
}
},
methods: {
escapeId( id ) {
return mw.util.escapeIdForAttribute( id )
}
},
data: function () {
return {
tabsData: this.tabberData.tabsData,
currentTab: this.tabberData.currentTab
};
},
methods: {
escapeId( id ) {
return mw.util.escapeIdForAttribute( id );
}
},
mounted: function () {
this.$el.parentElement.classList.add( 'tabber--live' );
}

View file

@ -32,12 +32,9 @@ module.exports = exports = defineComponent( {
compilerOptions: {
whitespace: 'condense'
},
data() {
return {
tabsData: [],
currentTab: ''
};
components: {
CdxTabs: CdxTabs,
CdxTab: CdxTab
},
props: {
html: {
@ -45,32 +42,35 @@ module.exports = exports = defineComponent( {
required: true
}
},
components: {
CdxTabs: CdxTabs,
CdxTab: CdxTab,
data() {
return {
tabsData: [],
currentTab: ''
};
},
methods: {
isChildTabber() {
return Array.isArray(this.html) || this.html.includes("{\"label\":")
return Array.isArray( this.html ) || this.html.includes( '{"label":' );
},
parse() {
if (Array.isArray(this.html)) {
return this.html
if ( Array.isArray( this.html ) ) {
return this.html;
} else {
const tmp = document.createElement('div');
const tmp = document.createElement( 'div' );
tmp.innerHTML = this.html;
return JSON.parse( tmp.textContent.trim() );
}
},
escapeId( id ) {
return mw.util.escapeIdForAttribute( id )
return mw.util.escapeIdForAttribute( id );
}
},
mounted: function () {
if (this.isChildTabber()) {
this.tabsData = this.parse(this.html)
this.currentTab = this.escapeId( this.tabsData[0].label )
if ( this.isChildTabber() ) {
this.tabsData = this.parse( this.html );
this.currentTab = this.escapeId( this.tabsData[ 0 ].label );
}
}
} );

View file

@ -26,7 +26,7 @@ function initApp( tabber ) {
tabberData.currentTab = tabberData.tabsData[ 0 ].name;
//@ts-ignore MediaWiki-specific function
// @ts-ignore MediaWiki-specific function
Vue.createMwApp(
App, Object.assign( {
tabberData: tabberData