diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..ba1902263 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": ["plugin:cypress/recommended"] +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..1c4266382 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,210 @@ +import cypress from 'eslint-plugin-cypress'; +import eslint from 'eslint-plugin-import'; +// Import eslint from '@eslint/eslintrc'; +import globals from 'globals'; +// Import path from 'node:path'; +// Import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import vue from 'eslint-plugin-vue'; +// Import { FlatCompat } from ''; +// Const compat = new FlatCompat({ +// BaseDirectory: import.meta.url, +// RecommendedConfig: js.configs.recommended, +// AllConfig: js.configs.all, +// Cypress: cypress.configs.recommended, +// }); + +export default { + // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy + // This option interrupts the configuration hierarchy at this file + // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos) + + plugins: { vue, eslint, cypress }, + languageOptions: { + globals: { + ...globals.node, + ...globals.browser, + ...vue.environments['setup-compiler-macros']['setup-compiler-macros'], + ...cypress.environments.globals.globals, + ga: 'readonly', + cordova: 'readonly', + __statics: 'readonly', + __QUASAR_SSR__: 'readonly', + __QUASAR_SSR_SERVER__: 'readonly', + __QUASAR_SSR_CLIENT__: 'readonly', + __QUASAR_SSR_PWA__: 'readonly', + process: 'readonly', + Capacitor: 'readonly', + chrome: 'readonly', + }, + + ecmaVersion: 2020, + sourceType: 'module', + + parserOptions: { + parser: '@babel/eslint-parser', + }, + }, + // Files: ['test/cypress/**/*.*'], + // Rules: { + // Semi: 'error', + // 'space-before-function-paren': 0, + // 'prefer-promise-reject-errors': 0, + // 'vue/no-multiple-template-root': 0, + // }, + rules: { + ...js.configs.recommended.rules, + 'generator-star-spacing': 'off', + 'arrow-parens': 'off', + 'one-var': 'off', + 'no-void': 'off', + 'multiline-ternary': 'off', + 'js/first': 'off', + 'vue/prefer-import-from-vue': 'error', + 'eslint/first': 'off', + 'eslint/dynamic-import-chunkname': 'off', + 'no-restricted-imports': 'off', + 'no-import-assign': 'off', + 'no-duplicate-imports': 'off', + 'no-useless-rename': 'off', + 'no-named-as-default': 'off', + 'no-named-as-default-member': 'off', + 'eslint/named': 'off', + 'no-unsafe-optional-chaining': 'off', + 'eslint/namespace': 'error', + 'eslint/default': 'error', + 'eslint/export': 'error', + 'eslint/extensions': 'off', + 'eslint/no-unresolved': 'off', + 'eslint/no-extraneous-dependencies': 'off', + 'eslint/no-import-module-exports': 'off', + 'eslint/no-self-import': 'off', + semi: 'off', + 'space-before-function-paren': 'off', + 'no-undef': 'error', + 'no-unused-vars': 'warn', + 'no-console': 'error', + 'no-debugger': 'off', + 'no-useless-escape': 'error', + 'no-prototype-builtins': 'error', + 'no-async-promise-executor': 'error', + 'no-irregular-whitespace': 'error', + 'no-constant-condition': 'error', + 'no-unsafe-finally': 'error', + 'no-extend-native': 'error', + 'vue/no-unused-components': 'error', + 'vue/no-unused-properties': 'error', + 'vue/no-multiple-template-root': 'error', + 'vue/no-v-html': 'error', + 'vue/no-v-model-argument': 'error', + 'vue/no-parsing-error': 'error', + 'vue/no-deprecated-slot-attribute': 'error', + 'prefer-promise-reject-errors': 'error', + // }, + // { + + // }, + }, + // LinterOptions: { + // ReportUnusedInlineConfigs: 'error', + // }, + ignores: [ + '/dist', + '/src-capacitor', + '/src-cordova', + '/.quasar', + '/node_modules', + '.eslintrc.js', + ], + // Rules order is important, please avoid shuffling them + // Extends: [ + // 'standard', + // // Base ESLint recommended rules + // 'eslint:recommended', + + // // Uncomment any of the lines below to choose desired strictness, + // // but leave only one uncommented! + // // See https://eslint.vuejs.org/rules/#available-rules + // // 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention) + // 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability) + // // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) + + // // https://github.com/prettier/eslint-config-prettier#installation + // // usage with Prettier, provided by 'eslint-config-prettier'. + // 'prettier', + // ], + + // Plugins: [ + // // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files + // // 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: {}, + + // Add your custom rules here + // Rules: { + // // allow async-await + // 'generator-star-spacing': 'error', + // // allow paren-less arrow functions + // 'arrow-parens': 'error', + // 'one-var': 'error', + // 'no-void': 'error', + // 'multiline-ternary': 'error', + + // 'import/first': 'error', + // 'import/named': 'error', + // 'import/namespace': 'error', + // 'import/default': 'error', + // 'import/export': 'error', + // 'import/extensions': 'error', + // 'import/no-unresolved': 'error', + // 'import/no-extraneous-dependencies': 'error', + // Semi: 'error', + // 'space-before-function-paren': 'error', + // 'no-undef': 'error', + // 'no-unused-vars': 'warn', + // 'no-console': 'error', + // 'no-debugger': 'error', + // 'no-useless-escape': 'error', + // 'no-prototype-builtins': 'error', + // 'no-async-promise-executor': 'error', + // 'no-irregular-whitespace': 'error', + // 'no-constant-condition': 'error', + // 'no-unsafe-finally': 'error', + // 'no-extend-native': 'error', + + // 'vue/no-unused-components': 'error', + // 'vue/no-unused-properties': 'error', + // 'vue/no-multiple-template-root': 'error', + // 'vue/no-v-html': 'error', + // 'vue/no-v-model-argument': 'error', + // 'vue/no-parsing-error': 'error', + // 'vue/no-deprecated-slot-attribute': 'error', + + // 'prefer-promise-reject-errors': 'error', + + // // allow debugger during development only + // 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'error', + // }, + // Overrides: [ + // { + // Files: ['test/cypress/**/*.*'], + // Extends: [ + // // Add Cypress-specific lint rules, globals and Cypress plugin + // // See https://github.com/cypress-io/eslint-plugin-cypress#rules + // 'plugin:cypress/recommended', + // ], + // Rules: { + // Semi: 'error', + // 'space-before-function-paren': 'error', + // 'prefer-promise-reject-errors': 'error', + // 'vue/no-multiple-template-root': 'error', + // }, + // }, + // ], +}; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..9e09aece8 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,108 @@ +import vue from 'eslint-plugin-vue'; +import globals from 'globals'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default [ + ...compat.extends( + 'standard', + 'eslint:recommended', + 'plugin:vue/vue3-strongly-recommended', + 'plugin:cypress/recommended', + 'prettier', + ), + { + plugins: { + vue, + cypress: 'eslint-plugin-cypress', + eslint: 'eslint-plugin-import', + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.browser, + ...vue.environments['setup-compiler-macros']['setup-compiler-macros'], + ga: 'readonly', + cordova: 'readonly', + __statics: 'readonly', + __QUASAR_SSR__: 'readonly', + __QUASAR_SSR_SERVER__: 'readonly', + __QUASAR_SSR_CLIENT__: 'readonly', + __QUASAR_SSR_PWA__: 'readonly', + process: 'readonly', + Capacitor: 'readonly', + chrome: 'readonly', + }, + + ecmaVersion: 2018, + sourceType: 'module', + + parserOptions: { + parser: '@babel/eslint-parser', + }, + }, + + rules: { + 'jest/expect-expect': 'error', + 'generator-star-spacing': 'error', + 'arrow-parens': 'error', + 'one-var': 'error', + 'no-void': 'error', + 'multiline-ternary': 'error', + 'import/first': 'error', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + 'import/extensions': 'error', + 'import/no-unresolved': 'error', + 'import/no-extraneous-dependencies': 'error', + semi: 'error', + 'space-before-function-paren': 'error', + 'no-undef': 'error', + 'no-unused-vars': 'warn', + 'no-console': 'error', + 'no-debugger': 'error', + 'no-useless-escape': 'error', + 'no-prototype-builtins': 'error', + 'no-async-promise-executor': 'error', + 'no-irregular-whitespace': 'error', + 'no-constant-condition': 'error', + 'no-unsafe-finally': 'error', + 'no-extend-native': 'error', + 'vue/no-unused-components': 'error', + 'vue/no-unused-properties': 'error', + 'vue/no-multiple-template-root': 'error', + 'vue/no-v-html': 'error', + 'vue/no-v-model-argument': 'error', + 'vue/no-parsing-error': 'error', + 'vue/no-deprecated-slot-attribute': 'error', + 'prefer-promise-reject-errors': 'error', + }, + }, + ...compat.extends('plugin:cypress/recommended').map((config) => ({ + ...config, + files: ['test/cypress/**/*.*'], + })), + { + files: ['test/cypress/**/*.*'], + + rules: { + semi: 'error', + 'space-before-function-paren': 'error', + 'prefer-promise-reject-errors': 'error', + 'vue/no-multiple-template-root': 'error', + }, + }, +]; diff --git a/src/boot/quasar.defaults.js b/src/boot/quasar.defaults.js index 9638e2057..e68bf8832 100644 --- a/src/boot/quasar.defaults.js +++ b/src/boot/quasar.defaults.js @@ -1,3 +1,8 @@ -export * from './defaults/qTable'; -export * from './defaults/qInput'; -export * from './defaults/qSelect'; +import { qTable } from './defaults/qTable'; +import { qInput } from './defaults/qInput'; +import { qSelect } from './defaults/qSelect'; +export default { + qTable, + qInput, + qSelect, +}; diff --git a/vitest.config.js b/vitest.config.js index b306609f4..4f19c2340 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,9 +1,9 @@ -const { defineConfig } = require('vitest/config'); -const vue = require('@vitejs/plugin-vue'); -const { quasar, transformAssetUrls } = require('@quasar/vite-plugin'); -const jsconfigPaths = require('vite-jsconfig-paths'); -const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/vite'); -const path = require('path'); +import { defineConfig } from 'vitest/config'; +import vue from '@vitejs/'; +import { quasar, transformAssetUrls } from '@quasar/vite-plugin'; +import jsconfigPaths from 'vite-jsconfig-paths'; +import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'; +import path from 'path'; let reporters, outputFile;