Comments (11)
There is a watch mode test. Could you make a test case that fails?
I've modified watch.test.js
. expect(message).toEqual(expect.stringMatching('prefer-const'));
fails in thirdPass()
. It passes in secondPass()
but the file has not changed.
// watch.test.js
import { join } from 'path';
import { writeFileSync } from 'fs';
import { removeSync } from 'fs-extra';
import pack from './utils/pack';
const target = join(__dirname, 'fixtures', 'watch-entry.js');
const target2 = join(__dirname, 'fixtures', 'watch-entry-2.js');
const targetExpectedPattern = expect.stringMatching(
target.replace(/\\/g, '\\\\')
);
describe('watch', () => {
afterEach(() => {
removeSync(target);
});
it('should watch', (done) => {
const compiler = pack('good');
const watch = compiler.watch({}, (err, stats) => {
watch.close();
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(false);
done();
});
});
it('should watch with unique messages', (done) => {
writeFileSync(target, 'var foo = stuff\n');
let next = firstPass;
const compiler = pack('watch');
const watch = compiler.watch({}, (err, stats) => next(err, stats));
function firstPass(err, stats) {
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(true);
const { errors } = stats.compilation;
expect(errors.length).toBe(1);
const [{ message }] = errors;
expect(message).toEqual(targetExpectedPattern);
expect(message).toEqual(expect.stringMatching('\\(3 errors,'));
next = secondPass;
writeFileSync(target2, "let bar = false;\n");
writeFileSync(target, "const x = require('./watch-entry-2.js')\n\nconst foo = false;\n");
}
function secondPass(err, stats) {
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(true);
const { errors } = stats.compilation;
expect(errors.length).toBe(1);
const [{ message }] = errors;
expect(message).toEqual(targetExpectedPattern);
expect(message).toEqual(expect.stringMatching('no-unused-vars'));
expect(message).toEqual(expect.stringMatching('prefer-const')); // `prefer-const` passes here
expect(message).toEqual(expect.stringMatching('\\(4 errors,'));
next = thirdPass;
writeFileSync(target, "const x = require('./watch-entry-2.js')\nconst foo = 0\n");
}
function thirdPass(err, stats) {
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(true);
const { errors } = stats.compilation;
expect(errors.length).toBe(1);
const [{ message }] = errors;
expect(message).toEqual(targetExpectedPattern);
expect(message).toEqual(expect.stringMatching('no-unused-vars'));
expect(message).toEqual(expect.stringMatching('prefer-const')); // `prefer-const` fails here
expect(message).toEqual(expect.stringMatching('\\(1 error,'));
next = finish;
writeFileSync(
target,
'/* eslint-disable no-unused-vars */\nconst foo = false;\n'
);
}
function finish(err, stats) {
watch.close();
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(false);
done();
}
});
});
from eslint-webpack-plugin.
@inker
I haven't released 2.4.1 yet 😬
from eslint-webpack-plugin.
@ricardogobbosouza I fixed one last edge case for this
from eslint-webpack-plugin.
the thread pool is now disabled by default. As a bonus, the pool will only be used for the initial completion.
from eslint-webpack-plugin.
Guessing, by reading changes, but is it possibly related to this:
eslint-webpack-plugin/src/index.js
Lines 28 to 38 in 8287872
and this
eslint-webpack-plugin/src/index.js
Lines 43 to 50 in 8287872
Blocking re-running of this.run
for watch?
from eslint-webpack-plugin.
There is a watch mode test. Could you make a test case that fails?
from eslint-webpack-plugin.
Guessing, by reading changes, but is it possibly related to this:
eslint-webpack-plugin/src/index.js
Lines 28 to 38 in 8287872
and this
eslint-webpack-plugin/src/index.js
Lines 43 to 50 in 8287872
Blocking re-running of
this.run
for watch?
The run method is probably miss named. It's actually registering hooks to a compiler. For watch mode, that compiler lives for the duration of your watch. So those hooks are already present it skips and let's the original hooks process each compilation.
from eslint-webpack-plugin.
I have the exact same issue.
I'm following this issue and waiting for the next fix.
from eslint-webpack-plugin.
Still occurring in 2.4.0.
from eslint-webpack-plugin.
actually the issue was fixed but created another performance issue.
now for each change in some file the build open new nodejs process and take more memory from cpu, that mean while you cding and saving in big projects, you get performance issue, due to for 3 with interval of few seconds create performance issue.
from eslint-webpack-plugin.
Works in 2.4.1. Thanks.
from eslint-webpack-plugin.
Related Issues (20)
- Error with eslint error detection HOT 1
- in webpack-dev-server, rule `@typescript-eslint/no-unsafe-assignment` throws an error when an imported type changed HOT 5
- Error if package.json is not in parent directory to the linted code HOT 2
- Build error in ci tool. HOT 4
- Lint Errors Kill Webpack Watch HOT 2
- Add support to the new eslint.config.js format HOT 6
- Checking/validating json files HOT 4
- v4.0.0 much slower than v3.2.0, potentially due to linting cached webpack files 🤷 HOT 3
- Performance: 4.0 Hot Module Replacement build very slow HOT 5
- Enable `cache` eslint HOT 4
- Can Nuxt2 use eslint-webpack-plugin? HOT 2
- lintDirtyModulesOnly relies on a populated cache, and lints all files if cache is not present HOT 2
- Angular 15+16 compile gets stuck at "70% sealing finish module graph ESLintWebpackPlugin_1" HOT 5
- detect new file issues HOT 2
- TS files that contain only typings are not linted HOT 1
- Run ESLint only on modified files HOT 1
- Add new option `flatConfigFile` HOT 2
- Update for ESLint 9 HOT 2
- 'extensions' has been removed HOT 3
- Update the eslint version to 9 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-webpack-plugin.