From 9ec2bf237a2cb520175b6d978acefe6c35270846 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 10:00:29 -0700 Subject: [PATCH 1/6] pin node 22 version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceb2e2d..92b2ffa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.1.x] os: [ubuntu-latest, windows-latest] exclude: - os: windows-latest From 2ca51429fdd81ab2c5aa4e3ce94ab40e55ab6cca Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 12:08:22 -0700 Subject: [PATCH 2/6] update eslint, pin node 22.0.x --- .eslintrc.json | 124 ------------------------------------- .github/workflows/test.yml | 2 +- eslint.config.js | 107 ++++++++++++++++++++++++++++++++ package.json | 11 ++-- 4 files changed, 114 insertions(+), 130 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 26f5eae..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "plugins": [], - "ignorePatterns": [ - "dist", - "importsJSONfile.with.js", - "importsJSONfile.assert.legacy.js" - ], - "extends": [ - "eslint:recommended", - "plugin:markdown/recommended" - ], - "env": { - "node": true, - "jest": true - }, - "parserOptions": { - "sourceType": "module", - "ecmaVersion": "latest", - "allowImportExportEverywhere": true - }, - "globals": { - "Set": true - }, - "rules": { - "no-trailing-spaces": [2], - "no-unused-vars": [ "error", { - "vars": "all", - "args": "after-used", - "ignoreRestSiblings": false - }], - "global-require": 0, - "no-sequences": 0, - "strict": [2, "never"], - "one-var": [2, { - "let": "always", - "const": "never" - }], - "space-in-parens": [2, "never" ], - "import/newline-after-import": 0, - "indent": [2, 2, { - "flatTernaryExpressions": true, - "VariableDeclarator": { - "let": 2, - "const": 3 - } - }], - "camelcase": [2, {"properties": "never"}], - "no-underscore-dangle": 0, - "func-names": [2, "never"], - "newline-per-chained-call": 0, - "max-len": [2, 80], - "comma-dangle": [2, "never"], - "no-mixed-operators": 0, - "no-plusplus": 0, - "no-console": 0, - "semi": [2, "never"], - "nonblock-statement-body-position": 0, - "arrow-parens": [2, "as-needed"], - "space-before-function-paren": [2, "always"], - "function-paren-newline": 0, - "consistent-return": 0, - "array-callback-return": 0, - "prefer-const": 0, - "prefer-object-spread": 0, - "curly": 0, - "operator-linebreak": 0, - "no-param-reassign": 0, - "key-spacing": [2], - "implicit-arrow-linebreak": 0, - "no-shadow": [0, "warn", { - "allow": [ "err" ] - } - ], - "prefer-arrow-callback": [2, { - "allowNamedFunctions": true - }], - "no-return-assign": 0, - "no-use-before-define": [2, "nofunc"], - "no-nested-ternary": 0, - "array-bracket-spacing": [2, "never"], - "prefer-destructuring": 0, - "class-methods-use-this": 0, - "no-confusing-arrow": 0 - }, - "overrides": [{ - "files": ["*.ts"], - "plugins": ["@typescript-eslint"], - "extends": ["plugin:@typescript-eslint/recommended"], - "parser": "@typescript-eslint/parser", - "rules": { - "@typescript-eslint/semi": ["error", "never"], - "@typescript-eslint/no-explicit-any": 0, - "no-extra-semi": "off", - "@typescript-eslint/no-extra-semi": "error", - "comma-dangle": "off", - "@typescript-eslint/comma-dangle": ["error", { - "tuples": "never", - "arrays": "never", - "objects": "never", - "imports": "never", - "exports": "never", - "functions": "never" - }], - "@typescript-eslint/member-delimiter-style": ["error", { - "multiline": { - "delimiter": "comma", - "requireLast": false - }, - "singleline": { - "delimiter": "comma", - "requireLast": false - }, - "overrides": { - "interface": { - "multiline": { - "delimiter": "semi", - "requireLast": false - } - } - } - }] - } - }] -} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92b2ffa..af3d607 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.1.x] + node-version: [18.x, 20.x, 22.0.x] os: [ubuntu-latest, windows-latest] exclude: - os: windows-latest diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..f3e5700 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,107 @@ +import js from '@eslint/js' +import markdown from 'eslint-plugin-markdown' +import tseslint from 'typescript-eslint' + +export default [ + { + ignores: [ + "tests/**/dist", + "tests/local/importsJSONfile.with.js", + "tests/local/importsJSONfile.assert.legacy.js" + ] + }, + js.configs.recommended, + ...tseslint.configs.recommended, + { + files: ["**/*.ts", "**/*.js"], + rules: { + "@typescript-eslint/no-unused-expressions": 0, + "@typescript-eslint/no-explicit-any": 0, + "comma-dangle": "off" + } + }, + ...markdown.configs.recommended, + { + ignores: [ + "src/esmock.d.ts" + ], + languageOptions: { + ecmaVersion: 2022, + sourceType: "module", + globals: { + Set: true, + console: true, + setTimeout: true, + fetch: true, + process: true, + URL: true, + global: true, + describe: true, + it: true, + test: true, + expect: true + } + }, + rules: { + "no-trailing-spaces": [2], + "no-unused-vars": ["error", { + "vars": "all", + "args": "after-used", + "ignoreRestSiblings": false + }], + "global-require": 0, + "no-sequences": 0, + "strict": [2, "never"], + "one-var": [2, { + "let": "always", + "const": "never" + }], + "space-in-parens": [2, "never"], + "import/newline-after-import": 0, + "indent": [2, 2, { + "flatTernaryExpressions": true, + "VariableDeclarator": { + "let": 2, + "const": 3 + } + }], + "camelcase": [2, {"properties": "never"}], + "no-underscore-dangle": 0, + "func-names": [2, "never"], + "newline-per-chained-call": 0, + "max-len": [2, 80], + "comma-dangle": [2, "never"], + "no-mixed-operators": 0, + "no-plusplus": 0, + "no-console": 0, + "semi": [2, "never"], + "nonblock-statement-body-position": 0, + "arrow-parens": [2, "as-needed"], + "space-before-function-paren": [2, "always"], + "function-paren-newline": 0, + "consistent-return": 0, + "array-callback-return": 0, + "prefer-const": 0, + "prefer-object-spread": 0, + "curly": 0, + "operator-linebreak": 0, + "no-param-reassign": 0, + "key-spacing": [2], + "implicit-arrow-linebreak": 0, + "no-shadow": [0, "warn", { + "allow": ["err"] + } + ], + "prefer-arrow-callback": [2, { + "allowNamedFunctions": true + }], + "no-return-assign": 0, + "no-use-before-define": [2, "nofunc"], + "no-nested-ternary": 0, + "array-bracket-spacing": [2, "never"], + "prefer-destructuring": 0, + "class-methods-use-this": 0, + "no-confusing-arrow": 0 + } + } +] diff --git a/package.json b/package.json index 3fe1028..e311708 100644 --- a/package.json +++ b/package.json @@ -63,11 +63,12 @@ "resolvewithplus": "^2.1.5" }, "devDependencies": { - "c8": "^9.1.0", - "eslint": "^8.57.0", - "eslint-plugin-markdown": "^3.0.1", - "@typescript-eslint/parser": "^7.1.0", - "@typescript-eslint/eslint-plugin": "^7.1.0" + "c8": "^10.1.2", + "eslint": "^9.5.0", + "eslint-plugin-markdown": "^5.0.0", + "typescript-eslint": "^8.0.0-alpha.30", + "@typescript-eslint/parser": "^8.0.0-alpha.30", + "@typescript-eslint/eslint-plugin": "^8.0.0-alpha.30" }, "scripts": { "test:install": "cd tests && npm run install:all", From d5bf4769e9c75b806da58d84d9d4bc488cbfcef3 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 12:11:16 -0700 Subject: [PATCH 3/6] pin node 22.1 for tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af3d607..92b2ffa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.0.x] + node-version: [18.x, 20.x, 22.1.x] os: [ubuntu-latest, windows-latest] exclude: - os: windows-latest From 0f083ab25d91191344f29f6e6ed0a5245d66eaff Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 12:17:01 -0700 Subject: [PATCH 4/6] remove exclude directive from test ci spec --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92b2ffa..5575bdd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,9 +15,6 @@ jobs: matrix: node-version: [18.x, 20.x, 22.1.x] os: [ubuntu-latest, windows-latest] - exclude: - - os: windows-latest - node-version: 22.x steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 3d88ca8b27c9b7a98d2624789c7bdf42d89d5fd9 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 12:22:23 -0700 Subject: [PATCH 5/6] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fabe64..757962f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ _**Note: For versions of node prior to v20.6.0,** "--loader" command line arguments must be used with `esmock` as demonstrated [in the wiki.][4] Current versions of node do not require "--loader"._ -_**Note: TypeScript loaders** `ts-node` 👍, `tsm` 👍 and `tsx` 👍 are compatible with other loaders, [including esmock.][3] `swc-node` has, at time of writing, been demonstrated as **incompatible** with other loaders, including esmock._ +_**Note: TypeScript loader** `swc-node` is, at time of writing, **incompatible** with other loaders, including esmock._ `esmock` has the below signature ```js From 5eb14033bcb3dc4d74e158e8159aa5a2c4835c62 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 15 Jun 2024 12:32:28 -0700 Subject: [PATCH 6/6] update CHANGELOG. clerical change use git+ at test package home --- CHANGELOG.md | 4 ++++ tests/tests-ava/package.json | 2 +- tests/tests-jest-ts/package.json | 2 +- tests/tests-jest/package.json | 2 +- tests/tests-mocha/package.json | 2 +- tests/tests-no-loader/package.json | 2 +- tests/tests-node/package.json | 2 +- tests/tests-nodets/package.json | 2 +- tests/tests-source-map/package.json | 2 +- tests/tests-tsm/package.json | 2 +- tests/tests-tsx/package.json | 2 +- tests/tests-uvu/package.json | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5210f65..9436ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # changelog + * 2.6.6 _Jun.15.2024_ + * [add tsx tests and remove tsx caution from README](https://github.com/iambumblehead/esmock/pull/305) thanks @galexite + * [pin node 22.1 at test CI](https://github.com/iambumblehead/esmock/pull/306) and ignore regressions in new node 22 + * [migrate to eslint 9](https://github.com/iambumblehead/esmock/pull/306) * 2.6.5 _Apr.25.2024_ * [add node 22 to ci test pipeline](https://github.com/iambumblehead/esmock/pull/297) thanks @aladdin-add * [use json import syntax `with { type: 'json' }`](https://github.com/iambumblehead/esmock/pull/298) for node 22 diff --git a/tests/tests-ava/package.json b/tests/tests-ava/package.json index bcf7eea..457ac90 100644 --- a/tests/tests-ava/package.json +++ b/tests/tests-ava/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, ava", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "ava": "^5.3.1", diff --git a/tests/tests-jest-ts/package.json b/tests/tests-jest-ts/package.json index 40cff77..89eba7b 100644 --- a/tests/tests-jest-ts/package.json +++ b/tests/tests-jest-ts/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, jest with jest-light-runner", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "ts-node": "^10.9.1", diff --git a/tests/tests-jest/package.json b/tests/tests-jest/package.json index d5a5077..217efd7 100644 --- a/tests/tests-jest/package.json +++ b/tests/tests-jest/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, jest with jest-light-runner", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "jest": "^29.6.2", diff --git a/tests/tests-mocha/package.json b/tests/tests-mocha/package.json index 8034907..27fa761 100644 --- a/tests/tests-mocha/package.json +++ b/tests/tests-mocha/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, mocha", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "mocha": "^10.2.0", diff --git a/tests/tests-no-loader/package.json b/tests/tests-no-loader/package.json index 6015362..a5bce05 100644 --- a/tests/tests-no-loader/package.json +++ b/tests/tests-no-loader/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, no loader should error", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "esmock": "file:..", diff --git a/tests/tests-node/package.json b/tests/tests-node/package.json index 5427e7c..5bf8edd 100644 --- a/tests/tests-node/package.json +++ b/tests/tests-node/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, node native runner", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "esmock": "file:..", diff --git a/tests/tests-nodets/package.json b/tests/tests-nodets/package.json index 1af42a2..7ae9dbc 100644 --- a/tests/tests-nodets/package.json +++ b/tests/tests-nodets/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, ts-node/esm with node native runner", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "ts-node": "^10.9.1", diff --git a/tests/tests-source-map/package.json b/tests/tests-source-map/package.json index 46c464d..bd631b2 100644 --- a/tests/tests-source-map/package.json +++ b/tests/tests-source-map/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, ava with sourcemap", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "esmock": "file:..", diff --git a/tests/tests-tsm/package.json b/tests/tests-tsm/package.json index 4869fe9..2db35d5 100644 --- a/tests/tests-tsm/package.json +++ b/tests/tests-tsm/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, tsm with node native runner", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "tsm": "^2.3.0", diff --git a/tests/tests-tsx/package.json b/tests/tests-tsx/package.json index 3deafcd..dfe9354 100644 --- a/tests/tests-tsx/package.json +++ b/tests/tests-tsx/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, tsx with node", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "esmock": "file:..", diff --git a/tests/tests-uvu/package.json b/tests/tests-uvu/package.json index d8f9a39..de32efa 100644 --- a/tests/tests-uvu/package.json +++ b/tests/tests-uvu/package.json @@ -3,7 +3,7 @@ "description": "esmock unit tests, uvu", "repository": { "type": "git", - "url": "https://github.com/iambumblehead/esmock.git" + "url": "git+https://github.com/iambumblehead/esmock.git" }, "dependencies": { "uvu": "^0.5.6",