|
| 1 | +/** |
| 2 | + * SPDX-FileCopyrightText: 2024 LibreCode coop and contributors |
| 3 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + */ |
| 5 | + |
| 6 | +import nextcloudConfig from '@nextcloud/eslint-config' |
| 7 | +import globals from 'globals' |
| 8 | + |
| 9 | +export default [ |
| 10 | + ...(Array.isArray(nextcloudConfig) ? nextcloudConfig : [nextcloudConfig]), |
| 11 | + |
| 12 | + { |
| 13 | + name: 'libresign/ignores', |
| 14 | + ignores: [ |
| 15 | + // Generated files |
| 16 | + 'src/types/openapi/*', |
| 17 | + 'js/*', |
| 18 | + // Build artifacts |
| 19 | + 'build/*', |
| 20 | + // Node modules |
| 21 | + 'node_modules/*', |
| 22 | + // TODO: upstream |
| 23 | + 'openapi-*.json', |
| 24 | + ], |
| 25 | + }, |
| 26 | + |
| 27 | + { |
| 28 | + name: 'libresign/config', |
| 29 | + rules: { |
| 30 | + // production only |
| 31 | + 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn', |
| 32 | + 'vue/no-unused-components': process.env.NODE_ENV === 'production' ? 'error' : 'warn', |
| 33 | + 'import/order': [ |
| 34 | + 'error', |
| 35 | + { |
| 36 | + groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'unknown'], |
| 37 | + pathGroups: [ |
| 38 | + { |
| 39 | + // group all style imports at the end |
| 40 | + pattern: '{*.css,*.scss}', |
| 41 | + patternOptions: { matchBase: true }, |
| 42 | + group: 'unknown', |
| 43 | + position: 'after', |
| 44 | + }, |
| 45 | + { |
| 46 | + // group material design icons |
| 47 | + pattern: 'vue-material-design-icons/**', |
| 48 | + group: 'external', |
| 49 | + position: 'after', |
| 50 | + }, |
| 51 | + { |
| 52 | + // group @nextcloud imports |
| 53 | + pattern: '@nextcloud/{!(vue),!(vue)/**}', |
| 54 | + group: 'external', |
| 55 | + position: 'after', |
| 56 | + }, |
| 57 | + { |
| 58 | + // group @nextcloud/vue imports |
| 59 | + pattern: '{@nextcloud/vue,@nextcloud/vue/**}', |
| 60 | + group: 'external', |
| 61 | + position: 'after', |
| 62 | + }, |
| 63 | + { |
| 64 | + // group project components |
| 65 | + pattern: '*.vue', |
| 66 | + patternOptions: { matchBase: true }, |
| 67 | + group: 'parent', |
| 68 | + position: 'before', |
| 69 | + }, |
| 70 | + ], |
| 71 | + pathGroupsExcludedImportTypes: ['@nextcloud', 'vue-material-design-icons'], |
| 72 | + 'newlines-between': 'always', |
| 73 | + alphabetize: { |
| 74 | + order: 'asc', |
| 75 | + caseInsensitive: true, |
| 76 | + }, |
| 77 | + warnOnUnassignedImports: true, |
| 78 | + }, |
| 79 | + ], |
| 80 | + 'import/no-unresolved': ['error', { |
| 81 | + // Ignore Webpack query parameters, not supported by eslint-plugin-import |
| 82 | + // https://github.com/import-js/eslint-plugin-import/issues/2562 |
| 83 | + ignore: ['\\?raw$'], |
| 84 | + }], |
| 85 | + }, |
| 86 | + }, |
| 87 | + |
| 88 | + { |
| 89 | + name: 'libresign/openapi-overrides', |
| 90 | + files: ['src/types/openapi/*.ts'], |
| 91 | + rules: { |
| 92 | + '@typescript-eslint/no-explicit-any': 'off', |
| 93 | + quotes: 'off', |
| 94 | + 'no-multiple-empty-lines': 'off', |
| 95 | + 'no-use-before-define': 'off', |
| 96 | + }, |
| 97 | + }, |
| 98 | +] |
0 commit comments