@fast-china/eslint-config 2.0.4 → 2.0.6
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/CHANGELOG.md +15 -0
- package/CONTRIBUTING.md +62 -0
- package/README.md +19 -6
- package/README.zh.md +19 -6
- package/SECURITY.md +133 -0
- package/dist/configs/angular.d.mts +7 -2
- package/dist/configs/angular.d.mts.map +1 -1
- package/dist/configs/angular.mjs +4 -0
- package/dist/configs/angular.mjs.map +1 -1
- package/dist/configs/common.d.mts +4 -0
- package/dist/configs/common.d.mts.map +1 -1
- package/dist/configs/common.mjs +4 -0
- package/dist/configs/common.mjs.map +1 -1
- package/dist/configs/environment.d.mts +16 -4
- package/dist/configs/environment.d.mts.map +1 -1
- package/dist/configs/environment.mjs +4 -0
- package/dist/configs/environment.mjs.map +1 -1
- package/dist/configs/ignores.d.mts +16 -2
- package/dist/configs/ignores.d.mts.map +1 -1
- package/dist/configs/ignores.mjs +16 -2
- package/dist/configs/ignores.mjs.map +1 -1
- package/dist/configs/import.d.mts +4 -0
- package/dist/configs/import.d.mts.map +1 -1
- package/dist/configs/import.mjs +4 -0
- package/dist/configs/import.mjs.map +1 -1
- package/dist/configs/javascript.d.mts +5 -0
- package/dist/configs/javascript.d.mts.map +1 -1
- package/dist/configs/javascript.mjs +5 -0
- package/dist/configs/javascript.mjs.map +1 -1
- package/dist/configs/json.d.mts +4 -0
- package/dist/configs/json.d.mts.map +1 -1
- package/dist/configs/json.mjs +4 -0
- package/dist/configs/json.mjs.map +1 -1
- package/dist/configs/lodash.d.mts +11 -1
- package/dist/configs/lodash.d.mts.map +1 -1
- package/dist/configs/lodash.mjs +6 -0
- package/dist/configs/lodash.mjs.map +1 -1
- package/dist/configs/markdown.d.mts +3 -0
- package/dist/configs/markdown.d.mts.map +1 -1
- package/dist/configs/markdown.mjs +3 -0
- package/dist/configs/markdown.mjs.map +1 -1
- package/dist/configs/prettier.d.mts +3 -0
- package/dist/configs/prettier.d.mts.map +1 -1
- package/dist/configs/prettier.mjs +3 -0
- package/dist/configs/prettier.mjs.map +1 -1
- package/dist/configs/react.d.mts +13 -6
- package/dist/configs/react.d.mts.map +1 -1
- package/dist/configs/react.mjs +5 -0
- package/dist/configs/react.mjs.map +1 -1
- package/dist/configs/regexp.d.mts +4 -0
- package/dist/configs/regexp.d.mts.map +1 -1
- package/dist/configs/regexp.mjs +4 -0
- package/dist/configs/regexp.mjs.map +1 -1
- package/dist/configs/sort-package.d.mts +3 -0
- package/dist/configs/sort-package.d.mts.map +1 -1
- package/dist/configs/sort-package.mjs +3 -0
- package/dist/configs/sort-package.mjs.map +1 -1
- package/dist/configs/sort-tsconfig.d.mts +3 -0
- package/dist/configs/sort-tsconfig.d.mts.map +1 -1
- package/dist/configs/sort-tsconfig.mjs +3 -0
- package/dist/configs/sort-tsconfig.mjs.map +1 -1
- package/dist/configs/typescript.d.mts +19 -3
- package/dist/configs/typescript.d.mts.map +1 -1
- package/dist/configs/typescript.mjs +16 -1
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/vue.d.mts +7 -2
- package/dist/configs/vue.d.mts.map +1 -1
- package/dist/configs/vue.mjs +4 -0
- package/dist/configs/vue.mjs.map +1 -1
- package/dist/constants/index.d.mts +12 -2
- package/dist/constants/index.d.mts.map +1 -1
- package/dist/constants/index.mjs +12 -2
- package/dist/constants/index.mjs.map +1 -1
- package/dist/index.d.mts +48 -19
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +31 -1
- package/dist/index.mjs.map +1 -1
- package/dist/rules/angular.d.mts +15 -2
- package/dist/rules/angular.d.mts.map +1 -1
- package/dist/rules/angular.mjs +15 -2
- package/dist/rules/angular.mjs.map +1 -1
- package/dist/rules/common.d.mts +1 -0
- package/dist/rules/common.d.mts.map +1 -1
- package/dist/rules/common.mjs +1 -0
- package/dist/rules/common.mjs.map +1 -1
- package/dist/rules/import.d.mts +7 -1
- package/dist/rules/import.d.mts.map +1 -1
- package/dist/rules/import.mjs +7 -1
- package/dist/rules/import.mjs.map +1 -1
- package/dist/rules/javascript.d.mts +2 -0
- package/dist/rules/javascript.d.mts.map +1 -1
- package/dist/rules/javascript.mjs +2 -0
- package/dist/rules/javascript.mjs.map +1 -1
- package/dist/rules/lodash.d.mts +2 -0
- package/dist/rules/lodash.d.mts.map +1 -1
- package/dist/rules/lodash.mjs +2 -0
- package/dist/rules/lodash.mjs.map +1 -1
- package/dist/rules/react.d.mts +1 -0
- package/dist/rules/react.d.mts.map +1 -1
- package/dist/rules/react.mjs +1 -0
- package/dist/rules/react.mjs.map +1 -1
- package/dist/rules/sort-package.d.mts +1 -0
- package/dist/rules/sort-package.d.mts.map +1 -1
- package/dist/rules/sort-package.mjs +1 -0
- package/dist/rules/sort-package.mjs.map +1 -1
- package/dist/rules/sort-tsconfig.d.mts +1 -0
- package/dist/rules/sort-tsconfig.d.mts.map +1 -1
- package/dist/rules/sort-tsconfig.mjs +1 -0
- package/dist/rules/sort-tsconfig.mjs.map +1 -1
- package/dist/rules/typescript.d.mts +2 -0
- package/dist/rules/typescript.d.mts.map +1 -1
- package/dist/rules/typescript.mjs +2 -0
- package/dist/rules/typescript.mjs.map +1 -1
- package/dist/rules/vue.d.mts +2 -0
- package/dist/rules/vue.d.mts.map +1 -1
- package/dist/rules/vue.mjs +2 -0
- package/dist/rules/vue.mjs.map +1 -1
- package/docs/engineering-audit.zh.md +4 -2
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 2.0.6 - 2026-08-04
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Standardized the bilingual README, repository ignores, editor settings, TypeScript checks, and tsdown output configuration across the Fast frontend SDK repositories.
|
|
14
|
+
- Simplified the test pipeline to runtime, type-contract, and package-contract verification by removing documentation- and comment-governance tests.
|
|
15
|
+
- Included contribution and security documents in the published package and refreshed the engineering guidance for the current workflow.
|
|
16
|
+
|
|
17
|
+
## 2.0.5 - 2026-08-02
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Upgraded public API documentation to complete TSDoc, including standard defaults, parameters, return values, thrown errors, remarks, examples, and package-level documentation.
|
|
22
|
+
- Separated runtime, type-contract, rule-governance, and package-contract tests, and replaced the hard-coded release version assertion with SemVer and changelog consistency checks.
|
|
23
|
+
|
|
9
24
|
## 2.0.4 - 2026-08-02
|
|
10
25
|
|
|
11
26
|
### Added
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for improving `@fast-china/eslint-config`.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- A supported Node.js version from `package.json`
|
|
8
|
+
- pnpm `11.x`
|
|
9
|
+
|
|
10
|
+
## Local workflow
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm install
|
|
14
|
+
pnpm typegen
|
|
15
|
+
pnpm check
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use `pnpm dev` to inspect the active Flat Config interactively while changing factories or rules.
|
|
19
|
+
|
|
20
|
+
Use `pnpm lint:fix` and `pnpm format` for safe mechanical fixes. `pnpm test` first rebuilds `dist`, then runs consumer type-contract, runtime integration, and package-contract suites. `pnpm check` is the same quality gate used by CI and adds source type-checking, full-repository linting, and formatting verification.
|
|
21
|
+
|
|
22
|
+
`src/typegen.d.ts` is generated from ESLint rule schemas and is part of the public type API. Run `pnpm typegen` after changing ESLint or plugin versions, inspect and commit the generated diff, and use `pnpm typegen:check` to verify it. Never edit the generated declaration manually.
|
|
23
|
+
|
|
24
|
+
## Changing rules or factory behavior
|
|
25
|
+
|
|
26
|
+
1. Keep correctness rules separate from formatting rules.
|
|
27
|
+
2. Scope every rule group with `files` unless it is intentionally global.
|
|
28
|
+
3. Register each plugin in a configuration that matches the same files as its rules.
|
|
29
|
+
4. Prefer upstream recommended configs before adding local overrides.
|
|
30
|
+
5. Keep organization-specific dependency restrictions out of this general-purpose package; projects should own those policies.
|
|
31
|
+
6. Explain the purpose, rationale, and important exception or risk immediately above every local rule override.
|
|
32
|
+
7. Mark disruptive defaults with `[高影响]`; verify `meta.fixable` before using `[可自动修复]`, and keep `docs/rules-risk.md` plus `docs/rules-risk.zh.md` synchronized.
|
|
33
|
+
8. Never sort a map whose key order has semantics, including conditional objects under `package.json#exports`.
|
|
34
|
+
9. Regenerate `src/typegen.d.ts` whenever ESLint or a bundled plugin changes; confirm new rules and changed option schemas intentionally.
|
|
35
|
+
10. Add or update an integration test for every parser, plugin, option, auto-fix, generated type, or public export change. The root API is intentionally limited to `fastConfig`, `defaultConfigOptions`, `defineRules`, and related types.
|
|
36
|
+
11. Document behavior changes in `CHANGELOG.md` and both README files.
|
|
37
|
+
|
|
38
|
+
## Pull requests
|
|
39
|
+
|
|
40
|
+
Keep changes focused and explain user-visible compatibility effects. Do not commit credentials or publish from a pull request. Changes to the Node.js, ESLint, TypeScript, Vue, React, Angular, Prettier, or module-format contract should be treated as release-significant changes.
|
|
41
|
+
|
|
42
|
+
## Releases
|
|
43
|
+
|
|
44
|
+
The package is ESM-only and publication is maintainer-controlled. Update `CHANGELOG.md` and `package.json`, commit the release state, then run:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pnpm check
|
|
48
|
+
pnpm pack --dry-run
|
|
49
|
+
pnpm publish --access public --registry https://registry.npmjs.org/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`prepack` reruns the complete quality gate before pnpm creates the publish archive. Inspect the dry-run list and verify that both root and `./rules` entry points contain JavaScript and declarations, together with the generated JavaScript and declaration source maps. After publication, verify the registry result and tag the exact commit:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pnpm view @fast-china/eslint-config version --registry https://registry.npmjs.org/
|
|
56
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
57
|
+
git tag -a "v$VERSION" -m "release: v$VERSION"
|
|
58
|
+
git push origin master
|
|
59
|
+
git push origin "v$VERSION"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
npm versions are immutable; never reuse an already published version.
|
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="./README.zh.md">简体中文</a> | <strong>English</strong>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="./Fast.png" alt="logo" width="160" />
|
|
7
|
+
</p>
|
|
2
8
|
|
|
3
9
|
# @fast-china/eslint-config
|
|
4
10
|
|
|
5
11
|
A practical, typed ESLint Flat Config for Vue 3, React, Angular, Vite, TypeScript, and JavaScript projects.
|
|
6
12
|
|
|
7
|
-
[](https://www.npmjs.com/package/@fast-china/eslint-config)
|
|
8
|
-
[](./LICENSE)
|
|
13
|
+
[](https://www.npmjs.com/package/@fast-china/eslint-config) [](https://nodejs.org/) [](https://eslint.org/) [](./LICENSE)
|
|
9
14
|
|
|
10
15
|
## Highlights
|
|
11
16
|
|
|
@@ -334,18 +339,26 @@ pnpm exec prettier --check .
|
|
|
334
339
|
|
|
335
340
|
Set `prettier: false` if another formatter or stylistic rule set should remain fully in control.
|
|
336
341
|
|
|
342
|
+
## Documentation
|
|
343
|
+
|
|
344
|
+
- [Default rules and risk guide](./docs/rules-risk.md)
|
|
345
|
+
- [Engineering audit (Chinese)](./docs/engineering-audit.zh.md)
|
|
346
|
+
- [Contributing guide](./CONTRIBUTING.md)
|
|
347
|
+
- [Security policy](./SECURITY.md)
|
|
348
|
+
- [Changelog](./CHANGELOG.md)
|
|
349
|
+
|
|
337
350
|
## Development
|
|
338
351
|
|
|
339
352
|
```sh
|
|
340
|
-
pnpm install
|
|
353
|
+
pnpm install --frozen-lockfile
|
|
341
354
|
pnpm typegen
|
|
342
355
|
pnpm check
|
|
343
356
|
pnpm pack --dry-run
|
|
344
357
|
```
|
|
345
358
|
|
|
346
|
-
|
|
359
|
+
Use `pnpm dev` to inspect the active Flat Config interactively while changing factories or rules.
|
|
347
360
|
|
|
348
|
-
|
|
361
|
+
Run `pnpm typegen` after upgrading ESLint or a plugin and commit `src/typegen.d.ts`; never edit the generated file manually. `pnpm test` rebuilds the package before running consumer type-contract, runtime integration, and package-contract tests. `pnpm check` adds source type-checking, full-repository linting, and formatting verification.
|
|
349
362
|
|
|
350
363
|
## License
|
|
351
364
|
|
package/README.zh.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="left">
|
|
2
|
+
<strong>简体中文</strong> | <a href="./README.md">English</a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="./Fast.png" alt="logo" width="160" />
|
|
7
|
+
</p>
|
|
2
8
|
|
|
3
9
|
# @fast-china/eslint-config
|
|
4
10
|
|
|
5
11
|
面向 Vue 3、React、Angular、Vite、TypeScript 与 JavaScript 项目的实用型 ESLint Flat Config 规则库。
|
|
6
12
|
|
|
7
|
-
[](https://www.npmjs.com/package/@fast-china/eslint-config)
|
|
8
|
-
[](./LICENSE)
|
|
13
|
+
[](https://www.npmjs.com/package/@fast-china/eslint-config) [](https://nodejs.org/) [](https://eslint.org/) [](./LICENSE)
|
|
9
14
|
|
|
10
15
|
## 特性
|
|
11
16
|
|
|
@@ -334,18 +339,26 @@ pnpm exec prettier --check .
|
|
|
334
339
|
|
|
335
340
|
如果使用其他格式化工具,或希望保留完整的样式类 ESLint 规则,请设置 `prettier: false`。
|
|
336
341
|
|
|
342
|
+
## 文档
|
|
343
|
+
|
|
344
|
+
- [默认规则与风险指南](./docs/rules-risk.zh.md)
|
|
345
|
+
- [工程质量审查报告](./docs/engineering-audit.zh.md)
|
|
346
|
+
- [贡献指南](./CONTRIBUTING.md)
|
|
347
|
+
- [安全策略](./SECURITY.md)
|
|
348
|
+
- [更新日志](./CHANGELOG.md)
|
|
349
|
+
|
|
337
350
|
## 开发与贡献
|
|
338
351
|
|
|
339
352
|
```sh
|
|
340
|
-
pnpm install
|
|
353
|
+
pnpm install --frozen-lockfile
|
|
341
354
|
pnpm typegen
|
|
342
355
|
pnpm check
|
|
343
356
|
pnpm pack --dry-run
|
|
344
357
|
```
|
|
345
358
|
|
|
346
|
-
|
|
359
|
+
修改配置工厂或规则时,可使用 `pnpm dev` 交互检查实际生效的 Flat Config。
|
|
347
360
|
|
|
348
|
-
|
|
361
|
+
升级 ESLint 或插件后运行 `pnpm typegen` 并提交 `src/typegen.d.ts`;不要手工编辑生成文件。`pnpm test` 会先重新构建发布产物,再分别执行消费者类型契约、运行时集成和发布包契约测试。`pnpm check` 在此基础上增加源码类型检查、全仓 ESLint 和格式验证。
|
|
349
362
|
|
|
350
363
|
## 开源协议
|
|
351
364
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
[中文说明](#安全策略) | **English**
|
|
4
|
+
|
|
5
|
+
## Supported versions
|
|
6
|
+
|
|
7
|
+
Security fixes are provided for the latest release in the current major line.
|
|
8
|
+
Fixes are not backported to unsupported versions.
|
|
9
|
+
|
|
10
|
+
| Version | Supported |
|
|
11
|
+
| --------- | --------- |
|
|
12
|
+
| `2.0.6` | Yes |
|
|
13
|
+
| `< 2.0.6` | No |
|
|
14
|
+
|
|
15
|
+
## Reporting a vulnerability
|
|
16
|
+
|
|
17
|
+
Do not disclose a suspected vulnerability in a public Issue, Pull Request,
|
|
18
|
+
Discussion, or other public channel.
|
|
19
|
+
|
|
20
|
+
This project does not currently publish a dedicated security email address. To
|
|
21
|
+
request a private reporting channel, create a minimal issue in the
|
|
22
|
+
[Gitee issue tracker](https://gitee.com/FastDotnet/fast.eslint.config/issues/new)
|
|
23
|
+
with the title `[Security] Private report request`. Include only the affected
|
|
24
|
+
package version and a safe way for the maintainer to contact you. Do not include
|
|
25
|
+
technical details, proof-of-concept code, logs, attachments, credentials, or
|
|
26
|
+
other sensitive information in that issue.
|
|
27
|
+
|
|
28
|
+
After a private channel has been established, please provide:
|
|
29
|
+
|
|
30
|
+
- the affected package version and runtime environment;
|
|
31
|
+
- the vulnerability type and potential impact;
|
|
32
|
+
- the smallest reproducible example or proof of concept;
|
|
33
|
+
- the conditions required to reproduce the issue;
|
|
34
|
+
- any known workaround or suggested remediation; and
|
|
35
|
+
- your preferred disclosure timeline and attribution name, if any.
|
|
36
|
+
|
|
37
|
+
Never include real credentials, tokens, personal data, or third-party secrets
|
|
38
|
+
in a report or reproduction.
|
|
39
|
+
|
|
40
|
+
## Response and disclosure process
|
|
41
|
+
|
|
42
|
+
The maintainers aim to:
|
|
43
|
+
|
|
44
|
+
- acknowledge a report within 7 calendar days;
|
|
45
|
+
- provide an initial assessment within 14 calendar days; and
|
|
46
|
+
- send progress updates at least every 14 calendar days while remediation is in
|
|
47
|
+
progress.
|
|
48
|
+
|
|
49
|
+
These are response targets rather than guaranteed service-level commitments.
|
|
50
|
+
Validated reports will be handled through coordinated disclosure. Please avoid
|
|
51
|
+
public disclosure until a fixed release is available or another disclosure date
|
|
52
|
+
has been agreed upon. When appropriate, the fix will be accompanied by release
|
|
53
|
+
notes or a security advisory. Reporter attribution is optional and will follow
|
|
54
|
+
the reporter's preference.
|
|
55
|
+
|
|
56
|
+
## Scope
|
|
57
|
+
|
|
58
|
+
Examples of issues that may be security vulnerabilities include:
|
|
59
|
+
|
|
60
|
+
- unintended code execution while installing, importing, or running the
|
|
61
|
+
package;
|
|
62
|
+
- tampered or unexpected contents in a published package or release artifact;
|
|
63
|
+
- exposure of credentials or sensitive local project data caused by this
|
|
64
|
+
package; and
|
|
65
|
+
- a dependency or configuration weakness that is demonstrably exploitable
|
|
66
|
+
through this package.
|
|
67
|
+
|
|
68
|
+
The following are normally handled as regular bug reports:
|
|
69
|
+
|
|
70
|
+
- disagreements about rule defaults or formatting preferences;
|
|
71
|
+
- lint false positives or false negatives without a concrete security impact;
|
|
72
|
+
- issues that affect only unsupported versions; and
|
|
73
|
+
- vulnerabilities that exist solely in an upstream dependency and cannot be
|
|
74
|
+
exploited through this package.
|
|
75
|
+
|
|
76
|
+
When researching a potential vulnerability, act in good faith: avoid accessing
|
|
77
|
+
data that is not yours, degrading services, or disrupting other users.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 安全策略
|
|
82
|
+
|
|
83
|
+
### 支持版本
|
|
84
|
+
|
|
85
|
+
安全修复仅面向当前主版本线中的最新发布版本,不会向已停止支持的版本回移植。
|
|
86
|
+
|
|
87
|
+
| 版本 | 是否支持 |
|
|
88
|
+
| --------- | -------- |
|
|
89
|
+
| `2.0.6` | 是 |
|
|
90
|
+
| `< 2.0.6` | 否 |
|
|
91
|
+
|
|
92
|
+
### 报告安全漏洞
|
|
93
|
+
|
|
94
|
+
请勿在公开的 Issue、Pull Request、讨论区或其他公开渠道中披露疑似漏洞的技术细节。
|
|
95
|
+
|
|
96
|
+
本项目目前没有公开专用的安全邮箱。如需建立私密报告渠道,请在
|
|
97
|
+
[Gitee Issue](https://gitee.com/FastDotnet/fast.eslint.config/issues/new)
|
|
98
|
+
中创建一个标题为 `[Security] Private report request` 的最小化 Issue。公开内容只能包含受影响的包版本,以及维护者可用于联系你的安全联系方式。请勿在该 Issue 中提交技术细节、概念验证代码、日志、附件、凭据或其他敏感信息。
|
|
99
|
+
|
|
100
|
+
建立私密渠道后,请尽量提供:
|
|
101
|
+
|
|
102
|
+
- 受影响的包版本和运行环境;
|
|
103
|
+
- 漏洞类型及潜在影响;
|
|
104
|
+
- 最小复现示例或概念验证;
|
|
105
|
+
- 复现所需的前置条件;
|
|
106
|
+
- 已知的临时规避方案或修复建议;
|
|
107
|
+
- 期望的披露时间,以及是否需要署名。
|
|
108
|
+
|
|
109
|
+
报告和复现内容中不得包含真实凭据、令牌、个人数据或第三方秘密信息。
|
|
110
|
+
|
|
111
|
+
### 响应与披露流程
|
|
112
|
+
|
|
113
|
+
维护者计划在 7 个自然日内确认收到报告,在 14 个自然日内给出初步评估;修复期间至少每 14 个自然日同步一次进展。这些时间是处理目标,不构成服务等级承诺。
|
|
114
|
+
|
|
115
|
+
确认有效的漏洞将采用协同披露流程。请在修复版本发布或双方约定的披露日期之前避免公开漏洞。必要时,修复版本会附带发布说明或安全公告。是否公开报告者署名,以报告者的意愿为准。
|
|
116
|
+
|
|
117
|
+
### 适用范围
|
|
118
|
+
|
|
119
|
+
以下问题可能属于安全漏洞:
|
|
120
|
+
|
|
121
|
+
- 安装、导入或运行本包时发生未预期的代码执行;
|
|
122
|
+
- npm 发布包或 Release 产物包含被篡改或未预期的内容;
|
|
123
|
+
- 本包导致凭据或本地项目敏感数据泄露;
|
|
124
|
+
- 依赖或配置缺陷能够通过本包被明确利用。
|
|
125
|
+
|
|
126
|
+
以下问题通常按普通 Bug 处理:
|
|
127
|
+
|
|
128
|
+
- 对默认规则或格式偏好的不同意见;
|
|
129
|
+
- 没有明确安全影响的误报或漏报;
|
|
130
|
+
- 仅影响已停止支持版本的问题;
|
|
131
|
+
- 仅存在于上游依赖、且无法通过本包利用的漏洞。
|
|
132
|
+
|
|
133
|
+
研究疑似漏洞时请遵循善意原则:不要访问不属于你的数据,不要降低服务可用性,也不要影响其他用户。
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Angular TypeScript 源码与 HTML 模板检查的细分选项。
|
|
4
4
|
*
|
|
5
|
+
* @remarks
|
|
5
6
|
* 该对象通过 `fastConfig({ angular: { ... } })` 传入。只要传入对象,Angular 支持就会
|
|
6
7
|
* 被启用;未指定的字段继续使用各自默认值。Angular 配置始终包含框架 TypeScript 规则
|
|
7
8
|
* 和外部 `.html` 模板基础规则,本接口只控制成本或迁移影响较高的可选部分。
|
|
@@ -16,7 +17,7 @@ interface AngularConfigOptions {
|
|
|
16
17
|
*
|
|
17
18
|
* 关闭后仍会检查 Angular TypeScript 源码和外部 `.html` 模板,只是不再处理组件中的
|
|
18
19
|
* 内联模板。大型项目若主要使用外部模板,或 processor 与其他工具发生冲突,可暂时关闭。
|
|
19
|
-
* @
|
|
20
|
+
* @defaultValue `true`
|
|
20
21
|
*/
|
|
21
22
|
inlineTemplates?: boolean;
|
|
22
23
|
/**
|
|
@@ -25,15 +26,19 @@ interface AngularConfigOptions {
|
|
|
25
26
|
* 该规则组检查替代文本、键盘交互、焦点、表单标签和 ARIA 等可访问性问题,适用于
|
|
26
27
|
* 外部模板与已提取的内联模板。关闭后仍保留模板语法、严格比较和现代控制流等基础规则。
|
|
27
28
|
* 对旧项目而言可能一次产生较多报告,建议在确认迁移计划后再决定是否临时关闭。
|
|
28
|
-
* @
|
|
29
|
+
* @defaultValue `true`
|
|
29
30
|
*/
|
|
30
31
|
templateAccessibility?: boolean;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* 创建 Angular TypeScript、外部 HTML 模板与内联模板配置。
|
|
34
35
|
*
|
|
36
|
+
* @remarks
|
|
35
37
|
* Angular 支持依赖工厂的 TypeScript 配置先注册 typescript-eslint 解析器;模板由
|
|
36
38
|
* Angular 专用 parser 解析,内联模板通过官方 processor 复用同一套 HTML 规则。
|
|
39
|
+
*
|
|
40
|
+
* @param options - 控制内联模板处理与模板无障碍规则的 Angular 选项。
|
|
41
|
+
* @returns 按 TypeScript 源码、外部模板顺序排列的 ESLint Flat Config 数组。
|
|
37
42
|
*/
|
|
38
43
|
declare const createAngularConfigs: ({ inlineTemplates, templateAccessibility }?: AngularConfigOptions) => import("eslint/config").ConfigObject[];
|
|
39
44
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.d.mts","names":[],"sources":["../../src/configs/angular.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular.d.mts","names":[],"sources":["../../src/configs/angular.ts"],"mappings":";;;;;;;;;;;;UAqBiB;;;;;;;;;EAShB;;;;;;;;;EASA;;;;;;;;;;;;cAaY,yBAAwB,iBAAA,0BAA0D,iDAAyB"}
|
package/dist/configs/angular.mjs
CHANGED
|
@@ -8,8 +8,12 @@ import { defineConfig } from "eslint/config";
|
|
|
8
8
|
/**
|
|
9
9
|
* 创建 Angular TypeScript、外部 HTML 模板与内联模板配置。
|
|
10
10
|
*
|
|
11
|
+
* @remarks
|
|
11
12
|
* Angular 支持依赖工厂的 TypeScript 配置先注册 typescript-eslint 解析器;模板由
|
|
12
13
|
* Angular 专用 parser 解析,内联模板通过官方 processor 复用同一套 HTML 规则。
|
|
14
|
+
*
|
|
15
|
+
* @param options - 控制内联模板处理与模板无障碍规则的 Angular 选项。
|
|
16
|
+
* @returns 按 TypeScript 源码、外部模板顺序排列的 ESLint Flat Config 数组。
|
|
13
17
|
*/
|
|
14
18
|
const createAngularConfigs = ({ inlineTemplates = true, templateAccessibility = true } = {}) => defineConfig([{
|
|
15
19
|
name: inlineTemplates ? "@fast-china/angular/typescript-with-inline-templates" : "@fast-china/angular/typescript",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.mjs","names":[],"sources":["../../src/configs/angular.ts"],"sourcesContent":["import angularPlugin from \"@angular-eslint/eslint-plugin\";\nimport angularTemplatePlugin from \"@angular-eslint/eslint-plugin-template\";\nimport angularTemplateParser from \"@angular-eslint/template-parser\";\nimport { defineConfig } from \"eslint/config\";\n\nimport { GLOB_ANGULAR_TEMPLATE, GLOB_ANGULAR_TYPESCRIPT } from \"../constants\";\nimport { angularRules, angularTemplateAccessibilityRules, angularTemplateRules } from \"../rules\";\n\nimport type { ESLint, Linter } from \"eslint\";\n\n/**\n * Angular TypeScript 源码与 HTML 模板检查的细分选项。\n *\n * 该对象通过 `fastConfig({ angular: { ... } })` 传入。只要传入对象,Angular 支持就会\n * 被启用;未指定的字段继续使用各自默认值。Angular 配置始终包含框架 TypeScript 规则\n * 和外部 `.html` 模板基础规则,本接口只控制成本或迁移影响较高的可选部分。\n *\n * Angular 支持依赖顶层 `typescript` 能力,不能与 `typescript: false` 同时使用。\n * 这些选项不会修改 Angular 编译器、CLI 或模板类型检查配置。\n */\nexport interface AngularConfigOptions {\n\t/**\n\t * 是否使用 Angular 官方 processor,从 TypeScript 文件的\n\t * `@Component({ template: ... })` 元数据中提取内联 HTML 并复用模板规则进行检查。\n\t *\n\t * 关闭后仍会检查 Angular TypeScript 源码和外部 `.html` 模板,只是不再处理组件中的\n\t * 内联模板。大型项目若主要使用外部模板,或 processor 与其他工具发生冲突,可暂时关闭。\n\t * @
|
|
1
|
+
{"version":3,"file":"angular.mjs","names":[],"sources":["../../src/configs/angular.ts"],"sourcesContent":["import angularPlugin from \"@angular-eslint/eslint-plugin\";\nimport angularTemplatePlugin from \"@angular-eslint/eslint-plugin-template\";\nimport angularTemplateParser from \"@angular-eslint/template-parser\";\nimport { defineConfig } from \"eslint/config\";\n\nimport { GLOB_ANGULAR_TEMPLATE, GLOB_ANGULAR_TYPESCRIPT } from \"../constants\";\nimport { angularRules, angularTemplateAccessibilityRules, angularTemplateRules } from \"../rules\";\n\nimport type { ESLint, Linter } from \"eslint\";\n\n/**\n * Angular TypeScript 源码与 HTML 模板检查的细分选项。\n *\n * @remarks\n * 该对象通过 `fastConfig({ angular: { ... } })` 传入。只要传入对象,Angular 支持就会\n * 被启用;未指定的字段继续使用各自默认值。Angular 配置始终包含框架 TypeScript 规则\n * 和外部 `.html` 模板基础规则,本接口只控制成本或迁移影响较高的可选部分。\n *\n * Angular 支持依赖顶层 `typescript` 能力,不能与 `typescript: false` 同时使用。\n * 这些选项不会修改 Angular 编译器、CLI 或模板类型检查配置。\n */\nexport interface AngularConfigOptions {\n\t/**\n\t * 是否使用 Angular 官方 processor,从 TypeScript 文件的\n\t * `@Component({ template: ... })` 元数据中提取内联 HTML 并复用模板规则进行检查。\n\t *\n\t * 关闭后仍会检查 Angular TypeScript 源码和外部 `.html` 模板,只是不再处理组件中的\n\t * 内联模板。大型项目若主要使用外部模板,或 processor 与其他工具发生冲突,可暂时关闭。\n\t * @defaultValue `true`\n\t */\n\tinlineTemplates?: boolean;\n\t/**\n\t * 是否在模板基础正确性规则之外启用 Angular 模板无障碍规则组。\n\t *\n\t * 该规则组检查替代文本、键盘交互、焦点、表单标签和 ARIA 等可访问性问题,适用于\n\t * 外部模板与已提取的内联模板。关闭后仍保留模板语法、严格比较和现代控制流等基础规则。\n\t * 对旧项目而言可能一次产生较多报告,建议在确认迁移计划后再决定是否临时关闭。\n\t * @defaultValue `true`\n\t */\n\ttemplateAccessibility?: boolean;\n}\n\n/**\n * 创建 Angular TypeScript、外部 HTML 模板与内联模板配置。\n *\n * @remarks\n * Angular 支持依赖工厂的 TypeScript 配置先注册 typescript-eslint 解析器;模板由\n * Angular 专用 parser 解析,内联模板通过官方 processor 复用同一套 HTML 规则。\n *\n * @param options - 控制内联模板处理与模板无障碍规则的 Angular 选项。\n * @returns 按 TypeScript 源码、外部模板顺序排列的 ESLint Flat Config 数组。\n */\nexport const createAngularConfigs = ({ inlineTemplates = true, templateAccessibility = true }: AngularConfigOptions = {}) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: inlineTemplates ? \"@fast-china/angular/typescript-with-inline-templates\" : \"@fast-china/angular/typescript\",\n\t\t\tfiles: [GLOB_ANGULAR_TYPESCRIPT],\n\t\t\tplugins: {\n\t\t\t\t\"@angular-eslint\": angularPlugin as unknown as ESLint.Plugin,\n\t\t\t},\n\t\t\t...(inlineTemplates\n\t\t\t\t? {\n\t\t\t\t\t\tprocessor: angularTemplatePlugin.processors[\"extract-inline-html\"] as Linter.Processor,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\trules: angularRules,\n\t\t},\n\t\t{\n\t\t\tname: templateAccessibility ? \"@fast-china/angular/template-accessibility\" : \"@fast-china/angular/template\",\n\t\t\tfiles: [GLOB_ANGULAR_TEMPLATE],\n\t\t\tlanguageOptions: {\n\t\t\t\tparser: angularTemplateParser as unknown as Linter.Parser,\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\t\"@angular-eslint/template\": angularTemplatePlugin as unknown as ESLint.Plugin,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...angularTemplateRules,\n\t\t\t\t...(templateAccessibility ? angularTemplateAccessibilityRules : {}),\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;AAoDA,MAAa,wBAAwB,EAAE,kBAAkB,MAAM,wBAAwB,SAA+B,CAAC,MACtH,aAAa,CACZ;CACC,MAAM,kBAAkB,yDAAyD;CACjF,OAAO,CAAC,uBAAuB;CAC/B,SAAS,EACR,mBAAmB,cACpB;CACA,GAAI,kBACD,EACA,WAAW,sBAAsB,WAAW,uBAC7C,IACC,CAAC;CACJ,OAAO;AACR,GACA;CACC,MAAM,wBAAwB,+CAA+C;CAC7E,OAAO,CAAC,qBAAqB;CAC7B,iBAAiB,EAChB,QAAQ,sBACT;CACA,SAAS,EACR,4BAA4B,sBAC7B;CACA,OAAO;EACN,GAAG;EACH,GAAI,wBAAwB,oCAAoC,CAAC;CAClE;AACD,CACD,CAAC"}
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的通用配置。
|
|
4
4
|
*
|
|
5
|
+
* @remarks
|
|
5
6
|
* 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后
|
|
6
7
|
* 留下长期失效的抑制注释。
|
|
8
|
+
*
|
|
9
|
+
* @param files - 应用公共规则的 ESLint glob 列表。
|
|
10
|
+
* @returns 包含公共规则与无效禁用指令检查的 Flat Config 数组。
|
|
7
11
|
*/
|
|
8
12
|
declare const createCommonConfigs: (files?: readonly string[]) => import("eslint/config").ConfigObject[];
|
|
9
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.mts","names":[],"sources":["../../src/configs/common.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.mts","names":[],"sources":["../../src/configs/common.ts"],"mappings":";;;;;;;;;;;cAea,sBAAuB,sDAAqC"}
|
package/dist/configs/common.mjs
CHANGED
|
@@ -5,8 +5,12 @@ import { defineConfig } from "eslint/config";
|
|
|
5
5
|
/**
|
|
6
6
|
* 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的通用配置。
|
|
7
7
|
*
|
|
8
|
+
* @remarks
|
|
8
9
|
* 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后
|
|
9
10
|
* 留下长期失效的抑制注释。
|
|
11
|
+
*
|
|
12
|
+
* @param files - 应用公共规则的 ESLint glob 列表。
|
|
13
|
+
* @returns 包含公共规则与无效禁用指令检查的 Flat Config 数组。
|
|
10
14
|
*/
|
|
11
15
|
const createCommonConfigs = (files = GLOBS_CODE) => defineConfig([{
|
|
12
16
|
name: "@fast-china/common",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.mjs","names":[],"sources":["../../src/configs/common.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_CODE } from \"../constants\";\nimport { commonRules } from \"../rules\";\n\n/**\n * 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的通用配置。\n *\n * 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后\n * 留下长期失效的抑制注释。\n */\nexport const createCommonConfigs = (files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/common\",\n\t\t\tfiles: [...files],\n\t\t\tlinterOptions: {\n\t\t\t\treportUnusedDisableDirectives: \"error\",\n\t\t\t},\n\t\t\trules: commonRules,\n\t\t},\n\t]);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.mjs","names":[],"sources":["../../src/configs/common.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\n\nimport { GLOBS_CODE } from \"../constants\";\nimport { commonRules } from \"../rules\";\n\n/**\n * 创建跨 JavaScript、TypeScript 与 Vue 脚本生效的通用配置。\n *\n * @remarks\n * 除公共规则外,这里还把无效的 `eslint-disable` 指令提升为错误,避免规则被移除后\n * 留下长期失效的抑制注释。\n *\n * @param files - 应用公共规则的 ESLint glob 列表。\n * @returns 包含公共规则与无效禁用指令检查的 Flat Config 数组。\n */\nexport const createCommonConfigs = (files: readonly string[] = GLOBS_CODE) =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/common\",\n\t\t\tfiles: [...files],\n\t\t\tlinterOptions: {\n\t\t\t\treportUnusedDisableDirectives: \"error\",\n\t\t\t},\n\t\t\trules: commonRules,\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,uBAAuB,QAA2B,eAC9D,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,eAAe,EACd,+BAA+B,QAChC;CACA,OAAO;AACR,CACD,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Linter } from "eslint";
|
|
2
2
|
//#region src/configs/environment.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 应用源码可声明的运行时环境。
|
|
5
|
+
*
|
|
6
|
+
* - `"browser"` 仅提供浏览器全局变量。
|
|
7
|
+
* - `"node"` 仅提供 Node.js 全局变量。
|
|
8
|
+
* - `"universal"` 同时提供浏览器与 Node.js 全局变量。
|
|
9
|
+
*/
|
|
3
10
|
type RuntimeEnvironment = "browser" | "node" | "universal";
|
|
4
11
|
/**
|
|
5
12
|
* 运行时全局变量配置片段的选项。
|
|
6
13
|
*
|
|
14
|
+
* @remarks
|
|
7
15
|
* `fastConfig()` 会根据已启用的语言和框架计算 `files`、`nodeFiles`,再调用
|
|
8
16
|
* `createEnvironmentConfigs()`。该接口仍保持独立,以便环境片段的输入、默认值和文件
|
|
9
17
|
* 范围在源码中具有明确契约;直接组合配置片段时可从 `./configs` 子路径使用。
|
|
@@ -18,7 +26,7 @@ interface EnvironmentConfigOptions {
|
|
|
18
26
|
* `"browser"` 只注入浏览器全局变量,`"node"` 只注入 Node.js 全局变量,
|
|
19
27
|
* `"universal"` 同时注入两组。该值不会影响 `nodeFiles` 对应的工程文件;后者始终
|
|
20
28
|
* 使用 Node.js 全局变量。
|
|
21
|
-
* @
|
|
29
|
+
* @defaultValue `"browser"`
|
|
22
30
|
*/
|
|
23
31
|
environment?: RuntimeEnvironment;
|
|
24
32
|
/**
|
|
@@ -26,7 +34,7 @@ interface EnvironmentConfigOptions {
|
|
|
26
34
|
*
|
|
27
35
|
* 工厂会把当前启用的 JavaScript、TypeScript 和 Vue 文件范围传入这里。数组会复制到
|
|
28
36
|
* 生成配置中,不会在函数内部修改调用方传入的值。
|
|
29
|
-
* @
|
|
37
|
+
* @defaultValue {@link GLOBS_CODE}
|
|
30
38
|
*/
|
|
31
39
|
files?: readonly string[];
|
|
32
40
|
/**
|
|
@@ -35,7 +43,7 @@ interface EnvironmentConfigOptions {
|
|
|
35
43
|
* 每一项都会与内置的配置文件、脚本目录、测试文件和 CLI 文件模式组合为 ESLint
|
|
36
44
|
* Flat Config 的 AND 文件条件。例如顶层关闭 TypeScript 后,Node.js 工程片段也不会
|
|
37
45
|
* 因自身模式较宽而意外接管 `.ts` 文件。
|
|
38
|
-
* @
|
|
46
|
+
* @defaultValue {@link GLOBS_JAVASCRIPT}
|
|
39
47
|
*/
|
|
40
48
|
nodeFiles?: readonly string[];
|
|
41
49
|
/**
|
|
@@ -44,16 +52,20 @@ interface EnvironmentConfigOptions {
|
|
|
44
52
|
* 该记录在标准环境全局变量之后合并,所以同名条目可以覆盖预置权限。它应用于完整
|
|
45
53
|
* `files` 范围;其中属于 Node.js 工程文件的子集还会由后续片段追加标准 Node.js 全局
|
|
46
54
|
* 变量。值格式遵循 ESLint `Linter.Globals`。
|
|
47
|
-
* @
|
|
55
|
+
* @defaultValue `{}`
|
|
48
56
|
*/
|
|
49
57
|
globals?: Linter.Globals;
|
|
50
58
|
}
|
|
51
59
|
/**
|
|
52
60
|
* 创建运行时环境相关的 ESLint 配置。
|
|
53
61
|
*
|
|
62
|
+
* @remarks
|
|
54
63
|
* 返回两个相互独立的 Flat Config 片段:第一个为应用源码配置所选环境和项目级全局
|
|
55
64
|
* 变量;第二个仅命中配置、脚本、测试与 CLI 等工程文件,为它们配置 Node.js 全局变量
|
|
56
65
|
* 并允许使用 `console`。分离范围可以减少跨运行时的假阴性。
|
|
66
|
+
*
|
|
67
|
+
* @param options - 运行时环境、目标文件范围与项目级全局变量。
|
|
68
|
+
* @returns 依次包含应用运行时环境和 Node.js 工程文件环境的 Flat Config 数组。
|
|
57
69
|
*/
|
|
58
70
|
declare const createEnvironmentConfigs: ({ environment, files, nodeFiles, globals: projectGlobals }?: EnvironmentConfigOptions) => import("eslint/config").ConfigObject[];
|
|
59
71
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/configs/environment.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.d.mts","names":[],"sources":["../../src/configs/environment.ts"],"mappings":";;;;;;;;;KAcY;;;;;;;;;;;;UAaK;;;;;;;;;EAShB,cAAc;;;;;;;;EAQd;;;;;;;;;EASA;;;;;;;;;EASA,UAAU,OAAO;;;;;;;;;;;;;cAcL,6BAA4B,aAAA,OAAA,WAAA,SAAA,mBAKtC,qDAA6B"}
|
|
@@ -5,9 +5,13 @@ import globals from "globals";
|
|
|
5
5
|
/**
|
|
6
6
|
* 创建运行时环境相关的 ESLint 配置。
|
|
7
7
|
*
|
|
8
|
+
* @remarks
|
|
8
9
|
* 返回两个相互独立的 Flat Config 片段:第一个为应用源码配置所选环境和项目级全局
|
|
9
10
|
* 变量;第二个仅命中配置、脚本、测试与 CLI 等工程文件,为它们配置 Node.js 全局变量
|
|
10
11
|
* 并允许使用 `console`。分离范围可以减少跨运行时的假阴性。
|
|
12
|
+
*
|
|
13
|
+
* @param options - 运行时环境、目标文件范围与项目级全局变量。
|
|
14
|
+
* @returns 依次包含应用运行时环境和 Node.js 工程文件环境的 Flat Config 数组。
|
|
11
15
|
*/
|
|
12
16
|
const createEnvironmentConfigs = ({ environment = "browser", files = GLOBS_CODE, nodeFiles = GLOBS_JAVASCRIPT, globals: projectGlobals = {} } = {}) => {
|
|
13
17
|
const runtimeGlobals = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.mjs","names":[],"sources":["../../src/configs/environment.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport globals from \"globals\";\n\nimport { GLOBS_CODE, GLOBS_JAVASCRIPT, GLOBS_NODE_TOOLING } from \"../constants\";\n\nimport type { Linter } from \"eslint\";\n\nexport type RuntimeEnvironment = \"browser\" | \"node\" | \"universal\";\n\n/**\n * 运行时全局变量配置片段的选项。\n *\n * `fastConfig()` 会根据已启用的语言和框架计算 `files`、`nodeFiles`,再调用\n * `createEnvironmentConfigs()`。该接口仍保持独立,以便环境片段的输入、默认值和文件\n * 范围在源码中具有明确契约;直接组合配置片段时可从 `./configs` 子路径使用。\n *\n * 应用代码与 Node.js 工程文件使用两个独立 Flat Config 片段,避免浏览器源码无条件获得\n * `process`、`Buffer` 等 Node.js 全局变量,也避免配置文件误报这些合法全局变量未定义。\n */\nexport interface EnvironmentConfigOptions {\n\t/**\n\t * 应用代码实际运行的环境,决定 `files` 范围内注入哪组标准全局变量。\n\t *\n\t * `\"browser\"` 只注入浏览器全局变量,`\"node\"` 只注入 Node.js 全局变量,\n\t * `\"universal\"` 同时注入两组。该值不会影响 `nodeFiles` 对应的工程文件;后者始终\n\t * 使用 Node.js 全局变量。\n\t * @
|
|
1
|
+
{"version":3,"file":"environment.mjs","names":[],"sources":["../../src/configs/environment.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport globals from \"globals\";\n\nimport { GLOBS_CODE, GLOBS_JAVASCRIPT, GLOBS_NODE_TOOLING } from \"../constants\";\n\nimport type { Linter } from \"eslint\";\n\n/**\n * 应用源码可声明的运行时环境。\n *\n * - `\"browser\"` 仅提供浏览器全局变量。\n * - `\"node\"` 仅提供 Node.js 全局变量。\n * - `\"universal\"` 同时提供浏览器与 Node.js 全局变量。\n */\nexport type RuntimeEnvironment = \"browser\" | \"node\" | \"universal\";\n\n/**\n * 运行时全局变量配置片段的选项。\n *\n * @remarks\n * `fastConfig()` 会根据已启用的语言和框架计算 `files`、`nodeFiles`,再调用\n * `createEnvironmentConfigs()`。该接口仍保持独立,以便环境片段的输入、默认值和文件\n * 范围在源码中具有明确契约;直接组合配置片段时可从 `./configs` 子路径使用。\n *\n * 应用代码与 Node.js 工程文件使用两个独立 Flat Config 片段,避免浏览器源码无条件获得\n * `process`、`Buffer` 等 Node.js 全局变量,也避免配置文件误报这些合法全局变量未定义。\n */\nexport interface EnvironmentConfigOptions {\n\t/**\n\t * 应用代码实际运行的环境,决定 `files` 范围内注入哪组标准全局变量。\n\t *\n\t * `\"browser\"` 只注入浏览器全局变量,`\"node\"` 只注入 Node.js 全局变量,\n\t * `\"universal\"` 同时注入两组。该值不会影响 `nodeFiles` 对应的工程文件;后者始终\n\t * 使用 Node.js 全局变量。\n\t * @defaultValue `\"browser\"`\n\t */\n\tenvironment?: RuntimeEnvironment;\n\t/**\n\t * 需要获得所选运行时全局变量的应用代码 glob 列表。\n\t *\n\t * 工厂会把当前启用的 JavaScript、TypeScript 和 Vue 文件范围传入这里。数组会复制到\n\t * 生成配置中,不会在函数内部修改调用方传入的值。\n\t * @defaultValue {@link GLOBS_CODE}\n\t */\n\tfiles?: readonly string[];\n\t/**\n\t * 当前启用且允许作为 Node.js 工程文件执行的脚本扩展名 glob 列表。\n\t *\n\t * 每一项都会与内置的配置文件、脚本目录、测试文件和 CLI 文件模式组合为 ESLint\n\t * Flat Config 的 AND 文件条件。例如顶层关闭 TypeScript 后,Node.js 工程片段也不会\n\t * 因自身模式较宽而意外接管 `.ts` 文件。\n\t * @defaultValue {@link GLOBS_JAVASCRIPT}\n\t */\n\tnodeFiles?: readonly string[];\n\t/**\n\t * 追加到应用代码环境中的项目级全局变量及其读写权限。\n\t *\n\t * 该记录在标准环境全局变量之后合并,所以同名条目可以覆盖预置权限。它应用于完整\n\t * `files` 范围;其中属于 Node.js 工程文件的子集还会由后续片段追加标准 Node.js 全局\n\t * 变量。值格式遵循 ESLint `Linter.Globals`。\n\t * @defaultValue `{}`\n\t */\n\tglobals?: Linter.Globals;\n}\n\n/**\n * 创建运行时环境相关的 ESLint 配置。\n *\n * @remarks\n * 返回两个相互独立的 Flat Config 片段:第一个为应用源码配置所选环境和项目级全局\n * 变量;第二个仅命中配置、脚本、测试与 CLI 等工程文件,为它们配置 Node.js 全局变量\n * 并允许使用 `console`。分离范围可以减少跨运行时的假阴性。\n *\n * @param options - 运行时环境、目标文件范围与项目级全局变量。\n * @returns 依次包含应用运行时环境和 Node.js 工程文件环境的 Flat Config 数组。\n */\nexport const createEnvironmentConfigs = ({\n\tenvironment = \"browser\",\n\tfiles = GLOBS_CODE,\n\tnodeFiles = GLOBS_JAVASCRIPT,\n\tglobals: projectGlobals = {},\n}: EnvironmentConfigOptions = {}) => {\n\tconst runtimeGlobals = {\n\t\t...(environment !== \"node\" ? globals.browser : {}),\n\t\t...(environment !== \"browser\" ? globals.node : {}),\n\t\t...projectGlobals,\n\t};\n\tconst nodeToolingFiles = GLOBS_NODE_TOOLING.flatMap((nodeGlob) => nodeFiles.map((fileGlob) => [nodeGlob, fileGlob]));\n\n\treturn defineConfig([\n\t\t{\n\t\t\tname: `@fast-china/globals/${environment}`,\n\t\t\tfiles: [...files],\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: runtimeGlobals,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/globals/node-tooling\",\n\t\t\tfiles: nodeToolingFiles,\n\t\t\tlanguageOptions: {\n\t\t\t\tglobals: globals.node,\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t\"no-console\": \"off\",\n\t\t\t},\n\t\t},\n\t]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AA4EA,MAAa,4BAA4B,EACxC,cAAc,WACd,QAAQ,YACR,YAAY,kBACZ,SAAS,iBAAiB,CAAC,MACE,CAAC,MAAM;CACpC,MAAM,iBAAiB;EACtB,GAAI,gBAAgB,SAAS,QAAQ,UAAU,CAAC;EAChD,GAAI,gBAAgB,YAAY,QAAQ,OAAO,CAAC;EAChD,GAAG;CACJ;CACA,MAAM,mBAAmB,mBAAmB,SAAS,aAAa,UAAU,KAAK,aAAa,CAAC,UAAU,QAAQ,CAAC,CAAC;CAEnH,OAAO,aAAa,CACnB;EACC,MAAM,uBAAuB;EAC7B,OAAO,CAAC,GAAG,KAAK;EAChB,iBAAiB,EAChB,SAAS,eACV;CACD,GACA;EACC,MAAM;EACN,OAAO;EACP,iBAAiB,EAChB,SAAS,QAAQ,KAClB;EACA,OAAO,EACN,cAAc,MACf;CACD,CACD,CAAC;AACF"}
|
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。
|
|
4
4
|
*
|
|
5
|
+
* @remarks
|
|
5
6
|
* 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检
|
|
6
7
|
* 应由项目维护的文件。
|
|
7
8
|
*/
|
|
8
9
|
declare const DEFAULT_IGNORE_PATTERNS: readonly string[];
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 创建全局忽略配置,并在默认集合之后追加项目自定义模式。
|
|
12
|
+
*
|
|
13
|
+
* @param additionalPatterns - 追加到 {@link DEFAULT_IGNORE_PATTERNS} 之后的 ESLint 全局忽略模式。
|
|
14
|
+
* @returns 包含单个命名全局忽略片段的 Flat Config 数组。
|
|
15
|
+
*/
|
|
10
16
|
declare const createGlobalIgnores: (additionalPatterns?: readonly string[]) => import("eslint/config").ConfigObject[];
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* 创建读取项目 `.gitignore` 的全局忽略配置。
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* `.gitignore` 的查找位置由 `eslint-config-flat-gitignore` 根据 ESLint 当前工作目录确定。
|
|
22
|
+
* 未找到文件时不会抛错;该片段也不会替代 {@link createGlobalIgnores} 的内置模式。
|
|
23
|
+
*
|
|
24
|
+
* @returns 包含 `.gitignore` 转换结果的 Flat Config 数组。
|
|
25
|
+
*/
|
|
12
26
|
declare const createGitignoreConfigs: () => import("eslint/config").ConfigObject[];
|
|
13
27
|
//#endregion
|
|
14
28
|
export { DEFAULT_IGNORE_PATTERNS, createGitignoreConfigs, createGlobalIgnores };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignores.d.mts","names":[],"sources":["../../src/configs/ignores.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"ignores.d.mts","names":[],"sources":["../../src/configs/ignores.ts"],"mappings":";;;;;;;;cAYa;;;;;;;cAkBA,sBAAuB,mEAA0C;;;;;;;;;;cAYjE,sDAAsB"}
|
package/dist/configs/ignores.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import eslintConfigFlatGitignore from "eslint-config-flat-gitignore";
|
|
|
5
5
|
/**
|
|
6
6
|
* 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。
|
|
7
7
|
*
|
|
8
|
+
* @remarks
|
|
8
9
|
* 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检
|
|
9
10
|
* 应由项目维护的文件。
|
|
10
11
|
*/
|
|
@@ -19,9 +20,22 @@ const DEFAULT_IGNORE_PATTERNS = Object.freeze([
|
|
|
19
20
|
"**/components.d.ts",
|
|
20
21
|
...GLOBS_LOCKFILES
|
|
21
22
|
]);
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* 创建全局忽略配置,并在默认集合之后追加项目自定义模式。
|
|
25
|
+
*
|
|
26
|
+
* @param additionalPatterns - 追加到 {@link DEFAULT_IGNORE_PATTERNS} 之后的 ESLint 全局忽略模式。
|
|
27
|
+
* @returns 包含单个命名全局忽略片段的 Flat Config 数组。
|
|
28
|
+
*/
|
|
23
29
|
const createGlobalIgnores = (additionalPatterns = []) => defineConfig([globalIgnores([...DEFAULT_IGNORE_PATTERNS, ...additionalPatterns], "@fast-china/ignores/global")]);
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* 创建读取项目 `.gitignore` 的全局忽略配置。
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* `.gitignore` 的查找位置由 `eslint-config-flat-gitignore` 根据 ESLint 当前工作目录确定。
|
|
35
|
+
* 未找到文件时不会抛错;该片段也不会替代 {@link createGlobalIgnores} 的内置模式。
|
|
36
|
+
*
|
|
37
|
+
* @returns 包含 `.gitignore` 转换结果的 Flat Config 数组。
|
|
38
|
+
*/
|
|
25
39
|
const createGitignoreConfigs = () => defineConfig([{
|
|
26
40
|
name: "@fast-china/ignores/git",
|
|
27
41
|
...eslintConfigFlatGitignore({ strict: false })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignores.mjs","names":[],"sources":["../../src/configs/ignores.ts"],"sourcesContent":["import { defineConfig, globalIgnores } from \"eslint/config\";\nimport eslintConfigFlatGitignore from \"eslint-config-flat-gitignore\";\n\nimport { GLOBS_LOCKFILES } from \"../constants\";\n\n/**\n * 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。\n *\n * 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检\n * 应由项目维护的文件。\n */\nexport const DEFAULT_IGNORE_PATTERNS = Object.freeze([\n\t\"**/node_modules/**\",\n\t\"**/{dist,build,coverage,output,temp,tmp}/**\",\n\t\"**/{.cache,.nuxt,.output,.vercel,.nitro}/**\",\n\t\"**/{.vitepress/cache,.vite-inspect}/**\",\n\t\"**/__snapshots__/**\",\n\t\"**/*.min.*\",\n\t\"**/auto-import?(s).d.ts\",\n\t\"**/components.d.ts\",\n\t...GLOBS_LOCKFILES,\n]);\n\n
|
|
1
|
+
{"version":3,"file":"ignores.mjs","names":[],"sources":["../../src/configs/ignores.ts"],"sourcesContent":["import { defineConfig, globalIgnores } from \"eslint/config\";\nimport eslintConfigFlatGitignore from \"eslint-config-flat-gitignore\";\n\nimport { GLOBS_LOCKFILES } from \"../constants\";\n\n/**\n * 默认忽略依赖、构建结果、缓存、生成文件和包管理器锁文件。\n *\n * @remarks\n * 不忽略 `src`、`public`、测试夹具或普通 Markdown 文档,避免共享配置静默漏检\n * 应由项目维护的文件。\n */\nexport const DEFAULT_IGNORE_PATTERNS = Object.freeze([\n\t\"**/node_modules/**\",\n\t\"**/{dist,build,coverage,output,temp,tmp}/**\",\n\t\"**/{.cache,.nuxt,.output,.vercel,.nitro}/**\",\n\t\"**/{.vitepress/cache,.vite-inspect}/**\",\n\t\"**/__snapshots__/**\",\n\t\"**/*.min.*\",\n\t\"**/auto-import?(s).d.ts\",\n\t\"**/components.d.ts\",\n\t...GLOBS_LOCKFILES,\n]);\n\n/**\n * 创建全局忽略配置,并在默认集合之后追加项目自定义模式。\n *\n * @param additionalPatterns - 追加到 {@link DEFAULT_IGNORE_PATTERNS} 之后的 ESLint 全局忽略模式。\n * @returns 包含单个命名全局忽略片段的 Flat Config 数组。\n */\nexport const createGlobalIgnores = (additionalPatterns: readonly string[] = []) =>\n\tdefineConfig([globalIgnores([...DEFAULT_IGNORE_PATTERNS, ...additionalPatterns], \"@fast-china/ignores/global\")]);\n\n/**\n * 创建读取项目 `.gitignore` 的全局忽略配置。\n *\n * @remarks\n * `.gitignore` 的查找位置由 `eslint-config-flat-gitignore` 根据 ESLint 当前工作目录确定。\n * 未找到文件时不会抛错;该片段也不会替代 {@link createGlobalIgnores} 的内置模式。\n *\n * @returns 包含 `.gitignore` 转换结果的 Flat Config 数组。\n */\nexport const createGitignoreConfigs = () =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/ignores/git\",\n\t\t\t...eslintConfigFlatGitignore({ strict: false }),\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,0BAA0B,OAAO,OAAO;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG;AACJ,CAAC;;;;;;;AAQD,MAAa,uBAAuB,qBAAwC,CAAC,MAC5E,aAAa,CAAC,cAAc,CAAC,GAAG,yBAAyB,GAAG,kBAAkB,GAAG,4BAA4B,CAAC,CAAC;;;;;;;;;;AAWhH,MAAa,+BACZ,aAAa,CACZ;CACC,MAAM;CACN,GAAG,0BAA0B,EAAE,QAAQ,MAAM,CAAC;AAC/C,CACD,CAAC"}
|