Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

eslint-migrate-optionseslint 迁移选项

Agent Skill

eslint-migrate-options 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

123

周安装

8

GitHub Stars

24,487

下载量

65
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:eslint-migrate-options(eslint 迁移选项)
来源仓库:https://github.com/biomejs/biome
仓库路径:skills/eslint-migrate-options
安装命令:
npx skills add https://github.com/biomejs/biome --skill eslint-migrate-options
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/biomejs/biome --skill eslint-migrate-options

简介

eslint-migrate-options 专门处理从 ESLint 向 Biome 迁移时带选项规则的转换逻辑,适合平滑过渡 lint 工具链。

  • 适用于保留原规则参数而非仅调整严重级别的迁移场景。
  • 提供反序列化、选项映射与测试用例生成支持。
  • 安装命令:npx skills add https://github.com/biomejs/biome --skill eslint-migrate-options。
  • 需先确认目标 Biome 规则是否存在,并检查是否会修改 migrate 相关源码。

SKILL.md

Purpose

Use this skill when a Biome lint rule already exists and biome migrate eslint should preserve more than just the rule severity.

This skill is specifically for cases where an ESLint rule has options that need to be:

  • deserialized from ESLint config
  • translated into Biome rule options
  • wired into the migrate pipeline
  • tested through migrator spec fixtures without depending on CLI tests

Do not use this skill for severity-only migrations. Those are usually covered by the generated rule mapping in eslint_any_rule_to_biome.rs.

Before You Edit

Confirm these points first:

  1. The target Biome rule already exists and already has its own options type in crates/biome_rule_options/src/.
  2. The Biome rule metadata already declares the ESLint source rule, so severity-only migration exists or can be generated.
  3. The ESLint rule really has user-facing options worth preserving.
  4. You have checked the ESLint rule docs or source so you know the exact option shape, defaults, and any plugin-specific quirks.

If any of those are missing, fix that first before adding a migrator.

Mental Model

The migrate pipeline has two layers:

  1. Generated severity mapping: eslint_any_rule_to_biome.rs
  2. Hand-written option migration: plugin-specific structs plus a custom arm in migrate_eslint_rule()

The generated file already handles the common case:

{
  "some-rule": "error"
}

Add a custom migrator only when a config like this should keep its options:

{
  "some-rule": ["error", { "someOption": true }]
}

Key Files

FileRole
crates/biome_cli/src/execute/migrate/eslint_eslint.rsShared ESLint config model, Rule enum, RuleConf<T>, deserialization entry points
crates/biome_cli/src/execute/migrate/eslint_unicorn.rseslint-plugin-unicorn option structs and conversions
crates/biome_cli/src/execute/migrate/eslint_typescript.rs@typescript-eslint option structs and conversions
crates/biome_cli/src/execute/migrate/eslint_jsxa11y.rsjsx-a11y option structs and conversions
crates/biome_cli/src/execute/migrate/eslint_to_biome.rsMain conversion logic, including migrate_eslint_rule()
crates/biome_cli/tests/specs/migrate_eslint/Fixture-driven snapshot tests for custom ESLint migrators
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsGenerated severity mapping for all known ESLint-backed rules
xtask/codegen/src/generate_migrate_eslint.rsCodegen for the generated rule mapping

Use the plugin-specific file that matches the source ESLint rule. Keep option structs close to similar migrators so future edits stay discoverable.

Recommended Workflow

Step 1: Inspect an Existing Migrator First

Before writing anything new, find a nearby rule that already migrates options. Reuse its shape if the target rule is in the same plugin or has the same Biome configuration type (RuleConfiguration vs RuleFixConfiguration).

This saves time and helps match the patterns already used in migrate_eslint_rule().

Step 2: Model the ESLint Options Exactly

Add structs in the correct plugin file. Match ESLint's option payload shape, not Biome's.

use biome_deserialize_macros::Deserializable;

#[derive(Clone, Debug, Default, Deserializable)]
pub(crate) struct EslintMyRuleOptions {
    some_option: Option<u8>,
    another_option: bool,
    nested: EslintMyRuleNestedOptions,
}

#[derive(Clone, Debug, Default, Deserializable)]
pub(crate) struct EslintMyRuleNestedOptions {
    threshold: Option<u8>,
}

