更新前端静态网页获取方式,放弃使用后端获取api

This commit is contained in:
2025-09-09 10:47:51 +08:00
parent 6889ca37e5
commit 44a4f1bae1
25558 changed files with 2463152 additions and 153 deletions

View File

@@ -0,0 +1,22 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('decoupled-local-node-rig/profiles/default/includes/eslint/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('decoupled-local-node-rig/profiles/default/includes/eslint/patch/custom-config-package-names');
module.exports = {
extends: [
'decoupled-local-node-rig/profiles/default/includes/eslint/profile/node',
'decoupled-local-node-rig/profiles/default/includes/eslint/mixins/friendly-locals',
'decoupled-local-node-rig/profiles/default/includes/eslint/mixins/tsdoc'
],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-console': 'off'
}
}
]
};

View File

@@ -0,0 +1,462 @@
{
"name": "@rushstack/eslint-patch",
"entries": [
{
"version": "1.12.0",
"tag": "@rushstack/eslint-patch_v1.12.0",
"date": "Thu, 26 Jun 2025 18:57:04 GMT",
"comments": {
"minor": [
{
"comment": "Update for compatibility with ESLint 9"
}
]
}
},
{
"version": "1.11.0",
"tag": "@rushstack/eslint-patch_v1.11.0",
"date": "Tue, 11 Mar 2025 02:12:33 GMT",
"comments": {
"minor": [
{
"comment": "Bump the `@typescript-eslint/*` packages to add support for TypeScript 5.8."
}
]
}
},
{
"version": "1.10.5",
"tag": "@rushstack/eslint-patch_v1.10.5",
"date": "Tue, 07 Jan 2025 16:11:06 GMT",
"comments": {
"patch": [
{
"comment": "Fix a performance issue when locating \".eslint-bulk-suppressions.json\"."
}
]
}
},
{
"version": "1.10.4",
"tag": "@rushstack/eslint-patch_v1.10.4",
"date": "Sat, 27 Jul 2024 00:10:27 GMT",
"comments": {
"patch": [
{
"comment": "Include CHANGELOG.md in published releases again"
}
]
}
},
{
"version": "1.10.3",
"tag": "@rushstack/eslint-patch_v1.10.3",
"date": "Fri, 17 May 2024 00:10:40 GMT",
"comments": {
"patch": [
{
"comment": "[eslint-patch] Allow use of ESLint v9"
}
]
}
},
{
"version": "1.10.2",
"tag": "@rushstack/eslint-patch_v1.10.2",
"date": "Wed, 10 Apr 2024 21:59:39 GMT",
"comments": {
"patch": [
{
"comment": "Bump maximum supported ESLint version for the bulk-suppressions tool to `8.57.0`."
}
]
}
},
{
"version": "1.10.1",
"tag": "@rushstack/eslint-patch_v1.10.1",
"date": "Fri, 29 Mar 2024 05:46:41 GMT",
"comments": {
"patch": [
{
"comment": "Fix an issue where the `eslint-bulk prune` command would crash if a bulk suppressions file exists that speicifies no suppressions."
},
{
"comment": "Exit with success under normal conditions."
}
]
}
},
{
"version": "1.10.0",
"tag": "@rushstack/eslint-patch_v1.10.0",
"date": "Thu, 28 Mar 2024 18:11:12 GMT",
"comments": {
"patch": [
{
"comment": "Fix an issue with running `eslint-bulk prune` in a project with suppressions that refer to deleted files."
}
],
"minor": [
{
"comment": "Delete the `.eslint-bulk-suppressions.json` file during pruning if all suppressions have been eliminated."
}
]
}
},
{
"version": "1.9.0",
"tag": "@rushstack/eslint-patch_v1.9.0",
"date": "Wed, 27 Mar 2024 19:47:21 GMT",
"comments": {
"minor": [
{
"comment": "Fix an issue where `eslint-bulk prune` does not work if there are no files to lint in the project root."
}
]
}
},
{
"version": "1.8.0",
"tag": "@rushstack/eslint-patch_v1.8.0",
"date": "Wed, 20 Mar 2024 02:09:14 GMT",
"comments": {
"minor": [
{
"comment": "Refactor the bulk-suppressions feature to fix some performance issues."
}
],
"patch": [
{
"comment": "Fix an issue where linting issues that were already suppressed via suppression comments were recorded in the bulk suppressions list."
}
]
}
},
{
"version": "1.7.2",
"tag": "@rushstack/eslint-patch_v1.7.2",
"date": "Thu, 25 Jan 2024 23:03:57 GMT",
"comments": {
"patch": [
{
"comment": "Some minor documentation updates"
}
]
}
},
{
"version": "1.7.1",
"tag": "@rushstack/eslint-patch_v1.7.1",
"date": "Wed, 24 Jan 2024 07:38:34 GMT",
"comments": {
"patch": [
{
"comment": "Update documentation"
}
]
}
},
{
"version": "1.7.0",
"tag": "@rushstack/eslint-patch_v1.7.0",
"date": "Tue, 16 Jan 2024 18:30:10 GMT",
"comments": {
"minor": [
{
"comment": "Add support for TypeScript 5.3 with @typescript-eslint 6.19.x"
}
]
}
},
{
"version": "1.6.1",
"tag": "@rushstack/eslint-patch_v1.6.1",
"date": "Fri, 15 Dec 2023 01:10:06 GMT",
"comments": {
"patch": [
{
"comment": "Fix bulk suppression patch's eslintrc detection in polyrepos"
}
]
}
},
{
"version": "1.6.0",
"tag": "@rushstack/eslint-patch_v1.6.0",
"date": "Wed, 22 Nov 2023 01:45:18 GMT",
"comments": {
"minor": [
{
"comment": "Add an experimental new feature for ESLint bulk suppressions; for details see GitHub #4303"
}
]
}
},
{
"version": "1.5.1",
"tag": "@rushstack/eslint-patch_v1.5.1",
"date": "Sun, 01 Oct 2023 02:56:29 GMT",
"comments": {
"patch": [
{
"comment": "Fix patch compatibility with ESLint 7 for versions matching <7.12.0"
}
]
}
},
{
"version": "1.5.0",
"tag": "@rushstack/eslint-patch_v1.5.0",
"date": "Tue, 26 Sep 2023 09:30:33 GMT",
"comments": {
"minor": [
{
"comment": "Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix"
}
]
}
},
{
"version": "1.4.0",
"tag": "@rushstack/eslint-patch_v1.4.0",
"date": "Fri, 15 Sep 2023 00:36:58 GMT",
"comments": {
"minor": [
{
"comment": "Update @types/node from 14 to 18"
}
]
}
},
{
"version": "1.3.3",
"tag": "@rushstack/eslint-patch_v1.3.3",
"date": "Tue, 08 Aug 2023 07:10:39 GMT",
"comments": {
"patch": [
{
"comment": "Fix patching for running eslint via eslint/use-at-your-own-risk, which VS Code's eslint extension does when enabling flat config support"
}
]
}
},
{
"version": "1.3.2",
"tag": "@rushstack/eslint-patch_v1.3.2",
"date": "Thu, 15 Jun 2023 00:21:01 GMT",
"comments": {
"patch": [
{
"comment": "[eslint-patch] add invalid importer path test to ESLint 7.x || 8.x block"
}
]
}
},
{
"version": "1.3.1",
"tag": "@rushstack/eslint-patch_v1.3.1",
"date": "Wed, 07 Jun 2023 22:45:16 GMT",
"comments": {
"patch": [
{
"comment": "Add test for invalid importer path to fallback to relative path when loading eslint 6 plugins"
}
]
}
},
{
"version": "1.3.0",
"tag": "@rushstack/eslint-patch_v1.3.0",
"date": "Mon, 22 May 2023 06:34:32 GMT",
"comments": {
"minor": [
{
"comment": "Upgrade the @typescript-eslint/* dependencies to ~5.59.2"
}
]
}
},
{
"version": "1.2.0",
"tag": "@rushstack/eslint-patch_v1.2.0",
"date": "Thu, 15 Sep 2022 00:18:51 GMT",
"comments": {
"minor": [
{
"comment": "Use original resolver if patched resolver fails."
}
]
}
},
{
"version": "1.1.4",
"tag": "@rushstack/eslint-patch_v1.1.4",
"date": "Tue, 28 Jun 2022 00:23:32 GMT",
"comments": {
"patch": [
{
"comment": "Update the README to mention support for ESLint 8."
}
]
}
},
{
"version": "1.1.3",
"tag": "@rushstack/eslint-patch_v1.1.3",
"date": "Fri, 15 Apr 2022 00:12:36 GMT",
"comments": {
"patch": [
{
"comment": "Fix an issue where tools could not determine the module type as CommonJS"
}
]
}
},
{
"version": "1.1.2",
"tag": "@rushstack/eslint-patch_v1.1.2",
"date": "Sat, 09 Apr 2022 02:24:26 GMT",
"comments": {
"patch": [
{
"comment": "Rename the \"master\" branch to \"main\"."
}
]
}
},
{
"version": "1.1.1",
"tag": "@rushstack/eslint-patch_v1.1.1",
"date": "Tue, 15 Mar 2022 19:15:53 GMT",
"comments": {
"patch": [
{
"comment": "Fix the path in the package.json \"directory\" field."
}
]
}
},
{
"version": "1.1.0",
"tag": "@rushstack/eslint-patch_v1.1.0",
"date": "Fri, 05 Nov 2021 15:09:18 GMT",
"comments": {
"minor": [
{
"comment": "feat(eslint-patch): Find patch targets independently of disk layout"
}
]
}
},
{
"version": "1.0.9",
"tag": "@rushstack/eslint-patch_v1.0.9",
"date": "Wed, 27 Oct 2021 00:08:15 GMT",
"comments": {
"patch": [
{
"comment": "Update the package.json repository field to include the directory property."
}
]
}
},
{
"version": "1.0.8",
"tag": "@rushstack/eslint-patch_v1.0.8",
"date": "Wed, 13 Oct 2021 15:09:54 GMT",
"comments": {
"patch": [
{
"comment": "Add support for ESLint 8.0.0"
}
]
}
},
{
"version": "1.0.7",
"tag": "@rushstack/eslint-patch_v1.0.7",
"date": "Thu, 23 Sep 2021 00:10:40 GMT",
"comments": {
"patch": [
{
"comment": "Upgrade the `@types/node` dependency to version to version 12."
}
]
}
},
{
"version": "1.0.6",
"tag": "@rushstack/eslint-patch_v1.0.6",
"date": "Fri, 30 Oct 2020 00:10:14 GMT",
"comments": {
"patch": [
{
"comment": "Update the \"modern-module-resolution\" patch to support ESLint 7.8.0 and newer"
}
]
}
},
{
"version": "1.0.5",
"tag": "@rushstack/eslint-patch_v1.0.5",
"date": "Wed, 30 Sep 2020 18:39:17 GMT",
"comments": {
"patch": [
{
"comment": "Update to build with @rushstack/heft-node-rig"
}
]
}
},
{
"version": "1.0.4",
"tag": "@rushstack/eslint-patch_v1.0.4",
"date": "Wed, 30 Sep 2020 06:53:53 GMT",
"comments": {
"patch": [
{
"comment": "Update README.md"
}
]
}
},
{
"version": "1.0.3",
"tag": "@rushstack/eslint-patch_v1.0.3",
"date": "Wed, 12 Aug 2020 00:10:05 GMT",
"comments": {
"patch": [
{
"comment": "Updated project to build with Heft"
}
]
}
},
{
"version": "1.0.2",
"tag": "@rushstack/eslint-patch_v1.0.2",
"date": "Wed, 24 Jun 2020 09:50:48 GMT",
"comments": {
"patch": [
{
"comment": "Fix an issue with the published file set"
}
]
}
},
{
"version": "1.0.1",
"tag": "@rushstack/eslint-patch_v1.0.1",
"date": "Wed, 24 Jun 2020 09:04:28 GMT",
"comments": {
"patch": [
{
"comment": "Initial release"
}
]
}
}
]
}

