Skip to content

Commit

Permalink
refactor: use import/order eslint rule (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViZhe authored May 6, 2022
1 parent c75d086 commit 493dc12
Show file tree
Hide file tree
Showing 140 changed files with 319 additions and 235 deletions.
20 changes: 20 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@
"import/extensions": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"import/order": [
"error",
{
"newlines-between": "always",
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object"
],
"pathGroups": [
{ "pattern": "@/**", "group": "internal", "position": "before" },
{ "pattern": "#/**", "group": "internal", "position": "before" }
],
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],

"vue/component-name-in-template-casing": ["error", "kebab-case"],
"vue/max-attributes-per-line": "warn",
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"*.{js,ts}": ["eslint --fix", "prettier --write"],
"*.scss": ["stylelint --fix", "prettier --write"],
"*.{vue,html}": ["stylelint --fix", "prettier --write", "eslint --fix"],
"*.{vue,html}": ["stylelint --fix", "eslint --fix", "prettier --write"],
"{*.json,.*rc}": ["prettier --parser json --write"],
"*.{yaml,yml}": ["prettier --parser yaml --write"],
"*.md": ["prettier --write"]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lint:style:fix": "stylelint --fix '**/*.{css,scss,vue}'",
"prettier": "prettier --check --ignore-unknown '**/*'",
"prettier:fix": "prettier --write --ignore-unknown '**/*'",
"format": "yarn lint:style:fix && yarn lint:js:fix && yarn prettier:fix",
"test": "vitest",
"test:c": "vitest --run --coverage",
"prepare": "husky install",
Expand Down
3 changes: 2 additions & 1 deletion src/qComponents/QBreadcrumbs/QBreadcrumbs.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, it, expect } from 'vitest';
import { shallowMount } from '@vue/test-utils';
import { describe, it, expect } from 'vitest';

import { QBreadcrumbs } from './index';

