123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- const fs = require('fs')
- const path = require('path')
- const mobilePagesDir = path.resolve(__dirname, 'app/frontend/apps/mobile/pages')
- const mobilePagesFolder = fs.readdirSync(mobilePagesDir)
- const desktopPagesDir = path.resolve(
- __dirname,
- 'app/frontend/apps/desktop/pages',
- )
- const desktopPagesFolder = fs.readdirSync(desktopPagesDir)
- module.exports = {
- root: true,
- env: {
- browser: true,
- node: true,
- },
- plugins: [
- '@typescript-eslint',
- 'vue',
- 'vuejs-accessibility',
- 'prettier',
- 'sonarjs',
- 'security',
- 'zammad',
- 'import',
- ],
- extends: [
- 'airbnb-base',
- 'plugin:vue/vue3-recommended',
- 'plugin:vuejs-accessibility/recommended',
- 'plugin:@typescript-eslint/eslint-recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:prettier/recommended',
- '@vue/prettier',
- '@vue/typescript/recommended',
- 'prettier',
- 'plugin:sonarjs/recommended',
- 'plugin:security/recommended-legacy',
- ],
- rules: {
- 'zammad/zammad-copyright': 'error',
- 'zammad/zammad-detect-translatable-string': 'error',
- 'zammad/zammad-tailwind-ltr': 'error',
- 'zammad/zammad-symbol-description': 'error',
- 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
- 'consistent-return': 'off',
- 'class-methods-use-this': 'off',
- 'prefer-destructuring': [
- 'error',
- {
- VariableDeclarator: {
- array: false,
- object: true,
- },
- AssignmentExpression: {
- array: false,
- object: true,
- },
- },
- {
- enforceForRenamedProperties: false,
- },
- ],
-
- 'no-restricted-syntax': [
- 'error',
- 'ForInStatement',
-
- 'LabeledStatement',
- 'WithStatement',
- ],
- 'no-underscore-dangle': 'off',
- 'no-param-reassign': 'off',
- 'func-style': ['error', 'expression'],
- 'no-restricted-imports': 'off',
- 'import/no-extraneous-dependencies': 'off',
- 'import/extensions': ['error', 'ignorePackages'],
- 'import/prefer-default-export': 'off',
- 'import/no-restricted-paths': [
- 'error',
- {
- zones: [
-
- {
- target: './app/frontend/shared',
- from: './app/frontend/apps',
- },
- {
- target: './app/frontend/apps/desktop',
- from: './app/frontend/apps/mobile',
- },
- {
- target: './app/frontend/apps/mobile',
- from: './app/frontend/apps/desktop',
- },
-
- ...mobilePagesFolder.map((page) => {
- return {
- target: `./app/frontend/apps/mobile/pages/!(${page})/**/*`,
- from: `./app/frontend/apps/mobile/pages/${page}/**/*`,
- }
- }),
- ...desktopPagesFolder.map((page) => {
- return {
- target: `./app/frontend/apps/desktop/pages/!(${page})/**/*`,
- from: `./app/frontend/apps/desktop/pages/${page}/**/*`,
- }
- }),
- ],
- },
- ],
-
- 'no-undef': 'off',
-
-
- 'no-shadow': 'off',
- '@typescript-eslint/no-shadow': 'off',
- '@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
- '@typescript-eslint/naming-convention': [
- 'error',
- {
- selector: 'enumMember',
- format: ['StrictPascalCase'],
- },
- {
- selector: 'typeLike',
- format: ['PascalCase'],
- },
- ],
- 'vue/component-tags-order': [
- 'error',
- {
- order: ['script', 'template', 'style'],
- },
- ],
- 'vue/custom-event-name-casing': ['error', 'kebab-case'],
-
- 'import/order': [
- 'error',
- {
- groups: [
- 'builtin',
- 'external',
- 'internal',
- 'parent',
- 'sibling',
- 'index',
- 'object',
- 'type',
- ],
- pathGroups: [
- {
- pattern: '#tests/**',
- group: 'internal',
- position: 'before',
- },
- {
- pattern: '#shared/**',
- group: 'internal',
- position: 'before',
- },
- {
- pattern: '#desktop/**',
- group: 'internal',
- },
- {
- pattern: '#mobile/**',
- group: 'internal',
- },
- {
- pattern: '**/types.ts',
- group: 'type',
- position: 'after',
- },
- ],
- 'newlines-between': 'always',
- alphabetize: { order: 'asc', caseInsensitive: true },
- },
- ],
-
- 'vue/define-emits-declaration': ['error', 'type-literal'],
- 'vue/script-setup-uses-vars': 'error',
-
- 'vue/require-default-prop': 'off',
-
- 'vue/multi-word-component-names': 'off',
-
- 'vue/v-bind-style': ['error', 'shorthand'],
-
- 'vue/v-on-style': ['error', 'shorthand'],
-
- 'vue/v-slot-style': ['error', 'shorthand'],
- 'no-promise-executor-return': 'off',
-
- 'sonarjs/no-duplicate-string': 'off',
-
- 'sonarjs/prefer-immediate-return': 'off',
- 'sonarjs/prefer-single-boolean-return': 'off',
-
- 'prettier/prettier': ['error'],
- },
- overrides: [
- {
- files: ['*.js'],
- rules: {
- '@typescript-eslint/no-var-requires': 'off',
- 'security/detect-object-injection': 'off',
- 'security/detect-non-literal-fs-filename': 'off',
- 'security/detect-non-literal-regexp': 'off',
- },
- },
- {
- files: [
- 'app/frontend/tests/**',
- 'app/frontend/**/__tests__/**',
- 'app/frontend/**/*.spec.*',
- 'app/frontend/cypress/**',
- '.eslint-plugin-zammad/**',
- '.eslintrc.js',
- ],
- rules: {
- 'zammad/zammad-tailwind-ltr': 'off',
- 'zammad/zammad-detect-translatable-string': 'off',
- '@typescript-eslint/no-non-null-assertion': 'off',
- '@typescript-eslint/no-explicit-any': 'off',
- },
- },
-
- {
- files: ['*.ts', '*.tsx', '*.vue'],
- rules: {
-
- '@typescript-eslint/consistent-type-imports': 'off',
- '@typescript-eslint/consistent-type-exports': 'error',
- 'security/detect-object-injection': 'off',
- 'security/detect-non-literal-fs-filename': 'off',
- 'security/detect-non-literal-regexp': 'off',
- },
- parserOptions: {
- project: ['./tsconfig.json', './app/frontend/cypress/tsconfig.json'],
- },
- },
- ],
- settings: {
- 'import/core-modules': ['virtual:pwa-register'],
- 'import/parsers': {
- '@typescript-eslint/parser': ['.ts', '.tsx'],
- },
- 'import/resolver': {
- typescript: {
- alwaysTryTypes: true,
- },
- alias: {
- map: [
- [
- 'vue-easy-lightbox/dist/external-css/vue-easy-lightbox.css',
- path.resolve(
- __dirname,
- 'node_modules/vue-easy-lightbox/dist/external-css/vue-easy-lightbox.css',
- ),
- ],
- ],
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
- },
- node: {
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
- },
- },
-
- 'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.vue'],
- },
- globals: {
- defineProps: 'readonly',
- defineEmits: 'readonly',
- defineExpose: 'readonly',
- withDefaults: 'readonly',
- },
- parser: 'vue-eslint-parser',
- parserOptions: {
- parser: '@typescript-eslint/parser',
- sourceType: 'module',
- ecmaVersion: 2020,
- },
- }
|