Guidelines:

  • Use snake_case Rust field names; Deserializable handles camelCase JSON keys.
  • Use Option<T> for fields that can be omitted.
  • Keep unsupported ESLint fields in the struct if they appear in the config shape; ignore them later during conversion.
  • Prefer mirroring the real JSON nesting instead of flattening early.

Step 3: Convert ESLint Options Into Biome Options

Implement From<Eslint...Options> for biome_rule_options::... in the same plugin file.

impl From<EslintMyRuleOptions> for my_rule::MyRuleOptions {
    fn from(value: EslintMyRuleOptions) -> Self {
        Self {
            some_option: value.some_option,
            different_name: Some(value.another_option),
            threshold: value.nested.threshold,
        }
    }
}

Focus on semantic mapping, not field-for-field copying:

  • rename concepts when ESLint and Biome use different names
  • drop unsupported knobs deliberately
  • preserve defaults only when they match Biome's behavior
  • add small helper functions when the conversion needs filtering or normalization

If an ESLint option should only be emitted when at least one nested field is set, use a helper that returns Option<_> rather than constructing empty Biome option objects.

Step 4: Add a Typed Rule Variant

In eslint_eslint.rs, add a Rule enum variant using RuleConf<T>:

pub(crate) enum Rule {
    // ...
    MyPluginMyRule(RuleConf<eslint_my_plugin::EslintMyRuleOptions>),
}

Then update both of these places:

  • Rule::name() so the variant returns the ESLint rule name
  • Rules::deserialize so the ESLint rule string deserializes into your typed variant before the catch-all fallback

Example:

Self::MyPluginMyRule(_) => Cow::Borrowed("my-plugin/my-rule"),
"my-plugin/my-rule" => {
    if let Some(conf) = RuleConf::deserialize(ctx, &value, name) {
        result.insert(Rule::MyPluginMyRule(conf));
    }
}

Order matters in Rules::deserialize: put the explicit match before the fallback rule_name => arm.

Step 5: Wire the Rule Into migrate_eslint_rule()

Add a match arm in crates/biome_cli/src/execute/migrate/eslint_to_biome.rs.

Always call migrate_eslint_any_rule() first. It handles severity tracking, unsupported-rule reporting, and deduplication.

Pick the configuration type that matches the Biome rule:

  • RuleFixConfiguration::WithOptions for fixable rules
  • RuleConfiguration::WithOptions for non-fixable rules

Typical fixable rule pattern:

eslint_eslint::Rule::MyPluginMyRule(conf) => {
    if migrate_eslint_any_rule(rules, &name, conf.severity(), opts, results) {
        let group = rules.style.get_or_insert_with(Default::default);
        if let SeverityOrGroup::Group(group) = group {
            group.my_biome_rule = Some(biome_config::RuleFixConfiguration::WithOptions(
                biome_config::RuleWithFixOptions {
                    level: conf.severity().into(),
                    fix: None,
                    options: conf.option_or_default().into(),
                },
            ));
        }
    }
}

Typical non-fixable rule pattern:

eslint_eslint::Rule::MyPluginMyRule(conf) => {
    if migrate_eslint_any_rule(rules, &name, conf.severity(), opts, results) {
        let group = rules.style.get_or_insert_with(Default::default);
        if let SeverityOrGroup::Group(group) = group {
            group.my_biome_rule = Some(biome_config::RuleConfiguration::WithOptions(
                biome_config::RuleWithOptions {
                    level: conf.severity().into(),
                    options: conf.option_or_default().into(),
                },
            ));
        }
    }
}

Replace rules.style with the correct group (a11y, complexity, correctness, nursery, performance, security, style, suspicious).

Step 6: Choose the Right RuleConf Access Pattern

Do not force every migrator into the same shape. The current codebase uses different access patterns depending on the ESLint rule schema.

Use the one that matches the source rule:

  • conf.option_or_default() when the rule has one options object and severity-only configs should fall back to defaults
  • if let RuleConf::Option(severity, rule_options) = conf when the migration should only attach options if the user explicitly provided the object
  • conf.into_vec() when the rule uses array-style payloads that need custom aggregation or normalization

If unsure, inspect an existing migrator with a similar ESLint schema and copy that pattern.

