CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-eslint-plugin-babel

An eslint plugin companion to babel-eslint that re-implements problematic rules to support experimental JavaScript features

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

rule-configuration.mddocs/

Rule Configuration

All active babel rules support the same configuration options as their corresponding core ESLint rules, with additional Babel-specific behavior layered on top.

Capabilities

Rule Configuration Format

Standard ESLint rule configuration format applies to all babel rules.

/**
 * Rule configuration formats
 * @type {number|string|Array}
 */
// Severity only
"babel/rule-name": 0 | 1 | 2 | "off" | "warn" | "error"

// Severity with options
"babel/rule-name": [severity, ...options]

Severity Levels

/**
 * ESLint severity levels
 * @type {number|string}
 */
const severityLevels = {
  0: "off",     // Rule is disabled
  1: "warn",    // Rule produces warnings
  2: "error"    // Rule produces errors
};

new-cap Configuration

/**
 * babel/new-cap rule options (same as core new-cap)
 * @type {Array}
 */
"babel/new-cap": [severity, {
  newIsCap?: boolean,              // Default: true
  capIsNew?: boolean,              // Default: true  
  newIsCapExceptions?: string[],   // Default: []
  newIsCapExceptionPattern?: string, // Default: undefined
  capIsNewExceptions?: string[],   // Default: []
  capIsNewExceptionPattern?: string, // Default: undefined
  properties?: boolean             // Default: true
}]

Usage Examples:

{
  "babel/new-cap": [1, { "capIsNew": false }],
  "babel/new-cap": [2, { "newIsCapExceptions": ["dataParser"] }],
  "babel/new-cap": [1, { "capIsNewExceptionPattern": "^Foo" }]
}

camelcase Configuration

/**
 * babel/camelcase rule options (same as core camelcase)
 * @type {Array}
 */
"babel/camelcase": [severity, {
  properties?: "always" | "never", // Default: "always"
  ignoreDestructuring?: boolean    // Default: false
}]

Usage Examples:

{
  "babel/camelcase": [1, { "properties": "never" }],
  "babel/camelcase": [2, { "ignoreDestructuring": true }],
  "babel/camelcase": [1, { "properties": "never", "ignoreDestructuring": true }]
}

no-invalid-this Configuration

/**
 * babel/no-invalid-this rule options (same as core no-invalid-this)
 * @type {Array}
 */
"babel/no-invalid-this": [severity, {
  capIsConstructor?: boolean // Default: true
}]

Usage Examples:

{
  "babel/no-invalid-this": 1,
  "babel/no-invalid-this": [2, { "capIsConstructor": false }]
}

object-curly-spacing Configuration

/**
 * babel/object-curly-spacing rule options (same as core object-curly-spacing)
 * @type {Array}
 */
"babel/object-curly-spacing": [severity, "always" | "never", {
  arraysInObjects?: boolean,  // Default: varies by spacing
  objectsInObjects?: boolean  // Default: varies by spacing
}]

Usage Examples:

{
  "babel/object-curly-spacing": [2, "always"],
  "babel/object-curly-spacing": [1, "never"],
  "babel/object-curly-spacing": [2, "always", { "objectsInObjects": false }]
}

quotes Configuration

/**
 * babel/quotes rule options (same as core quotes)
 * @type {Array}
 */
"babel/quotes": [severity, "single" | "double" | "backtick", {
  avoidEscape?: boolean,        // Default: false
  allowTemplateLiterals?: boolean // Default: false
}]

Usage Examples:

{
  "babel/quotes": [2, "single"],
  "babel/quotes": [1, "double", { "avoidEscape": true }],
  "babel/quotes": [2, "backtick", { "allowTemplateLiterals": false }]
}

semi Configuration

/**
 * babel/semi rule options (same as core semi)
 * @type {Array}
 */
"babel/semi": [severity, "always" | "never", {
  omitLastInOneLineBlock?: boolean // Default: false (when "always")
}]

Usage Examples:

{
  "babel/semi": [2, "always"],
  "babel/semi": [1, "never"],
  "babel/semi": [2, "always", { "omitLastInOneLineBlock": true }]
}

no-unused-expressions Configuration

/**
 * babel/no-unused-expressions rule options (same as core no-unused-expressions)
 * @type {Array}
 */
"babel/no-unused-expressions": [severity, {
  allowShortCircuit?: boolean,    // Default: false
  allowTernary?: boolean,         // Default: false
  allowTaggedTemplates?: boolean  // Default: false
}]

Usage Examples:

{
  "babel/no-unused-expressions": 2,
  "babel/no-unused-expressions": [1, { "allowShortCircuit": true }],
  "babel/no-unused-expressions": [2, { "allowTernary": true, "allowTaggedTemplates": true }]
}

valid-typeof Configuration

/**
 * babel/valid-typeof rule options (same as core valid-typeof)
 * @type {Array}
 */
"babel/valid-typeof": [severity, {
  requireStringLiterals?: boolean // Default: false
}]

Usage Examples:

{
  "babel/valid-typeof": 2,
  "babel/valid-typeof": [1, { "requireStringLiterals": true }]
}

Complete Configuration Example

{
  "plugins": ["babel"],
  "rules": {
    // Disable core rules to avoid conflicts
    "new-cap": 0,
    "camelcase": 0,
    "no-invalid-this": 0,
    "object-curly-spacing": 0,
    "quotes": 0,
    "semi": 0,
    "no-unused-expressions": 0,
    "valid-typeof": 0,
    
    // Configure babel alternatives
    "babel/new-cap": [1, { "capIsNew": false }],
    "babel/camelcase": [2, { "properties": "never" }],
    "babel/no-invalid-this": 1,
    "babel/object-curly-spacing": [2, "always"],
    "babel/quotes": [2, "single", { "avoidEscape": true }],
    "babel/semi": [2, "always"],
    "babel/no-unused-expressions": [2, { "allowShortCircuit": true }],
    "babel/valid-typeof": 2
  }
}

Install with Tessl CLI

npx tessl i tessl/npm-eslint-plugin-babel

docs

active-rules.md

deprecated-rules.md

index.md

plugin-configuration.md

rule-configuration.md

tile.json