Conversation
40be8f7 to
0f2d689
Compare
import type { NcSelectOption } from '../composables/useNcSelectModel.ts' // type
import { t } from '@nextcloud/l10n' // external (@nextcloud)
import NcButton from '@nextcloud/vue/components/NcButton' // external (Vue) (@nextcloud)
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch' // external (Vue) (@nextcloud)
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' // external (Vue) (@nextcloud)
import NcTextField from '@nextcloud/vue/components/NcTextField' // external (Vue) (@nextcloud)
import { storeToRefs } from 'pinia' // external
import { computed, ref } from 'vue' // external
import { ZOOM_MAX, ZOOM_MIN } from '../../../constants.js' // INTERNAL
import { useNcSelectModel } from '../composables/useNcSelectModel.ts' // INTERNAL
import { useAppConfigStore } from './appConfig.store.ts' // INTERNAL
import { useAppConfigValue } from './useAppConfigValue.ts' // INTERNAL
import SettingsFormGroup from './components/SettingsFormGroup.vue' // INTERNAL (Vue)
import SettingsSelect from './components/SettingsSelect.vue' // INTERNAL (Vue)
import SettingsSubsection from './components/SettingsSubsection.vue' // INTERNAL (Vue)
import IconBellRingOutline from 'vue-material-design-icons/BellRingOutline.vue' // external (Vue)
import IconCardAccountPhoneOutline from 'vue-material-design-icons/CardAccountPhoneOutline.vue' // external (Vue)
import IconMagnify from 'vue-material-design-icons/Magnify.vue' // external (Vue)
import IconMinus from 'vue-material-design-icons/Minus.vue' // external (Vue)
import IconPhoneRingOutline from 'vue-material-design-icons/PhoneRingOutline.vue' // external (Vue)
import IconPlus from 'vue-material-design-icons/Plus.vue' // external (Vue)
import IconRestore from 'vue-material-design-icons/Restore.vue' // external (Vue)
import IconThemeLightDark from 'vue-material-design-icons/ThemeLightDark.vue' // external (Vue)
import IconVolumeHigh from 'vue-material-design-icons/VolumeHigh.vue' // external (Vue)IMHO:
import type { NcSelectOption } from '../composables/useNcSelectModel.ts' // type
import { storeToRefs } from 'pinia' // external
import { computed, ref } from 'vue' // external
import { t } from '@nextcloud/l10n' // external (@nextcloud)
import NcButton from '@nextcloud/vue/components/NcButton' // external (Vue) (@nextcloud)
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch' // external (Vue) (@nextcloud)
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' // external (Vue) (@nextcloud)
import NcTextField from '@nextcloud/vue/components/NcTextField' // external (Vue) (@nextcloud)
import IconBellRingOutline from 'vue-material-design-icons/BellRingOutline.vue' // external (Vue)
import IconCardAccountPhoneOutline from 'vue-material-design-icons/CardAccountPhoneOutline.vue' // external (Vue)
import IconMagnify from 'vue-material-design-icons/Magnify.vue' // external (Vue)
import IconMinus from 'vue-material-design-icons/Minus.vue' // external (Vue)
import IconPhoneRingOutline from 'vue-material-design-icons/PhoneRingOutline.vue' // external (Vue)
import IconPlus from 'vue-material-design-icons/Plus.vue' // external (Vue)
import IconRestore from 'vue-material-design-icons/Restore.vue' // external (Vue)
import IconThemeLightDark from 'vue-material-design-icons/ThemeLightDark.vue' // external (Vue)
import IconVolumeHigh from 'vue-material-design-icons/VolumeHigh.vue' // external (Vue)
import SettingsFormGroup from './components/SettingsFormGroup.vue' // INTERNAL (Vue)
import SettingsSelect from './components/SettingsSelect.vue' // INTERNAL (Vue)
import SettingsSubsection from './components/SettingsSubsection.vue' // INTERNAL (Vue)
import { ZOOM_MAX, ZOOM_MIN } from '../../../constants.js' // INTERNAL
import { useNcSelectModel } from '../composables/useNcSelectModel.ts' // INTERNAL
import { useAppConfigStore } from './appConfig.store.ts' // INTERNAL
import { useAppConfigValue } from './useAppConfigValue.ts' // INTERNAL |
lib/configs/imports.ts
Outdated
| // everything else which is everything internal | ||
| 'unknown', | ||
| // import style from 'my.module.css' | ||
| 'style', | ||
| // Vue components | ||
| 'vue', |
There was a problem hiding this comment.
Agree with Grigorii (but also because I used to this order):
| // everything else which is everything internal | |
| 'unknown', | |
| // import style from 'my.module.css' | |
| 'style', | |
| // Vue components | |
| 'vue', | |
| // Imports from @nextcloud ecosystem | |
| 'nextcloud', | |
| // Imports from @nextcloud/vue library | |
| 'nextcloud-vue', | |
| // Vue components | |
| 'vue', | |
| // everything else which is everything internal | |
| 'unknown', | |
| // import style from 'my.module.css' | |
| 'style', |
lib/configs/imports.ts
Outdated
| ], | ||
| customGroups: { | ||
| value: { | ||
| vue: '\\.vue$', |
There was a problem hiding this comment.
| vue: '\\.vue$', | |
| nextcloud: '^@nextcloud.*', | |
| 'nextcloud-vue': '^@nextcloud\/vue.*', | |
| vue: '\\.vue$', |
This what is used in Talk:
// group @nextcloud imports
pattern: '@nextcloud/{!(vue),!(vue)/**}',
// group @nextcloud/vue imports
pattern: '{@nextcloud/vue,@nextcloud/vue/**}',e31110e to
c3c8f1c
Compare
Fixed ✅
Fixed ✅
Fixed ✅
What is the use case? Its just a namespace, like every other, I would consider it really weird to see: import { foo } from '@foo/bar'
import { computed } from 'vue'
import { t } from '@nextcloud/l10n'instead of consistent alphabetical ordering of normal modules¹: import { foo } from '@foo/bar'
import { t } from '@nextcloud/l10n'
import { computed } from 'vue'¹ I mean like If I import that code form one namespace or another makes no difference for reading the code, it does not provide any information except that is a Nextcloud maintained library but what does that help you in your flow? TL;DR: I am fine with it if others agree with that sorting but I would prefer only sort by module type rather than package maintainer. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
c3c8f1c to
d0623b1
Compare
|
Fixed performance issue by using the new config format. |
This comment was marked as resolved.
This comment was marked as resolved.
4b33d4d to
a523673
Compare
| // type first | ||
| 'external-type', | ||
| 'type', | ||
| { newlinesBetween: 'always' }, |
There was a problem hiding this comment.
Maybe remove these empty lines as well?
There was a problem hiding this comment.
So imports are a single block, separated by an empty line from the remaining module code.
Type imports are separated visually via import type prefix anyway.
There was a problem hiding this comment.
| { newlinesBetween: 'always' }, | |
| { newlinesBetween: 'ignore' }, |
Maybe?
Antreesy
left a comment
There was a problem hiding this comment.
Gonna be painful to get used to it
| // everything else which is everything internal | ||
| 'unknown', | ||
| // Vue components | ||
| 'vue', // external modules (e.g. nextcloud-vue) |
There was a problem hiding this comment.
@Antreesy one problem here is that you use the old imports they are not recognized as vue components. (The /dist/Components).
Instead use /components/Nc...
There was a problem hiding this comment.
From the config it is:
- external
- internal
- vue external
- vue internal
Which is indeed different from the proposal above
There was a problem hiding this comment.
It was always like that here 👀
- Typescript (external | internal)
- Javascript (external | internal)
- Vue (external | internal)
- Styles (external | internal)
Otherwise why should you sort vue independently if you mix it with Javascript?
There was a problem hiding this comment.
Typescript (external | internal)
Javascript (external | internal)
Does it actually separate TS from JS, or types from modules?
There was a problem hiding this comment.
Otherwise why should you sort vue independently if you mix it with Javascript?
To not break it in the middle, because it can be in a single batch without mixing externals with internals
There was a problem hiding this comment.
Does it actually separate TS from JS, or types from modules?
I do not mean .ts files I meat types.
- Types are stripped away so that block is only for type checking.
- Javascript is the code that stays so its the most important block.
- Vue files are components, you do not care in
<script>about them so they do not need to interrupt reading the script sources. They are only relevant for the<template>.
- Enforce file extensions - Enforce consistent named import / export sorting - Enforce consistent module sorting Do not use eslint-plugin-import(-x) because it is quite slow and has many issues with parsing different formats like vue script-setup in Typescript and similar. Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
a523673 to
aca2d69
Compare
This is why I thought, it was fixed, and externals don't go after internals |
|
Well then it was a misunderstanding. Currently there is really mixed sorting in e.g. server, but for me it seemed to be agreed that Vue components are sorted extra as they belong to In most components this leads to import { computed } from 'vue'
import { getSomething } from '../../utils/myUtil.ts'
import NcButton from '@nextcloud/vue/components/NcButton'
import MyComponent from './MyComponent.vue'Which I thought is more common than import { computed } from 'vue'
import NcButton from '@nextcloud/vue/components/NcButton'
import MyComponent from './MyComponent.vue'
import { getSomething } from '../../utils/myUtil.ts'So it was about seeing directly what are components vs seeing what origins from where. |
|

Do not use eslint-plugin-import(-x) because it is quite slow and has many issues with parsing different formats like vue script-setup in Typescript and similar.