From 2fc82694423151c161d004ff335eb3b221bb90a7 Mon Sep 17 00:00:00 2001 From: Minhyeok Park Date: Thu, 16 Jan 2025 09:28:24 +0900 Subject: [PATCH] chore: remove trailing comma --- .prettierrc | 3 ++- eslint.config.js | 12 ++++++------ src/Editor/index.tsx | 4 ++-- src/GlobalStates/EditorValueState.ts | 6 +++--- src/LandingAnimation/index.tsx | 2 +- src/TransformGridItem/index.tsx | 18 +++++++++--------- src/Transforms/Base64Transforms.ts | 4 ++-- src/Transforms/DatetimeTransforms.ts | 10 +++++----- src/Transforms/GzipCompressTransform.ts | 6 +++--- src/Transforms/GzipTransform.ts | 2 +- src/Transforms/JSONTransforms.ts | 20 ++++++++++---------- src/Transforms/RegexpTransform.ts | 2 +- src/Transforms/Transform.ts | 12 ++++++------ src/Transforms/URITransforms.ts | 12 ++++++------ src/Transforms/YAMLTransforms.ts | 4 ++-- src/main.tsx | 2 +- vite.config.ts | 8 ++++---- 17 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.prettierrc b/.prettierrc index e1076ed..6449b38 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,5 +2,6 @@ "semi": false, "singleQuote": true, "tabWidth": 2, - "useTabs": false + "useTabs": false, + "trailingComma": "none" } diff --git a/eslint.config.js b/eslint.config.js index 48c3162..979e43b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -13,20 +13,20 @@ export default tseslint.config( files: ['**/*.{ts,tsx}'], languageOptions: { ecmaVersion: 2020, - globals: globals.browser, + globals: globals.browser }, plugins: { 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, + 'react-refresh': reactRefresh }, rules: { ...reactHooks.configs.recommended.rules, 'react-refresh/only-export-components': [ 'warn', - { allowConstantExport: true }, - ], - }, + { allowConstantExport: true } + ] + } }, eslintConfigPrettier, - eslintPluginPrettierRecommended, + eslintPluginPrettierRecommended ) diff --git a/src/Editor/index.tsx b/src/Editor/index.tsx index 62a3574..2a5ee5e 100644 --- a/src/Editor/index.tsx +++ b/src/Editor/index.tsx @@ -21,7 +21,7 @@ export const Editor: FC = () => { const rect = containerRef.current?.getBoundingClientRect() ref.current?.layout({ width: rect?.width ?? 0, - height: rect?.height ?? 0, + height: rect?.height ?? 0 }) }) }) @@ -54,7 +54,7 @@ export const Editor: FC = () => { smoothScrolling: true, cursorSmoothCaretAnimation: 'on', cursorBlinking: 'smooth', - cursorStyle: 'line', + cursorStyle: 'line' }} theme="vs-dark" /> diff --git a/src/GlobalStates/EditorValueState.ts b/src/GlobalStates/EditorValueState.ts index 4127f5f..c030ec1 100644 --- a/src/GlobalStates/EditorValueState.ts +++ b/src/GlobalStates/EditorValueState.ts @@ -4,9 +4,9 @@ export const EditorValueState = atom({ key: 'editor_value', default: JSON.stringify( { - Hello: 'world!', + Hello: 'world!' }, null, - 2, - ), + 2 + ) }) diff --git a/src/LandingAnimation/index.tsx b/src/LandingAnimation/index.tsx index ad312eb..45a7cff 100644 --- a/src/LandingAnimation/index.tsx +++ b/src/LandingAnimation/index.tsx @@ -7,7 +7,7 @@ import Suika from '../Assets/favicon.webp' export const LandingAnimation: FC = () => { const [isVisible, setVisible] = useState(true) const exitAnimation: TargetAndTransition = { - opacity: 0, + opacity: 0 } useEffect(() => { diff --git a/src/TransformGridItem/index.tsx b/src/TransformGridItem/index.tsx index 6f4c42c..026d933 100644 --- a/src/TransformGridItem/index.tsx +++ b/src/TransformGridItem/index.tsx @@ -14,7 +14,7 @@ import { TransformRadioOption, TransformTextboxOption, WrappedTransform, - WrappedTransformResult, + WrappedTransformResult } from '../Transforms/Transform' import { useLocalStorage } from '@uidotdev/usehooks' import { AnimatePresence, motion } from 'framer-motion' @@ -30,11 +30,11 @@ export const TransformGridItem: FC = ({ transform }) => { const [options, setOptions] = useState(transform.options) const [closedToggle, setClosedToggle] = useLocalStorage( `transform_closed__${transform.name}`, - false, + false ) const [result, setResult] = useState({ error: false, - value: '', + value: '' }) const previewDisabled = value.length > 30000 @@ -68,7 +68,7 @@ export const TransformGridItem: FC = ({ transform }) => { setResult({ error: false, - value: '', + value: '' }) }, [options, previewDisabled]) @@ -77,7 +77,7 @@ export const TransformGridItem: FC = ({ transform }) => { if (previewDisabled) { setResult({ error: false, - value: '', + value: '' }) return } @@ -93,7 +93,7 @@ export const TransformGridItem: FC = ({ transform }) => { (event: ChangeEvent) => { options.set(option.key, { ...option, - value: event.target.checked, + value: event.target.checked }) setOptions(new Map(options)) @@ -104,7 +104,7 @@ export const TransformGridItem: FC = ({ transform }) => { (event: ChangeEvent) => { options.set(option.key, { ...option, - value: event.target.value, + value: event.target.value }) setOptions(new Map(options)) @@ -115,7 +115,7 @@ export const TransformGridItem: FC = ({ transform }) => { (event: ChangeEvent) => { options.set(option.key, { ...option, - value: parseInt(event.target.value), + value: parseInt(event.target.value) }) setOptions(new Map(options)) @@ -126,7 +126,7 @@ export const TransformGridItem: FC = ({ transform }) => { (event: ChangeEvent) => { options.set(option.key, { ...option, - value: event.target.value, + value: event.target.value }) setOptions(new Map(options)) diff --git a/src/Transforms/Base64Transforms.ts b/src/Transforms/Base64Transforms.ts index e71ca46..a47e1b6 100644 --- a/src/Transforms/Base64Transforms.ts +++ b/src/Transforms/Base64Transforms.ts @@ -2,10 +2,10 @@ import { Transform } from './Transform' export const Base64DecodeTransform: Transform = { name: 'base64d', - fn: async (v) => atob(v), + fn: async (v) => atob(v) } export const Base64EncodeTransform: Transform = { name: 'base64e', - fn: async (v) => btoa(v), + fn: async (v) => btoa(v) } diff --git a/src/Transforms/DatetimeTransforms.ts b/src/Transforms/DatetimeTransforms.ts index fa56169..2038dd5 100644 --- a/src/Transforms/DatetimeTransforms.ts +++ b/src/Transforms/DatetimeTransforms.ts @@ -28,8 +28,8 @@ export const DatetimeTransform: Transform = { hour: date.getHours(), minute: date.getMinutes(), second: date.getSeconds(), - milli: date.getMilliseconds(), - }), + milli: date.getMilliseconds() + }) ) .join('\n') @@ -41,7 +41,7 @@ export const DatetimeTransform: Transform = { type: 'RADIO', key: 'f', value: 'c', - radios: [{ value: 'c' }, { value: 'java' }], - }, - ], + radios: [{ value: 'c' }, { value: 'java' }] + } + ] } diff --git a/src/Transforms/GzipCompressTransform.ts b/src/Transforms/GzipCompressTransform.ts index 48ec112..4220599 100644 --- a/src/Transforms/GzipCompressTransform.ts +++ b/src/Transforms/GzipCompressTransform.ts @@ -10,7 +10,7 @@ const compressGzip = async (input: string): Promise => { // Check if CompressionStream is supported if (typeof CompressionStream === 'undefined') { throw new Error( - 'CompressionStream API is not supported in this environment.', + 'CompressionStream API is not supported in this environment.' ) } @@ -23,7 +23,7 @@ const compressGzip = async (input: string): Promise => { start(controller) { controller.enqueue(encoded) controller.close() - }, + } }) // Create a CompressionStream for Gzip @@ -78,5 +78,5 @@ export const GzipCompressTransform: Transform = { fn: (v: string) => compressGzip(v), - options: [], // Add any options if needed + options: [] // Add any options if needed } diff --git a/src/Transforms/GzipTransform.ts b/src/Transforms/GzipTransform.ts index 58cd6c0..6842bed 100644 --- a/src/Transforms/GzipTransform.ts +++ b/src/Transforms/GzipTransform.ts @@ -17,5 +17,5 @@ const decompressGzip = async (base64: string) => { export const GzipDecompressTransform: Transform = { name: 'gzipd', - fn: (v) => decompressGzip(v), + fn: (v) => decompressGzip(v) } diff --git a/src/Transforms/JSONTransforms.ts b/src/Transforms/JSONTransforms.ts index fde83ac..8912a22 100644 --- a/src/Transforms/JSONTransforms.ts +++ b/src/Transforms/JSONTransforms.ts @@ -9,7 +9,7 @@ export const JSONBeautifyTransform: Transform = { ? JSON.stringify( JSON5.parse(v), null, - (o.get('tab')?.value as number) ?? 2, + (o.get('tab')?.value as number) ?? 2 ) : v .split('\n') @@ -17,34 +17,34 @@ export const JSONBeautifyTransform: Transform = { JSON.stringify( JSON5.parse(v2), null, - (o.get('tab')?.value as number) ?? 2, - ), + (o.get('tab')?.value as number) ?? 2 + ) ) .join('\n'), options: [ { type: 'CHECKBOX', - key: 'multiline', + key: 'multiline' }, { type: 'INTBOX', key: 'tab', - value: 2, - }, - ], + value: 2 + } + ] } export const JSONSimplifyTransform: Transform = { name: 'jsonsmp', - fn: async (v) => JSON.stringify(JSON5.parse(v)), + fn: async (v) => JSON.stringify(JSON5.parse(v)) } export const JSONEscapeTransform: Transform = { name: 'jsonesc', - fn: async (v) => JSON.stringify(v), + fn: async (v) => JSON.stringify(v) } export const JSONUnescapeTransform: Transform = { @@ -56,5 +56,5 @@ export const JSONUnescapeTransform: Transform = { if (typeof result !== 'string') throw new Error('Not JSON escaped') return result - }, + } } diff --git a/src/Transforms/RegexpTransform.ts b/src/Transforms/RegexpTransform.ts index 7999205..bdce54a 100644 --- a/src/Transforms/RegexpTransform.ts +++ b/src/Transforms/RegexpTransform.ts @@ -12,5 +12,5 @@ export const RegexpTransform: Transform = { .join('\n') return [expression, samples, parsedSamples].join('\n\n') - }, + } } diff --git a/src/Transforms/Transform.ts b/src/Transforms/Transform.ts index f842b34..36f41b4 100644 --- a/src/Transforms/Transform.ts +++ b/src/Transforms/Transform.ts @@ -1,6 +1,6 @@ import { Base64DecodeTransform, - Base64EncodeTransform, + Base64EncodeTransform } from './Base64Transforms' import { DatetimeTransform } from './DatetimeTransforms' import { GzipCompressTransform } from './GzipCompressTransform' @@ -9,7 +9,7 @@ import { JSONBeautifyTransform, JSONEscapeTransform, JSONSimplifyTransform, - JSONUnescapeTransform, + JSONUnescapeTransform } from './JSONTransforms' import { RegexpTransform } from './RegexpTransform' import { URIDecodeTransform, URIEncodeTransform } from './URITransforms' @@ -69,7 +69,7 @@ export interface WrappedTransform extends Omit { fn: ( value: string, - options: Map, + options: Map ) => Promise options: Map @@ -85,9 +85,9 @@ export const wrapTransform = (transform: Transform): WrappedTransform => ({ .catch((error) => ({ error: true, value: error.toString() })), options: new Map( - (transform.options ?? []).map((v) => [v.key, v]), + (transform.options ?? []).map((v) => [v.key, v]) ), - wrapped: true, + wrapped: true }) export const transforms: Transform[] = [ @@ -104,5 +104,5 @@ export const transforms: Transform[] = [ JSON2YAMLTransform, YAML2JSONTransform, GzipCompressTransform, - GzipDecompressTransform, + GzipDecompressTransform ] diff --git a/src/Transforms/URITransforms.ts b/src/Transforms/URITransforms.ts index 1c67e9d..c1bdd8a 100644 --- a/src/Transforms/URITransforms.ts +++ b/src/Transforms/URITransforms.ts @@ -9,9 +9,9 @@ export const URIDecodeTransform: Transform = { options: [ { type: 'CHECKBOX', - key: 'cmp', - }, - ], + key: 'cmp' + } + ] } export const URIEncodeTransform: Transform = { @@ -23,7 +23,7 @@ export const URIEncodeTransform: Transform = { options: [ { type: 'CHECKBOX', - key: 'cmp', - }, - ], + key: 'cmp' + } + ] } diff --git a/src/Transforms/YAMLTransforms.ts b/src/Transforms/YAMLTransforms.ts index 91fec3d..2ce9881 100644 --- a/src/Transforms/YAMLTransforms.ts +++ b/src/Transforms/YAMLTransforms.ts @@ -5,11 +5,11 @@ import JSON5 from 'json5' export const YAML2JSONTransform: Transform = { name: 'yaml2json', - fn: async (v) => JSON.stringify(YAML.parse(v)), + fn: async (v) => JSON.stringify(YAML.parse(v)) } export const JSON2YAMLTransform: Transform = { name: 'json2yaml', - fn: async (v) => YAML.stringify(JSON5.parse(v)), + fn: async (v) => YAML.stringify(JSON5.parse(v)) } diff --git a/src/main.tsx b/src/main.tsx index 78d90d2..51831b8 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -19,5 +19,5 @@ createRoot(document.getElementById('root')!).render( - , + ) diff --git a/vite.config.ts b/vite.config.ts index bc0991f..bd82888 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,8 +7,8 @@ export default defineConfig({ css: { preprocessorOptions: { scss: { - api: 'modern-compiler', // or "modern" - }, - }, - }, + api: 'modern-compiler' // or "modern" + } + } + } })