0
0
Fork 0

Removed editor settings and eslint formatter

This commit is contained in:
Joan Sanchez 2022-03-14 11:31:37 +01:00
parent cbfcb237eb
commit 69728b32cb
48 changed files with 2847 additions and 469 deletions

View File

@ -80,7 +80,7 @@ module.exports = {
// TypeScript
quotes: ['warn', 'single', { avoidEscape: true }],
'@typescript-eslint/explicit-function-return-type': 'off',
"@typescript-eslint/unbound-method": "off",
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',

1
.gitignore vendored
View File

@ -3,7 +3,6 @@
node_modules
# Quasar core related directories
.quasar
/dist
# Cordova related directories and files

39
.quasar/app.js Normal file
View File

@ -0,0 +1,39 @@
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* DO NOT EDIT.
*
* You are probably looking on adding startup/initialization code.
* Use "quasar new boot <name>" and add it there.
* One boot file per concern. Then reference the file(s) in quasar.conf.js > boot:
* boot: ['file', ...] // do not add ".js" extension to it.
*
* Boot files are your "main.js"
**/
import { Quasar } from 'quasar';
import RootComponent from 'app/src/App.vue';
import createRouter from 'app/src/router/index';
export default async function (createAppFn, quasarUserOptions) {
// create store and router instances
const router = typeof createRouter === 'function' ? await createRouter({}) : createRouter;
// Create the app instance.
// Here we inject into it the Quasar UI, the router & possibly the store.
const app = createAppFn(RootComponent);
app.config.devtools = true;
app.use(Quasar, quasarUserOptions);
// Expose the app, the router and the store.
// Note that we are not mounting the app here, since bootstrapping will be
// different depending on whether we are in a browser or on the server.
return {
app,
router,
};
}

100
.quasar/client-entry.js Normal file
View File

@ -0,0 +1,100 @@
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* DO NOT EDIT.
*
* You are probably looking on adding startup/initialization code.
* Use "quasar new boot <name>" and add it there.
* One boot file per concern. Then reference the file(s) in quasar.conf.js > boot:
* boot: ['file', ...] // do not add ".js" extension to it.
*
* Boot files are your "main.js"
**/
import { createApp } from 'vue';
import '@quasar/extras/roboto-font/roboto-font.css';
import '@quasar/extras/material-icons/material-icons.css';
// We load Quasar stylesheet file
import 'quasar/dist/quasar.sass';
import 'src/css/app.scss';
import createQuasarApp from './app.js';
import quasarUserOptions from './quasar-user-options.js';
console.info('[Quasar] Running SPA.');
const publicPath = ``;
async function start({ app, router }, bootFiles) {
let hasRedirected = false;
const getRedirectUrl = (url) => {
try {
return router.resolve(url).href;
} catch (err) {}
return Object(url) === url ? null : url;
};
const redirect = (url) => {
hasRedirected = true;
if (typeof url === 'string' && /^https?:\/\//.test(url)) {
window.location.href = url;
return;
}
const href = getRedirectUrl(url);
// continue if we didn't fail to resolve the url
if (href !== null) {
window.location.href = href;
window.location.reload();
}
};
const urlPath = window.location.href.replace(window.location.origin, '');
for (let i = 0; hasRedirected === false && i < bootFiles.length; i++) {
try {
await bootFiles[i]({
app,
router,
ssrContext: null,
redirect,
urlPath,
publicPath,
});
} catch (err) {
if (err && err.url) {
redirect(err.url);
return;
}
console.error('[Quasar] boot error:', err);
return;
}
}
if (hasRedirected === true) {
return;
}
app.use(router);
app.mount('#q-app');
}
createQuasarApp(createApp, quasarUserOptions).then((app) => {
return Promise.all([
import(/* webpackMode: "eager" */ 'boot/i18n'),
import(/* webpackMode: "eager" */ 'boot/axios'),
]).then((bootFiles) => {
const boot = bootFiles.map((entry) => entry.default).filter((entry) => typeof entry === 'function');
start(app, boot);
});
});

113
.quasar/client-prefetch.js Normal file
View File

@ -0,0 +1,113 @@
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* DO NOT EDIT.
*
* You are probably looking on adding startup/initialization code.
* Use "quasar new boot <name>" and add it there.
* One boot file per concern. Then reference the file(s) in quasar.conf.js > boot:
* boot: ['file', ...] // do not add ".js" extension to it.
*
* Boot files are your "main.js"
**/
import App from 'app/src/App.vue';
let appPrefetch =
typeof App.preFetch === 'function'
? App.preFetch
: // Class components return the component options (and the preFetch hook) inside __c property
App.__c !== void 0 && typeof App.__c.preFetch === 'function'
? App.__c.preFetch
: false;
function getMatchedComponents(to, router) {
const route = to ? (to.matched ? to : router.resolve(to).route) : router.currentRoute;
if (!route) {
return [];
}
return Array.prototype.concat.apply(
[],
route.matched.map((m) => {
return Object.keys(m.components).map((key) => {
const comp = m.components[key];
return {
path: m.path,
c: comp,
};
});
})
);
}
export function addPreFetchHooks(router, publicPath) {
// Add router hook for handling preFetch.
// Doing it after initial route is resolved so that we don't double-fetch
// the data that we already have. Using router.beforeResolve() so that all
// async components are resolved.
router.beforeResolve((to, from, next) => {
const urlPath = window.location.href.replace(window.location.origin, ''),
matched = getMatchedComponents(to, router),
prevMatched = getMatchedComponents(from, router);
let diffed = false;
const preFetchList = matched
.filter((m, i) => {
return (
diffed ||
(diffed =
!prevMatched[i] || prevMatched[i].c !== m.c || m.path.indexOf('/:') > -1) // does it has params?
);
})
.filter(
(m) =>
m.c !== void 0 &&
(typeof m.c.preFetch === 'function' ||
// Class components return the component options (and the preFetch hook) inside __c property
(m.c.__c !== void 0 && typeof m.c.__c.preFetch === 'function'))
)
.map((m) => (m.c.__c !== void 0 ? m.c.__c.preFetch : m.c.preFetch));
if (appPrefetch !== false) {
preFetchList.unshift(appPrefetch);
appPrefetch = false;
}
if (preFetchList.length === 0) {
return next();
}
let hasRedirected = false;
const redirect = (url) => {
hasRedirected = true;
next(url);
};
const proceed = () => {
if (hasRedirected === false) {
next();
}
};
preFetchList
.reduce(
(promise, preFetch) =>
promise.then(
() =>
hasRedirected === false &&
preFetch({
currentRoute: to,
previousRoute: from,
redirect,
urlPath,
publicPath,
})
),
Promise.resolve()
)
.then(proceed)
.catch((e) => {
console.error(e);
proceed();
});
});
}

View File

@ -0,0 +1,15 @@
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* DO NOT EDIT.
*
* You are probably looking on adding startup/initialization code.
* Use "quasar new boot <name>" and add it there.
* One boot file per concern. Then reference the file(s) in quasar.conf.js > boot:
* boot: ['file', ...] // do not add ".js" extension to it.
*
* Boot files are your "main.js"
**/
import { Notify } from 'quasar';
export default { config: {}, plugins: { Notify } };

View File

@ -1,15 +0,0 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"editorconfig.editorconfig",
"johnsoncodehk.volar",
"wayou.vscode-todo-highlight"
],
"unwantedRecommendations": [
"octref.vetur",
"hookyqr.beautify",
"dbaeumer.jshint",
"ms-vscode.vscode-typescript-tslint-plugin"
]
}

