Updated rules to new format, added deprecated flag (babel/eslint-plugin-babel#119)

This commit is contained in:
Matthew Wagerfield 2017-01-18 23:01:31 +00:00
parent 3855f28ebb
commit 7f94d5f75f
6 changed files with 158 additions and 134 deletions

View File

@ -1,39 +1,43 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return; {
"enum": ["always", "never"]
},
{
"type": "object",
"properties": {
"singleValue": {
"type": "boolean"
},
"objectsInArrays": {
"type": "boolean"
},
"arraysInArrays": {
"type": "boolean"
}
},
"additionalProperties": false
} }
]
/* eslint-disable no-console */
console.log('The babel/array-bracket-spacing rule is deprecated. Please ' +
'use the built in array-bracket-spacing rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
};
module.exports.schema = [
{
"enum": ["always", "never"]
}, },
{ create: function() {
"type": "object", return {
"properties": { Program: function() {
"singleValue": { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
"type": "boolean" return;
}, }
"objectsInArrays": {
"type": "boolean" /* eslint-disable no-console */
}, console.log('The babel/array-bracket-spacing rule is deprecated. Please ' +
"arraysInArrays": { 'use the built in array-bracket-spacing rule instead.');
"type": "boolean" /* eslint-enable no-console */
isWarnedForDeprecation = true;
} }
}, };
"additionalProperties": false
} }
]; };

View File

@ -1,24 +1,28 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return; {
"enum": ["always", "as-needed"]
} }
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log('The babel/arrow-parens rule is deprecated. Please ' + console.log('The babel/arrow-parens rule is deprecated. Please ' +
'use the built in arrow-parens rule instead.'); 'use the built in arrow-parens rule instead.');
/* eslint-enable no-console */ /* eslint-enable no-console */
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
};
module.exports.schema = [
{
"enum": ["always", "as-needed"]
} }
]; };

View File

@ -1,25 +1,29 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return; {
"enum": ["semicolon", "comma"],
} }
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log('The babel/flow-object-type rule is deprecated. Please ' + console.log('The babel/flow-object-type rule is deprecated. Please ' +
'use the flowtype/object-type-delimiter rule instead.\n' + 'use the flowtype/object-type-delimiter rule instead.\n' +
'Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter'); 'Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter');
/* eslint-enable no-console */ /* eslint-enable no-console */
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
}
}; };
module.exports.schema = [
{
'enum': ['semicolon', 'comma'],
}
];

View File

@ -1,24 +1,28 @@
'use strict'; 'use strict';
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return; {
"enum": ["always", "always-multiline", "only-multiline", "never"]
} }
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' + console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' +
'use the built in comma-dangle rule instead.'); 'use the built in comma-dangle rule instead.');
/* eslint-enable no-console */ /* eslint-enable no-console */
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
}
}; };
module.exports.schema = [
{
enum: ['always', 'always-multiline', 'only-multiline', 'never']
}
];

View File

@ -1,36 +1,40 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return;
}
/* eslint-disable no-console */
console.log('The babel/generator-star-spacing rule is deprecated. Please ' +
'use the built in generator-star-spacing rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
};
module.exports.schema = [
{
"oneOf": [
{ {
"enum": ["before", "after", "both", "neither"] "oneOf": [
}, {
{ "enum": ["before", "after", "both", "neither"]
"type": "object", },
"properties": { {
"before": {"type": "boolean"}, "type": "object",
"after": {"type": "boolean"} "properties": {
}, "before": {"type": "boolean"},
"additionalProperties": false "after": {"type": "boolean"}
},
"additionalProperties": false
}
]
} }
] ]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* eslint-disable no-console */
console.log('The babel/generator-star-spacing rule is deprecated. Please ' +
'use the built in generator-star-spacing rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
} }
]; };

View File

@ -1,24 +1,28 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
return { meta: {
Program() { deprecated: true,
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { schema: [
return; {
"enum": ["always", "methods", "properties", "never"]
} }
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log('The babel/object-shorthand rule is deprecated. Please ' + console.log('The babel/object-shorthand rule is deprecated. Please ' +
'use the built in object-shorthand rule instead.'); 'use the built in object-shorthand rule instead.');
/* eslint-enable no-console */ /* eslint-enable no-console */
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
}
}; };
module.exports.schema = [
{
'enum': ['always', 'methods', 'properties', 'never']
}
];