diff --git a/apps/directory/src/routes/Error.jsx b/apps/directory/src/routes/Error.jsx index 232f413..8149042 100644 --- a/apps/directory/src/routes/Error.jsx +++ b/apps/directory/src/routes/Error.jsx @@ -9,7 +9,7 @@ import ReturnButton from '@/component/return_button' import { Typewriter } from 'react-simple-typewriter' import { useHeader } from '@/state/header' import VoiceElement from '@/component/voice' -import { spine } from '@aklive2d/module' +import { Player as SpinePlayer } from '@aklive2d/module' import useInsight from '@/state/insight' import buildConfig from '!/config.json' @@ -91,7 +91,7 @@ export default function Error() { useEffect(() => { if (spineRef.current?.children.length === 0) { setSpinePlayer( - new spine.SpinePlayer(spineRef.current, { + new SpinePlayer(spineRef.current, { skelUrl: `./_assets/${filename}.skel`, atlasUrl: `./_assets/${filename}.atlas`, animation: 'Relax', diff --git a/apps/directory/src/routes/path/Operator.jsx b/apps/directory/src/routes/path/Operator.jsx index 577be01..746e905 100644 --- a/apps/directory/src/routes/path/Operator.jsx +++ b/apps/directory/src/routes/path/Operator.jsx @@ -7,7 +7,7 @@ import { useHeader } from '@/state/header' import { useAppbar } from '@/state/appbar' import VoiceElement from '@/component/voice' import useInsight from '@/state/insight' -import { spine } from '@aklive2d/module' +import { Player as SpinePlayer } from '@aklive2d/module' import Border from '@/component/border' import { useI18n } from '@/state/language' import Switch from '@/component/switch' @@ -212,9 +212,7 @@ export default function Operator() { } else { playerConfig.skelUrl = `./${key}/assets/${configRef.current.filename.replace(/#/g, '%23')}.skel` } - setSpinePlayer( - new spine.SpinePlayer(spineRef.current, playerConfig) - ) + setSpinePlayer(new SpinePlayer(spineRef.current, playerConfig)) } }, [spineAnimationName, setSpinePlayer, spinePlayer, key]) diff --git a/apps/module/.prettierignore b/apps/module/.prettierignore new file mode 100644 index 0000000..cb88359 --- /dev/null +++ b/apps/module/.prettierignore @@ -0,0 +1,3 @@ +dist +data +auto_update \ No newline at end of file diff --git a/apps/module/eslint.config.js b/apps/module/eslint.config.js new file mode 100644 index 0000000..f9ddfd9 --- /dev/null +++ b/apps/module/eslint.config.js @@ -0,0 +1,30 @@ +import eslint from '@eslint/js' +import tseslint from 'typescript-eslint' +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' +import globals from 'globals' + +/** @type {import('eslint').Config} */ +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.recommended, + eslintPluginPrettierRecommended, + { + ignores: ['dist', 'spine-ts'], + }, + { + files: ['**/*.{js,jsx}', '**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2022, + globals: { + ...globals.browser, + }, + }, + rules: { + 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_' }, + ], + }, + } +) diff --git a/apps/module/index.ts b/apps/module/index.ts index 33c91d3..0e6a69e 100644 --- a/apps/module/index.ts +++ b/apps/module/index.ts @@ -1,3 +1,3 @@ import { Player } from './src/player.ts' -export { Player } \ No newline at end of file +export { Player } diff --git a/apps/module/package.json b/apps/module/package.json index f23b0a3..6e1e477 100644 --- a/apps/module/package.json +++ b/apps/module/package.json @@ -1,12 +1,18 @@ { - "name": "@aklive2d/module", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "build": "tsc" - }, - "devDependencies": { - "typescript": "~5.7.3" - } + "name": "@aklive2d/module", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "lint": "eslint && prettier --check ." + }, + "devDependencies": { + "@aklive2d/postcss-config": "workspace:*", + "@aklive2d/prettier-config": "workspace:*", + "@aklive2d/stylelint-config": "workspace:*", + "eslint-plugin-prettier": "^5.2.6", + "globals": "^16.0.0", + "typescript": "^5.8.3", + "typescript-eslint": "^8.31.1" + } } diff --git a/apps/module/postcss.config.js b/apps/module/postcss.config.js new file mode 100644 index 0000000..daf0049 --- /dev/null +++ b/apps/module/postcss.config.js @@ -0,0 +1,5 @@ +import baseConfig from '@aklive2d/postcss-config' +/** @type {import('postcss').Config} */ +export default { + ...baseConfig, +} diff --git a/apps/module/prettier.config.js b/apps/module/prettier.config.js new file mode 100644 index 0000000..a58af8e --- /dev/null +++ b/apps/module/prettier.config.js @@ -0,0 +1,11 @@ +import baseConfig from '@aklive2d/prettier-config' + +/** + * @type {import("prettier").Config} + */ +const config = { + ...baseConfig, + semi: false, +} + +export default config diff --git a/apps/module/src/player.ts b/apps/module/src/player.ts index a684f34..ad3420c 100644 --- a/apps/module/src/player.ts +++ b/apps/module/src/player.ts @@ -25,9 +25,9 @@ export interface PlayerConfig { atlasUrl: string /* Raw data URIs, mapping from a path to base 64 encoded raw data. When the player - resolves a path of the `jsonUrl`, `skelUrl`, `atlasUrl`, or the image paths - referenced in the atlas, it will first look for that path in this array of - raw data URIs. This allows embedding of resources directly in HTML/JS. */ + resolves a path of the `jsonUrl`, `skelUrl`, `atlasUrl`, or the image paths + referenced in the atlas, it will first look for that path in this array of + raw data URIs. This allows embedding of resources directly in HTML/JS. */ rawDataURIs: spine.Map | undefined fps: number @@ -73,10 +73,10 @@ export interface PlayerConfig { backgroundColor: string /* Optional: callback when the widget and its assets have been successfully loaded. */ - success: (widget: Player) => void + success: (_widget: Player) => void /* Optional: callback when the widget could not be loaded. */ - error: (widget: Player, msg: string) => void + error: (_widget: Player, _msg: string) => void } export class Player { @@ -117,7 +117,7 @@ export class Player { private eventListeners: { target: HTMLElement | Document | Window event: keyof HTMLElementEventMap - func: (this: HTMLElement, ev: Event) => any + func: EventListenerOrEventListenerObject }[] = [] constructor(parent: HTMLElement | string, config: Partial) { @@ -227,14 +227,14 @@ export class Player { } private showError(error: string) { - let errorDom = findWithClass(this.dom, 'spine-player-error')[0] + const errorDom = findWithClass(this.dom, 'spine-player-error')[0] errorDom.classList.remove('spine-player-hidden') errorDom.innerHTML = `

${error}

` this.config.error(this, error) } private render(config: Partial): HTMLElement { - let dom = (this.dom = createElement(` + const dom = (this.dom = createElement(`
@@ -244,8 +244,8 @@ export class Player { try { // Validate the configuration this.config = this.validateConfig(config) - } catch (e: any) { - this.showError(e) + } catch (e: unknown) { + this.showError(e as string) return dom } @@ -255,7 +255,7 @@ export class Player { dom, 'spine-player-canvas' )[0] as HTMLCanvasElement - var webglConfig = { alpha: this.config.alpha } + const webglConfig = { alpha: this.config.alpha } this.context = new spine.webgl.ManagedWebGLRenderingContext( this.canvas, webglConfig @@ -266,7 +266,7 @@ export class Player { this.context, true ) - } catch (e) { + } catch { this.showError( 'Sorry, your browser does not support WebGL.

Please use the latest version of Firefox, Chrome, Edge, or Safari.' ) @@ -276,8 +276,8 @@ export class Player { // Load the assets this.assetManager = new spine.webgl.AssetManager(this.context) if (this.config.rawDataURIs) { - for (let path in this.config.rawDataURIs) { - let data = this.config.rawDataURIs[path] + for (const path in this.config.rawDataURIs) { + const data = this.config.rawDataURIs[path] this.assetManager.setRawDataURI(path, data) } } @@ -305,17 +305,18 @@ export class Player { this.canvas.height = Math.floor(h * this.devicePixelRatio) } this.context.gl.viewport(0, 0, this.canvas.width, this.canvas.height) + // eslint-disable-next-line if (resizeMode === spine.webgl.ResizeMode.Stretch) { } else if (resizeMode === spine.webgl.ResizeMode.Expand) { this.sceneRenderer.camera.setViewport(w, h) } else if (resizeMode === spine.webgl.ResizeMode.Fit) { - var sourceWidth = this.canvas.width, + const sourceWidth = this.canvas.width, sourceHeight = this.canvas.height - var targetWidth = this.sceneRenderer.camera.viewportWidth, + const targetWidth = this.sceneRenderer.camera.viewportWidth, targetHeight = this.sceneRenderer.camera.viewportHeight - var targetRatio = targetHeight / targetWidth - var sourceRatio = sourceHeight / sourceWidth - var scale = + const targetRatio = targetHeight / targetWidth + const sourceRatio = sourceHeight / sourceWidth + const scale = targetRatio < sourceRatio ? targetWidth / sourceWidth : targetHeight / sourceHeight @@ -347,11 +348,11 @@ export class Player { this.config.animation && now - this.lastFrameTime > fpsInterval ) { - let ctx = this.context - let gl = ctx.gl + const ctx = this.context + const gl = ctx.gl // Clear the viewport - let bg = new spine.Color().setFromString( + const bg = new spine.Color().setFromString( this.config.backgroundColor ) gl.clearColor(bg.r, bg.g, bg.b, bg.a) @@ -359,9 +360,9 @@ export class Player { this.lastFrameTime = now this.time.update() - let delta = this.time.delta * this.speed + const delta = this.time.delta * this.speed - let animationDuration = + const animationDuration = this.animationState.getCurrent(0).animation.duration this.playTime += delta while ( @@ -398,12 +399,12 @@ export class Player { (this.currentViewport.padTop as number), } - let transitionAlpha = + const transitionAlpha = (performance.now() - this.viewportTransitionStart) / 1000 / this.config.viewport.transitionTime if (this.previousViewport && transitionAlpha < 1) { - let oldViewport = { + const oldViewport = { x: this.previousViewport.x - (this.previousViewport.padLeft as number), @@ -437,7 +438,7 @@ export class Player { } } - let viewportSize = this.scaleViewport( + const viewportSize = this.scaleViewport( viewport.width, viewport.height, this.canvas.width, @@ -472,13 +473,13 @@ export class Player { targetWidth: number, targetHeight: number ): spine.Vector2 { - let targetRatio = targetHeight / targetWidth - let sourceRatio = sourceHeight / sourceWidth - let scale = + const targetRatio = targetHeight / targetWidth + const sourceRatio = sourceHeight / sourceWidth + const scale = targetRatio > sourceRatio ? targetWidth / sourceWidth : targetHeight / sourceHeight - let temp = new spine.Vector2() + const temp = new spine.Vector2() temp.x = sourceWidth * scale temp.y = sourceHeight * scale return temp @@ -495,39 +496,39 @@ export class Player { return } - let atlas = this.assetManager.get(this.config.atlasUrl) + const atlas = this.assetManager.get(this.config.atlasUrl) let skeletonData: spine.SkeletonData if (this.config.jsonUrl) { - let jsonText = this.assetManager.get(this.config.jsonUrl) - let json = new spine.SkeletonJson( + const jsonText = this.assetManager.get(this.config.jsonUrl) + const json = new spine.SkeletonJson( new spine.AtlasAttachmentLoader(atlas) ) try { skeletonData = json.readSkeletonData(jsonText) - } catch (e: any) { + } catch (e: unknown) { this.showError( 'Error: could not load skeleton .json.

' + - e.toString() + (e as Error).toString() ) return } } else { - let binaryData = this.assetManager.get(this.config.skelUrl!) - let binary = new spine.SkeletonBinary( + const binaryData = this.assetManager.get(this.config.skelUrl!) + const binary = new spine.SkeletonBinary( new spine.AtlasAttachmentLoader(atlas) ) try { skeletonData = binary.readSkeletonData(binaryData) - } catch (e: any) { + } catch (e: unknown) { this.showError( 'Error: could not load skeleton .skel.

' + - e.toString() + (e as Error).toString() ) return } } this.skeleton = new spine.Skeleton(skeletonData) - let stateData = new spine.AnimationStateData(skeletonData) + const stateData = new spine.AnimationStateData(skeletonData) stateData.defaultMix = this.config.defaultMix this.animationState = new spine.AnimationState(stateData) @@ -568,7 +569,7 @@ export class Player { // if all animations for which viewports where given // exist. if (!this.config.viewport) { - ;(this.config.viewport as any) = { + ;(this.config.viewport as unknown) = { animations: {}, transitionTime: 0.2, } @@ -645,10 +646,10 @@ export class Player { public setAnimation(animation: string, loop: boolean = true) { // Determine viewport this.previousViewport = this.currentViewport - let animViewport = this.calculateAnimationViewport(animation) + const animViewport = this.calculateAnimationViewport(animation) // The calculated animation viewport is the base - let viewport: Viewport = { + const viewport: Viewport = { x: animViewport.x, y: animViewport.y, width: animViewport.width, @@ -660,7 +661,7 @@ export class Player { } // Override with global viewport settings if they exist - let globalViewport = this.config.viewport + const globalViewport = this.config.viewport if ( typeof globalViewport.x !== 'undefined' && typeof globalViewport.y !== 'undefined' && @@ -682,7 +683,7 @@ export class Player { viewport.padBottom = globalViewport.padBottom // Override with animation viewport settings given by user for final result. - let userAnimViewport = this.config.viewport.animations[animation] + const userAnimViewport = this.config.viewport.animations[animation] if (userAnimViewport) { if ( typeof userAnimViewport.x !== 'undefined' && @@ -753,21 +754,21 @@ export class Player { } private calculateAnimationViewport(animationName: string) { - let animation = this.skeleton.data.findAnimation(animationName) + const animation = this.skeleton.data.findAnimation(animationName) this.animationState.clearTracks() this.skeleton.setToSetupPose() this.animationState.setAnimationWith(0, animation, true) - let steps = 100 - let stepTime = animation.duration > 0 ? animation.duration / steps : 0 + const steps = 100 + const stepTime = animation.duration > 0 ? animation.duration / steps : 0 let minX = 100000000 let maxX = -100000000 let minY = 100000000 let maxY = -100000000 - let offset = new spine.Vector2() - let size = new spine.Vector2() + const offset = new spine.Vector2() + const size = new spine.Vector2() - for (var i = 0; i < steps; i++) { + for (let i = 0; i < steps; i++) { this.animationState.update(stepTime) this.animationState.apply(this.skeleton) this.skeleton.updateWorldTransform() @@ -804,7 +805,7 @@ export class Player { private addEventListener( target: HTMLElement | Document | Window, event: keyof HTMLElementEventMap, - func: (this: HTMLElement, ev: Event) => any + func: EventListenerOrEventListenerObject ) { this.eventListeners.push({ target: target, event: event, func: func }) target.addEventListener(event, func) @@ -813,8 +814,8 @@ export class Player { public dispose() { this.sceneRenderer.dispose() this.assetManager.dispose() - for (var i = 0; i < this.eventListeners.length; i++) { - var eventListener = this.eventListeners[i] + for (let i = 0; i < this.eventListeners.length; i++) { + const eventListener = this.eventListeners[i] eventListener.target.removeEventListener( eventListener.event, eventListener.func @@ -824,7 +825,7 @@ export class Player { } public updateViewport(viewport: Viewport) { - var _currentViewport = this.currentViewport + const _currentViewport = this.currentViewport _currentViewport.padLeft = this.percentageToWorldUnit( _currentViewport.width, viewport.padLeft @@ -854,14 +855,14 @@ export class Player { } const findWithClass = (dom: HTMLElement, className: string): HTMLElement[] => { - let found = new Array() - let findRecursive = ( + const found = new Array() + const findRecursive = ( dom: HTMLElement, className: string, found: HTMLElement[] ) => { - for (var i = 0; i < dom.children.length; i++) { - let child = dom.children[i] as HTMLElement + for (let i = 0; i < dom.children.length; i++) { + const child = dom.children[i] as HTMLElement if (child.classList.contains(className)) found.push(child) findRecursive(child, className, found) } @@ -871,7 +872,7 @@ const findWithClass = (dom: HTMLElement, className: string): HTMLElement[] => { } const createElement = (html: string): HTMLElement => { - let dom = document.createElement('div') + const dom = document.createElement('div') dom.innerHTML = html return dom.children[0] as HTMLElement } diff --git a/apps/module/stylelint.config.js b/apps/module/stylelint.config.js new file mode 100644 index 0000000..d3c74a2 --- /dev/null +++ b/apps/module/stylelint.config.js @@ -0,0 +1,5 @@ +import baseConfig from '@aklive2d/stylelint-config' +/** @type {import('stylelint').Config} */ +export default { + ...baseConfig, +} diff --git a/apps/module/tsconfig.json b/apps/module/tsconfig.json index 92f8583..572b401 100644 --- a/apps/module/tsconfig.json +++ b/apps/module/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2024", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": ["ES2024", "DOM", "DOM.Iterable"], "skipLibCheck": true, /* Bundler mode */ @@ -20,5 +20,6 @@ "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, - "include": ["src"] + "include": ["**/*"], + "exclude": ["spine-ts/**/*"] } diff --git a/bun.lock b/bun.lock index 86dfec2..e6f72a8 100644 --- a/bun.lock +++ b/bun.lock @@ -50,6 +50,15 @@ "apps/module": { "name": "@aklive2d/module", "version": "0.0.0", + "devDependencies": { + "@aklive2d/postcss-config": "workspace:*", + "@aklive2d/prettier-config": "workspace:*", + "@aklive2d/stylelint-config": "workspace:*", + "eslint-plugin-prettier": "^5.2.6", + "globals": "^16.0.0", + "typescript": "^5.8.3", + "typescript-eslint": "^8.31.1", + }, }, "apps/showcase": { "name": "@aklive2d/showcase", @@ -596,6 +605,22 @@ "@types/react-dom": ["@types/react-dom@19.1.3", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-rJXC08OG0h3W6wDMFxQrZF00Kq6qQvw0djHRdzl3U5DnIERz0MRce3WVc7IS6JYBwtaP/DwYtRRjVlvivNveKg=="], + "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.31.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.31.1", "@typescript-eslint/type-utils": "8.31.1", "@typescript-eslint/utils": "8.31.1", "@typescript-eslint/visitor-keys": "8.31.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", "ts-api-utils": "^2.0.1" }, "peerDependencies": { "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-oUlH4h1ABavI4F0Xnl8/fOtML/eu8nI2A1nYd+f+55XI0BLu+RIqKoCiZKNo6DtqZBEQm5aNKA20G3Z5w3R6GQ=="], + + "@typescript-eslint/parser": ["@typescript-eslint/parser@8.31.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.31.1", "@typescript-eslint/types": "8.31.1", "@typescript-eslint/typescript-estree": "8.31.1", "@typescript-eslint/visitor-keys": "8.31.1", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q=="], + + "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.31.1", "", { "dependencies": { "@typescript-eslint/types": "8.31.1", "@typescript-eslint/visitor-keys": "8.31.1" } }, "sha512-BMNLOElPxrtNQMIsFHE+3P0Yf1z0dJqV9zLdDxN/xLlWMlXK/ApEsVEKzpizg9oal8bAT5Sc7+ocal7AC1HCVw=="], + + "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.31.1", "", { "dependencies": { "@typescript-eslint/typescript-estree": "8.31.1", "@typescript-eslint/utils": "8.31.1", "debug": "^4.3.4", "ts-api-utils": "^2.0.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-fNaT/m9n0+dpSp8G/iOQ05GoHYXbxw81x+yvr7TArTuZuCA6VVKbqWYVZrV5dVagpDTtj/O8k5HBEE/p/HM5LA=="], + + "@typescript-eslint/types": ["@typescript-eslint/types@8.31.1", "", {}, "sha512-SfepaEFUDQYRoA70DD9GtytljBePSj17qPxFHA/h3eg6lPTqGJ5mWOtbXCk1YrVU1cTJRd14nhaXWFu0l2troQ=="], + + "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.31.1", "", { "dependencies": { "@typescript-eslint/types": "8.31.1", "@typescript-eslint/visitor-keys": "8.31.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.0.1" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-kaA0ueLe2v7KunYOyWYtlf/QhhZb7+qh4Yw6Ni5kgukMIG+iP773tjgBiLWIXYumWCwEq3nLW+TUywEp8uEeag=="], + + "@typescript-eslint/utils": ["@typescript-eslint/utils@8.31.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@typescript-eslint/scope-manager": "8.31.1", "@typescript-eslint/types": "8.31.1", "@typescript-eslint/typescript-estree": "8.31.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-2DSI4SNfF5T4oRveQ4nUrSjUqjMND0nLq9rEkz0gfGr3tg0S5KB6DhwR+WZPCjzkZl3cH+4x2ce3EsL50FubjQ=="], + + "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.31.1", "", { "dependencies": { "@typescript-eslint/types": "8.31.1", "eslint-visitor-keys": "^4.2.0" } }, "sha512-I+/rgqOVBn6f0o7NDTmAPWWC6NuqhV174lfYvAm9fUaWeiefLdux9/YI3/nLugEn9L8fcSi0XmpKi/r5u0nmpw=="], + "@vitejs/plugin-react-swc": ["@vitejs/plugin-react-swc@3.9.0", "", { "dependencies": { "@swc/core": "^1.11.21" }, "peerDependencies": { "vite": "^4 || ^5 || ^6" } }, "sha512-jYFUSXhwMCYsh/aQTgSGLIN3Foz5wMbH9ahb0Zva//UzwZYbMiZd7oT3AU9jHT9DLswYDswsRwPU9jVF3yA48Q=="], "acorn": ["acorn@8.14.1", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg=="], @@ -906,6 +931,8 @@ "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "graphemer": ["graphemer@1.4.0", "", {}, "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="], + "has-bigints": ["has-bigints@1.1.0", "", {}, "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg=="], "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], @@ -1384,6 +1411,8 @@ "tr46": ["tr46@5.1.1", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw=="], + "ts-api-utils": ["ts-api-utils@2.1.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ=="], + "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], "turbo": ["turbo@2.5.2", "", { "optionalDependencies": { "turbo-darwin-64": "2.5.2", "turbo-darwin-arm64": "2.5.2", "turbo-linux-64": "2.5.2", "turbo-linux-arm64": "2.5.2", "turbo-windows-64": "2.5.2", "turbo-windows-arm64": "2.5.2" }, "bin": { "turbo": "bin/turbo" } }, "sha512-Qo5lfuStr6LQh3sPQl7kIi243bGU4aHGDQJUf6ylAdGwks30jJFloc9NYHP7Y373+gGU9OS0faA4Mb5Sy8X9Xw=="], @@ -1416,6 +1445,8 @@ "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], + "typescript-eslint": ["typescript-eslint@8.31.1", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "@typescript-eslint/utils": "8.31.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-j6DsEotD/fH39qKzXTQRwYYWlt7D+0HmfpOK+DVhwJOFLcdmn92hq3mBb7HlKJHbjjI/gTOqEcc9d6JfpFf/VA=="], + "unbox-primitive": ["unbox-primitive@1.1.0", "", { "dependencies": { "call-bound": "^1.0.3", "has-bigints": "^1.0.2", "has-symbols": "^1.1.0", "which-boxed-primitive": "^1.1.1" } }, "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw=="], "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], @@ -1478,6 +1509,8 @@ "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], + "@aklive2d/module/globals": ["globals@16.0.0", "", {}, "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A=="], + "@commitlint/config-validator/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], "@commitlint/load/chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="], @@ -1494,6 +1527,8 @@ "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], + "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], + "ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], "brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], @@ -1562,6 +1597,8 @@ "@commitlint/config-validator/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], + "ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], "eslint/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -1590,6 +1627,8 @@ "table/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "resolve-dir/global-modules/global-prefix/which": ["which@1.3.1", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "which": "./bin/which" } }, "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ=="], } } diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index b8ae866..aaa9c98 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,23 +1,26 @@ import js from '@eslint/js' -import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' import globals from 'globals' export default [ - { ignores: ['dist'] }, - { - files: ['**/*.{js,jsx}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - parserOptions: { - ecmaVersion: 'latest', - ecmaFeatures: { jsx: true }, - sourceType: 'module', - }, + { ignores: ['dist'] }, + { + files: ['**/*.{js,jsx}', '**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: { + ...globals.browser, + ...globals.node, + }, + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { jsx: true }, + sourceType: 'module', + }, + }, + rules: { + ...js.configs.recommended.rules, + }, }, - rules: { - ...js.configs.recommended.rules, - }, - }, - eslintPluginPrettierRecommended, -] \ No newline at end of file + eslintPluginPrettierRecommended, +]