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,23 +1,10 @@
"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/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"] "enum": ["always", "never"]
}, },
@ -36,4 +23,21 @@ module.exports.schema = [
}, },
"additionalProperties": false "additionalProperties": false
} }
]; ]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}
/* 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;
}
};
}
};

View File

@ -1,9 +1,18 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["always", "as-needed"]
}
]
},
create: function() {
return { return {
Program() { Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return; return;
} }
@ -15,10 +24,5 @@ module.exports = function() {
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
};
module.exports.schema = [
{
"enum": ["always", "as-needed"]
} }
]; };

View File

@ -1,9 +1,18 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["semicolon", "comma"],
}
]
},
create: function() {
return { return {
Program() { Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return; return;
} }
@ -16,10 +25,5 @@ module.exports = function() {
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
};
module.exports.schema = [
{
'enum': ['semicolon', 'comma'],
} }
]; };

View File

@ -1,9 +1,18 @@
'use strict'; 'use strict';
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["always", "always-multiline", "only-multiline", "never"]
}
]
},
create: function() {
return { return {
Program() { Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return; return;
} }
@ -15,10 +24,5 @@ module.exports = function() {
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
};
module.exports.schema = [
{
enum: ['always', 'always-multiline', 'only-multiline', 'never']
} }
]; };

View File

@ -1,23 +1,10 @@
"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": [ "oneOf": [
{ {
@ -33,4 +20,21 @@ module.exports.schema = [
} }
] ]
} }
]; ]
},
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,9 +1,18 @@
"use strict"; "use strict";
var isWarnedForDeprecation = false; var isWarnedForDeprecation = false;
module.exports = function() { module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["always", "methods", "properties", "never"]
}
]
},
create: function() {
return { return {
Program() { Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return; return;
} }
@ -15,10 +24,5 @@ module.exports = function() {
isWarnedForDeprecation = true; isWarnedForDeprecation = true;
} }
}; };
};
module.exports.schema = [
{
'enum': ['always', 'methods', 'properties', 'never']
} }
]; };