@rsbuild/plugin-eslint 1.0.4 → 1.1.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/README.md +1 -0
- package/dist/index.cjs +110 -66
- package/dist/index.d.ts +5 -8
- package/dist/index.js +37 -34
- package/package.json +14 -15
- package/dist/index.d.cts +0 -19
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ The plugin has integrated [eslint-rspack-plugin](https://www.npmjs.com/package/e
|
|
|
9
9
|
<img src="https://img.shields.io/npm/v/@rsbuild/plugin-eslint?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
|
|
10
10
|
</a>
|
|
11
11
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
|
|
12
|
+
<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>
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
15
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -1,72 +1,116 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"eslint-rspack-plugin": function(module) {
|
|
4
|
+
module.exports = import("eslint-rspack-plugin");
|
|
5
|
+
}
|
|
19
6
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
/************************************************************************/ // The module cache
|
|
8
|
+
var __webpack_module_cache__ = {};
|
|
9
|
+
// The require function
|
|
10
|
+
function __webpack_require__(moduleId) {
|
|
11
|
+
// Check if module is in cache
|
|
12
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
|
+
// Create a new module (and put it into the cache)
|
|
15
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
16
|
+
exports: {}
|
|
17
|
+
};
|
|
18
|
+
// Execute the module function
|
|
19
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
20
|
+
// Return the exports of the module
|
|
21
|
+
return module.exports;
|
|
22
|
+
}
|
|
23
|
+
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
24
|
+
(()=>{
|
|
25
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
26
|
+
__webpack_require__.n = function(module) {
|
|
27
|
+
var getter = module && module.__esModule ? function() {
|
|
28
|
+
return module['default'];
|
|
29
|
+
} : function() {
|
|
30
|
+
return module;
|
|
31
|
+
};
|
|
32
|
+
__webpack_require__.d(getter, {
|
|
33
|
+
a: getter
|
|
34
|
+
});
|
|
35
|
+
return getter;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
// webpack/runtime/define_property_getters
|
|
39
|
+
(()=>{
|
|
40
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
41
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: definition[key]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
// webpack/runtime/has_own_property
|
|
48
|
+
(()=>{
|
|
49
|
+
__webpack_require__.o = function(obj, prop) {
|
|
50
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
// webpack/runtime/make_namespace_object
|
|
54
|
+
(()=>{
|
|
55
|
+
// define __esModule on exports
|
|
56
|
+
__webpack_require__.r = function(exports1) {
|
|
57
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
58
|
+
value: 'Module'
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
})();
|
|
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
|
|
35
72
|
});
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
+
});
|
|
63
110
|
}
|
|
64
|
-
]);
|
|
65
111
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
PLUGIN_ESLINT_NAME,
|
|
71
|
-
pluginEslint
|
|
112
|
+
var __webpack_export_target__ = exports;
|
|
113
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
114
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
115
|
+
value: true
|
|
72
116
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import { Options } from 'eslint-rspack-plugin';
|
|
3
|
-
|
|
4
|
-
type PluginEslintOptions = {
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { Options } from 'eslint-rspack-plugin';
|
|
3
|
+
export type PluginEslintOptions = {
|
|
5
4
|
/**
|
|
6
5
|
* Whether to enable ESLint checking.
|
|
7
6
|
* @default true
|
|
@@ -13,7 +12,5 @@ type PluginEslintOptions = {
|
|
|
13
12
|
*/
|
|
14
13
|
eslintPluginOptions?: Options;
|
|
15
14
|
};
|
|
16
|
-
declare const PLUGIN_ESLINT_NAME = "rsbuild:eslint";
|
|
17
|
-
declare const pluginEslint: (options?: PluginEslintOptions) => RsbuildPlugin;
|
|
18
|
-
|
|
19
|
-
export { PLUGIN_ESLINT_NAME, type PluginEslintOptions, pluginEslint };
|
|
15
|
+
export declare const PLUGIN_ESLINT_NAME = "rsbuild:eslint";
|
|
16
|
+
export declare const pluginEslint: (options?: PluginEslintOptions) => RsbuildPlugin;
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
2
|
+
const PLUGIN_ESLINT_NAME = 'rsbuild:eslint';
|
|
3
|
+
const pluginEslint = (options = {})=>({
|
|
4
|
+
name: PLUGIN_ESLINT_NAME,
|
|
5
|
+
setup (api) {
|
|
6
|
+
const { enable = true, eslintPluginOptions } = options;
|
|
7
|
+
if (!enable) return;
|
|
8
|
+
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
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
|
+
if (0 !== environment.index) return;
|
|
13
|
+
const { default: ESLintPlugin } = await import("eslint-rspack-plugin");
|
|
14
|
+
const defaultOptions = {
|
|
15
|
+
extensions: [
|
|
16
|
+
'js',
|
|
17
|
+
'jsx',
|
|
18
|
+
'mjs',
|
|
19
|
+
'cjs',
|
|
20
|
+
'ts',
|
|
21
|
+
'tsx',
|
|
22
|
+
'mts',
|
|
23
|
+
'cts'
|
|
24
|
+
],
|
|
25
|
+
exclude: [
|
|
26
|
+
'node_modules',
|
|
27
|
+
__WEBPACK_EXTERNAL_MODULE_node_path__["default"].relative(api.context.rootPath, distPath)
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
chain.plugin('eslint').use(ESLintPlugin, [
|
|
31
|
+
{
|
|
32
|
+
...defaultOptions,
|
|
33
|
+
...eslintPluginOptions
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
36
|
+
});
|
|
28
37
|
}
|
|
29
|
-
]);
|
|
30
38
|
});
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
export {
|
|
34
|
-
PLUGIN_ESLINT_NAME,
|
|
35
|
-
pluginEslint
|
|
36
|
-
};
|
|
39
|
+
export { PLUGIN_ESLINT_NAME, pluginEslint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-eslint",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-eslint",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"files": ["dist"],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
20
|
-
"dev": "
|
|
19
|
+
"build": "rslib build",
|
|
20
|
+
"dev": "rslib build --watch",
|
|
21
21
|
"lint": "biome check .",
|
|
22
22
|
"lint:write": "biome check . --write",
|
|
23
23
|
"prepare": "simple-git-hooks && npm run build",
|
|
@@ -33,23 +33,22 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"eslint-rspack-plugin": "^4.2.1"
|
|
37
|
-
"webpack": "^5.95.0"
|
|
36
|
+
"eslint-rspack-plugin": "^4.2.1"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@biomejs/biome": "^1.9.
|
|
41
|
-
"@playwright/test": "^1.
|
|
42
|
-
"@rsbuild/core": "^1.
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
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",
|
|
45
45
|
"nano-staged": "^0.8.0",
|
|
46
|
-
"playwright": "^1.
|
|
46
|
+
"playwright": "^1.49.0",
|
|
47
47
|
"simple-git-hooks": "^2.11.1",
|
|
48
|
-
"
|
|
49
|
-
"typescript": "^5.6.2"
|
|
48
|
+
"typescript": "^5.7.2"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"@rsbuild/core": "1.x
|
|
51
|
+
"@rsbuild/core": "1.x",
|
|
53
52
|
"eslint": "^8.0.0 || ^9.0.0"
|
|
54
53
|
},
|
|
55
54
|
"peerDependenciesMeta": {
|
|
@@ -57,7 +56,7 @@
|
|
|
57
56
|
"optional": true
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
|
-
"packageManager": "pnpm@9.
|
|
59
|
+
"packageManager": "pnpm@9.14.4",
|
|
61
60
|
"publishConfig": {
|
|
62
61
|
"access": "public",
|
|
63
62
|
"registry": "https://registry.npmjs.org/"
|
package/dist/index.d.cts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import { Options } from 'eslint-rspack-plugin';
|
|
3
|
-
|
|
4
|
-
type PluginEslintOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* Whether to enable ESLint checking.
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
enable?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* To modify the options of `eslint-rspack-plugin`.
|
|
12
|
-
* @see https://github.com/rspack-contrib/eslint-rspack-plugin
|
|
13
|
-
*/
|
|
14
|
-
eslintPluginOptions?: Options;
|
|
15
|
-
};
|
|
16
|
-
declare const PLUGIN_ESLINT_NAME = "rsbuild:eslint";
|
|
17
|
-
declare const pluginEslint: (options?: PluginEslintOptions) => RsbuildPlugin;
|
|
18
|
-
|
|
19
|
-
export { PLUGIN_ESLINT_NAME, type PluginEslintOptions, pluginEslint };
|