diff --git a/.eslintrc.js b/.eslintrc.js index 66eb669f3f..ff9fa2bb73 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,58 @@ module.exports = { // production only 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn', 'vue/no-unused-components': process.env.NODE_ENV === 'production' ? 'error' : 'warn', + 'import/order': [ + 'error', + { + groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'unknown'], + pathGroups: [ + { + // group all style imports at the end + pattern: '{*.css,*.scss}', + patternOptions: { matchBase: true }, + group: 'unknown', + position: 'after', + }, + { + // group material design icons + pattern: 'vue-material-design-icons/**', + group: 'external', + position: 'after', + }, + { + // group @nextcloud imports + pattern: '@nextcloud/{!(vue),!(vue)/**}', + group: 'external', + position: 'after', + }, + { + // group @nextcloud/vue imports + pattern: '{@nextcloud/vue,@nextcloud/vue/**}', + group: 'external', + position: 'after', + }, + { + // group project components + pattern: '*.vue', + patternOptions: { matchBase: true }, + group: 'parent', + position: 'before', + }, + ], + pathGroupsExcludedImportTypes: ['@nextcloud', 'vue-material-design-icons'], + 'newlines-between': 'always', + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + warnOnUnassignedImports: true, + }, + ], + 'import/no-unresolved': ['error', { + // Ignore Webpack query parameters, not supported by eslint-plugin-import + // https://github.com/import-js/eslint-plugin-import/issues/2562 + ignore: ['\\?raw$'], + }], }, overrides: [ { diff --git a/src/App.vue b/src/App.vue index c691d11266..3ceff73bda 100644 --- a/src/App.vue +++ b/src/App.vue @@ -37,13 +37,15 @@