You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.0 KiB

  1. /**
  2. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. module.exports = {
  6. extends: [
  7. '@nextcloud',
  8. '@nextcloud/eslint-config/typescript',
  9. ],
  10. globals: {
  11. // @nextcloud/webpack-vue-config globals
  12. appName: 'readonly',
  13. appVersion: 'readonly',
  14. // Desktop build globals
  15. IS_DESKTOP: 'readonly',
  16. },
  17. rules: {
  18. 'comma-dangle': 'off',
  19. 'jsdoc/no-defaults': 'off',
  20. '@typescript-eslint/no-unused-vars': 'off',
  21. // Forbid import without extension even when TS is used
  22. // TODO: fix in @nextcloud/eslint-config/typescript
  23. 'import/extensions': 'error',
  24. 'import/newline-after-import': 'error',
  25. 'import/no-named-as-default-member': 'off',
  26. 'import/order': [
  27. 'error',
  28. {
  29. groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'unknown'],
  30. pathGroups: [
  31. {
  32. // group all style imports at the end
  33. pattern: '{*.css,*.scss}',
  34. patternOptions: { matchBase: true },
  35. group: 'unknown',
  36. position: 'after',
  37. },
  38. {
  39. // group material design icons
  40. pattern: 'vue-material-design-icons/**',
  41. group: 'external',
  42. position: 'after',
  43. },
  44. {
  45. // group @nextcloud imports
  46. pattern: '@nextcloud/{!(vue),!(vue)/**}',
  47. group: 'external',
  48. position: 'after',
  49. },
  50. {
  51. // group @nextcloud/vue imports
  52. pattern: '{@nextcloud/vue,@nextcloud/vue/**}',
  53. group: 'external',
  54. position: 'after',
  55. },
  56. {
  57. // group project components
  58. pattern: '*.vue',
  59. patternOptions: { matchBase: true },
  60. group: 'parent',
  61. position: 'before',
  62. },
  63. ],
  64. pathGroupsExcludedImportTypes: ['@nextcloud', 'vue-material-design-icons'],
  65. 'newlines-between': 'always',
  66. alphabetize: {
  67. order: 'asc',
  68. caseInsensitive: true,
  69. },
  70. warnOnUnassignedImports: true,
  71. },
  72. ],
  73. 'import/no-unresolved': ['error', {
  74. // Ignore Webpack query parameters, not supported by eslint-plugin-import
  75. // https://github.com/import-js/eslint-plugin-import/issues/2562
  76. ignore: ['\\?raw$'],
  77. }],
  78. // Prepare for Vue 3 Migration
  79. 'vue/no-deprecated-data-object-declaration': 'warn',
  80. 'vue/no-deprecated-events-api': 'warn',
  81. 'vue/no-deprecated-filter': 'warn',
  82. 'vue/no-deprecated-functional-template': 'warn',
  83. 'vue/no-deprecated-html-element-is': 'warn',
  84. 'vue/no-deprecated-props-default-this': 'warn',
  85. 'vue/no-deprecated-router-link-tag-prop': 'warn',
  86. 'vue/no-deprecated-scope-attribute': 'warn',
  87. 'vue/no-deprecated-slot-attribute': 'warn',
  88. 'vue/no-deprecated-slot-scope-attribute': 'warn',
  89. 'vue/no-deprecated-v-is': 'warn',
  90. 'vue/no-deprecated-v-on-number-modifiers': 'warn',
  91. 'vue/require-explicit-emits': 'warn',
  92. },
  93. overrides: [
  94. {
  95. files: ['**/*.spec.js'],
  96. rules: {
  97. 'node/no-unpublished-import': 'off',
  98. },
  99. },
  100. {
  101. files: ['src/types/openapi/*.ts'],
  102. rules: {
  103. '@typescript-eslint/no-explicit-any': 'off',
  104. quotes: 'off',
  105. 'no-multiple-empty-lines': 'off',
  106. 'no-use-before-define': 'off',
  107. },
  108. },
  109. ],
  110. }