Skip to content

Commit

Permalink
Merge pull request #1038 from 3YOURMIND/bump-typescript-eslint
Browse files Browse the repository at this point in the history
Bump typescript eslint
  • Loading branch information
Isokaeder authored Jan 8, 2025
2 parents 593bd7e + 3348bd3 commit c68987f
Show file tree
Hide file tree
Showing 85 changed files with 2,432 additions and 707 deletions.
11 changes: 5 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ const config = tseslint.config(
languageOptions: {
ecmaVersion: 2022,
parserOptions: {
project: [
'./tsconfig.json',
'./internals/*/tsconfig.json',
'./packages/*/tsconfig.json',
'./packages/kotti-ui/tsconfig.node.json',
],
projectService: {
allowDefaultProject: ['*.mjs'],
defaultProject: 'tsconfig.json',
},
tsconfigRootDir: root,
},
sourceType: 'module',
Expand Down Expand Up @@ -126,6 +124,7 @@ const config = tseslint.config(
],
},
],
'@typescript-eslint/prefer-namespace-keyword': 'off',
},
},
{
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@
"url": "https://github.com/carsoli"
}
],
"dependencies": {},
"devDependencies": {
"@3yourmind/eslint-config": "*",
"@types/eslint__js": "^8.42.3",
"@types/node": "20.11.16",
"eslint": "^9.2.0",
"eslint": "^9.17.0",
"husky": "^7.0.1",
"knip": "^5.13.0",
"lerna": "^7.4.2",
Expand All @@ -68,7 +69,7 @@
"stylelint-csstree-validator": "^3.0.0",
"stylelint-prettier": "^4.0.2",
"turbo": "^1.13.3",
"typescript": "^5.4.4",
"typescript": "5.4.4",
"typescript-eslint": "^7.8.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/components/CodePreviewLegacy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { computed, defineComponent, ref } from 'vue'
export default defineComponent({
name: 'CodePreviewLegacy',
props: {
vueSlotLabel: { default: 'Kotti-UI', type: String },
styleSlotLabel: { default: 'Kotti-Style', type: String },
vueSlotLabel: { default: 'Kotti-UI', type: String },
},
setup(props) {
const showCode = ref(true)
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/components/CodePreviewNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { error, success } from '~/utilities/toaster'
/**
* Port of an equivalent component from 'vue3/upgrade'. Used to document the new kt-toaster
* TODO: remove in vue3
* FIXME: remove in vue3
*/
export default defineComponent({
name: 'CodePreviewNew',
Expand Down
12 changes: 6 additions & 6 deletions packages/documentation/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const saveSavedFieldsToLocalStorage = (isNarrow: boolean) => {
LOCALSTORAGE_IS_NAVBAR_NARROW_KEY,
JSON.stringify(isNarrow),
)
} catch (error) {
} catch {
// eslint-disable-next-line no-console
console.warn('could not save to localStorage')
}
Expand All @@ -55,7 +55,7 @@ export default defineComponent({
)
if (value) return JSON.parse(value)
}
} catch (error) {
} catch {
// eslint-disable-next-line no-console
console.warn('could not read localStorage')
}
Expand All @@ -68,20 +68,20 @@ export default defineComponent({
navLogo,
quickLinks: [
{
title: 'Create New Issue',
link: 'https://github.com/3YOURMIND/kotti/issues/new/choose',
title: 'Create New Issue',
},
{
title: 'NPM',
link: 'https://www.npmjs.com/package/@3yourmind/kotti-ui',
title: 'NPM',
},
{
title: 'Issues',
link: 'https://github.com/3YOURMIND/kotti/issues',
title: 'Issues',
},
{
title: 'Readme',
link: 'https://github.com/3YOURMIND/kotti#readme',
title: 'Readme',
},
],
sections: computed(() =>
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/pages/changelog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export default defineComponent({
return {
dayjs,
isLoading,
releases,
renderMarkdown: (markdown: string) =>
marked.parse(convertPoundToIssueLink(markdown)),
releases,
sortedReleases: computed(() =>
cloneDeep(releases.value).sort((a, b) =>
naturalSort({ direction: 'desc' })(a.tag_name, b.tag_name),
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/pages/foundations/icons/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default defineComponent({
},
setup() {
const component: { meta: Kotti.Meta; name: string } = {
name: 'Icons',
meta: {
addedVersion: null,
deprecated: null,
Expand All @@ -48,6 +47,7 @@ export default defineComponent({
schema: yocoIconSchema,
},
},
name: 'Icons',
}
return {
Expand Down
20 changes: 10 additions & 10 deletions packages/documentation/pages/usage/components/avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ export default defineComponent({
},
setup() {
return {
avatarSettings: ref<Kotti.Avatar.Props & { showContentSlot: boolean }>({
isHoverable: false,
name: "Jony O'Five",
showContentSlot: false,
size: Kotti.Avatar.Size.MEDIUM,
src: 'https://picsum.photos/200/100',
}),
avatarGroupSettings: ref<
Kotti.AvatarGroup.Props & { showContentSlot: boolean }
>({
Expand All @@ -133,13 +126,20 @@ export default defineComponent({
showContentSlot: false,
size: Kotti.Avatar.Size.MEDIUM,
}),
avatarSettings: ref<Kotti.Avatar.Props & { showContentSlot: boolean }>({
isHoverable: false,
name: "Jony O'Five",
showContentSlot: false,
size: Kotti.Avatar.Size.MEDIUM,
src: 'https://picsum.photos/200/100',
}),
Kotti,
KtAvatar,
KtAvatarGroup,
sizeOptions: Object.entries(Kotti.Avatar.Size).map(([label, value]) => ({
label,
value,
})),
Kotti,
KtAvatar,
KtAvatarGroup,
Yoco,
}
},
Expand Down
20 changes: 10 additions & 10 deletions packages/documentation/pages/usage/components/breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,44 @@ export default defineComponent({
component: KtBreadcrumb,
links: [
{
title: 'Kotti',
isCompleted: true,
onClick: () => {
activeIndex.value = 0
void router.value.push('#')
},
isCompleted: true,
title: 'Kotti',
},
{
title: 'Usage',
isCompleted: true,
onClick: () => {
activeIndex.value = 1
void router.value.push('#')
},
isCompleted: true,
title: 'Usage',
},
{
title: 'Components',
isCompleted: true,
onClick: () => {
activeIndex.value = 2
void router.value.push('#')
},
isCompleted: true,
title: 'Components',
},
{
title: 'Links',
isCompleted: false,
onClick: () => {
activeIndex.value = 3
void router.value.push('#')
},
isCompleted: false,
title: 'Links',
},
{
title: 'Breadcrumbs',
isDisabled: true,
onClick: () => {
activeIndex.value = 4
void router.value.push('#')
},
isDisabled: true,
title: 'Breadcrumbs',
},
],
textSeparator: {
Expand Down
30 changes: 15 additions & 15 deletions packages/documentation/pages/usage/components/comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ export default defineComponent({
comment.id === payload.id
? {
...comment,
isModified: true,
isInternal: payload.isInternal,
isModified: true,
message: payload.message,
}
: comment
Expand Down Expand Up @@ -432,12 +432,16 @@ export default defineComponent({
}),
)
},
handleEdit(payload: Kotti.Comment.Events.Edit) {
handleDelete(payload: Kotti.Comment.Events.Delete) {
if (!payload.parentId) {
if (!comments.value.some((comment) => comment.id === payload.id))
throw new Error(`Comment not found, comment id: ${payload.id}`)
throw new Error(
`Comment not found, comment id: ${String(payload.id)}`,
)
comments.value = comments.value.map(editComment(payload))
comments.value = comments.value.filter(
(comment) => comment.id !== payload.id,
)
return
}
Expand All @@ -455,18 +459,16 @@ export default defineComponent({
`Comment not found, comment id: ${String(payload.id)}`,
)
parentComment.replies = parentComment.replies.map(editComment(payload))
parentComment.replies = parentComment.replies.filter(
(reply) => reply.id !== payload.id,
)
},
handleDelete(payload: Kotti.Comment.Events.Delete) {
handleEdit(payload: Kotti.Comment.Events.Edit) {
if (!payload.parentId) {
if (!comments.value.some((comment) => comment.id === payload.id))
throw new Error(
`Comment not found, comment id: ${String(payload.id)}`,
)
throw new Error(`Comment not found, comment id: ${payload.id}`)
comments.value = comments.value.filter(
(comment) => comment.id !== payload.id,
)
comments.value = comments.value.map(editComment(payload))
return
}
Expand All @@ -484,9 +486,7 @@ export default defineComponent({
`Comment not found, comment id: ${String(payload.id)}`,
)
parentComment.replies = parentComment.replies.filter(
(reply) => reply.id !== payload.id,
)
parentComment.replies = parentComment.replies.map(editComment(payload))
},
postEscapeParser: (msg: string) => msg.replaceAll('\n', '</br>'),
settings,
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/pages/usage/components/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ import ComponentInfo from '~/components/ComponentInfo.vue'
export default defineComponent({
name: 'DocumentationPageUsageComponentsDrawer',
components: {
ComponentInfo,
CodePreviewLegacy,
ComponentInfo,
},
data() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ export default defineComponent({
{ label: '<token>', value: 'token' },
]),
component: KtFieldInlineEdit,
formValue,
fieldValue: computed(() => formValue.value.fieldValue),
fieldProps: computed(() => ({
autoComplete:
settings.value.autoComplete === 'token'
Expand All @@ -200,6 +198,8 @@ export default defineComponent({
type: settings.value.validation ?? 'empty',
}),
})),
fieldValue: computed(() => formValue.value.fieldValue),
formValue,
onConfirm: (newVal: Kotti.FieldInlineEdit.Events.Confirm) => {
success({ text: newVal ?? '' })
},
Expand Down
19 changes: 10 additions & 9 deletions packages/documentation/pages/usage/components/form-fields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ const saveSavedFieldsToLocalStorage = (savedFields: Array<unknown>) => {
LOCALSTORAGE_SAVED_COMPONENTS_KEY,
JSON.stringify(savedFields),
)
} catch (error) {
} catch {
// eslint-disable-next-line no-console
console.warn('could not save to localStorage')
}
Expand Down Expand Up @@ -1337,6 +1337,7 @@ export default defineComponent({
settings.value.component.includes('Range'),
)
// eslint-disable-next-line sonarjs/cognitive-complexity
const componentProps = computed(() => {
const standardProps = {
dataTest: settings.value.dataTest,
Expand Down Expand Up @@ -1666,7 +1667,7 @@ export default defineComponent({
)
if (value) return JSON.parse(value)
}
} catch (error) {
} catch {
// eslint-disable-next-line no-console
console.warn('could not read localStorage')
}
Expand Down Expand Up @@ -1814,6 +1815,13 @@ export default defineComponent({
reset: () => {
values.value = INITIAL_VALUES
},
savedFieldsAdd: () => {
savedFields.value = [
...savedFields.value,
cloneDeep(componentValue.value),
]
saveSavedFieldsToLocalStorage(savedFields.value)
},
savedFieldsMap: computed(() =>
savedFields.value.map(
(component): ComponentRepresentation => ({
Expand All @@ -1823,13 +1831,6 @@ export default defineComponent({
}),
),
),
savedFieldsAdd: () => {
savedFields.value = [
...savedFields.value,
cloneDeep(componentValue.value),
]
saveSavedFieldsToLocalStorage(savedFields.value)
},
savedFieldsRemove: (toRemove: number) => {
savedFields.value = savedFields.value.filter(
(_, index) => index !== toRemove,
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/pages/usage/components/heading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export default defineComponent({
setup() {
return {
component: KtHeading,
toggle: ref(false),
showAlert() {
info({ text: 'H3 Action Clicked' })
},
toggle: ref(false),
}
},
})
Expand Down
Loading

0 comments on commit c68987f

Please sign in to comment.