chore(format): Fix formatting, enforce prettier style

This commit is contained in:
Ferdinand Thiessen 2021-12-06 00:40:50 +01:00
parent f9f66e7172
commit 6a75d1bf51
10 changed files with 91 additions and 101 deletions

View File

@ -17,11 +17,11 @@ module.exports = {
project: resolve(__dirname, './tsconfig.json'), project: resolve(__dirname, './tsconfig.json'),
tsconfigRootDir: __dirname, tsconfigRootDir: __dirname,
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features 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: { env: {
browser: true browser: true,
}, },
// Rules order is important, please avoid shuffling them // Rules order is important, please avoid shuffling them
@ -44,7 +44,7 @@ module.exports = {
// https://github.com/prettier/eslint-config-prettier#installation // https://github.com/prettier/eslint-config-prettier#installation
// usage with Prettier, provided by 'eslint-config-prettier'. // usage with Prettier, provided by 'eslint-config-prettier'.
'prettier', //'plugin:prettier/recommended' 'plugin:prettier/recommended',
], ],
plugins: [ plugins: [
@ -54,10 +54,6 @@ module.exports = {
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
// required to lint *.vue files // required to lint *.vue files
'vue', '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: { globals: {
@ -70,7 +66,7 @@ module.exports = {
__QUASAR_SSR_PWA__: true, __QUASAR_SSR_PWA__: true,
process: true, process: true,
Capacitor: true, Capacitor: true,
chrome: true chrome: true,
}, },
// add your custom rules here // add your custom rules here
@ -80,20 +76,16 @@ module.exports = {
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',
// Rejects on promises should always be of the Error type (and allow empty rejects as well) // 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 // Allow " if ' is contained inside the string, so we can avoid escaping
quotes: [ quotes: ['error', 'single', { avoidEscape: true }],
process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'single',
{ avoidEscape: true }
],
// TypeScript, let us be not too strict // TypeScript, let us be not too strict
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
// allow debugger during development only // allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
} },
} };

View File

@ -3,6 +3,6 @@
module.exports = { module.exports = {
plugins: [ plugins: [
// to edit target browsers: use "browserslist" field in package.json // to edit target browsers: use "browserslist" field in package.json
require('autoprefixer') require('autoprefixer'),
] ],
} };

View File

@ -1,6 +1,4 @@
/* eslint-env node */ /* eslint-env node */
module.exports = { module.exports = {
presets: [ presets: ['@quasar/babel-preset-app'],
'@quasar/babel-preset-app' };
]
}

View File

@ -11,7 +11,7 @@
"url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues" "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues"
}, },
"scripts": { "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" "lint": "eslint --ext .js,.ts,.vue ./src ./api"
}, },
"dependencies": { "dependencies": {
@ -30,14 +30,15 @@
"@types/node": "^14.17.34", "@types/node": "^14.17.34",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-env": "^1.16.3", "@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.4.0", "@typescript-eslint/parser": "^5.5.0",
"eslint": "^8.3.0", "eslint": "^8.4.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.1.1", "eslint-plugin-vue": "^8.1.1",
"eslint-webpack-plugin": "^3.1.1", "eslint-webpack-plugin": "^3.1.1",
"modify-source-webpack-plugin": "^3.0.0", "modify-source-webpack-plugin": "^3.0.0",
"prettier": "^2.4.1", "prettier": "^2.5.1",
"typescript": "^4.5.2", "typescript": "^4.5.2",
"vuedraggable": "^4.1.0" "vuedraggable": "^4.1.0"
}, },

View File

