@rsbuild/plugin-eslint 0.6.14 → 0.7.0-beta.0

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/dist/index.cjs ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ pluginEslint: () => pluginEslint
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_node_path = __toESM(require("path"));
37
+ var pluginEslint = (options = {}) => ({
38
+ name: "rsbuild:eslint",
39
+ setup(api) {
40
+ const { enable = true, eslintPluginOptions } = options;
41
+ if (!enable) {
42
+ return;
43
+ }
44
+ api.modifyBundlerChain(async (chain, { target, CHAIN_ID }) => {
45
+ if (target !== api.context.targets[0]) {
46
+ return;
47
+ }
48
+ const { default: ESLintPlugin } = await import("eslint-webpack-plugin");
49
+ const defaultOptions = {
50
+ extensions: ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts"],
51
+ exclude: [
52
+ "node_modules",
53
+ import_node_path.default.relative(api.context.rootPath, api.context.distPath)
54
+ ]
55
+ };
56
+ chain.plugin(CHAIN_ID.PLUGIN.ESLINT).use(ESLintPlugin, [
57
+ {
58
+ ...defaultOptions,
59
+ ...eslintPluginOptions
60
+ }
61
+ ]);
62
+ });
63
+ }
64
+ });
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ pluginEslint
68
+ });
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { RsbuildPlugin } from '@rsbuild/core';
2
- import { Options } from 'eslint-webpack-plugin';
3
-
4
- type PluginEslintOptions = {
1
+ import type { RsbuildPlugin } from '@rsbuild/core';
2
+ import type { Options } from 'eslint-webpack-plugin';
3
+ export type PluginEslintOptions = {
5
4
  /**
6
5
  * Whether to enable ESLint checking.
7
6
  * @default true
@@ -13,6 +12,4 @@ type PluginEslintOptions = {
13
12
  */
14
13
  eslintPluginOptions?: Options;
15
14
  };
16
- declare const pluginEslint: (options?: PluginEslintOptions) => RsbuildPlugin;
17
-
18
- export { type PluginEslintOptions, pluginEslint };
15
+ export declare const pluginEslint: (options?: PluginEslintOptions) => RsbuildPlugin;
package/dist/index.js CHANGED
@@ -1,39 +1,13 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ import { createRequire } from 'module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+
5
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.49.3_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
6
+ import { fileURLToPath } from "url";
7
+ import path from "path";
29
8
 
30
9
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- pluginEslint: () => pluginEslint
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
- var import_node_path = __toESM(require("path"));
10
+ import path2 from "path";
37
11
  var pluginEslint = (options = {}) => ({
38
12
  name: "rsbuild:eslint",
39
13
  setup(api) {
@@ -50,7 +24,7 @@ var pluginEslint = (options = {}) => ({
50
24
  extensions: ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts"],
51
25
  exclude: [
52
26
  "node_modules",
53
- import_node_path.default.relative(api.context.rootPath, api.context.distPath)
27
+ path2.relative(api.context.rootPath, api.context.distPath)
54
28
  ]
55
29
  };
56
30
  chain.plugin(CHAIN_ID.PLUGIN.ESLINT).use(ESLintPlugin, [
@@ -62,7 +36,6 @@ var pluginEslint = (options = {}) => ({
62
36
  });
63
37
  }
64
38
  });
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
39
+ export {
67
40
  pluginEslint
68
- });
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-eslint",
3
- "version": "0.6.14",
3
+ "version": "0.7.0-beta.0",
4
4
  "description": "ESLint plugin for Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -9,15 +9,15 @@
9
9
  "directory": "packages/plugin-eslint"
10
10
  },
11
11
  "license": "MIT",
12
- "type": "commonjs",
12
+ "type": "module",
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "default": "./dist/index.js"
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
18
  }
19
19
  },
20
- "main": "./dist/index.js",
20
+ "main": "./dist/index.cjs",
21
21
  "types": "./dist/index.d.ts",
22
22
  "files": [
23
23
  "dist"
@@ -26,15 +26,15 @@
26
26
  "eslint": "^8.57.0",
27
27
  "eslint-webpack-plugin": "^4.1.0",
28
28
  "webpack": "^5.91.0",
29
- "@rsbuild/shared": "0.6.14"
29
+ "@rsbuild/shared": "0.7.0-beta.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "typescript": "^5.4.2",
33
- "@rsbuild/core": "0.6.14",
34
- "@scripts/test-helper": "0.6.14"
33
+ "@rsbuild/core": "0.7.0-beta.0",
34
+ "@scripts/test-helper": "0.7.0-beta.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@rsbuild/core": "^0.6.14"
37
+ "@rsbuild/core": "^0.7.0-beta.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",
package/dist/index.mjs DELETED
@@ -1,41 +0,0 @@
1
- import { createRequire } from 'module';
2
- var require = createRequire(import.meta['url']);
3
-
4
-
5
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.49.2_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
6
- import { fileURLToPath } from "url";
7
- import path from "path";
8
-
9
- // src/index.ts
10
- import path2 from "path";
11
- var pluginEslint = (options = {}) => ({
12
- name: "rsbuild:eslint",
13
- setup(api) {
14
- const { enable = true, eslintPluginOptions } = options;
15
- if (!enable) {
16
- return;
17
- }
18
- api.modifyBundlerChain(async (chain, { target, CHAIN_ID }) => {
19
- if (target !== api.context.targets[0]) {
20
- return;
21
- }
22
- const { default: ESLintPlugin } = await import("eslint-webpack-plugin");
23
- const defaultOptions = {
24
- extensions: ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts"],
25
- exclude: [
26
- "node_modules",
27
- path2.relative(api.context.rootPath, api.context.distPath)
28
- ]
29
- };
30
- chain.plugin(CHAIN_ID.PLUGIN.ESLINT).use(ESLintPlugin, [
31
- {
32
- ...defaultOptions,
33
- ...eslintPluginOptions
34
- }
35
- ]);
36
- });
37
- }
38
- });
39
- export {
40
- pluginEslint
41
- };