@rsbuild/plugin-eslint 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,8 @@ An Rsbuild plugin to run ESLint checks during the compilation.
4
4
 
5
5
  The plugin has integrated [eslint-rspack-plugin](https://www.npmjs.com/package/eslint-rspack-plugin) internally.
6
6
 
7
+ > We do not recommend using the `@rsbuild/plugin-eslint` plugin, as running ESLint during the build process will significantly increase the build time. Instead, we recommend using a separate `lint` command to run ESLint checks.
8
+
7
9
  <p>
8
10
  <a href="https://npmjs.com/package/@rsbuild/plugin-eslint">
9
11
  <img src="https://img.shields.io/npm/v/@rsbuild/plugin-eslint?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
@@ -12,6 +14,8 @@ The plugin has integrated [eslint-rspack-plugin](https://www.npmjs.com/package/e
12
14
  <a href="https://npmcharts.com/compare/@rsbuild/plugin-eslint?minimal=true"><img src="https://img.shields.io/npm/dm/@rsbuild/plugin-eslint.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
13
15
  </p>
14
16
 
17
+ <img width="1496" alt="Screenshot 2025-02-16 at 18 56 32" src="https://github.com/user-attachments/assets/ee4b1915-92ce-4032-834d-b2321f02f1d2" />
18
+
15
19
  ## Usage
16
20
 
17
21
  Install:
package/dist/index.cjs CHANGED
@@ -4,25 +4,17 @@ var __webpack_modules__ = {
4
4
  module.exports = import("eslint-rspack-plugin");
5
5
  }
6
6
  };
7
- /************************************************************************/ // The module cache
8
7
  var __webpack_module_cache__ = {};
9
- // The require function
10
8
  function __webpack_require__(moduleId) {
11
- // Check if module is in cache
12
9
  var cachedModule = __webpack_module_cache__[moduleId];
13
10
  if (void 0 !== cachedModule) return cachedModule.exports;
14
- // Create a new module (and put it into the cache)
15
11
  var module = __webpack_module_cache__[moduleId] = {
16
12
  exports: {}
17
13
  };
18
- // Execute the module function
19
14
  __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
20
- // Return the exports of the module
21
15
  return module.exports;
22
16
  }
23
- /************************************************************************/ // webpack/runtime/compat_get_default_export
24
17
  (()=>{
25
- // getDefaultExport function for compatibility with non-ESM modules
26
18
  __webpack_require__.n = function(module) {
27
19
  var getter = module && module.__esModule ? function() {
28
20
  return module['default'];
@@ -35,7 +27,6 @@ function __webpack_require__(moduleId) {
35
27
  return getter;
36
28
  };
37
29
  })();
38
- // webpack/runtime/define_property_getters
39
30
  (()=>{
40
31
  __webpack_require__.d = function(exports1, definition) {
41
32
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -44,15 +35,12 @@ function __webpack_require__(moduleId) {
44
35
  });
45
36
  };
46
37
  })();
47
- // webpack/runtime/has_own_property
48
38
  (()=>{
49
39
  __webpack_require__.o = function(obj, prop) {
50
40
  return Object.prototype.hasOwnProperty.call(obj, prop);
51
41
  };
52
42
  })();
53
- // webpack/runtime/make_namespace_object
54
43
  (()=>{
55
- // define __esModule on exports
56
44
  __webpack_require__.r = function(exports1) {
57
45
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
58
46
  value: 'Module'
@@ -62,53 +50,52 @@ function __webpack_require__(moduleId) {
62
50
  });
63
51
  };
64
52
  })();
65
- /************************************************************************/ var __webpack_exports__ = {};
66
- // ESM COMPAT FLAG
67
- __webpack_require__.r(__webpack_exports__);
68
- // EXPORTS
69
- __webpack_require__.d(__webpack_exports__, {
70
- pluginEslint: ()=>/* binding */ pluginEslint,
71
- PLUGIN_ESLINT_NAME: ()=>/* binding */ PLUGIN_ESLINT_NAME
72
- });
73
- const external_node_path_namespaceObject = require("node:path");
74
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
75
- const PLUGIN_ESLINT_NAME = 'rsbuild:eslint';
76
- const pluginEslint = (options = {})=>({
77
- name: PLUGIN_ESLINT_NAME,
78
- setup (api) {
79
- const { enable = true, eslintPluginOptions } = options;
80
- if (!enable) return;
81
- api.modifyBundlerChain(async (chain, { environment })=>{
82
- const { distPath } = environment;
83
- // If there is multiple environment, only apply eslint plugin to the first target
84
- // to avoid multiple eslint running at the same time
85
- if (0 !== environment.index) return;
86
- const { default: ESLintPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "eslint-rspack-plugin"));
87
- const defaultOptions = {
88
- extensions: [
89
- 'js',
90
- 'jsx',
91
- 'mjs',
92
- 'cjs',
93
- 'ts',
94
- 'tsx',
95
- 'mts',
96
- 'cts'
97
- ],
98
- exclude: [
99
- 'node_modules',
100
- external_node_path_default().relative(api.context.rootPath, distPath)
101
- ]
102
- };
103
- chain.plugin('eslint').use(ESLintPlugin, [
104
- {
105
- ...defaultOptions,
106
- ...eslintPluginOptions
107
- }
108
- ]);
109
- });
110
- }
53
+ var __webpack_exports__ = {};
54
+ (()=>{
55
+ __webpack_require__.r(__webpack_exports__);
56
+ __webpack_require__.d(__webpack_exports__, {
57
+ PLUGIN_ESLINT_NAME: ()=>PLUGIN_ESLINT_NAME,
58
+ pluginEslint: ()=>pluginEslint
111
59
  });
60
+ const external_node_path_namespaceObject = require("node:path");
61
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
62
+ const PLUGIN_ESLINT_NAME = 'rsbuild:eslint';
63
+ const pluginEslint = (options = {})=>({
64
+ name: PLUGIN_ESLINT_NAME,
65
+ setup (api) {
66
+ const { enable = true, eslintPluginOptions } = options;
67
+ if (!enable) return;
68
+ api.modifyBundlerChain(async (chain, { environment })=>{
69
+ const { distPath } = environment;
70
+ if (0 !== environment.index) return;
71
+ const ESLintPluginModule = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "eslint-rspack-plugin"));
72
+ const ESLintPlugin = ESLintPluginModule.default || ESLintPluginModule;
73
+ const defaultOptions = {
74
+ extensions: [
75
+ 'js',
76
+ 'jsx',
77
+ 'mjs',
78
+ 'cjs',
79
+ 'ts',
80
+ 'tsx',
81
+ 'mts',
82
+ 'cts'
83
+ ],
84
+ exclude: [
85
+ 'node_modules',
86
+ external_node_path_default().relative(api.context.rootPath, distPath)
87
+ ]
88
+ };
89
+ chain.plugin('eslint').use(ESLintPlugin, [
90
+ {
91
+ ...defaultOptions,
92
+ ...eslintPluginOptions
93
+ }
94
+ ]);
95
+ });
96
+ }
97
+ });
98
+ })();
112
99
  var __webpack_export_target__ = exports;
