Seven rules that are deprecated and should no longer be used. These rules show deprecation warnings when used and redirect users to newer ESLint versions or alternative plugins that provide the same functionality.
Use built-in array-bracket-spacing rule instead.
/**
* Deprecated array-bracket-spacing rule
* Shows deprecation warning when used
* @type {Object}
*/
'array-bracket-spacing': {
meta: {
deprecated: true,
schema: [{
enum: ["always", "never"]
}, {
type: "object",
properties: {
singleValue: { type: "boolean" },
objectsInArrays: { type: "boolean" },
arraysInArrays: { type: "boolean" }
},
additionalProperties: false
}]
},
create: Function // Shows deprecation warning
}Deprecation: Use built-in array-bracket-spacing rule since ESLint v3.9.0.
Migration:
{
"rules": {
"babel/array-bracket-spacing": 0,
"array-bracket-spacing": [2, "never"]
}
}Use built-in arrow-parens rule instead.
/**
* Deprecated arrow-parens rule
* @type {Function}
*/
'arrow-parens': deprecatedRuleWrapperDeprecation: Use built-in arrow-parens rule since ESLint v3.10.0.
Migration:
{
"rules": {
"babel/arrow-parens": 0,
"arrow-parens": [2, "as-needed"]
}
}Use flowtype/object-type-delimiter from eslint-plugin-flowtype instead.
/**
* Deprecated flow-object-type rule
* @type {Function}
*/
'flow-object-type': deprecatedRuleWrapperDeprecation: Use flowtype/object-type-delimiter from eslint-plugin-flowtype since v2.23.0.
Migration:
{
"plugins": ["flowtype"],
"rules": {
"babel/flow-object-type": 0,
"flowtype/object-type-delimiter": [2, "comma"]
}
}Use built-in comma-dangle rule instead.
/**
* Deprecated func-params-comma-dangle rule
* @type {Function}
*/
'func-params-comma-dangle': deprecatedRuleWrapperDeprecation: Use built-in comma-dangle rule since ESLint v3.8.0.
Migration:
{
"rules": {
"babel/func-params-comma-dangle": 0,
"comma-dangle": [2, "always-multiline"]
}
}Use built-in generator-star-spacing rule instead.
/**
* Deprecated generator-star-spacing rule
* @type {Function}
*/
'generator-star-spacing': deprecatedRuleWrapperDeprecation: Use built-in generator-star-spacing rule since ESLint v3.6.0.
Migration:
{
"rules": {
"babel/generator-star-spacing": 0,
"generator-star-spacing": [2, {"before": false, "after": true}]
}
}Use built-in object-shorthand rule instead.
/**
* Deprecated object-shorthand rule
* @type {Function}
*/
'object-shorthand': deprecatedRuleWrapperDeprecation: Use built-in object-shorthand rule since ESLint v0.20.0.
Migration:
{
"rules": {
"babel/object-shorthand": 0,
"object-shorthand": [2, "always"]
}
}Use built-in no-await-in-loop rule instead.
/**
* Deprecated no-await-in-loop rule
* @type {Function}
*/
'no-await-in-loop': deprecatedRuleWrapperDeprecation: Use built-in no-await-in-loop rule since ESLint v3.12.0.
Migration:
{
"rules": {
"babel/no-await-in-loop": 0,
"no-await-in-loop": 2
}
}All deprecated rules follow this pattern:
/**
* Standard deprecation warning pattern
* @param {string} ruleName - Name of the deprecated rule
* @param {string} replacement - Recommended replacement
* @returns {Object} Rule object that shows warning
*/
function createDeprecatedRule(ruleName, replacement) {
var isWarnedForDeprecation = false;
return {
meta: { deprecated: true },
create: function() {
return {
Program: function() {
if (!isWarnedForDeprecation) {
console.log(`The babel/${ruleName} rule is deprecated. Please use ${replacement} instead.`);
isWarnedForDeprecation = true;
}
}
};
}
};
}To migrate from deprecated rules:
Example Migration:
// Before (using deprecated rules)
{
"plugins": ["babel"],
"rules": {
"babel/array-bracket-spacing": [2, "never"],
"babel/arrow-parens": [2, "as-needed"],
"babel/comma-dangle": [2, "always"],
"babel/generator-star-spacing": [2, {"before": false, "after": true}],
"babel/object-shorthand": [2, "always"],
"babel/no-await-in-loop": 2
}
}
// After (using modern alternatives)
{
"plugins": ["babel"],
"rules": {
"array-bracket-spacing": [2, "never"],
"arrow-parens": [2, "as-needed"],
"comma-dangle": [2, "always"],
"generator-star-spacing": [2, {"before": false, "after": true}],
"object-shorthand": [2, "always"],
"no-await-in-loop": 2
}
}