From aaebb2c2a693ab76bc31378b8550657b7dd79a34 Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 25 Jul 2024 13:10:48 -0400 Subject: [PATCH 01/14] remove tslint.json --- tslint.json | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tslint.json diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 2384a0c197..0000000000 --- a/tslint.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": ["tslint:recommended"], - "jsRules": {}, - "rules": { - "trailing-comma": [false], - "object-literal-sort-keys": false, - "arrow-parens": false, - "quotemark": ["single"], - "ordered-imports": [false], - "variable-name": false, - "object-literal-key-quotes": false, - "interface-name": false, - "member-ordering": false, - "no-namespace": false, - "no-unused-expression": [true, "allow-fast-null-checks"] - }, - "rulesDirectory": [], - "ignorePaths": ["examples/", "editor/"] -} From 472570fa3de8feecde66669d6937418f5ff618bd Mon Sep 17 00:00:00 2001 From: with-heart Date: Sat, 27 Jul 2024 22:50:27 -0400 Subject: [PATCH 02/14] install and configure eslint --- .gitignore | 3 + eslint.config.mjs | 67 ++++++++ package.json | 5 + yarn.lock | 423 ++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 487 insertions(+), 11 deletions(-) create mode 100644 eslint.config.mjs diff --git a/.gitignore b/.gitignore index 8032a311c2..119d250408 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# eslint +.eslintcache + # Logs logs *.log diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..2ef1b2ffcb --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,67 @@ +// @ts-check +import globals from 'globals'; +import js from '@eslint/js'; +import ts from 'typescript-eslint'; + +export default ts.config( + // plugins + js.configs.recommended, + ...ts.configs.recommended, + + // global ignore + { + ignores: [ + '{docs,examples,templates}/', + '**/dist', + '**/*.test.*', + 'scripts/jest-utils/' + ] + }, + + // global language and linter options + { + languageOptions: { + globals: { ...globals.browser, ...globals.node } + }, + linterOptions: { + reportUnusedDisableDirectives: 'error' + } + }, + + // global rules + { + rules: { + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + args: 'all', + argsIgnorePattern: '^_', + caughtErrors: 'all', + caughtErrorsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + varsIgnorePattern: '^_', + ignoreRestSiblings: true + } + ], + 'prefer-const': [ + 'error', + { + destructuring: 'all' + } + ] + } + }, + + // js-specific config and rules + { + files: ['**/*.{js,cjs}'], + languageOptions: { + sourceType: 'commonjs' + }, + rules: { + '@typescript-eslint/no-require-imports': 'off' + } + } +); diff --git a/package.json b/package.json index c26ca60d8c..213311b778 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "postinstall": "patch-package && manypkg check && preconstruct dev", "build": "preconstruct build", "fix": "manypkg fix", + "lint": "eslint --cache --quiet", "typecheck": "tsc", "test": "jest", "test:core": "jest packages/core", @@ -52,6 +53,7 @@ "@babel/preset-typescript": "^7.23.3", "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", + "@eslint/js": "^9.7.0", "@jest/types": "^29.6.3", "@manypkg/cli": "^0.16.1", "@manypkg/get-packages": "^1.1.3", @@ -63,6 +65,8 @@ "@vue/vue3-jest": "^29.2.6", "babel-jest": "^29.7.0", "babel-preset-solid": "^1.8.4", + "eslint": "^9.7.0", + "globals": "^15.8.0", "husky": "^3.1.0", "jest": "^29.7.0", "jest-config": "^29.7.0", @@ -78,6 +82,7 @@ "svelte-jester": "^2.3.2", "synckit": "^0.8.5", "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1", "vue": "^3.0.11" }, "husky": { diff --git a/yarn.lock b/yarn.lock index b7598e7cc9..df07fee9cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1279,6 +1279,62 @@ human-id "^1.0.2" prettier "^2.7.1" +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.11.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" + integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== + +"@eslint/config-array@^0.17.0": + version "0.17.1" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.1.tgz#d9b8b8b6b946f47388f32bedfd3adf29ca8f8910" + integrity sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA== + dependencies: + "@eslint/object-schema" "^2.1.4" + debug "^4.3.1" + minimatch "^3.1.2" + +"@eslint/eslintrc@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" + integrity sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^10.0.1" + globals "^14.0.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@9.7.0", "@eslint/js@^9.7.0": + version "9.7.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.7.0.tgz#b712d802582f02b11cfdf83a85040a296afec3f0" + integrity sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng== + +"@eslint/object-schema@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.4.tgz#9e69f8bb4031e11df79e03db09f9dbbae1740843" + integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ== + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/retry@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.0.tgz#6d86b8cb322660f03d3f0aa94b99bdd8e172d570" + integrity sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1696,7 +1752,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== -"@nodelib/fs.walk@1.2.8": +"@nodelib/fs.walk@1.2.8", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -2229,6 +2285,87 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.1.tgz#5dbd1b498fdea83a16d292322d27d293ce156f94" + integrity sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "8.0.1" + "@typescript-eslint/type-utils" "8.0.1" + "@typescript-eslint/utils" "8.0.1" + "@typescript-eslint/visitor-keys" "8.0.1" + graphemer "^1.4.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/parser@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.0.1.tgz#eb0728147a3a79edf43dde84c797f117213bbfdb" + integrity sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg== + dependencies: + "@typescript-eslint/scope-manager" "8.0.1" + "@typescript-eslint/types" "8.0.1" + "@typescript-eslint/typescript-estree" "8.0.1" + "@typescript-eslint/visitor-keys" "8.0.1" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.0.1.tgz#544259c29e1ebf65d30b6e99a9f420d98795a54e" + integrity sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ== + dependencies: + "@typescript-eslint/types" "8.0.1" + "@typescript-eslint/visitor-keys" "8.0.1" + +"@typescript-eslint/type-utils@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.0.1.tgz#a613ee2dfeed4a9781300b5d326ec7cf946eed92" + integrity sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng== + dependencies: + "@typescript-eslint/typescript-estree" "8.0.1" + "@typescript-eslint/utils" "8.0.1" + debug "^4.3.4" + ts-api-utils "^1.3.0" + +"@typescript-eslint/types@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.0.1.tgz#333e2f4c158952dbc8181a4ddcc6e49898a28918" + integrity sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw== + +"@typescript-eslint/typescript-estree@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.1.tgz#64575ec7b77aedfe497acdfb2779ec942bb8d866" + integrity sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w== + dependencies: + "@typescript-eslint/types" "8.0.1" + "@typescript-eslint/visitor-keys" "8.0.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/utils@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.0.1.tgz#b48e3320c4f9011f97d25e0588b8c143adc38d2a" + integrity sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "8.0.1" + "@typescript-eslint/types" "8.0.1" + "@typescript-eslint/typescript-estree" "8.0.1" + +"@typescript-eslint/visitor-keys@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.1.tgz#e5816803b4dad1de5e97f00df8dc15d0bcb49778" + integrity sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ== + dependencies: + "@typescript-eslint/types" "8.0.1" + eslint-visitor-keys "^3.4.3" + "@vue/compiler-core@3.0.11": version "3.0.11" resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.11.tgz#5ef579e46d7b336b8735228758d1c2c505aae69a" @@ -2347,6 +2484,11 @@ acorn-globals@^7.0.0: acorn "^8.1.0" acorn-walk "^8.0.2" +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn-walk@^8.0.2: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" @@ -2357,6 +2499,11 @@ acorn@^8.1.0, acorn@^8.8.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== +acorn@^8.12.0: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + acorn@^8.5.0: version "8.8.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" @@ -2385,7 +2532,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.12.3: +ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2787,6 +2934,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -3292,7 +3446,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -3423,7 +3577,7 @@ debug@^3.1.0: dependencies: ms "^2.1.1" -debug@^4.0.0: +debug@^4.0.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.5" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== @@ -3482,6 +3636,11 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -3757,6 +3916,11 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escodegen@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" @@ -3769,12 +3933,93 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-scope@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.0.2.tgz#5cbb33d4384c9136083a71190d548158fe128f94" + integrity sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint-visitor-keys@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" + integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== + +eslint@^9.7.0: + version "9.7.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.7.0.tgz#bedb48e1cdc2362a0caaa106a4c6ed943e8b09e4" + integrity sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.11.0" + "@eslint/config-array" "^0.17.0" + "@eslint/eslintrc" "^3.1.0" + "@eslint/js" "9.7.0" + "@humanwhocodes/module-importer" "^1.0.1" + "@humanwhocodes/retry" "^0.3.0" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + escape-string-regexp "^4.0.0" + eslint-scope "^8.0.2" + eslint-visitor-keys "^4.0.0" + espree "^10.1.0" + esquery "^1.5.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^8.0.0" + find-up "^5.0.0" + glob-parent "^6.0.2" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + +espree@^10.0.1, espree@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.1.0.tgz#8788dae611574c0f070691f522e4116c5a11fc56" + integrity sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA== + dependencies: + acorn "^8.12.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^4.0.0" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^5.2.0: +esquery@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -3942,7 +4187,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== @@ -3970,7 +4215,7 @@ fast-glob@^3.1.1, fast-glob@^3.2.4, fast-glob@^3.2.7: merge2 "^1.3.0" micromatch "^4.0.4" -fast-glob@^3.3.2: +fast-glob@^3.2.9, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -3986,7 +4231,7 @@ fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= @@ -4025,6 +4270,13 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" +file-entry-cache@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== + dependencies: + flat-cache "^4.0.0" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -4121,6 +4373,19 @@ flagged-respawn@^1.0.0: resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" integrity sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q== +flat-cache@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.4" + +flatted@^3.2.9: + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== + fn-name@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7" @@ -4396,6 +4661,13 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" @@ -4449,6 +4721,16 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" + integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== + +globals@^15.8.0: + version "15.8.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.8.0.tgz#e64bb47b619dd8cbf32b3c1a0a61714e33cbbb41" + integrity sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw== + globby@^11.0.0: version "11.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357" @@ -4461,6 +4743,18 @@ globby@^11.0.0: merge2 "^1.3.0" slash "^3.0.0" +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + globby@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" @@ -4513,6 +4807,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + grunt-cli@~1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/grunt-cli/-/grunt-cli-1.3.2.tgz#60f12d12c1b5aae94ae3469c6b5fe24e960014e8" @@ -4842,7 +5141,7 @@ ignore@^5.1.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -ignore@^5.1.8: +ignore@^5.1.8, ignore@^5.2.0, ignore@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== @@ -5132,7 +5431,7 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -5199,6 +5498,11 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -5944,6 +6248,11 @@ json-buffer@3.0.0: resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -5969,6 +6278,11 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -6019,6 +6333,13 @@ keyv@^3.0.0: dependencies: json-buffer "3.0.0" +keyv@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -6087,6 +6408,14 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -6249,6 +6578,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.startcase@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" @@ -6473,7 +6807,7 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.2.3, merge2@^1.3.0: +merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -6753,6 +7087,20 @@ min-indent@^1.0.0: dependencies: brace-expansion "^1.1.7" +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0, minimist-options@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -7110,6 +7458,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.5" + os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -7540,6 +7900,11 @@ preferred-pm@^3.0.0: path-exists "^4.0.0" which-pm "2.0.0" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -8155,6 +8520,11 @@ semver@^7.5.3, semver@^7.5.4: dependencies: lru-cache "^6.0.0" +semver@^7.6.0: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + semver@~5.0.1: version "5.0.3" resolved "https://registry.yarnpkg.com/semver/-/semver-5.0.3.tgz#77466de589cd5d3c95f138aa78bc569a3cb5d27a" @@ -8783,6 +9153,11 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -8872,6 +9247,11 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.0.tgz#79726304a6a898aa8373427298d54c2ee8b1cb30" integrity sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA== +ts-api-utils@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== + tsconfig@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7" @@ -8922,6 +9302,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -8959,6 +9346,15 @@ type-fest@^3.0.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.5.2.tgz#16ff97c5dc1fd6bd6d50ef3c6ba92cc9c1add859" integrity sha512-Ph7S4EhXzWy0sbljEuZo0tTNoLl+K2tPauGrQpcwUWrOVneLePTuhVzcuzVJJ6RU5DsNwQZka+8YtkXXU4z9cA== +typescript-eslint@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.0.1.tgz#e812ce16e9332c6c81cfa2f17aecf99b74473da7" + integrity sha512-V3Y+MdfhawxEjE16dWpb7/IOgeXnLwAEEkS7v8oDqNcR1oYlqWhGH/iHqHdKVdpWme1VPZ0SoywXAkCqawj2eQ== + dependencies: + "@typescript-eslint/eslint-plugin" "8.0.1" + "@typescript-eslint/parser" "8.0.1" + "@typescript-eslint/utils" "8.0.1" + typescript@^5.0.3: version "5.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" @@ -9273,6 +9669,11 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" From 8bff3b8ad57516e9816278b77ff5e0fffafd85ca Mon Sep 17 00:00:00 2001 From: with-heart Date: Sat, 10 Aug 2024 10:59:43 -0400 Subject: [PATCH 03/14] resolve lint errors --- babel.config.js | 3 - eslint.config.mjs | 7 +- packages/core/src/SimulatedClock.ts | 2 + packages/core/src/State.ts | 8 +-- packages/core/src/StateMachine.ts | 9 +-- packages/core/src/actions/assign.ts | 4 +- packages/core/src/actions/cancel.ts | 5 +- packages/core/src/actions/emit.ts | 4 +- packages/core/src/actions/enqueueActions.ts | 4 +- packages/core/src/actions/log.ts | 4 +- packages/core/src/actions/raise.ts | 4 +- packages/core/src/actions/send.ts | 4 +- packages/core/src/actions/spawnChild.ts | 7 +- packages/core/src/actions/stopChild.ts | 5 +- packages/core/src/createActor.ts | 3 +- packages/core/src/createMachine.ts | 32 --------- packages/core/src/dev/index.ts | 2 +- packages/core/src/guards.ts | 10 +-- packages/core/src/scxml.ts | 6 +- packages/core/src/setup.ts | 5 +- packages/core/src/stateUtils.ts | 69 ++++--------------- packages/core/src/system.ts | 2 - packages/core/src/types.ts | 18 ++--- packages/core/src/utils.ts | 10 +-- packages/core/src/waitFor.ts | 3 +- packages/xstate-graph/src/TestModel.ts | 1 - packages/xstate-graph/src/graph.ts | 4 -- packages/xstate-inspect/src/browser.ts | 1 - packages/xstate-inspect/src/inspectMachine.ts | 6 +- packages/xstate-inspect/src/serialize.ts | 2 +- packages/xstate-inspect/src/server.ts | 4 +- packages/xstate-inspect/src/utils.ts | 4 +- packages/xstate-react/src/useActorRef.ts | 2 +- packages/xstate-react/src/useSelector.ts | 2 +- packages/xstate-solid/src/createImmutable.ts | 2 +- packages/xstate-solid/src/deepClone.ts | 8 +-- packages/xstate-store/src/types.ts | 2 +- packages/xstate-svelte/src/useSelector.ts | 2 +- 38 files changed, 91 insertions(+), 179 deletions(-) diff --git a/babel.config.js b/babel.config.js index 952c9eebef..82d3b1cc32 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1,3 @@ -const { NODE_ENV } = process.env; -const isTest = NODE_ENV === 'test'; - module.exports = { assumptions: { constantReexports: true, // only matters for tests (since only there we transpile to CJS using Babel), it makes debugging easier diff --git a/eslint.config.mjs b/eslint.config.mjs index 2ef1b2ffcb..8dc4d15964 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -31,7 +31,12 @@ export default ts.config( // global rules { rules: { - '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-empty-object-type': [ + 'error', + { + allowInterfaces: 'with-single-extends' + } + ], '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-unused-vars': [ 'error', diff --git a/packages/core/src/SimulatedClock.ts b/packages/core/src/SimulatedClock.ts index efe864eebf..150dc0358d 100644 --- a/packages/core/src/SimulatedClock.ts +++ b/packages/core/src/SimulatedClock.ts @@ -1,5 +1,6 @@ import { Clock } from './system.ts'; +// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging export interface SimulatedClock extends Clock { start(speed: number): void; increment(ms: number): void; @@ -11,6 +12,7 @@ interface SimulatedTimeout { timeout: number; fn: (...args: any[]) => void; } +// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging export class SimulatedClock implements SimulatedClock { private timeouts: Map = new Map(); private _now: number = 0; diff --git a/packages/core/src/State.ts b/packages/core/src/State.ts index 32ea67a23a..b9d9b0d69d 100644 --- a/packages/core/src/State.ts +++ b/packages/core/src/State.ts @@ -19,8 +19,7 @@ import type { MetaObject, StateSchema, StateId, - SnapshotStatus, - SnapshotFrom + SnapshotStatus } from './types.ts'; import { matchesState } from './utils.ts'; @@ -37,10 +36,7 @@ type ToTestStateValue = >; }; -export function isMachineSnapshot< - TContext extends MachineContext, - TEvent extends EventObject ->(value: unknown): value is AnyMachineSnapshot { +export function isMachineSnapshot(value: unknown): value is AnyMachineSnapshot { return ( !!value && typeof value === 'object' && diff --git a/packages/core/src/StateMachine.ts b/packages/core/src/StateMachine.ts index 490413207e..9c9d9798b0 100644 --- a/packages/core/src/StateMachine.ts +++ b/packages/core/src/StateMachine.ts @@ -95,7 +95,7 @@ export class StateMachine< public implementations: MachineImplementationsSimplified; /** @internal */ - public __xstatenode: true = true; + public __xstatenode = true as const; /** @internal */ public idMap: Map> = new Map(); @@ -222,7 +222,8 @@ export class StateMachine< error?: unknown; } & (Equals extends false ? { context: unknown } - : {}) + : // eslint-disable-next-line @typescript-eslint/no-empty-object-type + {}) ): MachineSnapshot< TContext, TEvent, @@ -603,7 +604,7 @@ export class StateMachine< TConfig >; - let seen = new Set(); + const seen = new Set(); function reviveContext( contextPart: Record, @@ -613,7 +614,7 @@ export class StateMachine< return; } seen.add(contextPart); - for (let key in contextPart) { + for (const key in contextPart) { const value: unknown = contextPart[key]; if (value && typeof value === 'object') { diff --git a/packages/core/src/actions/assign.ts b/packages/core/src/actions/assign.ts index 8256bdf916..076237df0c 100644 --- a/packages/core/src/actions/assign.ts +++ b/packages/core/src/actions/assign.ts @@ -166,8 +166,8 @@ export function assign< } function assign( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/cancel.ts b/packages/core/src/actions/cancel.ts index 443bef7b9e..96d36993ad 100644 --- a/packages/core/src/actions/cancel.ts +++ b/packages/core/src/actions/cancel.ts @@ -1,7 +1,6 @@ import isDevelopment from '#is-development'; import { AnyActorScope, - AnyActor, AnyMachineSnapshot, EventObject, MachineContext, @@ -89,8 +88,8 @@ export function cancel< sendId: ResolvableSendId ): CancelAction { function cancel( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/emit.ts b/packages/core/src/actions/emit.ts index c6de6ab8a8..7f30c30df9 100644 --- a/packages/core/src/actions/emit.ts +++ b/packages/core/src/actions/emit.ts @@ -137,8 +137,8 @@ export function emit< } function emit( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/enqueueActions.ts b/packages/core/src/actions/enqueueActions.ts index 3ff3b60d75..a1d2c83993 100644 --- a/packages/core/src/actions/enqueueActions.ts +++ b/packages/core/src/actions/enqueueActions.ts @@ -311,8 +311,8 @@ export function enqueueActions< TEmitted > { function enqueueActions( - args: ActionArgs, - params: unknown + _args: ActionArgs, + _params: unknown ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/log.ts b/packages/core/src/actions/log.ts index 2af9492fb9..a4552a2e49 100644 --- a/packages/core/src/actions/log.ts +++ b/packages/core/src/actions/log.ts @@ -81,8 +81,8 @@ export function log< label?: string ): LogAction { function log( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/raise.ts b/packages/core/src/actions/raise.ts index e1f964c4d6..0a2c56a27d 100644 --- a/packages/core/src/actions/raise.ts +++ b/packages/core/src/actions/raise.ts @@ -149,8 +149,8 @@ export function raise< } function raise( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/send.ts b/packages/core/src/actions/send.ts index a5adc9e667..6f8ab1f8ca 100644 --- a/packages/core/src/actions/send.ts +++ b/packages/core/src/actions/send.ts @@ -242,8 +242,8 @@ export function sendTo< } function sendTo( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/spawnChild.ts b/packages/core/src/actions/spawnChild.ts index ad93e2ce3b..9ca893e8ca 100644 --- a/packages/core/src/actions/spawnChild.ts +++ b/packages/core/src/actions/spawnChild.ts @@ -1,7 +1,6 @@ import isDevelopment from '#is-development'; import { cloneMachineSnapshot } from '../State.ts'; import { ProcessingStatus, createActor } from '../createActor.ts'; -import { executingCustomAction } from '../stateUtils.ts'; import { ActionArgs, ActionFunction, @@ -96,7 +95,7 @@ function resolveSpawn( function executeSpawn( actorScope: AnyActorScope, - { id, actorRef }: { id: string; actorRef: AnyActorRef } + { actorRef }: { id: string; actorRef: AnyActorRef } ) { if (!actorRef) { return; @@ -207,8 +206,8 @@ export function spawnChild< never > { function spawnChild( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/actions/stopChild.ts b/packages/core/src/actions/stopChild.ts index cc3c3e7d87..18b7f48c31 100644 --- a/packages/core/src/actions/stopChild.ts +++ b/packages/core/src/actions/stopChild.ts @@ -3,7 +3,6 @@ import { cloneMachineSnapshot } from '../State.ts'; import { ProcessingStatus } from '../createActor.ts'; import { ActionArgs, - ActorRef, AnyActorRef, AnyActorScope, AnyMachineSnapshot, @@ -102,8 +101,8 @@ export function stopChild< actorRef: ResolvableActorRef ): StopAction { function stop( - args: ActionArgs, - params: TParams + _args: ActionArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); diff --git a/packages/core/src/createActor.ts b/packages/core/src/createActor.ts index 3ad250edcc..94f638ce94 100644 --- a/packages/core/src/createActor.ts +++ b/packages/core/src/createActor.ts @@ -423,7 +423,8 @@ export class Actor public on['type'] | '*'>( type: TType, handler: ( - emitted: EmittedFrom & (TType extends '*' ? {} : { type: TType }) + emitted: EmittedFrom & + (TType extends '*' ? unknown : { type: TType }) ) => void ): Subscription { let listeners = this.eventListeners.get(type); diff --git a/packages/core/src/createMachine.ts b/packages/core/src/createMachine.ts index be03e55c8f..cacd45ff5f 100644 --- a/packages/core/src/createMachine.ts +++ b/packages/core/src/createMachine.ts @@ -6,7 +6,6 @@ import { AnyEventObject, Cast, InternalMachineImplementations, - IsNever, MachineConfig, MachineContext, MachineTypes, @@ -30,37 +29,6 @@ type _GroupTestValues = ? [never, never] : [TTestValue, never] : [never, TTestValue]; -type GroupTestValues = { - leafCandidates: _GroupTestValues[0]; - nonLeaf: _GroupTestValues[1]; -}; - -type FilterLeafValues< - TLeafCandidate extends string, - TNonLeaf extends { [k: string]: TestValue | undefined } -> = IsNever extends true - ? TLeafCandidate - : TLeafCandidate extends string - ? TLeafCandidate extends keyof TNonLeaf - ? never - : TLeafCandidate - : never; - -// this is not 100% accurate since we can't make parallel regions required in the result -// `TTestValue` doesn't encode this information anyhow for us to be able to do that -// this is fine for most practical use cases anyway though -type ToStateValue = - | FilterLeafValues< - GroupTestValues['leafCandidates'], - GroupTestValues['nonLeaf'] - > - | (IsNever['nonLeaf']> extends false - ? { - [K in keyof GroupTestValues['nonLeaf']]: ToStateValue< - NonNullable['nonLeaf'][K]> - >; - } - : never); /** * Creates a state machine (statechart) with the given configuration. diff --git a/packages/core/src/dev/index.ts b/packages/core/src/dev/index.ts index 1e06b8bebf..9600b33cd0 100644 --- a/packages/core/src/dev/index.ts +++ b/packages/core/src/dev/index.ts @@ -40,7 +40,7 @@ export function getGlobal(): typeof globalThis | undefined { function getDevTools(): DevInterface | undefined { const w = getGlobal(); - if (!!(w as any).__xstate__) { + if ((w as any).__xstate__) { return (w as any).__xstate__; } diff --git a/packages/core/src/guards.ts b/packages/core/src/guards.ts index 4e0ded4f64..53dee306d9 100644 --- a/packages/core/src/guards.ts +++ b/packages/core/src/guards.ts @@ -115,8 +115,8 @@ export function stateIn< any // TODO: recheck if we could replace this with something better here > { function stateIn( - args: GuardArgs, - params: TParams + _args: GuardArgs, + _params: TParams ) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); @@ -179,7 +179,7 @@ export function not< unknown, NormalizeGuardArg> > { - function not(args: GuardArgs, params: unknown) { + function not(_args: GuardArgs, _params: unknown) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); } @@ -252,7 +252,7 @@ export function and< unknown, NormalizeGuardArgArray> > { - function and(args: GuardArgs, params: unknown) { + function and(_args: GuardArgs, _params: unknown) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); } @@ -323,7 +323,7 @@ export function or< unknown, NormalizeGuardArgArray> > { - function or(args: GuardArgs, params: unknown) { + function or(_args: GuardArgs, _params: unknown) { if (isDevelopment) { throw new Error(`This isn't supposed to be called`); } diff --git a/packages/core/src/scxml.ts b/packages/core/src/scxml.ts index f3216919ec..4b2a667f6c 100644 --- a/packages/core/src/scxml.ts +++ b/packages/core/src/scxml.ts @@ -52,7 +52,7 @@ function getAttribute( return element.attributes ? element.attributes[attribute] : undefined; } -function indexedRecord( +function indexedRecord( items: T[], identifierFn: (item: T) => string ): Record { @@ -106,7 +106,7 @@ function delayToMs(delay?: string | number): number | undefined { if (!hasDecimal) { return parseInt(secondsMatch[3], 10) * 1000; } - const secondsPart = !!secondsMatch[1] + const secondsPart = secondsMatch[1] ? parseInt(secondsMatch[1], 10) * 1000 : 0; const millisecondsPart = parseInt( @@ -320,7 +320,7 @@ return ${element.attributes!.expr}; branches.push(current); - return enqueueActions(({ context, event, enqueue, check, ...meta }) => { + return enqueueActions(({ enqueue, check }) => { for (const branch of branches) { if (!branch.guard || check(branch.guard)) { branch.actions.forEach(enqueue); diff --git a/packages/core/src/setup.ts b/packages/core/src/setup.ts index 7070b19236..32f1a66e6d 100644 --- a/packages/core/src/setup.ts +++ b/packages/core/src/setup.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-object-type */ import { StateMachine } from './StateMachine'; import { createMachine } from './createMachine'; import { GuardPredicate } from './guards'; @@ -89,7 +90,7 @@ type ToStateValue = T extends { states: Record; } ? IsNever extends true - ? {} + ? NonNullable : | GroupStateKeys['leaf'] | (IsNever['nonLeaf']> extends false @@ -102,7 +103,7 @@ type ToStateValue = T extends { T extends { type: 'parallel' } ? true : false > : never) - : {}; + : NonNullable; type RequiredSetupKeys = IsNever extends true ? never diff --git a/packages/core/src/stateUtils.ts b/packages/core/src/stateUtils.ts index fce7765ed1..92a146409d 100644 --- a/packages/core/src/stateUtils.ts +++ b/packages/core/src/stateUtils.ts @@ -22,7 +22,6 @@ import { AnyMachineSnapshot, AnyStateNode, AnyTransitionDefinition, - DelayExpr, DelayedTransitionDefinition, EventObject, HistoryValue, @@ -277,7 +276,7 @@ export function getDelayedTransitions( return []; } - const mutateEntryExit = (delay: string | number, i: number) => { + const mutateEntryExit = (delay: string | number) => { const afterEvent = createAfterEvent(delay, stateNode.id); const eventType = afterEvent.type; stateNode.entry.push(raise(afterEvent, { id: eventType, delay })); @@ -285,14 +284,14 @@ export function getDelayedTransitions( return eventType; }; - const delayedTransitions = Object.keys(afterConfig).flatMap((delay, i) => { + const delayedTransitions = Object.keys(afterConfig).flatMap((delay) => { const configTransition = afterConfig[delay]; const resolvedTransition = typeof configTransition === 'string' ? { target: configTransition } : configTransition; const resolvedDelay = Number.isNaN(+delay) ? delay : +delay; - const eventType = mutateEntryExit(resolvedDelay, i); + const eventType = mutateEntryExit(resolvedDelay); return toArray(resolvedTransition).map((transition) => ({ ...transition, event: eventType, @@ -312,10 +311,7 @@ export function getDelayedTransitions( }); } -export function formatTransition< - TContext extends MachineContext, - TEvent extends EventObject ->( +export function formatTransition( stateNode: AnyStateNode, descriptor: string, transitionConfig: AnyTransitionConfig @@ -589,7 +585,7 @@ export function getStateNodeByPath( if (typeof statePath === 'string' && isStateId(statePath)) { try { return stateNode.machine.getStateNodeById(statePath); - } catch (e) { + } catch { // try individual paths // throw e; } @@ -611,10 +607,10 @@ export function getStateNodeByPath( * * @param stateValue The state value or State instance */ -export function getStateNodes< - TContext extends MachineContext, - TEvent extends EventObject ->(stateNode: AnyStateNode, stateValue: StateValue): Array { +export function getStateNodes( + stateNode: AnyStateNode, + stateValue: StateValue +): Array { if (typeof stateValue === 'string') { const childStateNode = stateNode.states[stateValue]; if (!childStateNode) { @@ -805,18 +801,6 @@ function isDescendant( return marker.parent === parentStateNode; } -function getPathFromRootToNode(stateNode: AnyStateNode): Array { - const path: Array = []; - let marker = stateNode.parent; - - while (marker) { - path.unshift(marker); - marker = marker.parent; - } - - return path; -} - function hasIntersection(s1: Iterable, s2: Iterable): boolean { const set1 = new Set(s1); const set2 = new Set(s2); @@ -974,8 +958,8 @@ function computeExitSet( } function areStateNodeCollectionsEqual( - prevStateNodes: StateNode[], - nextStateNodeSet: Set> + prevStateNodes: StateNode[], + nextStateNodeSet: Set ) { if (prevStateNodes.length !== nextStateNodeSet.size) { return false; @@ -989,10 +973,7 @@ function areStateNodeCollectionsEqual( } /** https://www.w3.org/TR/scxml/#microstepProcedure */ -export function microstep< - TContext extends MachineContext, - TEvent extends EventObject ->( +export function microstep( transitions: Array, currentSnapshot: AnyMachineSnapshot, actorScope: AnyActorScope, @@ -1062,6 +1043,7 @@ export function microstep< ); } + // eslint-disable-next-line no-useless-catch try { if ( historyValue === currentSnapshot.historyValue && @@ -1840,28 +1822,3 @@ export function resolveStateValue( const allStateNodes = getAllStateNodes(getStateNodes(rootNode, stateValue)); return getStateValue(rootNode, [...allStateNodes]); } - -function stateValuesEqual( - a: StateValue | undefined, - b: StateValue | undefined -): boolean { - if (a === b) { - return true; - } - - if (a === undefined || b === undefined) { - return false; - } - - if (typeof a === 'string' || typeof b === 'string') { - return a === b; - } - - const aKeys = Object.keys(a as StateValueMap); - const bKeys = Object.keys(b as StateValueMap); - - return ( - aKeys.length === bKeys.length && - aKeys.every((key) => stateValuesEqual(a[key], b[key])) - ); -} diff --git a/packages/core/src/system.ts b/packages/core/src/system.ts index 763c5c5e1e..cb0402c768 100644 --- a/packages/core/src/system.ts +++ b/packages/core/src/system.ts @@ -4,10 +4,8 @@ import { ActorSystemInfo, AnyActorRef, Observer, - Snapshot, HomomorphicOmit, EventObject, - AnyTransitionDefinition, Subscription } from './types.ts'; import { toObserver } from './utils.ts'; diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 13fbbcf924..24ad4c9e3d 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -41,7 +41,7 @@ export type GetParameterizedParams = * This type can be used to avoid this problem. This union represents the same * value space as `unknown`. */ -export type NonReducibleUnknown = {} | null | undefined; +export type NonReducibleUnknown = NonNullable | null | undefined; export type AnyFunction = (...args: any[]) => any; type ReturnTypeOrValue = T extends AnyFunction ? ReturnType : T; @@ -50,7 +50,7 @@ type ReturnTypeOrValue = T extends AnyFunction ? ReturnType : T; export type IsNever = [T] extends [never] ? true : false; export type IsNotNever = [T] extends [never] ? false : true; -export type Compute = { [K in keyof A]: A[K] } & unknown; +export type Compute = { [K in keyof A]: A[K] } & unknown; export type Prop = K extends keyof T ? T[K] : never; export type Values = T[keyof T]; export type Elements = T[keyof T & `${number}`]; @@ -61,9 +61,9 @@ export type IndexByProp, P extends keyof T> = { export type IndexByType = IndexByProp; -export type Equals = (() => A extends A2 - ? true - : false) extends () => A extends A1 ? true : false +export type Equals = (() => A extends A2 ? true : false) extends < + A +>() => A extends A1 ? true : false ? true : false; export type IsAny = Equals; @@ -73,7 +73,7 @@ export type Cast = A extends B ? A : B; export type DoNotInfer = [T][T extends any ? 0 : any]; /** @deprecated Use the built-in `NoInfer` type instead */ export type NoInfer = DoNotInfer; -export type LowInfer = T & {}; +export type LowInfer = T & NonNullable; export type MetaObject = Record; @@ -854,7 +854,7 @@ export interface StateNodeConfig< TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, - TOutput, + _TOutput, TEmitted extends EventObject, TMeta extends MetaObject > { @@ -1974,7 +1974,7 @@ export interface ActorRef< on: ( type: TType, handler: ( - emitted: TEmitted & (TType extends '*' ? {} : { type: TType }) + emitted: TEmitted & (TType extends '*' ? unknown : { type: TType }) ) => void ) => Subscription; } @@ -2461,7 +2461,7 @@ export type ToChildren = ? ActorRefFromLogic | undefined : never; }; - exclude: {}; + exclude: unknown; }[undefined extends TActor['id'] // if not all actors have literal string IDs then we need to create an index signature containing all possible actor types ? 'include' : string extends TActor['id'] diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index eafc3271c3..a7152562dc 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -3,7 +3,6 @@ import { isMachineSnapshot } from './State.ts'; import type { StateNode } from './StateNode.ts'; import { TARGETLESS_KEY } from './constants.ts'; import type { - AnyActorLogic, AnyActorRef, AnyEventObject, AnyMachineSnapshot, @@ -56,7 +55,7 @@ export function toStatePath(stateId: string | string[]): string[] { return stateId; } - let result: string[] = []; + const result: string[] = []; let segment = ''; for (let i = 0; i < stateId.length; i++) { @@ -181,7 +180,7 @@ export function resolveOutput< `Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.\nFound object containing properties whose values are possibly mapping functions: ${Object.entries( mapper ) - .filter(([key, value]) => typeof value === 'function') + .filter(([, value]) => typeof value === 'function') .map( ([key, value]) => `\n - ${key}: ${(value as () => any) @@ -205,10 +204,7 @@ export function isErrorActorEvent( return event.type.startsWith('xstate.error.actor'); } -export function toTransitionConfigArray< - TContext extends MachineContext, - TEvent extends EventObject ->( +export function toTransitionConfigArray( configLike: SingleOrArray ): Array { return toArrayStrict(configLike).map((transitionLike) => { diff --git a/packages/core/src/waitFor.ts b/packages/core/src/waitFor.ts index d125788d71..3d0825d511 100644 --- a/packages/core/src/waitFor.ts +++ b/packages/core/src/waitFor.ts @@ -1,5 +1,5 @@ import isDevelopment from '#is-development'; -import { ActorRef, AnyActorRef, SnapshotFrom, Subscription } from './types.ts'; +import { AnyActorRef, SnapshotFrom, Subscription } from './types.ts'; interface WaitForOptions { /** @@ -73,6 +73,7 @@ export function waitFor( } } + // eslint-disable-next-line prefer-const let sub: Subscription | undefined; // avoid TDZ when disposing synchronously // See if the current snapshot already matches the predicate diff --git a/packages/xstate-graph/src/TestModel.ts b/packages/xstate-graph/src/TestModel.ts index 1a64cf8900..7d5cba504a 100644 --- a/packages/xstate-graph/src/TestModel.ts +++ b/packages/xstate-graph/src/TestModel.ts @@ -2,7 +2,6 @@ import { getPathsFromEvents, getAdjacencyMap, joinPaths, - AdjacencyValue, serializeSnapshot } from '@xstate/graph'; import type { diff --git a/packages/xstate-graph/src/graph.ts b/packages/xstate-graph/src/graph.ts index 0962856b73..8c98ded8a1 100644 --- a/packages/xstate-graph/src/graph.ts +++ b/packages/xstate-graph/src/graph.ts @@ -1,12 +1,8 @@ import { EventObject, AnyStateMachine, - AnyMachineSnapshot, - StateFrom, - EventFrom, StateMachine, AnyActorLogic, - SnapshotFrom, EventFromLogic, Snapshot, __unsafe_getAllOwnEventDescriptors, diff --git a/packages/xstate-inspect/src/browser.ts b/packages/xstate-inspect/src/browser.ts index 7738dfb2fe..2d93208212 100644 --- a/packages/xstate-inspect/src/browser.ts +++ b/packages/xstate-inspect/src/browser.ts @@ -12,7 +12,6 @@ import { stringifyState } from './serialize.ts'; import type { Inspector, InspectorOptions, - InspectReceiver, ParsedReceiverEvent, ReceiverCommand, ServiceListener, diff --git a/packages/xstate-inspect/src/inspectMachine.ts b/packages/xstate-inspect/src/inspectMachine.ts index be14e7035b..d98ece2c9f 100644 --- a/packages/xstate-inspect/src/inspectMachine.ts +++ b/packages/xstate-inspect/src/inspectMachine.ts @@ -1,4 +1,4 @@ -import { ActorRef, assign, createMachine, Interpreter } from 'xstate'; +import { ActorRef, assign, createMachine } from 'xstate'; import { XStateDevInterface } from 'xstate/dev'; import { stringifyState } from './serialize.ts'; @@ -56,7 +56,9 @@ export function createInspectMachine( const { event } = e; const parsedEvent = JSON.parse(event); // TODO: figure out a different mechanism - const service = serviceMap.get(parsedEvent.origin?.id!); + const service = parsedEvent.origin + ? serviceMap.get(parsedEvent.origin.id) + : undefined; service?.send(parsedEvent); } }, diff --git a/packages/xstate-inspect/src/serialize.ts b/packages/xstate-inspect/src/serialize.ts index ee223136e9..a9a2529836 100644 --- a/packages/xstate-inspect/src/serialize.ts +++ b/packages/xstate-inspect/src/serialize.ts @@ -1,4 +1,4 @@ -import { AnyMachineSnapshot, AnyStateMachine } from 'xstate'; +import { AnyMachineSnapshot } from 'xstate'; import { Replacer } from './types.ts'; import { stringify } from './utils.ts'; diff --git a/packages/xstate-inspect/src/server.ts b/packages/xstate-inspect/src/server.ts index a242f0a3b5..5f5f5d6639 100644 --- a/packages/xstate-inspect/src/server.ts +++ b/packages/xstate-inspect/src/server.ts @@ -1,5 +1,5 @@ import { WebSocketServer } from 'ws'; -import { Actor, EventFromLogic, EventObject, createActor } from 'xstate'; +import { Actor, EventObject, createActor } from 'xstate'; import { XStateDevInterface } from 'xstate/dev'; import { InspectMachineEvent, createInspectMachine } from './inspectMachine.ts'; import { Inspector, Replacer } from './types.ts'; @@ -53,7 +53,7 @@ export function inspect(options: ServerInspectorOptions): Inspector { const inspectService = createActor( createInspectMachine(devTools, options) ).start(); - let client = { + const client = { name: '@@xstate/ws-client', send: (event: any) => { server.clients.forEach((wsClient) => { diff --git a/packages/xstate-inspect/src/utils.ts b/packages/xstate-inspect/src/utils.ts index 5b6ebef05c..bada0b525c 100644 --- a/packages/xstate-inspect/src/utils.ts +++ b/packages/xstate-inspect/src/utils.ts @@ -12,7 +12,7 @@ export function stringify( ): string { try { return JSON.stringify(value, replacer); - } catch (e) { + } catch { return safeStringify(value, replacer); } } @@ -30,7 +30,7 @@ export function isReceiverEvent(event: any): event is ReceiverEvent { ) { return true; } - } catch (e) { + } catch { return false; } diff --git a/packages/xstate-react/src/useActorRef.ts b/packages/xstate-react/src/useActorRef.ts index e491829f4d..ef0477ec38 100644 --- a/packages/xstate-react/src/useActorRef.ts +++ b/packages/xstate-react/src/useActorRef.ts @@ -55,7 +55,7 @@ export function useActorRef( if (!observerOrListener) { return; } - let sub = actorRef.subscribe(toObserver(observerOrListener)); + const sub = actorRef.subscribe(toObserver(observerOrListener)); return () => { sub.unsubscribe(); }; diff --git a/packages/xstate-react/src/useSelector.ts b/packages/xstate-react/src/useSelector.ts index da73946f65..c9a631cb65 100644 --- a/packages/xstate-react/src/useSelector.ts +++ b/packages/xstate-react/src/useSelector.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react'; import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'; -import { AnyActorRef, SnapshotFrom } from 'xstate'; +import { AnyActorRef } from 'xstate'; type SyncExternalStoreSubscribe = Parameters< typeof useSyncExternalStoreWithSelector diff --git a/packages/xstate-solid/src/createImmutable.ts b/packages/xstate-solid/src/createImmutable.ts index 7764371bac..5624473d5b 100644 --- a/packages/xstate-solid/src/createImmutable.ts +++ b/packages/xstate-solid/src/createImmutable.ts @@ -19,7 +19,7 @@ const updateStore = ( store: Store ) => { const valueRefs = new WeakMap(); - const diff = ( + const diff = ( next: CompareValue, prev: CompareValue, path: Path diff --git a/packages/xstate-solid/src/deepClone.ts b/packages/xstate-solid/src/deepClone.ts index 1eeaa76a2d..e829300845 100644 --- a/packages/xstate-solid/src/deepClone.ts +++ b/packages/xstate-solid/src/deepClone.ts @@ -17,10 +17,7 @@ export function isWrappable(obj: any): obj is object { * @param valueRefs A WeakMap that stores a reference from the original * object/array to the cloned object/array */ -const clone = ( - value: T, - valueRefs: WeakMap -): T => { +const clone = (value: T, valueRefs: WeakMap): T => { if (!isWrappable(value)) { return value; } @@ -50,5 +47,4 @@ const clone = ( return clonedValue; }; -export const deepClone = (value: T): T => - clone(value, new WeakMap()); +export const deepClone = (value: T): T => clone(value, new WeakMap()); diff --git a/packages/xstate-store/src/types.ts b/packages/xstate-store/src/types.ts index 04c0dee070..c194a94c7d 100644 --- a/packages/xstate-store/src/types.ts +++ b/packages/xstate-store/src/types.ts @@ -1,6 +1,6 @@ import { InspectionEvent } from 'xstate'; -export type EventPayloadMap = Record; +export type EventPayloadMap = Record; export type ExtractEventsFromPayloadMap = Values<{ [K in keyof T & string]: T[K] & { type: K }; diff --git a/packages/xstate-svelte/src/useSelector.ts b/packages/xstate-svelte/src/useSelector.ts index a0c35b5b30..80d8d25a46 100644 --- a/packages/xstate-svelte/src/useSelector.ts +++ b/packages/xstate-svelte/src/useSelector.ts @@ -1,5 +1,5 @@ import { readable } from 'svelte/store'; -import type { ActorRef, AnyActorRef, SnapshotFrom, Subscription } from 'xstate'; +import type { AnyActorRef, SnapshotFrom, Subscription } from 'xstate'; function defaultCompare(a: T, b: T) { return a === b; From de4b3d99c501f13f841ad4ec3fe3189324b3ab25 Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 15 Aug 2024 21:42:00 -0400 Subject: [PATCH 04/14] add eslint to ci-checks --- .github/actions/ci-checks/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/ci-checks/action.yml b/.github/actions/ci-checks/action.yml index 8973c57927..08ddf0810d 100644 --- a/.github/actions/ci-checks/action.yml +++ b/.github/actions/ci-checks/action.yml @@ -6,6 +6,10 @@ runs: run: yarn build shell: bash + - name: ESLint + run: yarn lint --no-cache + shell: bash + - name: Typecheck run: yarn typecheck shell: bash From e014d304d301b38e45316f8a038307d9a65b1e03 Mon Sep 17 00:00:00 2001 From: with-heart Date: Fri, 30 Aug 2024 13:23:43 -0400 Subject: [PATCH 05/14] enable eslint type-checked rules --- eslint.config.mjs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 8dc4d15964..fb44e616d6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -6,7 +6,7 @@ import ts from 'typescript-eslint'; export default ts.config( // plugins js.configs.recommended, - ...ts.configs.recommended, + ...ts.configs.recommendedTypeChecked, // global ignore { @@ -21,14 +21,18 @@ export default ts.config( // global language and linter options { languageOptions: { - globals: { ...globals.browser, ...globals.node } + globals: { ...globals.browser, ...globals.node }, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname + } }, linterOptions: { reportUnusedDisableDirectives: 'error' } }, - // global rules + // global rule overrides { rules: { '@typescript-eslint/no-empty-object-type': [ @@ -37,7 +41,12 @@ export default ts.config( allowInterfaces: 'with-single-extends' } ], - '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/no-unused-vars': [ 'error', { @@ -50,6 +59,7 @@ export default ts.config( ignoreRestSiblings: true } ], + '@typescript-eslint/unbound-method': 'off', 'prefer-const': [ 'error', { @@ -59,6 +69,12 @@ export default ts.config( } }, + // disable type-checking for js files + { + files: ['**/*.{js,cjs,mjs}'], + ...ts.configs.disableTypeChecked + }, + // js-specific config and rules { files: ['**/*.{js,cjs}'], From aeec38a6ef56bb534ff8bc968b95107ff54959cc Mon Sep 17 00:00:00 2001 From: with-heart Date: Fri, 30 Aug 2024 14:41:01 -0400 Subject: [PATCH 06/14] fix type-check errors --- packages/core/src/StateMachine.ts | 2 +- packages/core/src/StateNode.ts | 6 +++--- packages/core/src/actions/emit.ts | 5 ----- packages/core/src/actions/raise.ts | 5 ----- packages/core/src/actions/send.ts | 12 +++++------- packages/core/src/actions/spawnChild.ts | 1 + packages/core/src/actors/transition.ts | 2 +- packages/core/src/createActor.ts | 3 ++- packages/core/src/scxml.ts | 16 ++++++++++------ packages/core/src/stateUtils.ts | 11 ++++++----- packages/core/src/types.ts | 4 ++-- packages/core/src/waitFor.ts | 3 ++- packages/xstate-graph/src/deduplicatePaths.ts | 1 + packages/xstate-inspect/src/server.ts | 1 + packages/xstate-solid/src/createImmutable.ts | 6 +++--- 15 files changed, 38 insertions(+), 40 deletions(-) diff --git a/packages/core/src/StateMachine.ts b/packages/core/src/StateMachine.ts index 9c9d9798b0..99d6cb684b 100644 --- a/packages/core/src/StateMachine.ts +++ b/packages/core/src/StateMachine.ts @@ -561,7 +561,7 @@ export class StateMachine< Object.keys(snapshotChildren).forEach((actorId) => { const actorData = - snapshotChildren[actorId as keyof typeof snapshotChildren]; + snapshotChildren[actorId]; const childState = actorData.snapshot; const src = actorData.src; diff --git a/packages/core/src/StateNode.ts b/packages/core/src/StateNode.ts index 375551fca9..039f32db4e 100644 --- a/packages/core/src/StateNode.ts +++ b/packages/core/src/StateNode.ts @@ -186,7 +186,7 @@ export class StateNode< (stateConfig: AnyStateNodeConfig, key) => { const stateNode = new StateNode(stateConfig, { _parent: this, - _key: key as string, + _key: key, _machine: this.machine }); return stateNode; @@ -247,9 +247,9 @@ export class StateNode< eventType: null as any, reenter: false, toJSON: () => ({ - target: this.initial!.target!.map((t) => `#${t.id}`), + target: this.initial.target.map((t) => `#${t.id}`), source: `#${this.id}`, - actions: this.initial!.actions.map(toSerializableAction), + actions: this.initial.actions.map(toSerializableAction), eventType: null as any }) } diff --git a/packages/core/src/actions/emit.ts b/packages/core/src/actions/emit.ts index 7f30c30df9..94d27bf7be 100644 --- a/packages/core/src/actions/emit.ts +++ b/packages/core/src/actions/emit.ts @@ -32,11 +32,6 @@ function resolveEmit( >; } ) { - if (isDevelopment && typeof eventOrExpr === 'string') { - throw new Error( - `Only event objects may be used with emit; use emit({ type: "${eventOrExpr}" }) instead` - ); - } const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) diff --git a/packages/core/src/actions/raise.ts b/packages/core/src/actions/raise.ts index 0a2c56a27d..1c79ca2fe0 100644 --- a/packages/core/src/actions/raise.ts +++ b/packages/core/src/actions/raise.ts @@ -50,11 +50,6 @@ function resolveRaise( ) { const delaysMap = snapshot.machine.implementations.delays; - if (typeof eventOrExpr === 'string') { - throw new Error( - `Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead` - ); - } const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) diff --git a/packages/core/src/actions/send.ts b/packages/core/src/actions/send.ts index 6f8ab1f8ca..1a36b2de39 100644 --- a/packages/core/src/actions/send.ts +++ b/packages/core/src/actions/send.ts @@ -66,11 +66,6 @@ function resolveSendTo( ) { const delaysMap = snapshot.machine.implementations.delays; - if (typeof eventOrExpr === 'string') { - throw new Error( - `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead` - ); - } const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) @@ -92,9 +87,12 @@ function resolveSendTo( let targetActorRef: AnyActorRef | string | undefined; if (typeof resolvedTarget === 'string') { + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (resolvedTarget === SpecialTargets.Parent) { targetActorRef = actorScope.self._parent; - } else if (resolvedTarget === SpecialTargets.Internal) { + } + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison + else if (resolvedTarget === SpecialTargets.Internal) { targetActorRef = actorScope.self; } else if (resolvedTarget.startsWith('#_')) { // SCXML compatibility: https://www.w3.org/TR/scxml/#SCXMLEventProcessor @@ -162,7 +160,7 @@ function executeSendTo( actorScope.self, // at this point, in a deferred task, it should already be mutated by retryResolveSendTo // if it initially started as a string - to as Exclude, + to, event.type === XSTATE_ERROR ? createErrorActorEvent(actorScope.self.id, (event as any).data) : event diff --git a/packages/core/src/actions/spawnChild.ts b/packages/core/src/actions/spawnChild.ts index 9ca893e8ca..d2b7eaf78e 100644 --- a/packages/core/src/actions/spawnChild.ts +++ b/packages/core/src/actions/spawnChild.ts @@ -76,6 +76,7 @@ function resolveSpawn( if (isDevelopment && !actorRef) { console.warn( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-base-to-string `Actor type '${src}' not found in machine '${actorScope.id}'.` ); } diff --git a/packages/core/src/actors/transition.ts b/packages/core/src/actors/transition.ts index 4c92b2c168..0706aef460 100644 --- a/packages/core/src/actors/transition.ts +++ b/packages/core/src/actors/transition.ts @@ -198,7 +198,7 @@ export function fromTransition< ...snapshot, context: transition( snapshot.context, - event as TEvent, + event, actorScope as any ) }; diff --git a/packages/core/src/createActor.ts b/packages/core/src/createActor.ts index 94f638ce94..49bc4fafd3 100644 --- a/packages/core/src/createActor.ts +++ b/packages/core/src/createActor.ts @@ -196,6 +196,7 @@ export class Actor // Ensure that the send method is bound to this Actor instance // if destructured this.send = this.send.bind(this); + this.system._sendInspectionEvent({ type: '@xstate.actor', actorRef: this @@ -437,7 +438,7 @@ export class Actor return { unsubscribe: () => { - listeners!.delete(wrappedHandler); + listeners.delete(wrappedHandler); } }; } diff --git a/packages/core/src/scxml.ts b/packages/core/src/scxml.ts index 4b2a667f6c..8fc61ebc77 100644 --- a/packages/core/src/scxml.ts +++ b/packages/core/src/scxml.ts @@ -147,6 +147,7 @@ with (context) { } `; + // eslint-disable-next-line @typescript-eslint/no-implied-eval const fn = new Function(...args, ...extraArgs, fnBody); return fn(context, { name: event.type, data: event }); @@ -196,7 +197,7 @@ return {'${element.attributes!.location}': ${element.attributes!.expr}}; } case 'cancel': if ('sendid' in element.attributes!) { - return cancel(element.attributes!.sendid! as string); + return cancel(element.attributes.sendid! as string); } return cancel(({ context, event, ...meta }) => { const fnBody = ` @@ -246,11 +247,14 @@ return { type: ${event ? `"${event}"` : eventexpr}, ${params ? params : ''} } } if ('delay' in element.attributes!) { - convertedDelay = delayToMs(element.attributes!.delay); + convertedDelay = delayToMs(element.attributes.delay); } else if (element.attributes!.delayexpr) { convertedDelay = ({ context, event: _ev, ...meta }) => { const fnBody = ` -return (${delayToMs})(${element.attributes!.delayexpr}); +return (${ + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + delayToMs + })(${element.attributes!.delayexpr}); `; return evaluateExecutableContent(context, _ev, meta, fnBody); @@ -313,7 +317,7 @@ return ${element.attributes!.expr}; current = { actions: [] }; break; default: - (current.actions as any[]).push(mapAction(el)); + current.actions.push(mapAction(el)); break; } } @@ -443,7 +447,7 @@ function toConfig(nodeJson: XMLElement, id: string): AnyStateNodeConfig { let guardObject = {}; if (value.attributes?.cond) { - const guard = value.attributes!.cond; + const guard = value.attributes.cond; if ((guard as string).startsWith('In')) { const inMatch = (guard as string).trim().match(/^In\('(.*)'\)/); @@ -462,7 +466,7 @@ function toConfig(nodeJson: XMLElement, id: string): AnyStateNodeConfig { } } else { guardObject = { - guard: createGuard(value.attributes!.cond as string) + guard: createGuard(value.attributes.cond as string) }; } } diff --git a/packages/core/src/stateUtils.ts b/packages/core/src/stateUtils.ts index 92a146409d..659abbf831 100644 --- a/packages/core/src/stateUtils.ts +++ b/packages/core/src/stateUtils.ts @@ -437,6 +437,7 @@ export function formatInitialTransition< : undefined; if (!resolvedTarget && _target) { throw new Error( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-base-to-string `Initial state node "${_target}" not found on parent state node #${stateNode.id}` ); } @@ -1140,7 +1141,7 @@ function enterStates( } if (statesForDefaultEntry.has(stateNodeToEnter)) { - const initialActions = stateNodeToEnter.initial!.actions; + const initialActions = stateNodeToEnter.initial.actions; actions.push(...initialActions); } @@ -1163,7 +1164,7 @@ function enterStates( if (parent?.type === 'compound') { internalQueue.push( createDoneStateEvent( - parent!.id, + parent.id, stateNodeToEnter.output !== undefined ? resolveOutput( stateNodeToEnter.output, @@ -1239,7 +1240,7 @@ function computeEntrySet( for (const s of targetStates) { const ancestors = getProperAncestors(s, domain); if (domain?.type === 'parallel') { - ancestors.push(domain!); + ancestors.push(domain); } addAncestorStatesToEnter( statesToEnter, @@ -1277,7 +1278,7 @@ function addDescendantStatesToEnter< for (const s of historyStateNodes) { addProperAncestorStatesToEnter( s, - stateNode.parent!, + stateNode.parent, statesToEnter, historyValue, statesForDefaultEntry @@ -1306,7 +1307,7 @@ function addDescendantStatesToEnter< for (const s of historyDefaultTransition.target) { addProperAncestorStatesToEnter( s, - stateNode.parent!, + stateNode.parent, statesToEnter, historyValue, statesForDefaultEntry diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 24ad4c9e3d..c4c81c776d 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -50,7 +50,7 @@ type ReturnTypeOrValue = T extends AnyFunction ? ReturnType : T; export type IsNever = [T] extends [never] ? true : false; export type IsNotNever = [T] extends [never] ? false : true; -export type Compute = { [K in keyof A]: A[K] } & unknown; +export type Compute = { [K in keyof A]: A[K] }; export type Prop = K extends keyof T ? T[K] : never; export type Values = T[keyof T]; export type Elements = T[keyof T & `${number}`]; @@ -485,7 +485,7 @@ export type StateTypes = | 'parallel' | 'final' | 'history' - | string; // TODO: remove once TS fixes this type-widening issue + | ({} & string); // TODO: remove once TS fixes this type-widening issue export type SingleOrArray = readonly T[] | T; diff --git a/packages/core/src/waitFor.ts b/packages/core/src/waitFor.ts index 3d0825d511..9515f25afa 100644 --- a/packages/core/src/waitFor.ts +++ b/packages/core/src/waitFor.ts @@ -61,7 +61,7 @@ export function waitFor( }, resolvedOptions.timeout); const dispose = () => { - clearTimeout(handle!); + clearTimeout(handle); done = true; sub?.unsubscribe(); }; @@ -86,6 +86,7 @@ export function waitFor( next: checkEmitted, error: (err) => { dispose(); + // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors rej(err); }, complete: () => { diff --git a/packages/xstate-graph/src/deduplicatePaths.ts b/packages/xstate-graph/src/deduplicatePaths.ts index 20caf9a018..97b845cd6e 100644 --- a/packages/xstate-graph/src/deduplicatePaths.ts +++ b/packages/xstate-graph/src/deduplicatePaths.ts @@ -37,6 +37,7 @@ export const deduplicatePaths = < pathLoop: for (const pathWithEventSequence of allPathsWithEventSequence) { // Check each existing superpath to see if the path is a subpath of it superpathLoop: for (const superpathWithEventSequence of superpathsWithEventSequence) { + // eslint-disable-next-line @typescript-eslint/no-for-in-array for (const i in pathWithEventSequence.eventSequence) { // Check event sequence to determine if path is subpath, e.g.: // diff --git a/packages/xstate-inspect/src/server.ts b/packages/xstate-inspect/src/server.ts index 5f5f5d6639..6c1f8d1eec 100644 --- a/packages/xstate-inspect/src/server.ts +++ b/packages/xstate-inspect/src/server.ts @@ -73,6 +73,7 @@ export function inspect(options: ServerInspectorOptions): Inspector { return; } + // eslint-disable-next-line @typescript-eslint/no-base-to-string const jsonMessage = JSON.parse(data.toString()); inspectService.send({ ...jsonMessage, diff --git a/packages/xstate-solid/src/createImmutable.ts b/packages/xstate-solid/src/createImmutable.ts index 5624473d5b..0d837c1c3d 100644 --- a/packages/xstate-solid/src/createImmutable.ts +++ b/packages/xstate-solid/src/createImmutable.ts @@ -72,7 +72,7 @@ const updateStore = ( // Update new values const targetKeys = Object.keys(next) as Array; for (let i = 0, len = targetKeys.length; i < len; i++) { - diff(next[targetKeys[i]!], prev[targetKeys[i]!], [ + diff(next[targetKeys[i]], prev[targetKeys[i]], [ ...path, targetKeys[i] ] as Path); @@ -81,8 +81,8 @@ const updateStore = ( // Remove previous keys that are now undefined const previousKeys = Object.keys(prev) as Array; for (let i = 0, len = previousKeys.length; i < len; i++) { - if (next[previousKeys[i]!] === undefined) { - set(...path, previousKeys[i]!, undefined); + if (next[previousKeys[i]] === undefined) { + set(...path, previousKeys[i], undefined); } } } From 28b8b72c9d6a022479081e452de93e8e7fe60ef3 Mon Sep 17 00:00:00 2001 From: with-heart Date: Fri, 30 Aug 2024 14:43:13 -0400 Subject: [PATCH 07/14] add eslint fix commits to .git-blame-ignore-revs --- .git-blame-ignore-revs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 79638850d5..f0541587c4 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -2,3 +2,7 @@ 71183da18ae6b0b6b2e8f0c52ea9976232e54f41 94037fe9c429839f0508ddcd287718b659276e3b f51bf4d8907307ace083a0decb34668176c7fad3 + +# lint fixes +8bff3b8ad57516e9816278b77ff5e0fffafd85ca +aeec38a6ef56bb534ff8bc968b95107ff54959cc From ef5c51d116d4a73d841ad2faf2aa4de156dc6be1 Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 12 Sep 2024 11:30:06 -0400 Subject: [PATCH 08/14] allow empty object types --- eslint.config.mjs | 3 ++- packages/core/src/StateMachine.ts | 6 ++---- packages/core/src/setup.ts | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index fb44e616d6..5ec845d834 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -38,7 +38,8 @@ export default ts.config( '@typescript-eslint/no-empty-object-type': [ 'error', { - allowInterfaces: 'with-single-extends' + allowInterfaces: 'with-single-extends', + allowObjectTypes: 'always' } ], '@typescript-eslint/no-explicit-any': 'off', diff --git a/packages/core/src/StateMachine.ts b/packages/core/src/StateMachine.ts index 99d6cb684b..c4ce523bfb 100644 --- a/packages/core/src/StateMachine.ts +++ b/packages/core/src/StateMachine.ts @@ -222,8 +222,7 @@ export class StateMachine< error?: unknown; } & (Equals extends false ? { context: unknown } - : // eslint-disable-next-line @typescript-eslint/no-empty-object-type - {}) + : {}) ): MachineSnapshot< TContext, TEvent, @@ -560,8 +559,7 @@ export class StateMachine< > = (snapshot as any).children; Object.keys(snapshotChildren).forEach((actorId) => { - const actorData = - snapshotChildren[actorId]; + const actorData = snapshotChildren[actorId]; const childState = actorData.snapshot; const src = actorData.src; diff --git a/packages/core/src/setup.ts b/packages/core/src/setup.ts index 32f1a66e6d..59aa3d8861 100644 --- a/packages/core/src/setup.ts +++ b/packages/core/src/setup.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-object-type */ import { StateMachine } from './StateMachine'; import { createMachine } from './createMachine'; import { GuardPredicate } from './guards'; From cc323c7077733bd05f03f47fe65cdcb5e4646066 Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 12 Sep 2024 13:54:54 -0400 Subject: [PATCH 09/14] disable no-unnecessary-type-constraints on specific lines --- packages/xstate-solid/src/createImmutable.ts | 3 ++- packages/xstate-solid/src/deepClone.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/xstate-solid/src/createImmutable.ts b/packages/xstate-solid/src/createImmutable.ts index 0d837c1c3d..27fb81b73b 100644 --- a/packages/xstate-solid/src/createImmutable.ts +++ b/packages/xstate-solid/src/createImmutable.ts @@ -19,7 +19,8 @@ const updateStore = ( store: Store ) => { const valueRefs = new WeakMap(); - const diff = ( + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint + const diff = ( next: CompareValue, prev: CompareValue, path: Path diff --git a/packages/xstate-solid/src/deepClone.ts b/packages/xstate-solid/src/deepClone.ts index e829300845..bc27127451 100644 --- a/packages/xstate-solid/src/deepClone.ts +++ b/packages/xstate-solid/src/deepClone.ts @@ -17,7 +17,11 @@ export function isWrappable(obj: any): obj is object { * @param valueRefs A WeakMap that stores a reference from the original * object/array to the cloned object/array */ -const clone = (value: T, valueRefs: WeakMap): T => { +// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint +const clone = ( + value: T, + valueRefs: WeakMap +): T => { if (!isWrappable(value)) { return value; } @@ -47,4 +51,6 @@ const clone = (value: T, valueRefs: WeakMap): T => { return clonedValue; }; -export const deepClone = (value: T): T => clone(value, new WeakMap()); +// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint +export const deepClone = (value: T): T => + clone(value, new WeakMap()); From 838e53aa654b84da37c6beb976f5adc85a820b8f Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 12 Sep 2024 14:01:57 -0400 Subject: [PATCH 10/14] revert removal of non-conforming type check in actions --- packages/core/src/actions/raise.ts | 6 ++++++ packages/core/src/actions/send.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/core/src/actions/raise.ts b/packages/core/src/actions/raise.ts index 1c79ca2fe0..0afd349a08 100644 --- a/packages/core/src/actions/raise.ts +++ b/packages/core/src/actions/raise.ts @@ -50,6 +50,12 @@ function resolveRaise( ) { const delaysMap = snapshot.machine.implementations.delays; + if (typeof eventOrExpr === 'string') { + throw new Error( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead` + ); + } const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) diff --git a/packages/core/src/actions/send.ts b/packages/core/src/actions/send.ts index 1a36b2de39..433cefeb57 100644 --- a/packages/core/src/actions/send.ts +++ b/packages/core/src/actions/send.ts @@ -66,6 +66,12 @@ function resolveSendTo( ) { const delaysMap = snapshot.machine.implementations.delays; + if (typeof eventOrExpr === 'string') { + throw new Error( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead` + ); + } const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args, actionParams) From 560cac9f419a20f026be30f6644f01bb7fd580c6 Mon Sep 17 00:00:00 2001 From: with-heart Date: Thu, 19 Sep 2024 11:13:21 -0400 Subject: [PATCH 11/14] resolve lint errors --- packages/xstate-graph/src/graph.ts | 8 ++++---- packages/xstate-store/src/react.ts | 2 +- packages/xstate-store/src/solid.ts | 2 +- packages/xstate-store/src/store.ts | 16 +++++----------- packages/xstate-store/src/types.ts | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/xstate-graph/src/graph.ts b/packages/xstate-graph/src/graph.ts index 8c98ded8a1..d78cfd946c 100644 --- a/packages/xstate-graph/src/graph.ts +++ b/packages/xstate-graph/src/graph.ts @@ -88,7 +88,7 @@ export function createDefaultMachineOptions( serializeEvent, events: (state) => { const events = - typeof getEvents === 'function' ? getEvents(state) : getEvents ?? []; + typeof getEvents === 'function' ? getEvents(state) : (getEvents ?? []); return __unsafe_getAllOwnEventDescriptors(state).flatMap((type) => { const matchingEvents = events.filter((ev) => (ev as any).type === type); if (matchingEvents.length) { @@ -128,7 +128,7 @@ export function toDirectedGraph( return targets.map((target, targetIndex) => { const edge: DirectedGraphEdge = { id: `${stateNode.id}:${transitionIndex}:${targetIndex}`, - source: stateNode as AnyStateNode, + source: stateNode, target: target as AnyStateNode, transition: t, label: { @@ -148,8 +148,8 @@ export function toDirectedGraph( const graph = { id: stateNode.id, - stateNode: stateNode as AnyStateNode, - children: getChildren(stateNode as AnyStateNode).map(toDirectedGraph), + stateNode: stateNode, + children: getChildren(stateNode).map(toDirectedGraph), edges, toJSON: () => { const { id, children, edges: graphEdges } = graph; diff --git a/packages/xstate-store/src/react.ts b/packages/xstate-store/src/react.ts index a445c49405..306221bcbb 100644 --- a/packages/xstate-store/src/react.ts +++ b/packages/xstate-store/src/react.ts @@ -1,5 +1,5 @@ import { useCallback, useRef, useSyncExternalStore } from 'react'; -import { Store, SnapshotFromStore, AnyStore } from './types'; +import { SnapshotFromStore, AnyStore } from './types'; function defaultCompare(a: T | undefined, b: T) { return a === b; diff --git a/packages/xstate-store/src/solid.ts b/packages/xstate-store/src/solid.ts index 7e2f779bf0..05bcd65904 100644 --- a/packages/xstate-store/src/solid.ts +++ b/packages/xstate-store/src/solid.ts @@ -1,6 +1,6 @@ /* @jsxImportSource solid-js */ import { createEffect, createSignal, onCleanup } from 'solid-js'; -import type { Store, SnapshotFromStore, AnyStore } from './types'; +import type { SnapshotFromStore, AnyStore } from './types'; function defaultCompare(a: T | undefined, b: T) { return a === b; diff --git a/packages/xstate-store/src/store.ts b/packages/xstate-store/src/store.ts index 3b1acd1487..41ddb38c7d 100644 --- a/packages/xstate-store/src/store.ts +++ b/packages/xstate-store/src/store.ts @@ -131,7 +131,7 @@ function createStoreCore< return { unsubscribe() { - eventListeners!.delete(wrappedHandler); + eventListeners.delete(wrappedHandler); } }; }, @@ -434,16 +434,10 @@ export function createStoreTransition< if (typeof assigner === 'function') { currentContext = updater - ? updater( - currentContext, - (draftContext) => - ( - assigner as StoreCompleteAssigner< - TContext, - StoreEvent, - TEmitted - > - )?.(draftContext, event, enqueue) + ? updater(currentContext, (draftContext) => + ( + assigner as StoreCompleteAssigner + )?.(draftContext, event, enqueue) ) : setter(currentContext, (draftContext) => Object.assign( diff --git a/packages/xstate-store/src/types.ts b/packages/xstate-store/src/types.ts index 9e36ed2ea6..78d60ae7dd 100644 --- a/packages/xstate-store/src/types.ts +++ b/packages/xstate-store/src/types.ts @@ -109,7 +109,7 @@ export interface Store< export type AnyStore = Store; -export type Compute = { [K in keyof A]: A[K] } & unknown; +export type Compute = { [K in keyof A]: A[K] }; export type SnapshotFromStore> = TStore extends Store From a7bd0a1e93eab710bb5771dbdd157650ca6c0027 Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Sat, 28 Sep 2024 14:32:13 -0400 Subject: [PATCH 12/14] Update packages/core/src/types.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Burzyński --- packages/core/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 0263a9fa97..33c53f3e93 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -50,7 +50,7 @@ type ReturnTypeOrValue = T extends AnyFunction ? ReturnType : T; export type IsNever = [T] extends [never] ? true : false; export type IsNotNever = [T] extends [never] ? false : true; -export type Compute = { [K in keyof A]: A[K] }; +export type Compute = { [K in keyof A]: A[K] } & unknown; export type Prop = K extends keyof T ? T[K] : never; export type Values = T[keyof T]; export type Elements = T[keyof T & `${number}`]; From a2c72e36129f1750360a7aba6341419c4efac05d Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Sat, 28 Sep 2024 14:32:19 -0400 Subject: [PATCH 13/14] Update packages/core/src/types.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Burzyński --- packages/core/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 33c53f3e93..18c97738e8 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -485,7 +485,7 @@ export type StateTypes = | 'parallel' | 'final' | 'history' - | ({} & string); // TODO: remove once TS fixes this type-widening issue + | ({} & string); export type SingleOrArray = readonly T[] | T; From 173855724f4802e896fbd9d72fe7d27a509fb47f Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Sat, 28 Sep 2024 14:32:29 -0400 Subject: [PATCH 14/14] Update packages/xstate-inspect/src/server.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Burzyński --- packages/xstate-inspect/src/server.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/xstate-inspect/src/server.ts b/packages/xstate-inspect/src/server.ts index 6c1f8d1eec..2762f0eb74 100644 --- a/packages/xstate-inspect/src/server.ts +++ b/packages/xstate-inspect/src/server.ts @@ -73,8 +73,7 @@ export function inspect(options: ServerInspectorOptions): Inspector { return; } - // eslint-disable-next-line @typescript-eslint/no-base-to-string - const jsonMessage = JSON.parse(data.toString()); + const jsonMessage = JSON.parse(String(data)); inspectService.send({ ...jsonMessage, client