From db4e21607ec8314fddc2a4cb167b8cd72a38e7d5 Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Tue, 30 Sep 2025 19:56:15 +0900 Subject: [PATCH] removed dependency of @shin-chan/kypes. --- .cspell.json | 10 ++- eslint.config.mjs | 17 ----- package-lock.json | 24 ------- package.json | 1 - src/common/ui/KintonePluginTitle.tsx | 3 +- src/desktop/MenuPanel.tsx | 3 +- src/kintone-env.d.ts | 12 ---- src/types/css-modules.d.ts | 93 ++++++++++++++++++++++++++++ src/types/cybozu.d.ts | 30 +++++++++ src/types/kintone.d.ts | 93 ++++++++++++++++++++++++++++ 10 files changed, 228 insertions(+), 58 deletions(-) delete mode 100644 eslint.config.mjs delete mode 100644 src/kintone-env.d.ts create mode 100644 src/types/css-modules.d.ts create mode 100644 src/types/cybozu.d.ts create mode 100644 src/types/kintone.d.ts diff --git a/.cspell.json b/.cspell.json index 72b0944..b22c2e9 100644 --- a/.cspell.json +++ b/.cspell.json @@ -15,11 +15,19 @@ "officedocument", "OKUMURA", "openxmlformats", + "pcss", "pizzip", "rspack", + "styl", "SUBTABLE", "wordprocessingml", "Yoshihiro" ], - "ignorePaths": [".env", "dist", "node_modules", "scripts", "plugin"] + "ignorePaths": [ + ".env", + "dist", + "node_modules", + "scripts", + "plugin" + ] } diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index e41de11..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import presetsPrettier from '@cybozu/eslint-config/flat/presets/react-typescript-prettier.js'; -import globals from 'globals'; - -/** @type {import("eslint").Linter.Config[]} */ -export default [ - ...presetsPrettier, - { - languageOptions: { - globals: { - ...globals.node, - }, - }, - rules: { - 'spaced-comment': ['error', 'always', { markers: ['/'] }], - }, - }, -]; diff --git a/package-lock.json b/package-lock.json index a1a2f25..59d9b2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,6 @@ "@kintone/webpack-plugin-kintone-plugin": "^8.0.11", "@rspack/cli": "^1.5.8", "@rspack/core": "^1.5.8", - "@shin-chan/kypes": "^0.0.7", "@types/file-saver": "^2.0.7", "@types/node": "^24.6.0", "@types/react": "^19.1.16", @@ -2210,29 +2209,6 @@ "node": ">=16.0.0" } }, - "node_modules/@shin-chan/kypes": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@shin-chan/kypes/-/kypes-0.0.7.tgz", - "integrity": "sha512-2GapEDTz4OX2MUeZwkWyTBuWZXhHZ62D91RxV7iW2083xiBlCiyg/kc4caXhOZIiWC3LNdLUC7ZqxgjqqfaePg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@shin-chan/kypes-rest": "^0.0.4" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@shin-chan/kypes-rest": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@shin-chan/kypes-rest/-/kypes-rest-0.0.4.tgz", - "integrity": "sha512-5JrOdSlvRuxlLJqzcj06nroosTm4NpVxHHgwR2MQauppSRBIEUaXirqyBbTDzUzrR0cp8kW8EVLKMxGM1LJKGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/@stylistic/eslint-plugin-ts": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-3.1.0.tgz", diff --git a/package.json b/package.json index a86fed2..881a5b7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "@kintone/webpack-plugin-kintone-plugin": "^8.0.11", "@rspack/cli": "^1.5.8", "@rspack/core": "^1.5.8", - "@shin-chan/kypes": "^0.0.7", "@types/file-saver": "^2.0.7", "@types/node": "^24.6.0", "@types/react": "^19.1.16", diff --git a/src/common/ui/KintonePluginTitle.tsx b/src/common/ui/KintonePluginTitle.tsx index 21feb91..8e5b962 100644 --- a/src/common/ui/KintonePluginTitle.tsx +++ b/src/common/ui/KintonePluginTitle.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; -import type React from 'react'; +// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform. +import React from 'react'; export type KintonePluginTitleProps = React.PropsWithChildren<{ className?: string; diff --git a/src/desktop/MenuPanel.tsx b/src/desktop/MenuPanel.tsx index 385a0da..ce18b66 100644 --- a/src/desktop/MenuPanel.tsx +++ b/src/desktop/MenuPanel.tsx @@ -1,5 +1,4 @@ import { type KintoneFormFieldProperty, KintoneRestAPIClient } from '@kintone/rest-api-client'; -import type { KintoneRecord } from '@shin-chan/kypes/types/page'; import dayjs from 'dayjs'; import Docxtemplater from 'docxtemplater'; import expressionParser from 'docxtemplater/expressions'; @@ -134,7 +133,7 @@ const formatCalculatedRecordValue = ( const record2data = ( properties: KintoneFormFieldProperties, - record: Partial, + record: Partial, language: string, ): TemplateData => { const data: TemplateData = {}; diff --git a/src/kintone-env.d.ts b/src/kintone-env.d.ts deleted file mode 100644 index e77c6b2..0000000 --- a/src/kintone-env.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// CSS modules -type CSSModuleClasses = { readonly [key: string]: string }; - -declare module '*.module.css' { - const classes: CSSModuleClasses; - export default classes; -} - -// CSS -declare module '*.css' {} diff --git a/src/types/css-modules.d.ts b/src/types/css-modules.d.ts new file mode 100644 index 0000000..0af04d3 --- /dev/null +++ b/src/types/css-modules.d.ts @@ -0,0 +1,93 @@ +// CSS modules +type CSSModuleClasses = { readonly [key: string]: string }; + +declare module '*.module.css' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.scss' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.sass' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.less' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.styl' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.stylus' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.pcss' { + const classes: CSSModuleClasses; + export default classes; +} +declare module '*.module.sss' { + const classes: CSSModuleClasses; + export default classes; +} + +// CSS +declare module '*.css' { + /** + * @deprecated Use `import style from './style.css?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.scss' { + /** + * @deprecated Use `import style from './style.scss?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.sass' { + /** + * @deprecated Use `import style from './style.sass?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.less' { + /** + * @deprecated Use `import style from './style.less?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.styl' { + /** + * @deprecated Use `import style from './style.styl?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.stylus' { + /** + * @deprecated Use `import style from './style.stylus?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.pcss' { + /** + * @deprecated Use `import style from './style.pcss?inline'` instead. + */ + const css: string; + export default css; +} +declare module '*.sss' { + /** + * @deprecated Use `import style from './style.sss?inline'` instead. + */ + const css: string; + export default css; +} diff --git a/src/types/cybozu.d.ts b/src/types/cybozu.d.ts new file mode 100644 index 0000000..aed6370 --- /dev/null +++ b/src/types/cybozu.d.ts @@ -0,0 +1,30 @@ +declare namespace cybozu.data { + namespace types { + type SchemaDataField = { + id: string; + label: string; // field name + properties: Record; + type: string; + var: string; // field code + }; + type SchemaDataTable = cybozu.data.types.SchemaDataField & { + fieldList: Record; + }; + type SchemaDataSubtable = Record; + type SchemaDataGroups = Array<{ + table: cybozu.data.types.SchemaDataTable; + subTable: cybozu.data.types.SchemaDataSubtable; + }>; + type SchemaData = { + groups: cybozu.data.types.SchemaDataGroups; + revision: string; + table: cybozu.data.types.SchemaDataTable; + subTable: cybozu.data.types.SchemaDataSubtable; + }; + } + namespace page { + const FORM_DATA: { + schema: cybozu.data.types.SchemaData; + }; + } +} diff --git a/src/types/kintone.d.ts b/src/types/kintone.d.ts new file mode 100644 index 0000000..a1d001f --- /dev/null +++ b/src/types/kintone.d.ts @@ -0,0 +1,93 @@ +declare namespace kintone { + namespace fieldTypes { + interface Category { + type?: 'CATEGORY'; + value: Array; + } + interface Status { + type?: 'STATUS'; + value: string; + } + interface StatusAssignee { + type?: 'STATUS_ASSIGNEE'; + value: kintone.fieldTypes.UserSelect['value']; + } + type InSubtableFieldTypes = + | kintone.fieldTypes.SingleLineText + | kintone.fieldTypes.RichText + | kintone.fieldTypes.MultiLineText + | kintone.fieldTypes.Number + | kintone.fieldTypes.Calc + | kintone.fieldTypes.RadioButton + | kintone.fieldTypes.DropDown + | kintone.fieldTypes.Date + | kintone.fieldTypes.Time + | kintone.fieldTypes.DateTime + | kintone.fieldTypes.Link + | kintone.fieldTypes.CheckBox + | kintone.fieldTypes.MultiSelect + | kintone.fieldTypes.UserSelect + | kintone.fieldTypes.OrganizationSelect + | kintone.fieldTypes.GroupSelect + | kintone.fieldTypes.File; + type SystemFieldTypes = + | kintone.fieldTypes.Id + | kintone.fieldTypes.Revision + | kintone.fieldTypes.Modifier + | kintone.fieldTypes.Creator + | kintone.fieldTypes.RecordNumber + | kintone.fieldTypes.UpdatedTime + | kintone.fieldTypes.CreatedTime; + type SubtableValue = { + id: string; + value: Record; + }; + type Subtable = { + type: 'SUBTABLE'; + value: Array>; + }; + type ExtraFieldTypes = Category | Status | StatusAssignee; + type GenericFieldTypes = InSubtableFieldTypes | SystemFieldTypes | Subtable | ExtraFieldTypes; + } + namespace types { + type GenericFields = Record; + } + + namespace events { + interface AppRecordIndexEditShowEvent { + type: 'app.record.index.edit.show'; + appId: number; + recordId: number; + record: kintone.types.SavedFields; + } + interface AppRecordCreateShowEvent { + type: 'app.record.create.show'; + appId: number; + record: kintone.types.Fields; + reuse: boolean; + } + interface AppRecordEditShowEvent { + type: 'app.record.edit.show'; + appId: number; + recordId: number; + record: kintone.types.SavedFields; + } + interface AppRecordDetailShowEvent { + type: 'app.record.detail.show'; + appId: number; + recordId: number; + record: kintone.types.SavedFields; + } + interface MobileAppRecordDetailShowEvent { + type: 'mobile.app.record.detail.show'; + appId: number; + recordId: number; + record: kintone.types.SavedFields; + } + } + + namespace app { + function getFormFields(): Promise; + function getFormLayout(): Promise; + } +}