@ -8,10 +8,9 @@
/* eslint-env node */ /* eslint-env node */
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const ESLintPlugin = require('eslint-webpack-plugin') const ESLintPlugin = require('eslint-webpack-plugin');
const { ModifySourcePlugin } = require('modify-source-webpack-plugin') const { ModifySourcePlugin } = require('modify-source-webpack-plugin');
const { configure } = require('quasar/wrappers') const { configure } = require('quasar/wrappers');
module.exports = configure(function (/* ctx */) { module.exports = configure(function (/* ctx */) {
return { return {
@ -22,7 +21,7 @@ module.exports = configure(function (/* ctx */) {
enabled: true, enabled: true,
files: './src/**/*.{ts,tsx,js,jsx,vue}', files: './src/**/*.{ts,tsx,js,jsx,vue}',
}, },
} },
}, },
// https://quasar.dev/quasar-cli/prefetch-feature // https://quasar.dev/quasar-cli/prefetch-feature
@ -56,7 +55,6 @@ module.exports = configure(function (/* ctx */) {
// transpile: false, // transpile: false,
// Add dependencies for transpiling with Babel (Array of string/regex) // Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled). // (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true. // Applies only if "transpile" is set to true.
@ -71,33 +69,38 @@ module.exports = configure(function (/* ctx */) {
// https://quasar.dev/quasar-cli/handling-webpack // https://quasar.dev/quasar-cli/handling-webpack
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain // "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpack (chain) { chainWebpack(chain) {
chain.plugin('eslint-webpack-plugin') chain.plugin('eslint-webpack-plugin').use(ESLintPlugin, [
.use(ESLintPlugin, [{ {
extensions: [ 'ts', 'js', 'vue' ], extensions: ['ts', 'js', 'vue'],
exclude: ['node_modules', 'src-capacitor'] exclude: ['node_modules', 'src-capacitor'],
}]) },
chain.plugin('modify-source-webpack-plugin') ]);
.use(ModifySourcePlugin, [{ chain.plugin('modify-source-webpack-plugin').use(ModifySourcePlugin, [
{
rules: [ rules: [
{ {
test: /plugins\.ts$/, test: /plugins\.ts$/,
modify: (src, filename) => { modify: (src, filename) => {
const custom_plgns = require('./plugin.config.js') const custom_plgns = require('./plugin.config.js');
const required_plgns = require('./src/vendor-plugin.config.js') const required_plgns = require('./src/vendor-plugin.config.js');
return src.replace(/\/\* *INSERT_PLUGIN_LIST *\*\//, return src.replace(
[...custom_plgns, ...required_plgns].map(v => `import("${v}").catch(() => "${v}")`) /\/\* *INSERT_PLUGIN_LIST *\*\//,
.join(',')) [...custom_plgns, ...required_plgns]
} .map((v) => `import("${v}").catch(() => "${v}")`)
} .join(',')
] );
}]) },
},
],
},
]);
chain.merge({ chain.merge({
snapshot: { snapshot: {
managedPaths: [] managedPaths: [],
} },
}) });
} },
}, },
// Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer // 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, https: false,
port: 8080, port: 8080,
open: false, // opens browser window automatically 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 // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
@ -117,8 +120,8 @@ module.exports = configure(function (/* ctx */) {
loadingBar: { loadingBar: {
position: 'top', position: 'top',
color: 'warning', color: 'warning',
size: '5px' size: '5px',
} },
}, },
// For special cases outside of where the auto-import stategy can have an impact // For special cases outside of where the auto-import stategy can have an impact
@ -129,14 +132,7 @@ module.exports = configure(function (/* ctx */) {
// directives: [], // directives: [],
// Quasar plugins // Quasar plugins
plugins: [ plugins: ['LocalStorage', 'SessionStorage', 'Dialog', 'Loading', 'Notify', 'LoadingBar'],
'LocalStorage',
'SessionStorage',
'Dialog',
'Loading',
'Notify',
'LoadingBar'
]
}, },
// animations: 'all', // --- includes all animations // animations: 'all', // --- includes all animations
@ -145,7 +141,7 @@ module.exports = configure(function (/* ctx */) {
// https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr // https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr
ssr: { ssr: {
pwa: false pwa: false,
}, },
// https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa // https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa
@ -164,20 +160,20 @@ module.exports = configure(function (/* ctx */) {
{ {
src: 'flaschengeist-logo.svg', src: 'flaschengeist-logo.svg',
sizes: 'any', sizes: 'any',
type: 'image/svg+xml' type: 'image/svg+xml',
}, },
{ {
src: 'favicon-128x128.png', src: 'favicon-128x128.png',
sizes: '128x128', sizes: '128x128',
type: 'image/png' type: 'image/png',
}, },
{ {
src: 'favicon-256x256.png', src: 'favicon-256x256.png',
sizes: '256x256', sizes: '256x256',
type: 'image/png' type: 'image/png',
},
],
}, },
]
}
}, },
// Full list of options: https://quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova // 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 // Full list of options: https://quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
capacitor: { capacitor: {
hideSplashscreen: true hideSplashscreen: true,
}, },
// Full list of options: https://quasar.dev/quasar-cli/developing-electron-apps/configuring-electron // Full list of options: https://quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
@ -196,13 +192,11 @@ module.exports = configure(function (/* ctx */) {
packager: { packager: {
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
// OS X / Mac App Store // OS X / Mac App Store
// appBundleId: '', // appBundleId: '',
// appCategoryType: '', // appCategoryType: '',
// osxSign: '', // osxSign: '',
// protocol: 'myapp://path', // protocol: 'myapp://path',
// Windows only // Windows only
// win32metadata: { ... } // win32metadata: { ... }
}, },
@ -210,16 +204,16 @@ module.exports = configure(function (/* ctx */) {
builder: { builder: {
// https://www.electron.build/configuration/configuration // https://www.electron.build/configuration/configuration
appId: 'flaschengeist-frontend' appId: 'flaschengeist-frontend',
}, },
// More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration // More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration
nodeIntegration: true, nodeIntegration: true,
extendWebpack (/* cfg */) { extendWebpack(/* cfg */) {
// do something with Electron main process Webpack cfg // do something with Electron main process Webpack cfg
// chainWebpack also available besides this extendWebpack // chainWebpack also available besides this extendWebpack
} },
} },
} };
}); });

View File

@ -1,9 +1,9 @@
/* eslint-disable */ /* eslint-disable */
// THIS FEATURE-FLAG FILE IS AUTOGENERATED, // THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING // 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 { interface QuasarFeatureFlags {
capacitor: true; capacitor: true;
} }

View File

@ -40,7 +40,14 @@
<shortcut-link :shortcut="element" context @delete-shortcut="deleteShortcut" /> <shortcut-link :shortcut="element" context @delete-shortcut="deleteShortcut" />
</template> </template>
</drag> </drag>
<q-btn v-if="!platform.is.capacitor" flat round dense icon="mdi-exit-to-app" @click="logout()" /> <q-btn
v-if="!platform.is.capacitor"
flat
round
dense
icon="mdi-exit-to-app"
@click="logout()"
/>
</q-toolbar> </q-toolbar>
</q-header> </q-header>

View File

@ -1,3 +1 @@
module.exports = [ module.exports = ['@flaschengeist/users'];
'@flaschengeist/users',
]