From 6a75d1bf518cbfed581c786650cb4b7b33763f67 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 6 Dec 2021 00:40:50 +0100 Subject: [PATCH] chore(format): Fix formatting, enforce prettier style --- .eslintrc.js | 30 ++++----- .postcssrc.js | 6 +- api/components/PasswordInput.vue | 2 +- api/components/UserAvatar.vue | 2 +- babel.config.js | 6 +- package.json | 11 ++-- quasar.conf.js | 100 ++++++++++++++---------------- src-capacitor/capacitor-flag.d.ts | 4 +- src/layouts/MainLayout.vue | 27 +++++--- src/vendor-plugin.config.js | 4 +- 10 files changed, 91 insertions(+), 101 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5282c8c..f11ab16 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,11 +17,11 @@ module.exports = { project: resolve(__dirname, './tsconfig.json'), tsconfigRootDir: __dirname, ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features - sourceType: 'module' // Allows for the use of imports + sourceType: 'module', // Allows for the use of imports }, env: { - browser: true + browser: true, }, // Rules order is important, please avoid shuffling them @@ -44,7 +44,7 @@ module.exports = { // https://github.com/prettier/eslint-config-prettier#installation // usage with Prettier, provided by 'eslint-config-prettier'. - 'prettier', //'plugin:prettier/recommended' + 'plugin:prettier/recommended', ], plugins: [ @@ -54,10 +54,6 @@ module.exports = { // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file // required to lint *.vue files 'vue', - - // https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674 - // Prettier has not been included as plugin to avoid performance impact - // add it as an extension for your IDE ], globals: { @@ -70,7 +66,7 @@ module.exports = { __QUASAR_SSR_PWA__: true, process: true, Capacitor: true, - chrome: true + chrome: true, }, // add your custom rules here @@ -80,20 +76,16 @@ module.exports = { 'vue/multi-word-component-names': 'off', // Rejects on promises should always be of the Error type (and allow empty rejects as well) - 'prefer-promise-reject-errors': ["error", {"allowEmptyReject": true}], + 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], + + // Allow " if ' is contained inside the string, so we can avoid escaping + quotes: ['error', 'single', { avoidEscape: true }], - // Allow " if ' is contained inside the string, so we can avoid escaping - quotes: [ - process.env.NODE_ENV === 'production' ? 'error' : 'warn', - 'single', - { avoidEscape: true } - ], - // TypeScript, let us be not too strict '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', // allow debugger during development only - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' - } -} + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + }, +}; diff --git a/.postcssrc.js b/.postcssrc.js index 1174fe5..6da0a62 100644 --- a/.postcssrc.js +++ b/.postcssrc.js @@ -3,6 +3,6 @@ module.exports = { plugins: [ // to edit target browsers: use "browserslist" field in package.json - require('autoprefixer') - ] -} + require('autoprefixer'), + ], +}; diff --git a/api/components/PasswordInput.vue b/api/components/PasswordInput.vue index c7242c0..19d8301 100644 --- a/api/components/PasswordInput.vue +++ b/api/components/PasswordInput.vue @@ -44,4 +44,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/api/components/UserAvatar.vue b/api/components/UserAvatar.vue index 05eb2bf..98b8d91 100644 --- a/api/components/UserAvatar.vue +++ b/api/components/UserAvatar.vue @@ -43,4 +43,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/babel.config.js b/babel.config.js index 7744537..b4fda0c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1,4 @@ /* eslint-env node */ module.exports = { - presets: [ - '@quasar/babel-preset-app' - ] -} + presets: ['@quasar/babel-preset-app'], +}; diff --git a/package.json b/package.json index 149a3f3..311b369 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues" }, "scripts": { - "format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'", + "format": "prettier --config ./package.json --write '{,!(node_modules|dist|.*)/**/}*.{js,ts,vue}'", "lint": "eslint --ext .js,.ts,.vue ./src ./api" }, "dependencies": { @@ -30,14 +30,15 @@ "@types/node": "^14.17.34", "@types/webpack": "^5.28.0", "@types/webpack-env": "^1.16.3", - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", - "eslint": "^8.3.0", + "@typescript-eslint/eslint-plugin": "^5.5.0", + "@typescript-eslint/parser": "^5.5.0", + "eslint": "^8.4.0", "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-vue": "^8.1.1", "eslint-webpack-plugin": "^3.1.1", "modify-source-webpack-plugin": "^3.0.0", - "prettier": "^2.4.1", + "prettier": "^2.5.1", "typescript": "^4.5.2", "vuedraggable": "^4.1.0" }, diff --git a/quasar.conf.js b/quasar.conf.js index 6a86699..00fab5e 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -8,10 +8,9 @@ /* eslint-env node */ /* eslint-disable @typescript-eslint/no-var-requires */ -const ESLintPlugin = require('eslint-webpack-plugin') -const { ModifySourcePlugin } = require('modify-source-webpack-plugin') -const { configure } = require('quasar/wrappers') - +const ESLintPlugin = require('eslint-webpack-plugin'); +const { ModifySourcePlugin } = require('modify-source-webpack-plugin'); +const { configure } = require('quasar/wrappers'); module.exports = configure(function (/* ctx */) { return { @@ -22,7 +21,7 @@ module.exports = configure(function (/* ctx */) { enabled: true, files: './src/**/*.{ts,tsx,js,jsx,vue}', }, - } + }, }, // https://quasar.dev/quasar-cli/prefetch-feature @@ -45,7 +44,7 @@ module.exports = configure(function (/* ctx */) { // 'material-icons', 'mdi-v6', // 'themify', - + // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! 'roboto-font', // optional, you are not bound to it ], @@ -56,7 +55,6 @@ module.exports = configure(function (/* ctx */) { // transpile: false, - // Add dependencies for transpiling with Babel (Array of string/regex) // (from node_modules, which are by default not transpiled). // Applies only if "transpile" is set to true. @@ -71,33 +69,38 @@ module.exports = configure(function (/* ctx */) { // https://quasar.dev/quasar-cli/handling-webpack // "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain - chainWebpack (chain) { - chain.plugin('eslint-webpack-plugin') - .use(ESLintPlugin, [{ - extensions: [ 'ts', 'js', 'vue' ], - exclude: ['node_modules', 'src-capacitor'] - }]) - chain.plugin('modify-source-webpack-plugin') - .use(ModifySourcePlugin, [{ + chainWebpack(chain) { + chain.plugin('eslint-webpack-plugin').use(ESLintPlugin, [ + { + extensions: ['ts', 'js', 'vue'], + exclude: ['node_modules', 'src-capacitor'], + }, + ]); + chain.plugin('modify-source-webpack-plugin').use(ModifySourcePlugin, [ + { rules: [ { test: /plugins\.ts$/, modify: (src, filename) => { - const custom_plgns = require('./plugin.config.js') - const required_plgns = require('./src/vendor-plugin.config.js') - return src.replace(/\/\* *INSERT_PLUGIN_LIST *\*\//, - [...custom_plgns, ...required_plgns].map(v => `import("${v}").catch(() => "${v}")`) - .join(',')) - } - } - ] - }]) + const custom_plgns = require('./plugin.config.js'); + const required_plgns = require('./src/vendor-plugin.config.js'); + return src.replace( + /\/\* *INSERT_PLUGIN_LIST *\*\//, + [...custom_plgns, ...required_plgns] + .map((v) => `import("${v}").catch(() => "${v}")`) + .join(',') + ); + }, + }, + ], + }, + ]); chain.merge({ snapshot: { - managedPaths: [] - } - }) - } + managedPaths: [], + }, + }); + }, }, // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer @@ -105,7 +108,7 @@ module.exports = configure(function (/* ctx */) { https: false, port: 8080, open: false, // opens browser window automatically - watchFiles: {paths: ['/node_modules/@flaschengeist/**/*']} + watchFiles: { paths: ['/node_modules/@flaschengeist/**/*'] }, }, // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework @@ -117,8 +120,8 @@ module.exports = configure(function (/* ctx */) { loadingBar: { position: 'top', color: 'warning', - size: '5px' - } + size: '5px', + }, }, // For special cases outside of where the auto-import stategy can have an impact @@ -129,14 +132,7 @@ module.exports = configure(function (/* ctx */) { // directives: [], // Quasar plugins - plugins: [ - 'LocalStorage', - 'SessionStorage', - 'Dialog', - 'Loading', - 'Notify', - 'LoadingBar' - ] + plugins: ['LocalStorage', 'SessionStorage', 'Dialog', 'Loading', 'Notify', 'LoadingBar'], }, // animations: 'all', // --- includes all animations @@ -145,7 +141,7 @@ module.exports = configure(function (/* ctx */) { // https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr ssr: { - pwa: false + pwa: false, }, // https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa @@ -164,20 +160,20 @@ module.exports = configure(function (/* ctx */) { { src: 'flaschengeist-logo.svg', sizes: 'any', - type: 'image/svg+xml' + type: 'image/svg+xml', }, { src: 'favicon-128x128.png', sizes: '128x128', - type: 'image/png' + type: 'image/png', }, { src: 'favicon-256x256.png', sizes: '256x256', - type: 'image/png' + type: 'image/png', }, - ] - } + ], + }, }, // Full list of options: https://quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova @@ -187,7 +183,7 @@ module.exports = configure(function (/* ctx */) { // Full list of options: https://quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor capacitor: { - hideSplashscreen: true + hideSplashscreen: true, }, // Full list of options: https://quasar.dev/quasar-cli/developing-electron-apps/configuring-electron @@ -196,13 +192,11 @@ module.exports = configure(function (/* ctx */) { packager: { // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options - // OS X / Mac App Store // appBundleId: '', // appCategoryType: '', // osxSign: '', // protocol: 'myapp://path', - // Windows only // win32metadata: { ... } }, @@ -210,16 +204,16 @@ module.exports = configure(function (/* ctx */) { builder: { // https://www.electron.build/configuration/configuration - appId: 'flaschengeist-frontend' + appId: 'flaschengeist-frontend', }, // More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration nodeIntegration: true, - extendWebpack (/* cfg */) { + extendWebpack(/* cfg */) { // do something with Electron main process Webpack cfg // chainWebpack also available besides this extendWebpack - } - } - } + }, + }, + }; }); diff --git a/src-capacitor/capacitor-flag.d.ts b/src-capacitor/capacitor-flag.d.ts index 59c9966..b4b1e24 100644 --- a/src-capacitor/capacitor-flag.d.ts +++ b/src-capacitor/capacitor-flag.d.ts @@ -1,9 +1,9 @@ /* eslint-disable */ // THIS FEATURE-FLAG FILE IS AUTOGENERATED, // REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING -import "quasar/dist/types/feature-flag"; +import 'quasar/dist/types/feature-flag'; -declare module "quasar/dist/types/feature-flag" { +declare module 'quasar/dist/types/feature-flag' { interface QuasarFeatureFlags { capacitor: true; } diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 0546592..5f1bb5f 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -40,7 +40,14 @@ - + @@ -65,16 +72,16 @@ :entry="entry" />
- - - - - + + + + + - - Logout - - + + Logout + +
diff --git a/src/vendor-plugin.config.js b/src/vendor-plugin.config.js index 60bf79b..29fbc91 100644 --- a/src/vendor-plugin.config.js +++ b/src/vendor-plugin.config.js @@ -1,3 +1 @@ -module.exports = [ - '@flaschengeist/users', -] \ No newline at end of file +module.exports = ['@flaschengeist/users'];