2015-04-29 01:03:05 +08:00
|
|
|
/**
|
|
|
|
* @fileoverview Rule to check for properties whose identifier ends with the string Sync
|
|
|
|
* @author Matt DuVall<http://mattduvall.com/>
|
|
|
|
*/
|
|
|
|
|
2016-01-13 03:50:19 +08:00
|
|
|
/* jshint node:true */
|
2015-04-29 01:03:05 +08:00
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Rule Definition
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = function(context) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
"MemberExpression": function(node) {
|
|
|
|
var propertyName = node.property.name,
|
|
|
|
syncRegex = /.*Sync$/;
|
|
|
|
|
|
|
|
if (syncRegex.exec(propertyName) !== null) {
|
|
|
|
context.report(node, "Unexpected sync method: '" + propertyName + "'.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2015-06-28 23:36:14 +08:00
|
|
|
|
|
|
|
module.exports.schema = [];
|