
发布分类: 发布说明 阅读 2 分钟
我们刚刚发布了 ESLint v9.15.0,这是一个次要版本升级。此版本添加了一些新功能并修复了先前版本中发现的几个错误。
此版本将 @eslint/plugin-kit
依赖项更新到最新版本 0.2.3,其中包含针对安全公告 GHSA-7q7g-4xm8-89cq 的修复。
meta.defaultOptions
规则现在可以指定默认选项。ESLint 将递归地将任何用户提供的选项元素合并到默认元素之上。
此功能使在规则中使用选项变得更容易。
// 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 { /* ... */ };
}
};
此功能还允许文档生成器、其他工具和集成以及最终用户轻松找到规则的默认选项。
normalizeLanguageOptions(languageOptions)
方法。返回值将在调用 parse()
、createSourceCode()
和 applyLanguageOptions()
方法时用作 languageOptions
,并在规则中的 context.languageOptions
属性中用作值。no-useless-computed-key
规则现在完全支持对象解构模式。01557ce
feat: 实现 Language#normalizeLanguageOptions() (#19104) (Nicholas C. Zakas)2edc0e2
feat: 添加 meta.defaultOptions (#17656) (Josh Goldberg ✨)bdec50e
feat: 修复 no-useless-computed-key
与 __proto__
相关的误报 (#19123) (Milos Djermanovic)3087c9e
feat: 向 @eslint/js
插件添加 meta
对象 (#19095) (Francesco Trotta)fd33f13
fix: 更新 no-restricted-imports
规则的类型 (#19060) (Nitin Kumar)bd35098
fix: 停止使用 Node.js node:assert 和 AssertionError (#19082) (Josh Goldberg ✨)9db5b15
fix: no-lonely-if
的不安全报告 (#19087) (Abraham Guo)68fa497
fix: 在 Windows 上忽略不同驱动器上的文件 (#19069) (Francesco Trotta)4ce625a
fix: 将 @humanwhocodes/[email protected] 升级到避免调试日志 (#19102) (Milos Djermanovic)d927920
docs: 修复无 JS 模式下的样式 (#18916) (Tanuj Kanti)09bc2a8
docs: 更新 README (GitHub Actions Bot)39089c8
docs: 添加 no-useless-computed-key
使用对象模式的示例 (#19109) (Milos Djermanovic)895c60f
docs: 添加缺失的 messageId 属性和 suggestion 属性 (#19122) (fnx)298625e
docs: 将 CLI -c 更改为使用扁平化配置 (#19103) (Nicholas C. Zakas)522d8a3
docs: 在 indent
、quotes
和 semi
规则类型上添加弃用说明 (#19090) (Marco Pasqualetti)2967d91
chore: 将 @eslint/js 升级到 9.15.0 (#19133) (Milos Djermanovic)b441bee
chore: @eslint/js 发布后的 package.json 更新 (Jenkins)7d6bf4a
chore: 将 @eslint/core 升级到 0.9.0 (#19131) (Milos Djermanovic)902e707
chore: 将 @eslint/plugin-kit 升级到 0.2.3 (#19130) (Milos Djermanovic)5ff6c1d
chore: 升级 cross-spawn (#19125) (Ian Bobinac)cceccc7
chore: 将 @eslint/json 的依赖项更新到 ^0.6.0 (#19117) (renovate[bot])0da3f73
chore: 更新 Algolia 推荐 (#19114) (Strek)4f08332
ci: 取消固定 trunk-io/trunk-action
(#19108) (Francesco Trotta)6b75683
perf: 通过使用 trimEnd
替换正则表达式来优化 text-table
(#19061) (Nitin Kumar)最新的 ESLint 新闻、案例研究、教程和资源。