All active babel rules support the same configuration options as their corresponding core ESLint rules, with additional Babel-specific behavior layered on top.
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]/**
* ESLint severity levels
* @type {number|string}
*/
const severityLevels = {
0: "off", // Rule is disabled
1: "warn", // Rule produces warnings
2: "error" // Rule produces errors
};/**
* 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" }]
}/**
* 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 }]
}/**
* 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 }]
}/**
* 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 }]
}/**
* 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 }]
}/**
* 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 }]
}/**
* 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 }]
}/**
* 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 }]
}{
"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
}
}