Common Pitfalls

  • Adding a custom migrator when severity-only migration was enough
  • Modeling the Biome options instead of the ESLint JSON shape
  • Forgetting to update both Rule::name() and Rules::deserialize
  • Putting the deserialization arm after the fallback arm
  • Writing a custom match arm but skipping migrate_eslint_any_rule()
  • Using RuleFixConfiguration for a rule that is not fixable, or the inverse
  • Emitting empty option objects that change semantics compared with the default Biome config
  • Ignoring ESLint fields during deserialization by leaving them out of the struct, causing valid configs to fail to deserialize

Worked Example

unicorn/numeric-separators-style is a good reference because the names do not line up perfectly.

ESLint uses number; Biome uses decimal. ESLint also exposes onlyIfContainsSeparator, which Biome does not support, so the migrator ignores it.

#[derive(Clone, Debug, Default, Deserializable)]
pub(crate) struct NumericSeparatorsStyleOptions {
    number: EslintNumericSeparatorTypeOptions,
    binary: EslintNumericSeparatorTypeOptions,
    octal: EslintNumericSeparatorTypeOptions,
    hexadecimal: EslintNumericSeparatorTypeOptions,
}

#[derive(Clone, Debug, Default, Deserializable)]
pub(crate) struct EslintNumericSeparatorTypeOptions {
    minimum_digits: Option<u8>,
    group_length: Option<u8>,
}

impl From<NumericSeparatorsStyleOptions>
    for use_numeric_separators::UseNumericSeparatorsOptions
{
    fn from(value: NumericSeparatorsStyleOptions) -> Self {
        Self {
            binary: some_if_set(value.binary),
            octal: some_if_set(value.octal),
            decimal: some_if_set(value.number),
            hexadecimal: some_if_set(value.hexadecimal),
        }
    }
}

fn some_if_set(
    options: EslintNumericSeparatorTypeOptions,
) -> Option<use_numeric_separators::NumericLiteralSeparatorOptions> {
    if options.minimum_digits.is_some() || options.group_length.is_some() {
        Some(options.into())
    } else {
        None
    }
}

This is the pattern to follow when:

  • ESLint names differ from Biome names
  • nested objects may be partially unset
  • empty nested config should collapse to None

Testing Checklist

At minimum, verify all of these:

  1. Severity-only ESLint config still migrates correctly.
  2. ESLint config with options produces the expected Biome options.
  3. Unsupported ESLint knobs do not break deserialization.
  4. Empty or partially specified nested options do not emit incorrect Biome config.

Use the migrator spec fixtures in crates/biome_cli/tests/specs/migrate_eslint/ as the default test path for custom migrators.

  • Add one fixture file per case.
  • Keep the fixture focused on eslint input and pre-migration biome config input.
  • Let the generated test runner in eslint_to_biome.rs discover the file and write the adjacent .snap.new.
  • Prefer adding or updating these fixture snapshots instead of writing a new full CLI test when you are verifying custom option migration behavior.
  • After inspecting snapshot differences, use cargo insta accept to accept valid new snapshots, or cargo insta reject to reject invalid ones and keep iterating.

CLI tests in crates/biome_cli/tests/commands/migrate_eslint.rs should be treated as smoke coverage for command wiring and end-to-end behavior, not the primary place to test custom migrators.

Useful commands:

cargo check -p biome_cli
cargo test -p biome_cli migrate_eslint

When the rule itself has analyzer behavior tied to the options, run targeted analyzer tests too:

cargo test -p biome_js_analyze my_rule_name

Review Checklist

Before finishing, confirm:

  • the typed Rule variant exists
  • Rule::name() returns the exact ESLint rule name
  • Rules::deserialize has an explicit arm before the fallback
  • the plugin-specific ESLint option structs match the real ESLint schema
  • the From impl maps semantics correctly, not just names mechanically
  • migrate_eslint_any_rule() is still called first
  • the chosen Biome rule group and configuration type are correct
  • migrator spec fixtures cover both severity-only and option-bearing configs when relevant

References

  • crates/biome_cli/src/execute/migrate/
  • crates/biome_cli/src/execute/migrate/eslint_eslint.rs
  • crates/biome_cli/src/execute/migrate/eslint_to_biome.rs
  • crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs
  • crates/biome_rule_options/src/
  • xtask/codegen/src/generate_migrate_eslint.rs

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.5%
按下载量换算23

Claude

31.84%
按下载量换算21

Cursor

18.89%
按下载量换算12

Gemini CLI

10.92%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills