chore(vue): add eslint and prettier (#26635)

This commit is contained in:
Liam DeBeasi
2023-01-18 18:29:25 -05:00
committed by GitHub
parent 6d4c52aa5b
commit dc27736bd5
25 changed files with 5693 additions and 574 deletions

View File

@ -1,27 +1,32 @@
import { App, Plugin } from 'vue';
import { IonicConfig, initialize } from '@ionic/core/components';
import type { IonicConfig } from "@ionic/core/components";
import { initialize } from "@ionic/core/components";
import type { App, Plugin } from "vue";
// TODO(FW-2969): types
/**
* We need to make sure that the web component fires an event
* that will not conflict with the user's @ionChange binding,
* otherwise the binding's callback will fire before any
* v-model values have been updated.
*/
const toKebabCase = (eventName: string) => eventName === 'ionChange' ? 'v-ion-change' : eventName.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
* We need to make sure that the web component fires an event
* that will not conflict with the user's @ionChange binding,
* otherwise the binding's callback will fire before any
* v-model values have been updated.
*/
const toKebabCase = (eventName: string) =>
eventName === "ionChange"
? "v-ion-change"
: eventName.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
const getHelperFunctions = () => {
return {
ael: (el: any, eventName: string, cb: any, opts: any) => el.addEventListener(toKebabCase(eventName), cb, opts),
rel: (el: any, eventName: string, cb: any, opts: any) => el.removeEventListener(toKebabCase(eventName), cb, opts),
ce: (eventName: string, opts: any) => new CustomEvent(toKebabCase(eventName), opts)
ael: (el: any, eventName: string, cb: any, opts: any) =>
el.addEventListener(toKebabCase(eventName), cb, opts),
rel: (el: any, eventName: string, cb: any, opts: any) =>
el.removeEventListener(toKebabCase(eventName), cb, opts),
ce: (eventName: string, opts: any) =>
new CustomEvent(toKebabCase(eventName), opts),
};
};
export const IonicVue: Plugin = {
async install(_: App, config: IonicConfig = {}) {
/**
* By default Ionic Framework hides elements that
@ -30,8 +35,8 @@ export const IonicVue: Plugin = {
* TODO FW-2797: Remove when all integrations have been
* migrated to CE build.
*/
if (typeof (document as any) !== 'undefined') {
document.documentElement.classList.add('ion-ce');
if (typeof (document as any) !== "undefined") {
document.documentElement.classList.add("ion-ce");
}
const { ael, rel, ce } = getHelperFunctions();
@ -39,7 +44,7 @@ export const IonicVue: Plugin = {
...config,
_ael: ael,
_rel: rel,
_ce: ce
_ce: ce,
});
}
},
};