
此版本将 @eslint/plugin-kit 依赖更新到最新的 0.2.3 版本,其中包括针对安全公告 GHSA-7q7g-4xm8-89cq 的修复。
🌐 This release updates the @eslint/plugin-kit dependency to the latest version 0.2.3 which includes the fix for security advisory GHSA-7q7g-4xm8-89cq.
亮点
🌐 Highlights
meta.defaultOptions
规则现在可以指定默认选项。ESLint 将递归地将任何用户提供的选项元素合并到默认元素之上。
🌐 Rules can now specify default options. ESLint will recursively merge any user-provided options elements on top of the default elements.
此功能使在规则中处理选项变得更容易。
🌐 This feature makes it easier to work with options in rules.
// my-rule.js
export default {
meta: {
defaultOptions: [{
alias: "basic",
ignoreClassFields: false
}],
schema: [{
type: "object",
properties: {
alias: {
type: "string"
},
ignoreClassFields: {
type: "boolean"
}
},
additionalProperties: false
}]
},
create(context) {
// `context.options` is guaranteed to be an array with a single object
// that has a string property `alias` and a boolean property `ignoreClassFields`.
// If the rule is enabled with no options specified in the configuration file,
// `alias` will be `"basic"`, and `ignoreClassFields` will be `false`.
const [{ alias, ignoreClassFields }] = context.options;
return { /* ... */ };
}
};
此功能还允许文档生成器、其他工具和集成以及终端用户轻松找到规则的默认选项。
🌐 This feature also allows document generators, other tools and integrations, and end users to easily find the default options for rules.
其他显著变化
🌐 Other notable changes
- 自定义语言现在可以提供
normalizeLanguageOptions(languageOptions)方法。返回值在调用parse()、createSourceCode()和applyLanguageOptions()方法时将用作languageOptions,并作为规则中context.languageOptions属性的值。 - 现在
no-useless-computed-key规则完全支持对象解构模式。
特性
🌐 Features
01557ce功能:实现 Language#normalizeLanguageOptions() (#19104) (Nicholas C. Zakas)2edc0e2功能:添加 meta.defaultOptions (#17656) (Josh Goldberg ✨)bdec50e功能:修复使用__proto__时no-useless-computed-key的假阴性 (#19123) (Milos Djermanovic)3087c9e功能:向@eslint/js插件添加meta对象 (#19095) (Francesco Trotta)
错误修复
🌐 Bug Fixes
fd33f13修复:更新no-restricted-imports规则的类型 (#19060) (Nitin Kumar)bd35098修复:转离 Node.js 的 node:assert 和 AssertionError (#19082) (Josh Goldberg ✨)9db5b15修复:no-lonely-if的不安全报告 (#19087) (Abraham Guo)68fa497修复:在 Windows 上忽略不同驱动器上的文件 (#19069) (Francesco Trotta)4ce625a修复:升级 @humanwhocodes/retry@0.4.1 以避免调试日志 (#19102) (Milos Djermanovic)
文档
🌐 Documentation
d927920文档:修复无 JS 模式下的样式 (#18916) (Tanuj Kanti)09bc2a8文档:更新自述文件(GitHub Actions 机器人)39089c8文档:添加带有对象模式的no-useless-computed-key示例 (#19109) (Milos Djermanovic)895c60f文档:添加缺失的 messageId 属性和 suggestion 属性 (#19122) (fnx)298625e文档:更改 CLI -c 使用平面配置 (#19103) (Nicholas C. Zakas)522d8a3文档:在indent、quotes和semi规则类型上添加废弃标记 (#19090) (Marco Pasqualetti)
杂项
🌐 Chores
2967d91杂务:升级 @eslint/js@9.15.0 (#19133) (Milos Djermanovic)b441bee事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)7d6bf4a杂务:升级 @eslint/core@0.9.0 (#19131) (Milos Djermanovic)902e707杂务: 升级 @eslint/plugin-kit@0.2.3 (#19130) (Milos Djermanovic)5ff6c1d杂务:升级 cross-spawn (#19125) (Ian Bobinac)cceccc7杂项:将依赖 @eslint/json 更新到 ^0.6.0 (#19117) (renovate[bot])0da3f73杂务:更新 Algolia 推荐来源 (#19114) (Strek)4f08332ci:取消固定trunk-io/trunk-action(#19108) (Francesco Trotta)6b75683性能:通过用trimEnd替换正则表达式来优化text-table(#19061) (Nitin Kumar)
