From f2faf7f0ed150ec9fe1813e1c02d48946f05843c Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 21 Dec 2020 18:46:54 -0500 Subject: [PATCH 1/4] fix: strip resource query --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 65ceb83..bc86da5 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ import { isAbsolute, join } from 'path'; +import { parse } from 'url'; import arrify from 'arrify'; import micromatch from 'micromatch'; @@ -80,7 +81,7 @@ export class ESLintWebpackPlugin { // @ts-ignore const processModule = (module) => { - const file = module.resource; + const file = parse(module.resource).pathname; if ( file && From 730012ffb62dcb5efb9ab329f80ee503e821ef24 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Tue, 22 Dec 2020 01:06:16 -0500 Subject: [PATCH 2/4] test: resource query test --- test/fixtures/query-entry.js | 2 ++ test/query.test.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/fixtures/query-entry.js create mode 100644 test/query.test.js diff --git a/test/fixtures/query-entry.js b/test/fixtures/query-entry.js new file mode 100644 index 0000000..754e097 --- /dev/null +++ b/test/fixtures/query-entry.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line import/no-unresolved +require('./good.js?some-query=1234.js'); diff --git a/test/query.test.js b/test/query.test.js new file mode 100644 index 0000000..0cdb75b --- /dev/null +++ b/test/query.test.js @@ -0,0 +1,15 @@ +import pack from './utils/pack'; + +describe('query', () => { + it('should correctly resolve file despite query path', (done) => { + const compiler = pack('query'); + + compiler.run((err, stats) => { + expect(err).toBeNull(); + expect(stats.hasWarnings()).toBe(false); + expect(stats.hasErrors()).toBe(false); + + done(); + }); + }); +}); From 34acbb7355223b4f3f8fc54c6e87a735f2b6c7d9 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Tue, 22 Dec 2020 12:46:06 -0500 Subject: [PATCH 3/4] refactor: split by ? instead of url.parse --- src/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index bc86da5..d6d6b42 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,4 @@ import { isAbsolute, join } from 'path'; -import { parse } from 'url'; import arrify from 'arrify'; import micromatch from 'micromatch'; @@ -81,7 +80,7 @@ export class ESLintWebpackPlugin { // @ts-ignore const processModule = (module) => { - const file = parse(module.resource).pathname; + const file = module.resource.split('?')[0]; if ( file && From 8ed4f534d1eb12c3180e9073fe04ccde29f087e8 Mon Sep 17 00:00:00 2001 From: Ricardo Gobbo de Souza Date: Tue, 19 Jan 2021 08:45:22 -0300 Subject: [PATCH 4/4] chore: update lock files --- package-lock.json | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae87acf..cfae8fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "requires": true, "packages": { "": { - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "dependencies": { "@types/eslint": "^7.2.4", @@ -8481,13 +8481,10 @@ "dev": true }, "node_modules/ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true, - "engines": { - "node": "*" - } + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true }, "node_modules/interpret": { "version": "1.4.0", @@ -22331,9 +22328,9 @@ "dev": true }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": {