Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Updated rules to new format, added deprecated flag (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
wagerfield authored and hzoo committed Jan 18, 2017
1 parent be8d95c commit 08d35b3
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 134 deletions.
68 changes: 36 additions & 32 deletions rules/array-bracket-spacing.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
"use strict";

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
module.exports = {
meta: {
deprecated: true,
schema: [
{
"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"]
]
},
{
"type": "object",
"properties": {
"singleValue": {
"type": "boolean"
},
"objectsInArrays": {
"type": "boolean"
},
"arraysInArrays": {
"type": "boolean"
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;
}
},
"additionalProperties": false
};
}
];
};
40 changes: 22 additions & 18 deletions rules/arrow-parens.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
"use strict";

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["always", "as-needed"]
}
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}

/* eslint-disable no-console */
console.log('The babel/arrow-parens rule is deprecated. Please ' +
'use the built in arrow-parens rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
};

module.exports.schema = [
{
"enum": ["always", "as-needed"]
/* eslint-disable no-console */
console.log('The babel/arrow-parens rule is deprecated. Please ' +
'use the built in arrow-parens rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
}
];
};
42 changes: 23 additions & 19 deletions rules/flow-object-type.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
"use strict";

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["semicolon", "comma"],
}
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}

/* eslint-disable no-console */
console.log('The babel/flow-object-type rule is deprecated. Please ' +
'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');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
/* eslint-disable no-console */
console.log('The babel/flow-object-type rule is deprecated. Please ' +
'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');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
}
};

module.exports.schema = [
{
'enum': ['semicolon', 'comma'],
}
];
40 changes: 22 additions & 18 deletions rules/func-params-comma-dangle.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
'use strict';

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
module.exports = {
meta: {
deprecated: true,
schema: [
{
"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 */
console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' +
'use the built in comma-dangle rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
/* eslint-disable no-console */
console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' +
'use the built in comma-dangle rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
}
};

module.exports.schema = [
{
enum: ['always', 'always-multiline', 'only-multiline', 'never']
}
];
62 changes: 33 additions & 29 deletions rules/generator-star-spacing.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
"use strict";

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
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;
}
};
};

module.exports.schema = [
{
"oneOf": [
module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["before", "after", "both", "neither"]
},
{
"type": "object",
"properties": {
"before": {"type": "boolean"},
"after": {"type": "boolean"}
},
"additionalProperties": false
"oneOf": [
{
"enum": ["before", "after", "both", "neither"]
},
{
"type": "object",
"properties": {
"before": {"type": "boolean"},
"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;
}
};
}
];
};
40 changes: 22 additions & 18 deletions rules/object-shorthand.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
"use strict";

var isWarnedForDeprecation = false;
module.exports = function() {
return {
Program() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
module.exports = {
meta: {
deprecated: true,
schema: [
{
"enum": ["always", "methods", "properties", "never"]
}
]
},
create: function() {
return {
Program: function() {
if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) {
return;
}

/* eslint-disable no-console */
console.log('The babel/object-shorthand rule is deprecated. Please ' +
'use the built in object-shorthand rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
/* eslint-disable no-console */
console.log('The babel/object-shorthand rule is deprecated. Please ' +
'use the built in object-shorthand rule instead.');
/* eslint-enable no-console */
isWarnedForDeprecation = true;
}
};
}
};

module.exports.schema = [
{
'enum': ['always', 'methods', 'properties', 'never']
}
];

0 comments on commit 08d35b3

Please sign in to comment.