eslint-rspack-plugin 5.0.0: Now a Pure ESM Package

The eslint-rspack-plugin has released version 5.0.0, transitioning to a pure ESM package and removing its CommonJS build.

The Shift to Pure ESM in eslint-rspack-plugin 5.0.0

The primary change in version 5.0.0 is the removal of the CommonJS build. This architectural shift mirrors the strategy used by Rspack 2.0 to ensure consistency across the Rstack ecosystem. For most developers, this change is minimally disruptive; the project notes that Node.js 20 and later can load ESM modules using require(esm), meaning the JavaScript API should remain functional without immediate code changes.

This update brings the plugin into alignment with modern Node.js practices, favoring the ECMAScript Module (ESM) standard over the legacy CommonJS format. Developers moving from the 4.x line are encouraged to verify their toolchains against this ESM requirement.

Pro Tip: When upgrading to 5.0.0, use the configType: 'flat' option to adopt ESLint’s newer flat config format, ensuring your linting setup stays current with the broader ESLint ecosystem.

Core Functionality and Configuration Options

The plugin continues to integrate ESLint directly into the Rspack compilation process. In watch mode, it optimizes performance by re-running checks only on files that Rspack has modified. Because the tool was originally forked from eslint-webpack-plugin, the configuration remains familiar to those experienced with webpack.

Key options available in the 5.x line include:

  • Caching: Enabled by default to minimize execution time across builds.
  • Threads: Allows linting tasks to be distributed across a thread pool for better concurrency.
  • lintAllFiles: Ensures every matching file is linted, rather than just those in the dependency graph. This is specifically useful for multi-environment Rsbuild and Rspack builds where client and server passes might otherwise miss certain files.

The Performance Trade-off: Bundler Linting vs. Standalone Tools

Despite the available optimizations, the project README cautions that running ESLint during the build can lead to longer compilation times. The documentation suggests that users may find it more efficient to avoid the plugin in favor of a separate lint command.

This same performance warning is echoed in the Rsbuild FAQ and within @rsbuild/plugin-eslint. The Rsbuild team explicitly states that Rsbuild does not run ESLint during builds by default to “protect compilation performance.”

Did you know? The Rstack team has introduced Rslint, a TypeScript-first linter written in Go. According to the team, Rslint delivers linting speeds 20 to 40 times faster than traditional ESLint setups.

Comparing Linting Strategies

Method Integration Primary Advantage Primary Drawback
eslint-rspack-plugin Inside Bundler Immediate feedback during build Slower compilation times
Standalone ESLint Separate Script Faster build cycles Manual or CI-triggered execution
Rslint External/Go-powered 20-40x faster execution Newer ecosystem tooling

Future Trends in Build-Time Linting

The transition toward pure ESM and the development of Go-based tools like Rslint indicate a broader industry shift.

ERROR [eslint] Plugin “react” was conflicted between “package.json » eslint-config-react-app »

Frequently Asked Questions

Do I need to change my code for eslint-rspack-plugin 5.0.0?
If you are using Node.js 20 or later, the project states most users should see little practical impact and require no code changes due to require(esm) support.

Why is my build slower when using this plugin?
According to the project README, running ESLint during the build process adds execution time to the compilation, which is why a separate lint command is often recommended.

What is the difference between the classic and flat config?
The classic format uses .eslintrc files, while the “flat config” is ESLint’s newer configuration system. You can switch between them using the configType option in the plugin.

Leave a Comment