or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

active-rules.mddeprecated-rules.mdindex.mdplugin-configuration.mdrule-configuration.md
tile.json

index.mddocs/

eslint-plugin-babel

eslint-plugin-babel is an ESLint plugin that provides alternative implementations of core ESLint rules designed to work with experimental JavaScript features supported by Babel. While babel-eslint adapts ESLint to work with Babel's parsing, this plugin re-implements problematic rules to prevent false positives when using modern JavaScript syntax like decorators, optional chaining, class properties, and other experimental features.

Package Information

  • Package Name: eslint-plugin-babel
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install eslint-plugin-babel --save-dev

Core Imports

No direct imports needed - configured as an ESLint plugin:

{
  "plugins": ["babel"]
}

Basic Usage

{
  "plugins": ["babel"],
  "rules": {
    "babel/new-cap": 1,
    "babel/camelcase": 1,
    "babel/no-invalid-this": 1,
    "babel/object-curly-spacing": 1,
    "babel/quotes": 1,
    "babel/semi": 1,
    "babel/no-unused-expressions": 1,
    "babel/valid-typeof": 1
  }
}

Architecture

eslint-plugin-babel follows the standard ESLint plugin structure:

  • Plugin Configuration: Main export provides rules and rulesConfig objects
  • Rule Implementation: Most rules use eslint-rule-composer to wrap core ESLint rules with custom filtering logic
  • Babel Compatibility: Each rule adds specific support for experimental JavaScript features
  • Deprecation Pattern: Deprecated rules show warnings and redirect to newer ESLint versions

The plugin requires ESLint >=4.0.0 and Node >=4.

Capabilities

Plugin Configuration

Main plugin export providing ESLint rule definitions and configurations.

module.exports = {
  rules: {
    // All available rules (active and deprecated)
  },
  rulesConfig: {
    // Default rule configurations (all disabled by default)
  }
};

Plugin Configuration

Active Rules

Eight enhanced rules that provide Babel-compatible alternatives to core ESLint rules.

// Core active rules with Babel syntax support
const activeRules = [
  'new-cap',           // Ignores capitalized decorators (@Decorator)
  'camelcase',         // Supports optional chaining (bar?.a_b)
  'no-invalid-this',   // Allows 'this' in class properties
  'object-curly-spacing', // Handles export syntax variations
  'quotes',            // Supports JSX fragment shorthand (<>foo</>;)
  'semi',              // Handles async iteration and class properties
  'no-unused-expressions', // Supports do expressions and optional chaining
  'valid-typeof'       // Allows BigInt typeof checks
];

Active Rules

Rule Options and Configuration

All active rules support the same options as their corresponding core ESLint rules.

// Example rule configurations with options
"babel/new-cap": [1, { "capIsNew": false }]
"babel/camelcase": [1, { "properties": "never", "ignoreDestructuring": true }]
"babel/semi": [2, "always"]

Rule Configuration

Deprecated Rules

Seven deprecated rules that redirect to newer ESLint or plugin alternatives.

// Deprecated rules (show warnings when used)
const deprecatedRules = [
  'array-bracket-spacing',    // Use built-in since eslint@3.9.0
  'arrow-parens',            // Use built-in since eslint@3.10.0  
  'flow-object-type',        // Use flowtype/object-type-delimiter
  'func-params-comma-dangle', // Use built-in comma-dangle since eslint@3.8.0
  'generator-star-spacing',   // Use built-in since eslint@3.6.0
  'object-shorthand',        // Use built-in since eslint@0.20.0
  'no-await-in-loop'         // Use built-in since eslint@3.12.0
];

Deprecated Rules