describe('QBreadcrumbs', () => {
Expand Down
1 change: 1 addition & 0 deletions src/qComponents/QButton/src/QButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { defineComponent, PropType, computed, inject } from 'vue';
import { validateArray } from '@/qComponents/helpers';
import type { QFormProvider } from '@/qComponents/QForm';
import type { Nullable } from '#/helpers';
import type {
Expand Down
6 changes: 3 additions & 3 deletions src/qComponents/QCascader/src/QCascader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</template>

<script lang="ts">
import type { Instance } from '@popperjs/core';
import {
defineComponent,
inject,
Expand All @@ -37,20 +38,19 @@ import {
watch,
nextTick
} from 'vue';
import type { Instance } from '@popperjs/core';
import { isServer } from '@/qComponents/constants/isServer';
import { randId } from '@/qComponents/helpers';
import { useResizeListener } from '@/qComponents/hooks';
import type { QFormProvider } from '@/qComponents/QForm';
import type { QFormItemProvider } from '@/qComponents/QFormItem';
import type { Nullable, UnwrappedInstance } from '#/helpers';
import QCascaderDropdown from './QCascaderDropdown/QCascaderDropdown.vue';
import QCascaderInput from './QCascaderInput/QCascaderInput.vue';
import QCascaderTags from './QCascaderTags/QCascaderTags.vue';
import type { QCascaderInputInstance } from './QCascaderInput/types';
import QCascaderTags from './QCascaderTags/QCascaderTags.vue';
import type {
QCascaderPropModelValue,
QCascaderPropOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ import {
} from 'vue';
import { QScrollbar } from '@/qComponents/QScrollbar';
import type { Nullable } from '#/helpers';
import findAllLeaves from '../helpers/findAllLeaves';
import QCascaderRow from '../QCascaderRow/QCascaderRow.vue';
import type { QCascaderDropdownProvider } from '../QCascaderDropdown/types';
import QCascaderRow from '../QCascaderRow/QCascaderRow.vue';
import type { Option, QCascaderProvider } from '../types';
import { getSibling } from './helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</template>

<script lang="ts">
import { createPopper } from '@popperjs/core';
import {
defineComponent,
inject,
Expand All @@ -34,9 +35,9 @@ import {
onMounted,
onUnmounted
} from 'vue';
import { createPopper } from '@popperjs/core';
import { getConfig } from '@/qComponents/config';
import type { Nullable } from '#/helpers';
import QCascaderColumn from '../QCascaderColumn/QCascaderColumn.vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
</template>

<script lang="ts">
import { defineComponent, inject, computed } from 'vue';
import { isNumber, isEmpty } from 'lodash-es';
import { defineComponent, inject, computed } from 'vue';
import { t } from '@/qComponents/locale';
import { QInput } from '@/qComponents/QInput';
import type { Nullable } from '#/helpers';
import findFullPath from '../helpers/findFullPath';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import { defineComponent, inject, computed, PropType } from 'vue';
import { QCheckbox } from '@/qComponents/QCheckbox';
import getChildStatuses from '../helpers/getChildStatuses';
import type { QCascaderProvider } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import { defineComponent, inject, computed } from 'vue';
import { QTag } from '@/qComponents/QTag';
import findFullPath from '../helpers/findFullPath';
import type { QCascaderProvider } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/qComponents/QCascader/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Ref, ComputedRef } from 'vue';
import type { Instance } from '@popperjs/core';
import type { Ref, ComputedRef } from 'vue';

import type { Nullable, UnwrappedInstance } from '#/helpers';

Expand Down
3 changes: 2 additions & 1 deletion src/qComponents/QCheckbox/src/QCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
<script lang="ts">
import { computed, defineComponent, inject, watch, ref } from 'vue';
import type { QCheckboxGroupProvider } from '@/qComponents/QCheckboxGroup';
import type { QFormProvider } from '@/qComponents/QForm';
import type { QFormItemProvider } from '@/qComponents/QFormItem';
import type { QCheckboxGroupProvider } from '@/qComponents/QCheckboxGroup';
import type { Nullable } from '#/helpers';
import type { QCheckboxProps, QCheckboxInstance } from './types';
Expand Down
1 change: 1 addition & 0 deletions src/qComponents/QCheckboxGroup/src/QCheckboxGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { validateArray } from '@/qComponents/helpers';
import type { QFormItemProvider } from '@/qComponents/QFormItem';
import type { Nullable } from '#/helpers';
import type {
Expand Down
2 changes: 1 addition & 1 deletion src/qComponents/QCollapse/src/QCollapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</template>

<script lang="ts">
import { defineComponent, PropType, provide, watch, ref } from 'vue';
import { uniqueId } from 'lodash-es';
import { defineComponent, PropType, provide, watch, ref } from 'vue';
import type {
QCollapseProps,
Expand Down
1 change: 1 addition & 0 deletions src/qComponents/QCollapseItem/src/QCollapseItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { defineComponent, inject, computed } from 'vue';
import { randId } from '@/qComponents/helpers';
import type { QCollapseProvider } from '@/qComponents/QCollapse';
import QCollapseTransition from './QCollapseTransition.vue';
import type { QCollapseItemProps, QCollapseItemInstance } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</template>

<script lang="ts">
import { colord } from 'colord';
import {
defineComponent,
ref,
Expand All @@ -28,12 +29,11 @@ import {
nextTick
} from 'vue';
import { colord } from 'colord';
import type { Nullable } from '#/helpers';
import draggable from '../utils/draggable';
import type { QPickerDropdownProvider } from '../QPickerDropdown';
import draggable from '../utils/draggable';
import type { QColorAlphaSliderInstance } from './types';
export default defineComponent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import {
import type { Nullable } from '#/helpers';
import draggable from '../utils/draggable';
import type { QPickerDropdownProvider } from '../QPickerDropdown';
import draggable from '../utils/draggable';
import type { QColorHueSliderInstance } from './types';
export default defineComponent({
Expand Down
9 changes: 5 additions & 4 deletions src/qComponents/QColorPicker/src/QColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
</template>

<script lang="ts">
import { createPopper, Instance, Options } from '@popperjs/core';
import { placements } from '@popperjs/core/lib/enums';
import { colord } from 'colord';
import {
defineComponent,
PropType,
Expand All @@ -62,15 +65,13 @@ import {
nextTick,
provide
} from 'vue';
import { createPopper, Instance, Options } from '@popperjs/core';
import { placements } from '@popperjs/core/lib/enums';
import { colord } from 'colord';
import { getConfig } from '@/qComponents/config';
import { isServer } from '@/qComponents/constants/isServer';
import { validateArray } from '@/qComponents/helpers';
import { getConfig } from '@/qComponents/config';
import type { QFormProvider } from '@/qComponents/QForm';
import type { QFormItemProvider } from '@/qComponents/QFormItem';
import type { Nullable, UnwrappedInstance } from '#/helpers';
import QPickerDropdown from './QPickerDropdown';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</template>

<script lang="ts">
import { colord } from 'colord';
import {
defineComponent,
ref,
Expand All @@ -21,12 +22,12 @@ import {
nextTick,
inject
} from 'vue';
import { colord } from 'colord';
import type { Nullable } from '#/helpers';
import draggable from '../utils/draggable';
import type { QPickerDropdownProvider } from '../QPickerDropdown';
import draggable from '../utils/draggable';
import type { QColorSvpanelInstance } from './types';
export default defineComponent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
</template>

<script lang="ts">
import { colord } from 'colord';
import type { HsvaColor } from 'colord';
import {
defineComponent,
PropType,
Expand All @@ -62,21 +64,20 @@ import {
onUnmounted,
provide
} from 'vue';
import { colord } from 'colord';
import type { HsvaColor } from 'colord';
import { t } from '@/qComponents/locale';
import { validateArray } from '@/qComponents/helpers';
import { t } from '@/qComponents/locale';
import { QButton } from '@/qComponents/QButton';
import { QInput } from '@/qComponents/QInput';
import type { Nillable, Nullable, UnwrappedInstance } from '#/helpers';
import QColorSvpanel from '../QColorSvpanel';
import QColorAlphaSlider from '../QColorAlphaSlider';
import type { QColorAlphaSliderInstance } from '../QColorAlphaSlider';
import QColorHueSlider from '../QColorHueSlider';
import type { QColorSvpanelInstance } from '../QColorSvpanel';
import type { QColorHueSliderInstance } from '../QColorHueSlider';
import type { QColorAlphaSliderInstance } from '../QColorAlphaSlider';
import type { QColorSvpanelInstance } from '../QColorSvpanel';
import QColorSvpanel from '../QColorSvpanel';
import type { QColorPickerProvider } from '../types';
import type {
Expand Down
6 changes: 3 additions & 3 deletions src/qComponents/QColorPicker/src/QPickerDropdown/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { Ref } from 'vue';

import type { Nullable, UnwrappedInstance } from '#/helpers';

import type { ColorFormat } from '../types';
import type { QColorSvpanelInstance } from '../QColorSvpanel';
import type { QColorHueSliderInstance } from '../QColorHueSlider';
import type { QColorAlphaSliderInstance } from '../QColorAlphaSlider';
import type { QColorHueSliderInstance } from '../QColorHueSlider';
import type { QColorSvpanelInstance } from '../QColorSvpanel';
import type { ColorFormat } from '../types';

export type QPickerDropdownPropColorFormat = ColorFormat;

Expand Down
2 changes: 1 addition & 1 deletion src/qComponents/QColorPicker/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Ref, ComputedRef } from 'vue';
import type { Placement, Options } from '@popperjs/core';
import type { Ref, ComputedRef } from 'vue';

import type { Nullable, UnwrappedInstance } from '#/helpers';

Expand Down
15 changes: 8 additions & 7 deletions src/qComponents/QContextMenu/src/QContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</template>

<script lang="ts">
import {
createPopper as createPopperJs,
Instance,
Options,
Placement
} from '@popperjs/core';
import {
defineComponent,
computed,
Expand All @@ -60,16 +66,11 @@ import {
onUnmounted,
onBeforeUpdate
} from 'vue';
import {
createPopper as createPopperJs,
Instance,
Options,
Placement
} from '@popperjs/core';
import { getConfig } from '@/qComponents/config';
import { isServer } from '@/qComponents/constants/isServer';
import { validateArray } from '@/qComponents/helpers';
import { getConfig } from '@/qComponents/config';
import type { Nullable } from '#/helpers';
import type {
Expand Down
Loading

0 comments on commit 493dc12

Please sign in to comment.