diff --git a/.eslintrc.json b/.eslintrc.json index 0985a7d..d8dd055 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,6 +21,7 @@ "Set": true }, "rules": { + "no-trailing-spaces": [2], "no-unused-vars": [ "error", { "vars": "all", "args": "after-used", diff --git a/CHANGELOG.md b/CHANGELOG.md index b265949..7034e6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * 2.6.1 _???.??.2023_ * [update README to work w/ eslint-plugin-markdown](https://github.com/iambumblehead/esmock/pull/275) + * [update eslint](https://github.com/iambumblehead/esmock/pull/276) disallow trailing whitespace * 2.6.0 _Nov.07.2023_ * [typings: make MockFunction generic,](https://github.com/iambumblehead/esmock/pull/267) thanks @uwinkelvos * 2.5.9 _Nov.01.2023_ diff --git a/src/esmock.d.ts b/src/esmock.d.ts index 6e17319..e8e35b0 100644 --- a/src/esmock.d.ts +++ b/src/esmock.d.ts @@ -93,5 +93,5 @@ export { type MockFunction, type MockMap, type Options, - type Resolver + type Resolver } diff --git a/src/esmockModule.js b/src/esmockModule.js index 214b0af..31ade8f 100644 --- a/src/esmockModule.js +++ b/src/esmockModule.js @@ -24,7 +24,7 @@ const isJSONExtnRe = /\.json$/i // assigning the object to its own prototypal inheritor can error, eg // 'Cannot assign to read only property \'F_OK\' of object \'#\'' -// +// // if not plain obj, assign enumerable vals only. core modules === plain obj const esmockModuleMerge = (defLive, def) => isPlainObj(defLive) ? Object.assign({}, defLive, def) diff --git a/tests/local/pnp/enable.js b/tests/local/pnp/enable.js index bbbbd68..0da6644 100644 --- a/tests/local/pnp/enable.js +++ b/tests/local/pnp/enable.js @@ -6,7 +6,7 @@ async function resolve (specifier, context, next) { ? '../tests/local/pnp/api.js' : specifier, context) } - + module.register && (process.versions.pnp = '3') && module.register(` data:text/javascript, export ${encodeURIComponent(resolve)}`.slice(1)) diff --git a/tests/tests-node/esmock.node.resolver-pnp.test.js b/tests/tests-node/esmock.node.resolver-pnp.test.js index 02825ce..ffac726 100644 --- a/tests/tests-node/esmock.node.resolver-pnp.test.js +++ b/tests/tests-node/esmock.node.resolver-pnp.test.js @@ -20,7 +20,7 @@ test.beforeEach(() => { test('should work with pnp resolver', async ({ mock }) => { if (!module.register) return assert.ok('skip test') - + pnpapi.resolveRequest = mock.fn(resolver) const main = await esmock('../local/main.js', { diff --git a/tests/tests-node/esmock.node.test.js b/tests/tests-node/esmock.node.test.js index 8b02f1f..60952c1 100644 --- a/tests/tests-node/esmock.node.test.js +++ b/tests/tests-node/esmock.node.test.js @@ -559,7 +559,7 @@ test('should mock imported json', async () => { if (/^(18|20)$/.test(process.versions.node.split('.')[0])) return assert.ok(true) - + assert.strictEqual( Object.keys(importsJSON.JSONobj).sort().join(), 'example,test-example') assert.strictEqual(importsJSON.JSONobj['test-example'], 'test-json-a') @@ -576,7 +576,7 @@ test('should mock imported json (strict)', async () => { if (/^(18|20)$/.test(process.versions.node.split('.')[0])) return assert.ok(true) - + assert.strictEqual( Object.keys(importsJSON.JSONobj).sort().join(), 'test-example') assert.strictEqual(importsJSON.JSONobj['test-example'], 'test-json-b')