39
.vscode/settings.json vendored
View File

@ -2,41 +2,6 @@
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": [
"source.fixAll.eslint"
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"vue"
],
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[vue]": {
"editor.defaultFormatter": "johnsoncodehk.volar"
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"json.schemas": [
{
"fileMatch": [
"cypress.json"
],
"url": "https://on.cypress.io/cypress.schema.json"
}
]
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"]
}

View File

@ -74,8 +74,7 @@ module.exports = {
// (sync) .babelrc, .babelrc.js, babel.config.js, package.json
// https://github.com/tleunen/find-babel-config/issues/33
'.*\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
},
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],

View File

@ -1,14 +1,9 @@
{
"@quasar/testing-unit-jest": {
"babel": "babelrc",
"options": [
"scripts",
"typescript"
]
"options": ["scripts", "typescript"]
},
"@quasar/testing-e2e-cypress": {
"options": [
"scripts"
]
"options": ["scripts"]
}
}

View File

@ -4,7 +4,6 @@ import axios, { AxiosInstance } from 'axios';
import { useSession } from 'src/composables/useSession';
const { getToken } = useSession();
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$axios: AxiosInstance;
@ -34,7 +33,6 @@ axios.interceptors.request.use(
}
);
export default boot(({ app }) => {
// for use inside Vue files (Options API) through this.$axios and this.$api

View File

@ -1,7 +1,7 @@
<template>
<q-header class="bg-dark" color="white" elevated bordered>
<q-toolbar class="q-py-sm q-px-md">
<q-btn flat @click="$emit('on-toggle-drawer')" round dense icon="menu" />
<q-btn flat @click="$emit('toggle-drawer')" round dense icon="menu" />
<router-link to="/">
<q-btn flat round class="q-ml-xs" v-if="$q.screen.gt.xs">
<q-avatar square size="md">
@ -51,4 +51,8 @@ const session = useSession();
const state = useState();
const user = state.getUser();
const token = session.getToken();
defineEmits<{
(event: 'toggle-drawer'): void;
}>();
</script>

View File

@ -1,12 +1,5 @@
<template>
<q-btn
data-cy="button"
label="test emit"
color="positive"
rounded
icon="edit"
@click="$emit('test')"
/>
<q-btn data-cy="button" label="test emit" color="positive" rounded icon="edit" @click="$emit('test')" />
</template>
<script>

View File

@ -6,12 +6,7 @@
<!-- buttons example -->
<q-card-actions align="right">
<q-btn
data-cy="ok-button"
color="primary"
label="OK"
@click="onOKClick"
/>
<q-btn data-cy="ok-button" color="primary" label="OK" @click="onOKClick" />
<q-btn color="primary" label="Cancel" @click="onCancelClick" />
</q-card-actions>
</q-card>
@ -37,8 +32,7 @@ export default defineComponent({
setup() {
// REQUIRED; must be called inside of setup()
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
useDialogPluginComponent();
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent();
// dialogRef - Vue ref to be applied to QDialog
// onDialogHide - Function to be used as handler for @hide on QDialog
// onDialogOK - Function to call to settle dialog with "ok" outcome

View File

@ -1,14 +1,7 @@
<template>
<q-btn color="primary" data-cy="button">
Button
<q-tooltip
v-model="showTooltip"
data-cy="tooltip"
class="bg-red"
:offset="[10, 10]"
>
Here I am!
</q-tooltip>
<q-tooltip v-model="showTooltip" data-cy="tooltip" class="bg-red" :offset="[10, 10]"> Here I am! </q-tooltip>
</q-btn>
</template>

View File

@ -11,12 +11,7 @@
true-value="en"
v-model="locale"
/>
<q-toggle
v-model="darkMode"
checked-icon="dark_mode"
color="orange"
unchecked-icon="light_mode"
/>
<q-toggle v-model="darkMode" checked-icon="dark_mode" color="orange" unchecked-icon="light_mode" />
<q-btn color="orange" outline size="sm" label="Settings" icon="settings" />
</div>
@ -36,15 +31,7 @@
</div>
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.username }}</div>
<q-btn
color="orange"
flat
label="Log Out"
size="sm"
icon="logout"
@click="logout()"
v-close-popup
/>
<q-btn color="orange" flat label="Log Out" size="sm" icon="logout" @click="logout()" v-close-popup />
</div>
</div>
</q-menu>

View File

@ -27,9 +27,7 @@ describe('QuasarButton', () => {
it('should have a `positive` color', () => {
mount(QuasarButton);
cy.dataCy('button')
.should('have.backgroundColor', 'var(--q-positive)')
.should('have.color', 'white');
cy.dataCy('button').should('have.backgroundColor', 'var(--q-positive)').should('have.color', 'white');
});
it('should emit `test` upon click', () => {

View File

@ -9,13 +9,7 @@ describe('QuasarDrawer', () => {
component: QuasarDrawer,
},
});
cy.dataCy('drawer')
.should('exist')
.dataCy('button')
.should('not.be.visible');
cy.get('.q-scrollarea .scroll')
.scrollTo('bottom', { duration: 500 })
.dataCy('button')
.should('be.visible');
cy.dataCy('drawer').should('exist').dataCy('button').should('not.be.visible');
cy.get('.q-scrollarea .scroll').scrollTo('bottom', { duration: 500 }).dataCy('button').should('be.visible');
});
});

File diff suppressed because one or more lines are too long

View File

@ -1,35 +1,35 @@
export default {
globals: {
lang: {
'es': 'Spanish',
'en': 'English'
}
es: 'Spanish',
en: 'English',
},
},
errors: {
'statusUnauthorized': 'Access denied',
'statusInternalServerError': 'An internal server error has ocurred'
statusUnauthorized: 'Access denied',
statusInternalServerError: 'An internal server error has ocurred',
},
login: {
'title': 'Login',
'username': 'Username',
'password': 'Password',
'submit': 'Log in',
'keepLogin': 'Keep me logged in',
'loginSuccess': 'You have successfully logged in',
'loginError': 'Invalid username or password'
title: 'Login',
username: 'Username',
password: 'Password',
submit: 'Log in',
keepLogin: 'Keep me logged in',
loginSuccess: 'You have successfully logged in',
loginError: 'Invalid username or password',
},
customer: {},
components: {
'topbar': {},
'userPanel': {
'settings': 'Settings',
'logOut': 'Log Out'
}
topbar: {},
userPanel: {
settings: 'Settings',
logOut: 'Log Out',
},
},
pages: {
'logIn': 'Log In',
'dashboard': 'Dashboard',
'customers': 'Customers',
'list': 'List',
}
logIn: 'Log In',
dashboard: 'Dashboard',
customers: 'Customers',
list: 'List',
},
};

