diff --git a/.eslintrc.js b/.eslintrc.js index 0c545731..020b049f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,186 +3,19 @@ module.exports = { browser: true, es2021: true, }, - extends: [ - '@antfu/eslint-config-vue', - 'plugin:vue/vue3-recommended', - 'plugin:import/recommended', - 'plugin:import/typescript', - 'plugin:promise/recommended', - 'plugin:sonarjs/recommended', - 'plugin:@typescript-eslint/recommended', - - // 'plugin:unicorn/recommended', - ], - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 13, - parser: '@typescript-eslint/parser', - sourceType: 'module', - }, - plugins: [ - 'vue', - '@typescript-eslint', - 'regex', - ], + extends: ['@antfu/eslint-config-vue', 'plugin:sonarjs/recommended'], ignorePatterns: ['src/@iconify/*.js', 'node_modules', 'dist', '*.d.ts'], + plugins: ['regex'], rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - // indentation (Already present in TypeScript) - 'comma-spacing': ['error', { before: false, after: true }], - 'key-spacing': ['error', { afterColon: true }], + 'sonarjs/no-duplicate-string': 'warn', - 'vue/first-attribute-linebreak': ['error', { - singleline: 'beside', - multiline: 'below', - }], - - 'antfu/top-level-function': 'off', - - // indentation (Already present in TypeScript) - 'indent': ['error', 2], - - // Enforce trailing comma (Already present in TypeScript) - 'comma-dangle': ['error', 'always-multiline'], - - // Enforce consistent spacing inside braces of object (Already present in TypeScript) - 'object-curly-spacing': ['error', 'always'], - - // Disable max-len - 'max-len': 'off', - - // we don't want it - 'semi': ['error', 'never'], - - // add parens ony when required in arrow function - 'arrow-parens': ['error', 'as-needed'], - - // add new line above comment - 'newline-before-return': 'error', - - // add new line above comment - 'lines-around-comment': [ - 'error', - { - beforeBlockComment: true, - beforeLineComment: true, - allowBlockStart: true, - allowClassStart: true, - allowObjectStart: true, - allowArrayStart: true, - }, - ], - - // Ignore _ as unused variable - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_+$' }], - - 'array-element-newline': ['error', 'consistent'], - 'array-bracket-newline': ['error', 'consistent'], - - 'vue/multi-word-component-names': 'off', - - 'padding-line-between-statements': [ - 'error', - { blankLine: 'always', prev: 'expression', next: 'const' }, - { blankLine: 'always', prev: 'const', next: 'expression' }, - { blankLine: 'always', prev: 'multiline-const', next: '*' }, - { blankLine: 'always', prev: '*', next: 'multiline-const' }, - ], - - // Plugin: eslint-plugin-import - 'import/prefer-default-export': 'off', - 'import/newline-after-import': ['error', { count: 1 }], - 'no-restricted-imports': ['error', 'vuetify/components'], - - // For omitting extension for ts files - 'import/extensions': [ - 'error', - 'ignorePackages', - { - js: 'never', - jsx: 'never', - ts: 'never', - tsx: 'never', - }, - ], - - // ignore virtual files - 'import/no-unresolved': [2, { - ignore: [ - '~pages$', - 'virtual:generated-layouts', - - // Ignore vite's ?raw imports - '.*\?raw', - ], - }], - - // Thanks: https://stackoverflow.com/a/63961972/10796681 - 'no-shadow': 'off', - '@typescript-eslint/no-shadow': ['error'], - - '@typescript-eslint/consistent-type-imports': 'error', - - // Plugin: eslint-plugin-promise - 'promise/always-return': 'off', - 'promise/catch-or-return': 'off', - - // ESLint plugin vue - 'vue/block-tag-newline': 'error', - 'vue/component-api-style': 'error', - 'vue/component-name-in-template-casing': ['error', 'PascalCase', { registeredComponentsOnly: false }], - 'vue/custom-event-name-casing': ['error', 'camelCase', { - ignores: [ - '/^(click):[a-z]+((\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?/', - ], - }], - 'vue/define-macros-order': 'error', - 'vue/html-comment-content-newline': 'error', - 'vue/html-comment-content-spacing': 'error', - 'vue/html-comment-indent': 'error', - 'vue/match-component-file-name': 'error', - 'vue/no-child-content': 'error', - 'vue/require-default-prop': 'off', - - // NOTE this rule only supported in SFC, Users of the unplugin-vue-define-options should disable that rule: https://github.com/vuejs/eslint-plugin-vue/issues/1886 - // 'vue/no-duplicate-attr-inheritance': 'error', - 'vue/no-empty-component-block': 'error', - 'vue/no-multiple-objects-in-class': 'error', - 'vue/no-reserved-component-names': 'error', - 'vue/no-template-target-blank': 'error', - 'vue/no-useless-mustaches': 'error', - 'vue/no-useless-v-bind': 'error', - 'vue/padding-line-between-blocks': 'error', - 'vue/prefer-separate-static-class': 'error', - 'vue/prefer-true-attribute-shorthand': 'error', - 'vue/v-on-function-call': 'error', - 'vue/no-restricted-class': ['error', '/^(p|m)(l|r)-/'], 'vue/valid-v-slot': ['error', { allowModifiers: true, }], - // -- Extension Rules - 'vue/no-irregular-whitespace': 'error', - 'vue/template-curly-spacing': 'error', - - // -- Sonarlint - 'sonarjs/no-duplicate-string': 'off', - 'sonarjs/no-nested-template-literals': 'off', - - // -- Unicorn - // 'unicorn/filename-case': 'off', - // 'unicorn/prevent-abbreviations': ['error', { - // replacements: { - // props: false, - // }, - // }], - - // Internal Rules - 'valid-appcardcode-code-prop': 'error', - 'valid-appcardcode-demo-sfc': 'error', - // https://github.com/gmullerb/eslint-plugin-regex 'regex/invalid': [ 'error', @@ -213,23 +46,16 @@ module.exports = { }, { regex: 'useLayouts\\(', - message: '`useLayouts` composable is only allowed in @layouts & @core directory. Please use `useThemeConfig` composable instead.', + message: + '`useLayouts` composable is only allowed in @layouts & @core directory. Please use `useThemeConfig` composable instead.', files: { inspect: '^(?!.*(@core|@layouts)).*', }, }, - { - regex: 'import axios from \'axios\'', - replacement: 'import axios from \'@axios\'', - message: 'Use axios instances created in \'src/plugin/axios.ts\' instead of unconfigured axios', - files: { - ignore: '^.*plugins/axios.ts.*', - }, - }, ], // Ignore files - '\.eslintrc\.js', + '.eslintrc.js', ], }, settings: { diff --git a/.prettierrc.json b/.prettierrc.json index 9b8b61a5..5e3e7e8e 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,20 +1,20 @@ { - "arrowParens": "avoid", - "bracketSpacing": true, - "htmlWhitespaceSensitivity": "css", - "insertPragma": false, - "jsxBracketSameLine": false, - "jsxSingleQuote": true, - "printWidth": 120, - "proseWrap": "preserve", - "quoteProps": "as-needed", - "requirePragma": false, - "semi": false, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false, - "vueIndentScriptAndStyle": false, - "endOfLine": "lf", - "singleAttributePerLine": true -} \ No newline at end of file + "arrowParens": "avoid", + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxBracketSameLine": false, + "jsxSingleQuote": true, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "preserve", + "requirePragma": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false, + "vueIndentScriptAndStyle": false, + "endOfLine": "lf", + "singleAttributePerLine": false +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4286b3f2..98420c03 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", "mgmcdermott.vscode-language-babel", "editorconfig.editorconfig", "xabikos.javascriptsnippets", @@ -12,4 +13,4 @@ "cipchk.cssrem", "matijao.vue-nuxt-snippets" ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index d15a735d..112bfd9c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,114 +1,107 @@ { - "editor.formatOnSave": true, - "javascript.updateImportsOnFileMove.enabled": "always", - "[javascript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint" + "editor.formatOnSave": true, + "javascript.updateImportsOnFileMove.enabled": "always", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "files.eol": "\n", + "[javascript]": { + "editor.formatOnSave": false + }, + "[typescript]": { + "editor.formatOnSave": false + }, + "[markdown]": { + "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" + }, + // SCSS + "[scss]": { + "editor.defaultFormatter": "stylelint.vscode-stylelint" + }, + // JSON + "[json]": { + "editor.defaultFormatter": "vscode.json-language-features" + }, + "[jsonc]": { + "editor.defaultFormatter": "vscode.json-language-features" + }, + // Vue + "[vue]": { + "editor.formatOnSave": false + }, + // Extension: Volar + "volar.preview.port": 3000, + "volar.completion.preferredTagNameCase": "pascal", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.fixAll.stylelint": true + }, + "eslint.alwaysShowStatus": true, + "eslint.format.enable": true, + // Extension: Stylelint + "stylelint.packageManager": "yarn", + "stylelint.validate": [ + "css", + "scss", + "vue" + ], + // Extension: Spell Checker + "cSpell.words": [ + "Composables", + "Customizer", + "flagpack", + "Iconify", + "psudo", + "stylelint", + "touchless", + "triggerer", + "vuetify" + ], + // Extension: Comment Anchors + "commentAnchors.tags.list": [ + { + "tag": "ℹ️", + "scope": "hidden", + // This color is taken from "Better Comments" Extension (?) + "highlightColor": "#3498DB", + "styleComment": true, + "isItalic": false }, - "[typescript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint", - "editor.autoClosingBrackets": "always" + { + "tag": "👉", + "scope": "file", + // This color is taken from "Better Comments" Extension (*) + "highlightColor": "#98C379", + "styleComment": true, + "isItalic": false }, - "[markdown]": { - "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" - }, - // SCSS - "[scss]": { - "editor.defaultFormatter": "stylelint.vscode-stylelint" - }, - // JSON - "[json]": { - "editor.defaultFormatter": "vscode.json-language-features" - }, - "[jsonc]": { - "editor.defaultFormatter": "vscode.json-language-features" - }, - // Vue - "[vue]": { - "editor.defaultFormatter": "Wscats.vue", - }, - // Extension: Volar - "volar.preview.port": 3000, - "volar.completion.preferredTagNameCase": "pascal", - // Extension: ESLint - "eslint.options": { - "rulePaths": [ - "eslint-internal-rules" - ] - }, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, - "source.fixAll.stylelint": true, - "source.organizeImports": true, - }, - "eslint.alwaysShowStatus": true, - "eslint.format.enable": true, - "eslint.packageManager": "yarn", - // Extension: Stylelint - "stylelint.packageManager": "yarn", - "stylelint.validate": [ - "css", - "scss", - "vue" + { + "tag": "❗", + "scope": "hidden", + // This color is taken from "Better Comments" Extension (*) + "highlightColor": "#FF2D00", + "styleComment": true, + "isItalic": false + } + ], + // Extension: fabiospampinato.vscode-highlight + "highlight.regexFlags": "gi", + "highlight.regexes": { + // We flaged this for enforcing logical CSS properties + "(100vh|translate|margin:|padding:|margin-left|margin-right|rotate|text-align|border-top|border-right|border-bottom|border-left|float|background-position|transform|width|height|top|left|bottom|right|float|clear|(p|m)(l|r)-|border-(start|end)-(start|end)-radius)": [ + { + // "rangeBehavior": 1, + "borderWidth": "1px", + "borderColor": "tomato", + "borderStyle": "solid" + } ], - // Extension: Spell Checker - "cSpell.words": [ - "Composables", - "Customizer", - "flagpack", - "Iconify", - "psudo", - "stylelint", - "touchless", - "triggerer", - "vuetify" - ], - // Extension: Comment Anchors - "commentAnchors.tags.list": [ - { - "tag": "ℹ️", - "scope": "hidden", - // This color is taken from "Better Comments" Extension (?) - "highlightColor": "#3498DB", - "styleComment": true, - "isItalic": false, - }, - { - "tag": "👉", - "scope": "file", - // This color is taken from "Better Comments" Extension (*) - "highlightColor": "#98C379", - "styleComment": true, - "isItalic": false - }, - { - "tag": "❗", - "scope": "hidden", - // This color is taken from "Better Comments" Extension (*) - "highlightColor": "#FF2D00", - "styleComment": true, - "isItalic": false, - }, - ], - // Extension: fabiospampinato.vscode-highlight - "highlight.regexFlags": "gi", - "highlight.regexes": { - // We flaged this for enforcing logical CSS properties - "(100vh|translate|margin:|padding:|margin-left|margin-right|rotate|text-align|border-top|border-right|border-bottom|border-left|float|background-position|transform|width|height|top|left|bottom|right|float|clear|(p|m)(l|r)-|border-(start|end)-(start|end)-radius)": [ - { - // "rangeBehavior": 1, - "borderWidth": "1px", - "borderColor": "tomato", - "borderStyle": "solid" - } - ], - "(overflow-x:|overflow-y:)": [ - { - // "rangeBehavior": 1, - "borderWidth": "1px", - "borderColor": "green", - "borderStyle": "solid" - } - ] - }, - "vue3snippets.enable-compile-vue-file-on-did-save-code": true + "(overflow-x:|overflow-y:)": [ + { + // "rangeBehavior": 1, + "borderWidth": "1px", + "borderColor": "green", + "borderStyle": "solid" + } + ] + }, + "vue3snippets.enable-compile-vue-file-on-did-save-code": true } \ No newline at end of file diff --git a/package.json b/package.json index 965355f7..67fa38fe 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "vite build", "preview": "vite preview --port 5050", "typecheck": "vue-tsc --noEmit", - "lint": "eslint . -c .eslintrc.js --fix --rulesdir eslint-internal-rules/ --ext .ts,.js,.vue,.tsx,.jsx", + "lint": "eslint . -c .eslintrc.js --fix --ext .ts,.js,.vue,.tsx,.jsx", "build:icons": "tsc -b src/@iconify && node src/@iconify/build-icons.js", "postinstall": "npm run build:icons" }, diff --git a/src/@core/components/DialogCloseBtn.vue b/src/@core/components/DialogCloseBtn.vue index 1794823e..70dad1dc 100644 --- a/src/@core/components/DialogCloseBtn.vue +++ b/src/@core/components/DialogCloseBtn.vue @@ -1,15 +1,18 @@ diff --git a/src/@core/components/ErrorHeader.vue b/src/@core/components/ErrorHeader.vue index 82fed08b..d0bddbee 100644 --- a/src/@core/components/ErrorHeader.vue +++ b/src/@core/components/ErrorHeader.vue @@ -1,20 +1,26 @@