introduce biome instead of prettier and eslint.
This commit is contained in:
@@ -13,11 +13,13 @@
|
||||
"Ligh",
|
||||
"moize",
|
||||
"officedocument",
|
||||
"OKUMURA",
|
||||
"openxmlformats",
|
||||
"pizzip",
|
||||
"rspack",
|
||||
"SUBTABLE",
|
||||
"wordprocessingml"
|
||||
"wordprocessingml",
|
||||
"Yoshihiro"
|
||||
],
|
||||
"ignorePaths": [".env"]
|
||||
"ignorePaths": [".env", "dist", "node_modules", "scripts", "plugin"]
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/prettierrc",
|
||||
"semi": true,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"printWidth": 120,
|
||||
"trailingComma": "all"
|
||||
}
|
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"esbenp.prettier-vscode",
|
||||
"biomejs.biome",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"jawandarajbir.react-vscode-extension-pack"
|
||||
|
29
.vscode/settings.json
vendored
29
.vscode/settings.json
vendored
@@ -1,39 +1,30 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"quickfix.biome": "explicit",
|
||||
"source.organizeImports": "explicit"
|
||||
},
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
"[javascriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[html]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[css]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
// Extensions - Biome
|
||||
// - see: biome.json
|
||||
// Exteions - cSpell
|
||||
// - see: .cspell.json
|
||||
// Extensions - ESLint
|
||||
"eslint.enable": false,
|
||||
// Extensions - HTML
|
||||
"html.format.wrapLineLength": 0,
|
||||
// Extentions - Prettier
|
||||
// - see: .prettierrc.json
|
||||
// Extentions - Typescript
|
||||
"javascript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always"
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
}
|
||||
|
43
biome.json
Normal file
43
biome.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": true
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": false,
|
||||
"includes": ["src/**"]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"formatWithErrors": false,
|
||||
"indentStyle": "space",
|
||||
"lineEnding": "lf",
|
||||
"indentWidth": 2,
|
||||
"lineWidth": 120,
|
||||
"attributePosition": "auto"
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"domains": {
|
||||
"react": "recommended"
|
||||
},
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "single"
|
||||
}
|
||||
},
|
||||
"assist": {
|
||||
"enabled": true,
|
||||
"actions": {
|
||||
"source": {
|
||||
"organizeImports": "on"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2874
package-lock.json
generated
2874
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
@@ -10,45 +10,46 @@
|
||||
"prebuild:prod": "npm run gen",
|
||||
"build": "cross-env NODE_ENV=development rspack build",
|
||||
"build:prod": "cross-env NODE_ENV=production rspack build",
|
||||
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
|
||||
"cspell": "cspell .",
|
||||
"lint": "biome lint .",
|
||||
"format": "biome check --write .",
|
||||
"upload": "env-cmd --silent kintone-plugin-uploader dist/plugin.zip --watch --waiting-dialog-ms 3000"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kintone/rest-api-client": "^5.7.4",
|
||||
"angular-expressions": "^1.5.0",
|
||||
"@kintone/rest-api-client": "^5.7.5",
|
||||
"angular-expressions": "^1.5.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"docxtemplater": "^3.65.1",
|
||||
"dayjs": "^1.11.18",
|
||||
"docxtemplater": "^3.66.4",
|
||||
"file-saver": "^2.0.5",
|
||||
"i18next": "^25.3.0",
|
||||
"i18next": "^25.5.2",
|
||||
"moize": "^6.1.6",
|
||||
"pizzip": "^3.2.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-error-boundary": "^6.0.0",
|
||||
"react-i18next": "^15.6.0",
|
||||
"react-i18next": "^16.0.0",
|
||||
"tiny-invariant": "^1.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cybozu/eslint-config": "^24.0.0",
|
||||
"@kintone/dts-gen": "^8.1.2",
|
||||
"@biomejs/biome": "^2.2.4",
|
||||
"@kintone/dts-gen": "^8.1.3",
|
||||
"@kintone/plugin-uploader": "^9.1.5",
|
||||
"@kintone/webpack-plugin-kintone-plugin": "^8.0.11",
|
||||
"@rspack/cli": "^1.4.3",
|
||||
"@rspack/core": "^1.4.3",
|
||||
"@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.0.10",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"cross-env": "^7.0.3",
|
||||
"env-cmd": "^10.1.0",
|
||||
"eslint": "^9.30.1",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"globals": "^16.3.0",
|
||||
"@types/node": "^24.6.0",
|
||||
"@types/react": "^19.1.16",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"cross-env": "^10.1.0",
|
||||
"cspell": "^9.2.1",
|
||||
"env-cmd": "^11.0.0",
|
||||
"globals": "^16.4.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.6.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.8.3"
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
import invariant from 'tiny-invariant';
|
||||
|
||||
@@ -21,8 +20,7 @@ const DynamicPortal: React.FC<DynamicPortalProps> = (props) => {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
}, [el]);
|
||||
return ReactDOM.createPortal(children, el);
|
||||
};
|
||||
export default DynamicPortal;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
import KintonePluginAlert from './ui/KintonePluginAlert';
|
||||
|
||||
interface Props {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
import DynamicPortal from './DynamicPortal';
|
||||
|
||||
import styles from './Loading.module.css';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { LanguageDetectorModule } from 'i18next';
|
||||
import type { LanguageDetectorModule } from 'i18next';
|
||||
|
||||
const KintoneLanguageDetector: LanguageDetectorModule = {
|
||||
type: 'languageDetector',
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { KintoneFormFieldProperty } from '@kintone/rest-api-client';
|
||||
import type { KintoneFormFieldProperty } from '@kintone/rest-api-client';
|
||||
|
||||
export type KintoneFormFieldProperties = {
|
||||
[fieldCode: string]: KintoneFormFieldProperty.OneOf;
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginAlertProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginButtonProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginDescProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginLabelProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginRequire = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
// biome-ignore lint/style/useImportType: React is required in scope for the old JSX transform.
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginRowProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
|
||||
export type KintonePluginSelectOptionData = {
|
||||
value: string;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import clsx from 'clsx';
|
||||
import type React from 'react';
|
||||
|
||||
export type KintonePluginTitleProps = React.PropsWithChildren<{
|
||||
className?: string;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import ErrorFallback from '../common/ErrorFallback';
|
||||
import Loading from '../common/Loading';
|
||||
|
@@ -1,18 +1,17 @@
|
||||
import React from 'react';
|
||||
|
||||
import { KintoneRestAPIClient } from '@kintone/rest-api-client';
|
||||
import moize from 'moize';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import invariant from 'tiny-invariant';
|
||||
import { naturalCompare } from '../common/stringUtils';
|
||||
import { KintoneFormFieldProperties } from '../common/types';
|
||||
import type { KintoneFormFieldProperties } from '../common/types';
|
||||
import KintonePluginAlert from '../common/ui/KintonePluginAlert';
|
||||
import KintonePluginButton from '../common/ui/KintonePluginButton';
|
||||
import KintonePluginDesc from '../common/ui/KintonePluginDesc';
|
||||
import KintonePluginLabel from '../common/ui/KintonePluginLabel';
|
||||
import KintonePluginRequire from '../common/ui/KintonePluginRequire';
|
||||
import KintonePluginRow from '../common/ui/KintonePluginRow';
|
||||
import KintonePluginSelect, { KintonePluginSelectOptionData } from '../common/ui/KintonePluginSelect';
|
||||
import KintonePluginSelect, { type KintonePluginSelectOptionData } from '../common/ui/KintonePluginSelect';
|
||||
import KintonePluginTitle from '../common/ui/KintonePluginTitle';
|
||||
|
||||
import styles from './Settings.module.css';
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import invariant from 'tiny-invariant';
|
||||
import ConfigApp from './ConfigApp';
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import ErrorFallback from '../common/ErrorFallback';
|
||||
import Loading from '../common/Loading';
|
||||
|
@@ -1,17 +1,16 @@
|
||||
import React from 'react';
|
||||
|
||||
import { KintoneFormFieldProperty, KintoneRestAPIClient } from '@kintone/rest-api-client';
|
||||
import { KintoneRecord } from '@shin-chan/kypes/types/page';
|
||||
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';
|
||||
import { saveAs } from 'file-saver';
|
||||
import moize from 'moize';
|
||||
import PizZip from 'pizzip';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import invariant from 'tiny-invariant';
|
||||
import { DOCX_CONTENT_TYPE } from '../common/constants';
|
||||
import { KintoneFormFieldProperties } from '../common/types';
|
||||
import type { KintoneFormFieldProperties } from '../common/types';
|
||||
import KintonePluginAlert from '../common/ui/KintonePluginAlert';
|
||||
import KintonePluginButton from '../common/ui/KintonePluginButton';
|
||||
|
||||
@@ -31,7 +30,7 @@ const cachedFormFieldsProperties = moize.promise(async (appId: number): Promise<
|
||||
});
|
||||
|
||||
const formatNumberValue = (value: string, digit: boolean, scale?: number): string => {
|
||||
if (value !== '' && !isNaN(Number(value))) {
|
||||
if (value !== '' && !Number.isNaN(Number(value))) {
|
||||
const numberValue = Number(value);
|
||||
const options: Intl.NumberFormatOptions = {
|
||||
useGrouping: digit,
|
||||
@@ -90,18 +89,18 @@ const formatCalculatedRecordValue = (
|
||||
} else if (format === 'DATETIME') {
|
||||
// "2025-05-30T00:00:00Z" -> "2025-05-30 9:00" (browser local timezone)
|
||||
const date = new Date(value);
|
||||
invariant(!isNaN(date.getTime()), `Expected value to be a valid date string, but got ${value}`);
|
||||
invariant(!Number.isNaN(date.getTime()), `Expected value to be a valid date string, but got ${value}`);
|
||||
formattedValue = dayjs(date).format('YYYY-MM-DD h:mm');
|
||||
} else if (format === 'DATE') {
|
||||
// "2025-05-30T00:00:00Z" -> "2025-05-30" (browser local timezone)
|
||||
const date = new Date(value);
|
||||
invariant(!isNaN(date.getTime()), `Expected value to be a valid date string, but got ${value}`);
|
||||
invariant(!Number.isNaN(date.getTime()), `Expected value to be a valid date string, but got ${value}`);
|
||||
formattedValue = dayjs(date).format('YYYY-MM-DD');
|
||||
} else if (format === 'TIME') {
|
||||
// "00:30" -> "0:30"
|
||||
const [hours, minutes] = value.split(':').map((v) => Number(v));
|
||||
invariant(
|
||||
!isNaN(hours) && !isNaN(minutes),
|
||||
!Number.isNaN(hours) && !Number.isNaN(minutes),
|
||||
`Expected hours and minutes to be numbers, but got hours: ${hours}, minutes: ${minutes}`,
|
||||
);
|
||||
formattedValue = `${hours}:${String(minutes).padStart(2, '0')}`;
|
||||
@@ -109,7 +108,7 @@ const formatCalculatedRecordValue = (
|
||||
// "49:30" -> en:"49 hours 30 minutes", ja: "49時間30分"
|
||||
const [hours, minutes] = value.split(':').map((v) => Number(v));
|
||||
invariant(
|
||||
!isNaN(hours) && !isNaN(minutes),
|
||||
!Number.isNaN(hours) && !Number.isNaN(minutes),
|
||||
`Expected hours and minutes to be numbers, but got hours: ${hours}, minutes: ${minutes}`,
|
||||
);
|
||||
formattedValue = language === 'ja' ? `${hours}時間${minutes}分` : `${hours} hours ${minutes} minutes`;
|
||||
@@ -117,7 +116,7 @@ const formatCalculatedRecordValue = (
|
||||
// "49:30" -> en: "2 days 1 hour 30 minutes", ja: "2日1時間30分
|
||||
const [hours, minutes] = value.split(':').map((v) => Number(v));
|
||||
invariant(
|
||||
!isNaN(hours) && !isNaN(minutes),
|
||||
!Number.isNaN(hours) && !Number.isNaN(minutes),
|
||||
`Expected hours and minutes to be numbers, but got hours: ${hours}, minutes: ${minutes}`,
|
||||
);
|
||||
const days = Math.floor(Number(hours) / 24);
|
||||
@@ -140,6 +139,7 @@ const record2data = (
|
||||
): TemplateData => {
|
||||
const data: TemplateData = {};
|
||||
for (const key in record) {
|
||||
// biome-ignore lint/suspicious/noPrototypeBuiltins: avoid prototype pollution
|
||||
if (Object.prototype.hasOwnProperty.call(record, key) && Object.prototype.hasOwnProperty.call(properties, key)) {
|
||||
const item = record[key];
|
||||
const property = properties[key];
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import invariant from 'tiny-invariant';
|
||||
import DesktopApp from './DesktopApp';
|
||||
|
@@ -19,7 +19,8 @@
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": ["src/**/*", "./node_modules/@kintone/dts-gen/kintone.d.ts"],
|
||||
"files": ["./node_modules/@kintone/dts-gen/kintone.d.ts"],
|
||||
"include": ["src/**/*"],
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS"
|
||||
|
Reference in New Issue
Block a user