Sort imports by groups in CE specs
What does this MR do?
Sort all imports by their groups. This is the first MR from 3 to address the issue.
2nd MR will cover the EE code and the 3rd will enable the ESLint rule.
Example
Without path group this order considered as valid
import { GlIcon } from '@gitlab/ui';
import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { unescape } from 'lodash';
import MarkdownHeader from './header.vue'; // not okay
import MarkdownToolbar from './toolbar.vue'; // not okay
import { deprecatedCreateFlash as Flash } from '~/flash';
import GLForm from '~/gl_form';
import axios from '~/lib/utils/axios_utils';
import { stripHtml } from '~/lib/utils/text_utility';
import { __, sprintf } from '~/locale';
import GlMentions from '~/vue_shared/components/gl_mentions.vue';
import Suggestions from '~/vue_shared/components/markdown/suggestions.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
With path group this order will be transformed to
import { GlIcon } from '@gitlab/ui';
import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { unescape } from 'lodash';
import { deprecatedCreateFlash as Flash } from '~/flash';
import GLForm from '~/gl_form';
import axios from '~/lib/utils/axios_utils';
import { stripHtml } from '~/lib/utils/text_utility';
import { __, sprintf } from '~/locale';
import GlMentions from '~/vue_shared/components/gl_mentions.vue';
import Suggestions from '~/vue_shared/components/markdown/suggestions.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import MarkdownHeader from './header.vue';
import MarkdownToolbar from './toolbar.vue';
ESLint configuration used:
{
"rules": {
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"pathGroups": [
{
"pattern": "~/**",
"group": "internal"
},
{
"pattern": "ee_else_ce/**",
"group": "internal"
},
{
"pattern": "emojis/**",
"group": "internal"
},
{
"pattern": "empty_states/**",
"group": "internal"
},
{
"pattern": "icons/**",
"group": "internal"
},
{
"pattern": "images/**",
"group": "internal"
},
{
"pattern": "vendor/**",
"group": "internal"
},
{
"pattern": "shared_queries/**",
"group": "internal"
},
{
"pattern": "ee/**",
"group": "internal"
},
{
"pattern": "ee_component/**",
"group": "internal"
},
{
"pattern": "ee_empty_states/**",
"group": "internal"
},
{
"pattern": "ee_icons/**",
"group": "internal"
},
{
"pattern": "ee_images/**",
"group": "internal"
}
]
}
]
}
}
Screenshots (strongly suggested)
N/A
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Vitaly Slobodin