Skip to content

Commit 41b0f53

Browse files
fix: convert back-slashes (#186)
1 parent 9b37d90 commit 41b0f53

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/LintDirtyModulesPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class LintDirtyModulesPlugin {
2020
}
2121

2222
const dirtyOptions = { ...this.options };
23-
const glob = dirtyOptions.files.join('|');
23+
const glob = dirtyOptions.files.join('|').replace(/\\/g, '/');
2424
const changedFiles = this.getChangedFiles(compilation.fileTimestamps, glob);
2525

2626
this.prevTimestamps = compilation.fileTimestamps;

test/lint-dirty-modules-only.test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('lint dirty modules only', () => {
1212
beforeAll(() => {
1313
callback = jest.fn();
1414

15-
plugin = new LintDirtyModulesPlugin(null, { files: ['**/*.s?(c|a)ss'] });
15+
plugin = new LintDirtyModulesPlugin(null, { files: ['**\\*.s?(c|a)ss'] });
1616
plugin.isFirstRun = false;
1717
});
1818

@@ -32,9 +32,16 @@ describe('lint dirty modules only', () => {
3232
});
3333

3434
it('linting on change file', () => {
35-
const fileTimestamps = new Map([['changed.scss', 1], ['new-file.scss']]);
36-
37-
plugin.prevTimestamps = new Map([['changed.scss', 2]]);
35+
const fileTimestamps = new Map([
36+
['foo/changed.scss', 1],
37+
['bar\\changed.scss', 1],
38+
['new-file.scss'],
39+
]);
40+
41+
plugin.prevTimestamps = new Map([
42+
['foo/changed.scss', 2],
43+
['bar\\changed.scss', 2],
44+
]);
3845
plugin.apply({ fileTimestamps }, callback);
3946

4047
expect(linter).toBeCalledTimes(1);

0 commit comments

Comments
 (0)