113
100
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
114
101
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
2
  const PLUGIN_ESLINT_NAME = 'rsbuild:eslint';
3
3
  const pluginEslint = (options = {})=>({
4
4
  name: PLUGIN_ESLINT_NAME,
@@ -7,10 +7,9 @@ const pluginEslint = (options = {})=>({
7
7
  if (!enable) return;
8
8
  api.modifyBundlerChain(async (chain, { environment })=>{
9
9
  const { distPath } = environment;
10
- // If there is multiple environment, only apply eslint plugin to the first target
11
- // to avoid multiple eslint running at the same time
12
10
  if (0 !== environment.index) return;
13
- const { default: ESLintPlugin } = await import("eslint-rspack-plugin");
11
+ const ESLintPluginModule = await import("eslint-rspack-plugin");
12
+ const ESLintPlugin = ESLintPluginModule.default || ESLintPluginModule;
14
13
  const defaultOptions = {
15
14
  extensions: [
16
15
  'js',
@@ -24,7 +23,7 @@ const pluginEslint = (options = {})=>({
24
23
  ],
25
24
  exclude: [
26
25
  'node_modules',
27
- __WEBPACK_EXTERNAL_MODULE_node_path__["default"].relative(api.context.rootPath, distPath)
26
+ __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(api.context.rootPath, distPath)
28
27
  ]
29
28
  };
30
29
  chain.plugin('eslint').use(ESLintPlugin, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-eslint",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "repository": "https://github.com/rspack-contrib/rsbuild-plugin-eslint",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,15 +37,15 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@biomejs/biome": "^1.9.4",
40
- "@playwright/test": "^1.49.0",
41
- "@rsbuild/core": "^1.1.6",
42
- "@rslib/core": "^0.1.1",
43
- "@types/node": "^22.10.1",
44
- "eslint": "^9.16.0",
40
+ "@playwright/test": "^1.50.1",
41
+ "@rsbuild/core": "^1.2.3",
42
+ "@rslib/core": "^0.4.0",
43
+ "@types/node": "^22.13.0",
44
+ "eslint": "^9.19.0",
45
45
  "nano-staged": "^0.8.0",
46
- "playwright": "^1.49.0",
46
+ "playwright": "^1.50.1",
47
47
  "simple-git-hooks": "^2.11.1",
48
- "typescript": "^5.7.2"
48
+ "typescript": "^5.7.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@rsbuild/core": "1.x",
@@ -56,7 +56,7 @@
56
56
  "optional": true
57
57
  }
58
58
  },
59
- "packageManager": "pnpm@9.14.4",
59
+ "packageManager": "pnpm@9.15.4",
60
60
  "publishConfig": {
61
61
  "access": "public",
62
62
  "registry": "https://registry.npmjs.org/"