diff --git a/eslint.config.js b/eslint.config.js index 9c46578..77d41c5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,11 +5,11 @@ import nodePlugin from 'eslint-plugin-n' export default tseslint.config( eslint.configs.recommended, nodePlugin.configs['flat/recommended'], - ...tseslint.configs.recommended, + ...tseslint.configs.strictTypeChecked, { languageOptions: { parserOptions: { - project: './tsconfig.meta.json', + project: './tsconfig.json', }, }, rules: { @@ -57,6 +57,12 @@ export default tseslint.config( ], }, }, + { + files: ['test/*'], + rules: { + '@typescript-eslint/no-floating-promises': 'off', + }, + }, { ignores: ['dist', 'coverage', 'eslint.config.js'], }, diff --git a/package-lock.json b/package-lock.json index 1880318..de83982 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "prettier": "^3.3.0", "tsx": "^4.12.0", "typescript": "^5.4.5", - "typescript-eslint": "^8.0.0-alpha.28" + "typescript-eslint": "^8.0.0-alpha.30" }, "engines": { "node": ">=20.0.0" @@ -1344,16 +1344,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.0-alpha.28.tgz", - "integrity": "sha512-LsTbTdXiF7rP/H/ni85ia+01WmLBkkOq5sAi60OqHRa7mv7FTbwmiPwQ3hcHmXWxZFkHVy7hXXfBhwZzbbsaIA==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.0-alpha.30.tgz", + "integrity": "sha512-2CBUupdkfbE3eATph4QeZejvT+M+1bVur+zXlVx09WN31phap51ps/qemeclnCbGEz6kTgBDmScrr9XmmF8/Pg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.0.0-alpha.28", - "@typescript-eslint/type-utils": "8.0.0-alpha.28", - "@typescript-eslint/utils": "8.0.0-alpha.28", - "@typescript-eslint/visitor-keys": "8.0.0-alpha.28", + "@typescript-eslint/scope-manager": "8.0.0-alpha.30", + "@typescript-eslint/type-utils": "8.0.0-alpha.30", + "@typescript-eslint/utils": "8.0.0-alpha.30", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.30", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1377,15 +1377,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.0-alpha.28.tgz", - "integrity": "sha512-44N1MlwmhMUJ0jyrGuWe093wywcCIVu7I7Ge1H15HXCRIB7ptpSf3GJZRCDpumuEUKkVxoL8rdLixMnVDWyT2w==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.0-alpha.30.tgz", + "integrity": "sha512-tAYgFmgXU1MlCK3nbblUvJlDSibBvxtAQXGrF3IG0KmnRza9FXILZifHWL0rrwacDn40K53K607Fk2QkMjiGgw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.0.0-alpha.28", - "@typescript-eslint/types": "8.0.0-alpha.28", - "@typescript-eslint/typescript-estree": "8.0.0-alpha.28", - "@typescript-eslint/visitor-keys": "8.0.0-alpha.28", + "@typescript-eslint/scope-manager": "8.0.0-alpha.30", + "@typescript-eslint/types": "8.0.0-alpha.30", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.30", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.30", "debug": "^4.3.4" }, "engines": { @@ -1405,13 +1405,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.0-alpha.28.tgz", - "integrity": "sha512-Iq8QFmJ2DH2tx7jfOraMZM1Y1axRfWh4t29JXRgbzvgiDQ2uHRHcaXqTulqsZXzJ0+vERNvNkOIPcQYGsNeGVQ==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.0-alpha.30.tgz", + "integrity": "sha512-FGW/iPWGyPFamAVZ60oCAthMqQrqafUGebF8UKuq/ha+e9SVG6YhJoRzurlQXOVf8dHfOhJ0ADMXyFnMc53clg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0-alpha.28", - "@typescript-eslint/visitor-keys": "8.0.0-alpha.28" + "@typescript-eslint/types": "8.0.0-alpha.30", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.30" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1422,13 +1422,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.0-alpha.28.tgz", - "integrity": "sha512-Ta7vf3DtAakaeLEFGEnMGcfRtFV38PSLD+PvLT2xkof3vz5exKv4KYMyjAlNJmrhLzHwGWvHbt6IN8HoWwYnCw==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.0-alpha.30.tgz", + "integrity": "sha512-FrnhlCKEKZKRbpDviHkIU9tayIUGTOfa+SjvrRv6p/AJIUv6QT8oRboRjLH/cCuwUEbM0k5UtRWYug4albHUqQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.0.0-alpha.28", - "@typescript-eslint/utils": "8.0.0-alpha.28", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.30", + "@typescript-eslint/utils": "8.0.0-alpha.30", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1446,9 +1446,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.0-alpha.28.tgz", - "integrity": "sha512-HYg+e0EWVShx0FEX0MAjDinYLmd+wD6nGMpbaddB1iACYwqaJFbf7vw0l+hdLTJvQC6UY8ndRkaEsL68QEoIZQ==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.0-alpha.30.tgz", + "integrity": "sha512-4WzLlw27SO9pK9UFj/Hu7WGo8WveT0SEiIpFVsV2WwtQmLps6kouwtVCB8GJPZKJyurhZhcqCoQVQFmpv441Vg==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1459,13 +1459,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.0-alpha.28.tgz", - "integrity": "sha512-I/5ODd4XJ+TO0XrKwDaB4tVGVi6kz2LAlN3WPd7mZVVtW21HHByCILRhOF9RbC69gJQ/TGHFpWCmAcsq2RZisg==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.0-alpha.30.tgz", + "integrity": "sha512-WSXbc9ZcXI+7yC+6q95u77i8FXz6HOLsw3ST+vMUlFy1lFbXyFL/3e6HDKQCm2Clt0krnoCPiTGvIn+GkYPn4Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0-alpha.28", - "@typescript-eslint/visitor-keys": "8.0.0-alpha.28", + "@typescript-eslint/types": "8.0.0-alpha.30", + "@typescript-eslint/visitor-keys": "8.0.0-alpha.30", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1511,15 +1511,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.0-alpha.28.tgz", - "integrity": "sha512-PnIz94+nbyjJisMI+KZqXMfw0wfIHvbyh0MGEx2M314wqm6SUWcxB5I8zduGQgJbRB0YFnboPS+MeSlBYPWrBQ==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.0-alpha.30.tgz", + "integrity": "sha512-rfhqfLqFyXhHNDwMnHiVGxl/Z2q/3guQ1jLlGQ0hi9Rb7inmwz42crM+NnLPR+2vEnwyw1P/g7fnQgQ3qvFx4g==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.0.0-alpha.28", - "@typescript-eslint/types": "8.0.0-alpha.28", - "@typescript-eslint/typescript-estree": "8.0.0-alpha.28" + "@typescript-eslint/scope-manager": "8.0.0-alpha.30", + "@typescript-eslint/types": "8.0.0-alpha.30", + "@typescript-eslint/typescript-estree": "8.0.0-alpha.30" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1533,12 +1533,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.0-alpha.28.tgz", - "integrity": "sha512-+ewAOeKDycydKMlnfmW8zAURTA8PR5Csyvxy6PJt4XRYjoquode9/eWaMt9Sp4Rz1FGMSVU9KxDRR83ASH/xkQ==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.0-alpha.30.tgz", + "integrity": "sha512-XZuNurZxBqmr6ZIRIwWFq7j5RZd6ZlkId/HZEWyfciK+CWoyOxSF9Pv2VXH9Rlu2ZG2PfbhLz2Veszl4Pfn7yA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0-alpha.28", + "@typescript-eslint/types": "8.0.0-alpha.30", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -3489,14 +3489,14 @@ } }, "node_modules/typescript-eslint": { - "version": "8.0.0-alpha.28", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.0.0-alpha.28.tgz", - "integrity": "sha512-hCJMQp3fOwt7o3V8ETQoMK+6yctfN++Rq9rQ8cukTfu/oCLkUycuez2TqBbkkkGxT/prqRNteU72RxiregqgWw==", + "version": "8.0.0-alpha.30", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.0.0-alpha.30.tgz", + "integrity": "sha512-/vGhBMsK1TpadQh1eQ02c5pyiPGmKR9cVzX5C9plZ+LC0HPLpWoJbbTVfQN7BkIK7tUxDt2BFr3pFL5hDDrx7g==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.0.0-alpha.28", - "@typescript-eslint/parser": "8.0.0-alpha.28", - "@typescript-eslint/utils": "8.0.0-alpha.28" + "@typescript-eslint/eslint-plugin": "8.0.0-alpha.30", + "@typescript-eslint/parser": "8.0.0-alpha.30", + "@typescript-eslint/utils": "8.0.0-alpha.30" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" diff --git a/package.json b/package.json index cfb9284..221ee3a 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "engineStrict": true, "scripts": { "prettier": "prettier -w .", - "lint": "eslint --ignore-pattern dist .", - "lint:fix": "eslint --ignore-pattern dist --fix .", + "lint": "eslint .", + "lint:fix": "eslint --fix .", "build": "duel --dirs", "test": "c8 --reporter=text --reporter=text-summary --reporter=lcov tsx --test --test-reporter=spec test/*.ts", "prepack": "npm run build" @@ -77,7 +77,7 @@ "prettier": "^3.3.0", "tsx": "^4.12.0", "typescript": "^5.4.5", - "typescript-eslint": "^8.0.0-alpha.28" + "typescript-eslint": "^8.0.0-alpha.30" }, "dependencies": { "acorn-walk": "^8.3.2" diff --git a/src/baseVisitor.ts b/src/baseVisitor.ts index aead3e4..5aa61ed 100644 --- a/src/baseVisitor.ts +++ b/src/baseVisitor.ts @@ -71,10 +71,8 @@ export class BaseVisitor implements Required> { CallExpression(n: swc.CallExpression, st: S, cb: Callback) { cb(n.callee, st) - if (n.arguments) { - for (const arg of n.arguments) { - cb(arg.expression, st) - } + for (const arg of n.arguments) { + cb(arg.expression, st) } if (n.typeArguments) { @@ -82,13 +80,11 @@ export class BaseVisitor implements Required> { } } CatchClause(n: swc.CatchClause, st: S, cb: Callback) { - if (n) { - if (n.param) { - cb(n.param, st) - } - - cb(n.body, st) + if (n.param) { + cb(n.param, st) } + + cb(n.body, st) } ClassDeclaration(_n: swc.ClassDeclaration, _st: S, _cb: Callback) { // not implemented diff --git a/tsconfig.json b/tsconfig.json index 506f629..2f160f0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,5 @@ "outDir": "dist", "target": "ESNext" }, - "references": [{ "path": "./tsconfig.meta.json" }], - "include": ["src"] + "include": ["src", "test", "eslint.config.js"] } diff --git a/tsconfig.meta.json b/tsconfig.meta.json deleted file mode 100644 index 6cee89f..0000000 --- a/tsconfig.meta.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "composite": true - }, - "extends": "./tsconfig.json", - "include": ["src", "test", "eslint.config.js"] -}