View File

@ -1,29 +1,29 @@
export default {
'globals': {
'lang': {
'es': 'Español',
'en': 'Inglés'
}
globals: {
lang: {
es: 'Español',
en: 'Inglés',
},
'errors': {
'statusUnauthorized': 'Acceso denegado',
'statusInternalServerError': 'Ha ocurrido un error interno del servidor'
},
'login': {
'title': 'Iniciar sesión',
'username': 'Nombre de usuario',
'password': 'Contraseña',
'submit': 'Iniciar sesión',
'keepLogin': 'Mantener sesión iniciada',
'loginSuccess': 'Inicio de sesión correcto',
'loginError': 'Nombre de usuario o contraseña incorrectos'
errors: {
statusUnauthorized: 'Acceso denegado',
statusInternalServerError: 'Ha ocurrido un error interno del servidor',
},
'customer': {},
'components': {
'topbar': {},
'userPanel': {
'settings': 'Configuración',
'logOut': 'Cerrar sesión'
}
}
}
login: {
title: 'Iniciar sesión',
username: 'Nombre de usuario',
password: 'Contraseña',
submit: 'Iniciar sesión',
keepLogin: 'Mantener sesión iniciada',
loginSuccess: 'Inicio de sesión correcto',
loginError: 'Nombre de usuario o contraseña incorrectos',
},
customer: {},
components: {
topbar: {},
userPanel: {
settings: 'Configuración',
logOut: 'Cerrar sesión',
},
},
};

View File

@ -2,6 +2,6 @@ import en from './en';
import es from './es';
export default {
'en': en,
'es': es,
en: en,
es: es,
};

View File

@ -1,17 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>
<%= productName %>
</title>
<title><%= productName %></title>
<meta charset="utf-8" />
<meta name="description" content="<%= productDescription %>" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>" />
<meta
name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"
/>
<link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png" />
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png" />
@ -24,5 +23,4 @@
<!-- DO NOT touch the following DIV -->
<div id="q-app"></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<template>
<q-layout view="hHh lpR fFf">
<Navbar @on-toggle-drawer="onToggleDrawer()" />
<Navbar @toggle-drawer="onToggleDrawer()" />
<q-drawer
v-model="drawer"
show-if-above
@ -13,23 +13,13 @@
>
<q-scroll-area class="fit text-grey-8">
<q-list padding>
<q-item
clickable
v-ripple
:to="{ path: '/dashboard' }"
active-class="text-orange"
>
<q-item clickable v-ripple :to="{ path: '/dashboard' }" active-class="text-orange">
<q-item-section avatar>
<q-icon name="dashboard" />
</q-item-section>
<q-item-section>Dashboard</q-item-section>
</q-item>
<q-item
clickable
v-ripple
:to="{ path: '/customer' }"
active-class="text-orange"
>
<q-item clickable v-ripple :to="{ path: '/customer' }" active-class="text-orange">
<q-item-section avatar>
<q-icon name="people" />
</q-item-section>
@ -86,5 +76,4 @@ function onToggleDrawer(): void {
}
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>

View File

@ -11,25 +11,14 @@
true-value="en"
v-model="locale"
/>
<q-toggle
v-model="darkMode"
checked-icon="dark_mode"
color="orange"
unchecked-icon="light_mode"
/>
<q-toggle v-model="darkMode" checked-icon="dark_mode" color="orange" unchecked-icon="light_mode" />
</q-toolbar>
</q-header>
<q-page-container>
<q-page>
<div id="login">
<q-card class="login q-pa-xl">
<q-img
src="~/assets/logo.svg"
alt="Logo"
fit="contain"
:ratio="16 / 9"
class="q-mb-md"
/>
<q-img src="~/assets/logo.svg" alt="Logo" fit="contain" :ratio="16 / 9" class="q-mb-md" />
<q-form @submit="onSubmit" class="q-gutter-md">
<q-input
filled
@ -52,11 +41,7 @@
(val: string) => (val && val.length > 0) || 'Please type something',
]"
/>
<q-toggle
v-model="keepLogin"
:label="t('login.keepLogin')"
color="orange"
/>
<q-toggle v-model="keepLogin" :label="t('login.keepLogin')" color="orange" />
<div>
<q-btn :label="t('login.submit')" type="submit" color="orange" />

View File

@ -5,15 +5,7 @@
<div class="text-h2" style="opacity: 0.4">Oops. Nothing here...</div>
<q-btn
class="q-mt-xl"
color="white"
text-color="blue"
unelevated
to="/"
label="Go Home"
no-caps
/>
<q-btn class="q-mt-xl" color="white" text-color="blue" unelevated to="/" label="Go Home" no-caps />
</div>
</div>
</template>

View File

@ -1,10 +1,5 @@
import { route } from 'quasar/wrappers';
import {
createMemoryHistory,
createRouter,
createWebHashHistory,
createWebHistory,
} from 'vue-router';
import { createMemoryHistory, createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
import routes from './routes';
import { i18n } from 'src/boot/i18n';
import { useSession } from 'src/composables/useSession';
@ -32,13 +27,10 @@ export default route(function (/* { store, ssrContext } */) {
// Leave this as is and make changes in quasar.conf.js instead!
// quasar.conf.js -> build -> vueRouterMode
// quasar.conf.js -> build -> publicPath
history: createHistory(
process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE
),
history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE),
});
Router.beforeEach((to, from, next) => {
const { isLoggedIn } = session;
if (!isLoggedIn && to.name !== 'Login') {
@ -56,7 +48,6 @@ export default route(function (/* { store, ssrContext } */) {
const { t } = i18n.global;
let title = '';
const parent = to.matched[1];
if (parent) {
const parentMeta: Meta = parent.meta;
@ -76,6 +67,5 @@ export default route(function (/* { store, ssrContext } */) {
document.title = title;
});
return Router;
});

View File

@ -15,9 +15,7 @@
// cypress/plugins/index.js
const {
injectDevServer,
} = require('@quasar/quasar-app-extension-testing-e2e-cypress/cct-dev-server');
const { injectDevServer } = require('@quasar/quasar-app-extension-testing-e2e-cypress/cct-dev-server');
/**
* @type {Cypress.PluginConfig}

View File

@ -19,7 +19,7 @@ describe('MyButton', () => {
const wrapper = mount(MyButton);
const { vm } = wrapper;
expect((vm.$el).textContent).toContain('rocket muffin');
expect(vm.$el.textContent).toContain('rocket muffin');
expect(wrapper.find('.content').text()).toContain('rocket muffin');
});

View File

@ -12,7 +12,6 @@ const input = ref('rocket muffin');
function increment() {
counter.value += props.incrementStep;
}
</script>
<template>

View File

@ -1,4 +1,3 @@
<script lang="ts" setup>
import { ref } from 'vue';
const isDialogOpen = ref(false);