Skip to content

Latest commit

 

History

History
90 lines (72 loc) · 2.23 KB

File metadata and controls

90 lines (72 loc) · 2.23 KB
title config

コンパイラの設定オプションを検証します。

ルールの詳細 {/rule-details/}

React Compiler は、動作を制御するさまざまな設定オプションを受け付けます。このルールは、設定で正しいオプション名と値の型が使われているか検証し、タイプミスや誤った設定によって気づかないうちに動作しなくなることを防ぎます。

無効な例 {/invalid/}

このルールに違反するコードの例です。

// ❌ Unknown option name
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compileMode: 'all' // Typo: should be compilationMode
    }]
  ]
};

// ❌ Invalid option value
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compilationMode: 'everything' // Invalid: use 'all' or 'infer'
    }]
  ]
};

有効な例 {/valid/}

このルールに従ったコードの例です。

// ✅ Valid compiler configuration
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compilationMode: 'infer',
      panicThreshold: 'critical_errors'
    }]
  ]
};

トラブルシューティング {/troubleshooting/}

設定が期待どおりに動作しない {/config-not-working/}

以下のように、コンパイラの設定にタイプミスや誤った値が含まれているかもしれません。

// ❌ Wrong: Common configuration mistakes
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      // Typo in option name
      compilationMod: 'all',
      // Wrong value type
      panicThreshold: true,
      // Unknown option
      optimizationLevel: 'max'
    }]
  ]
};

有効なオプションについては、設定のドキュメントを確認してください。

// ✅ Better: Valid configuration
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compilationMode: 'all', // or 'infer'
      panicThreshold: 'none', // or 'critical_errors', 'all_errors'
      // Only use documented options
    }]
  ]
};