View File

@@ -0,0 +1,272 @@
# Change Log - @rushstack/eslint-patch
This log was last generated on Thu, 26 Jun 2025 18:57:04 GMT and should not be manually modified.
## 1.12.0
Thu, 26 Jun 2025 18:57:04 GMT
### Minor changes
- Update for compatibility with ESLint 9
## 1.11.0
Tue, 11 Mar 2025 02:12:33 GMT
### Minor changes
- Bump the `@typescript-eslint/*` packages to add support for TypeScript 5.8.
## 1.10.5
Tue, 07 Jan 2025 16:11:06 GMT
### Patches
- Fix a performance issue when locating ".eslint-bulk-suppressions.json".
## 1.10.4
Sat, 27 Jul 2024 00:10:27 GMT
### Patches
- Include CHANGELOG.md in published releases again
## 1.10.3
Fri, 17 May 2024 00:10:40 GMT
### Patches
- [eslint-patch] Allow use of ESLint v9
## 1.10.2
Wed, 10 Apr 2024 21:59:39 GMT
### Patches
- Bump maximum supported ESLint version for the bulk-suppressions tool to `8.57.0`.
## 1.10.1
Fri, 29 Mar 2024 05:46:41 GMT
### Patches
- Fix an issue where the `eslint-bulk prune` command would crash if a bulk suppressions file exists that speicifies no suppressions.
- Exit with success under normal conditions.
## 1.10.0
Thu, 28 Mar 2024 18:11:12 GMT
### Minor changes
- Delete the `.eslint-bulk-suppressions.json` file during pruning if all suppressions have been eliminated.
### Patches
- Fix an issue with running `eslint-bulk prune` in a project with suppressions that refer to deleted files.
## 1.9.0
Wed, 27 Mar 2024 19:47:21 GMT
### Minor changes
- Fix an issue where `eslint-bulk prune` does not work if there are no files to lint in the project root.
## 1.8.0
Wed, 20 Mar 2024 02:09:14 GMT
### Minor changes
- Refactor the bulk-suppressions feature to fix some performance issues.
### Patches
- Fix an issue where linting issues that were already suppressed via suppression comments were recorded in the bulk suppressions list.
## 1.7.2
Thu, 25 Jan 2024 23:03:57 GMT
### Patches
- Some minor documentation updates
## 1.7.1
Wed, 24 Jan 2024 07:38:34 GMT
### Patches
- Update documentation
## 1.7.0
Tue, 16 Jan 2024 18:30:10 GMT
### Minor changes
- Add support for TypeScript 5.3 with @typescript-eslint 6.19.x
## 1.6.1
Fri, 15 Dec 2023 01:10:06 GMT
### Patches
- Fix bulk suppression patch's eslintrc detection in polyrepos
## 1.6.0
Wed, 22 Nov 2023 01:45:18 GMT
### Minor changes
- Add an experimental new feature for ESLint bulk suppressions; for details see GitHub #4303
## 1.5.1
Sun, 01 Oct 2023 02:56:29 GMT
### Patches
- Fix patch compatibility with ESLint 7 for versions matching <7.12.0
## 1.5.0
Tue, 26 Sep 2023 09:30:33 GMT
### Minor changes
- Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the "eslint-config-" prefix
## 1.4.0
Fri, 15 Sep 2023 00:36:58 GMT
### Minor changes
- Update @types/node from 14 to 18
## 1.3.3
Tue, 08 Aug 2023 07:10:39 GMT
### Patches
- Fix patching for running eslint via eslint/use-at-your-own-risk, which VS Code's eslint extension does when enabling flat config support
## 1.3.2
Thu, 15 Jun 2023 00:21:01 GMT
### Patches
- [eslint-patch] add invalid importer path test to ESLint 7.x || 8.x block
## 1.3.1
Wed, 07 Jun 2023 22:45:16 GMT
### Patches
- Add test for invalid importer path to fallback to relative path when loading eslint 6 plugins
## 1.3.0
Mon, 22 May 2023 06:34:32 GMT
### Minor changes
- Upgrade the @typescript-eslint/* dependencies to ~5.59.2
## 1.2.0
Thu, 15 Sep 2022 00:18:51 GMT
### Minor changes
- Use original resolver if patched resolver fails.
## 1.1.4
Tue, 28 Jun 2022 00:23:32 GMT
### Patches
- Update the README to mention support for ESLint 8.
## 1.1.3
Fri, 15 Apr 2022 00:12:36 GMT
### Patches
- Fix an issue where tools could not determine the module type as CommonJS
## 1.1.2
Sat, 09 Apr 2022 02:24:26 GMT
### Patches
- Rename the "master" branch to "main".
## 1.1.1
Tue, 15 Mar 2022 19:15:53 GMT
### Patches
- Fix the path in the package.json "directory" field.
## 1.1.0
Fri, 05 Nov 2021 15:09:18 GMT
### Minor changes
- feat(eslint-patch): Find patch targets independently of disk layout
## 1.0.9
Wed, 27 Oct 2021 00:08:15 GMT
### Patches
- Update the package.json repository field to include the directory property.
## 1.0.8
Wed, 13 Oct 2021 15:09:54 GMT
### Patches
- Add support for ESLint 8.0.0
## 1.0.7
Thu, 23 Sep 2021 00:10:40 GMT
### Patches
- Upgrade the `@types/node` dependency to version to version 12.
## 1.0.6
Fri, 30 Oct 2020 00:10:14 GMT
### Patches
- Update the "modern-module-resolution" patch to support ESLint 7.8.0 and newer
## 1.0.5
Wed, 30 Sep 2020 18:39:17 GMT
### Patches
- Update to build with @rushstack/heft-node-rig
## 1.0.4
Wed, 30 Sep 2020 06:53:53 GMT
### Patches
- Update README.md
## 1.0.3
Wed, 12 Aug 2020 00:10:05 GMT
### Patches
- Updated project to build with Heft
## 1.0.2
Wed, 24 Jun 2020 09:50:48 GMT
### Patches
- Fix an issue with the published file set
## 1.0.1
Wed, 24 Jun 2020 09:04:28 GMT
### Patches
- Initial release

24
frontend/node_modules/@rushstack/eslint-patch/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,24 @@
@rushstack/eslint-patch
Copyright (c) Microsoft Corporation. All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

252
frontend/node_modules/@rushstack/eslint-patch/README.md generated vendored Normal file
View File

@@ -0,0 +1,252 @@
# @rushstack/eslint-patch
Enhance [ESLint](https://eslint.org/) with better support for large scale monorepos!
This is a runtime patch that enables new/experimental features for ESLint. It operates as a "monkey patch"
that gets loaded with **.eslintrc.js** and modifies the ESLint engine in memory. This approach works
with your existing ESLint version (no need to install a forked ESLint), and is fully interoperable with
companion tools such as the ESLint extensions for VS Code and WebStorm.
This package provides several independently loadable features:
- **eslint-bulk-suppressions**: enables you to roll out new lint rules in your monorepo without having to
clutter up source files with thousands of machine-generated `// eslint-ignore-next-line` directives.
Instead, the "bulk suppressions" for legacy violations are managed in a separate file called
**.eslint-bulk-suppressions.json**.
- **modern-module-resolution**: allows an ESLint config package to provide plugin dependencies, avoiding the
problem where hundreds of projects in a monorepo need to copy+paste the same `"devDependencies"` in
every **package.json** file.
> **NOTE:** ESLint 8.21.0 has now introduced a new `ESLINT_USE_FLAT_CONFIG` mode that may reduce the need
for the `modern-module-resolution` patch.
- **custom-config-package-names**: enables [rig packages](https://heft.rushstack.io/pages/intro/rig_packages/)
to provide shareable configs for ESLint, by removing the requirement that `eslint-config` must appear in
the NPM package name.
Contributions welcome! If you have more ideas for experimental ESLint enhancements that might benefit
large scale monorepos, consider adding them to this patch.
# eslint-bulk-suppressions feature
<!-- ## is correct here, but ### looks better in NPM's rendering -->
### What it does
As your monorepo evolves and grows, there's an ongoing need to expand and improve lint rules. But whenever a
new rule is enabled, there may be hundreds or thousands of "legacy violations" in existing source files.
How to handle that? We could fix the old code, but that's often prohibitively expensive and may even cause
regressions. We could disable the rule for those projects or files, but we want new code to follow the rule.
An effective solution is to inject thousands of `// eslint-ignore-next-line` lines, but these "bulk suppressions"
have an unintended side effect: It normalizes the practice of suppressing lint rules. If people get used to
seeing `// eslint-ignore-next-line` everywhere, nobody will notice when humans suppress the rules for new code.
That would undermine the mission of establishing better code standards.
The `eslint-bulk-suppressions` feature introduces a way to store machine-generated suppressions in a separate
file **.eslint-bulk-suppressions.json** which can even be protected using `CODEOWNERS` policies, since that file
will generally only change when new lint rules are introduced, or in occasional circumstances when existing files
are being moved or renamed. In this way `// eslint-ignore-next-line` remains a directive written by humans
and hopefully rarely needed.
### Why it's a patch
As with `modern-module-resolution`, our hope is for this feature to eventually be incorporated as an official
feature of ESLint. Starting out as an unofficial patch allows faster iteration and community feedback.
### How to use it
1. Add `@rushstack/eslint-patch` as a dependency of your project:
```bash
cd your-project
npm install --save-dev @rushstack/eslint-patch
```
2. Globally install the [`@rushstack/eslint-bulk`](https://www.npmjs.com/package/@rushstack/eslint-bulk)
command line interface (CLI) package. For example:
```bash
npm install --global @rushstack/eslint-bulk
```
This installs the `eslint-bulk` shell command for managing the **.eslint-bulk-suppressions.json** files.
With it you can generate new suppressions as well as "prune" old suppressions that are no longer needed.
3. Load the patch by adding the following `require()` statement as the first line of
your **.eslintrc.js** file. For example:
**.eslintrc.js**
```js
require("@rushstack/eslint-patch/eslint-bulk-suppressions"); // 👈 add this line
module.exports = {
rules: {
rule1: 'error',
rule2: 'warning'
},
parserOptions: { tsconfigRootDir: __dirname }
};
```
Typical workflow:
1. Checkout your `main` branch, which is in a clean state where ESLint reports no violations.
2. Update your configuration to enable the latest lint rules; ESLint now reports thousands of legacy violations.
3. Run `eslint-bulk suppress --all ./src` to update **.eslint-bulk-suppressions.json.**
4. ESLint now no longer reports violations, so commit the results to Git and merge your pull request.
5. Over time, engineers may improve some of the suppressed code, in which case the associated suppressions are no longer needed.
6. Run `eslint-bulk prune` periodically to find and remove unnecessary suppressions from **.eslint-bulk-suppressions.json**, ensuring that new violations will now get caught in those scopes.
### "eslint-bulk suppress" command
```bash
eslint-bulk suppress --rule NAME1 [--rule NAME2...] PATH1 [PATH2...]
eslint-bulk suppress --all PATH1 [PATH2...]
```
Use this command to automatically generate bulk suppressions for the specified lint rules and file paths.
The path argument is a [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) with the same syntax
as path arguments for the `eslint` command.
### "eslint-bulk prune" command
Use this command to automatically delete all unnecessary suppression entries in all
**.eslint-bulk-suppressions.json** files under the current working directory.
```bash
eslint-bulk prune
```
### Implementation notes
The `eslint-bulk` command is a thin wrapper whose behavior is actually provided by the patch itself.
In this way, if your monorepo contains projects using different versions of this package, the same globally
installed `eslint-bulk` command can be used under any project folder, and it will always invoke the correct
version of the engine compatible with that project. Because the patch is loaded by ESLint, the `eslint-bulk`
command must be invoked in a project folder that contains an **.eslintrc.js** configuration with correctly
installed **package.json** dependencies.
Here's an example of the bulk suppressions file content:
**.eslint-bulk-suppressions.json**
```js
{
"suppressions": [
{
"rule": "no-var",
"file": "./src/your-file.ts",
"scopeId": ".ExampleClass.exampleMethod"
}
]
}
```
The `rule` field is the ESLint rule name. The `file` field is the source file path, relative to the **eslintrc.js** file. The `scopeId` is a special string built from the names of containing structures. (For implementation details, take a look at the [calculateScopeId()](https://github.com/microsoft/rushstack/blob/e95c51088341f01516ee5a7639d57c3f6dce8772/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts#L52) function.) The `scopeId` identifies a region of code where the rule should be suppressed, while being reasonably stable across edits of the source file.
# modern-module-resolution feature
### What it does
This patch is a workaround for a longstanding [ESLint feature request](https://github.com/eslint/eslint/issues/3458)
that would allow a shareable ESLint config to bring along its own plugins, rather than imposing peer dependencies
on every consumer of the config. In a monorepo scenario, this enables your lint setup to be consolidated in a
single NPM package. Doing so greatly reduces the copy+pasting and version management for all the other projects
that use your standard lint rule set, but don't want to be bothered with the details.
> **NOTE:** ESLint 8.21.0 has now introduced a new `ESLINT_USE_FLAT_CONFIG` mode that may reduce the need
> for this patch.
### Why it's a patch
We initially proposed this feature in a pull request for the official ESLint back in 2019, however the
maintainers preferred to implement a more comprehensive overhaul of the ESLint config engine. It ultimately
shipped with the experimental new `ESLINT_USE_FLAT_CONFIG` mode (still opt-in as of ESLint 8).
While waiting for that, Rush Stack's `modern-module-resolution` patch provided a reliable interim solution.
We will continue to maintain this patch as long as it is being widely used, but we encourage you to check out
`ESLINT_USE_FLAT_CONFIG` and see if it meets your needs.
### How to use it
1. Add `@rushstack/eslint-patch` as a dependency of your project:
```bash
cd your-project
npm install --save-dev @rushstack/eslint-patch
```
2. Add a `require()` call to the to top of the **.eslintrc.js** file for each project that depends
on your shareable ESLint config, for example:
**.eslintrc.js**
```ts
require("@rushstack/eslint-patch/modern-module-resolution"); // 👈 add this line
// Add your "extends" boilerplate here, for example:
module.exports = {
extends: ['@your-company/eslint-config'],
parserOptions: { tsconfigRootDir: __dirname }
};
```
With this change, the local project no longer needs any ESLint plugins in its **package.json** file.
Instead, the hypothetical `@your-company/eslint-config` NPM package would declare the plugins as its
own dependencies.
This patch works by modifying the ESLint engine so that its module resolver will load relative to the folder of
the referencing config file, rather than the project folder. The patch is compatible with ESLint 6, 7, and 8.
It also works with any editor extensions that load ESLint as a library.
For an even leaner setup, `@your-company/eslint-config` can provide the patches as its own dependency.
See [@rushstack/eslint-config](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-config/patch/modern-module-resolution.js) for a real world example.
# custom-config-package-names feature
### What it does
Load the `custom-config-package-names` patch to remove ESLint's
[naming requirement](https://eslint.org/docs/latest/extend/shareable-configs)
that `eslint-config` must be part of the NPM package name for shareable configs.
This is useful because Rush Stack's [rig package](https://heft.rushstack.io/pages/intro/rig_packages/)
specification defines a way for many different tooling configurations and dependencies to be shared
via a single NPM package, for example
[`@rushstack/heft-web-rig`](https://www.npmjs.com/package/@rushstack/heft-web-rig).
Rigs avoid a lot of copy+pasting of dependencies in a large scale monorepo.
Rig packages always include the `-rig` suffix in their name. It doesn't make sense to enforce
that `eslint-config` should also appear in the name of a package that includes shareable configs
for many other tools besides ESLint.
### How to use it
Continuing the example above, to load this patch you would add a second line to your config file:
**.eslintrc.js**
```ts
require("@rushstack/eslint-patch/modern-module-resolution");
require("@rushstack/eslint-patch/custom-config-package-names"); // 👈 add this line
// Add your "extends" boilerplate here, for example:
module.exports = {
extends: [
'@your-company/build-rig/profile/default/includes/eslint/node' // Notice the package name does not start with "eslint-config-"
],
parserOptions: { tsconfigRootDir: __dirname }
};
```
# Links
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-patch/CHANGELOG.md) - Find
out what's new in the latest version
- [`@rushstack/eslint-bulk`](https://www.npmjs.com/package/@rushstack/eslint-bulk) CLI package
`@rushstack/eslint-patch` is part of the [Rush Stack](https://rushstack.io/) family of projects.

View File

@@ -0,0 +1 @@
require('./lib/custom-config-package-names');

View File

@@ -0,0 +1 @@
require('./lib/eslint-bulk-suppressions');

View File

@@ -0,0 +1 @@
require('./lib/modern-module-resolution');

View File

@@ -0,0 +1,42 @@
{
"name": "@rushstack/eslint-patch",
"version": "1.12.0",
"description": "Enhance ESLint with better support for large scale monorepos",
"main": "lib/usage.js",
"license": "MIT",
"repository": {
"url": "https://github.com/microsoft/rushstack.git",
"type": "git",
"directory": "eslint/eslint-patch"
},
"homepage": "https://rushstack.io",
"keywords": [
"eslintrc",
"config",
"module",
"resolve",
"resolver",
"plugin",
"relative",
"package",
"bulk",
"suppressions",
"monorepo",
"monkey",
"patch"
],
"devDependencies": {
"@rushstack/heft": "0.73.2",
"@types/eslint-8": "npm:@types/eslint@8.56.10",
"@types/eslint-9": "npm:@types/eslint@9.6.1",
"@typescript-eslint/types": "~8.31.0",
"eslint-9": "npm:eslint@~9.25.1",
"eslint-8": "npm:eslint@~8.57.0",
"typescript": "~5.8.2",
"decoupled-local-node-rig": "1.0.0"
},
"scripts": {
"build": "heft build --clean",
"_phase:build": "heft run --only build -- --clean"
}
}