PR-URL: https://github.com/nodejs/io.js/pull/2072 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-by: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alex Kocharin <alex@kocharin.ru>
30 lines
762 B
JavaScript
30 lines
762 B
JavaScript
/**
|
|
* @fileoverview Rule to check for properties whose identifier ends with the string Sync
|
|
* @author Matt DuVall<http://mattduvall.com/>
|
|
*/
|
|
|
|
/*jshint node:true*/
|
|
|
|
"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 + "'.");
|
|
}
|
|
}
|
|
};
|
|
|
|
};
|
|
|
|
module.exports.schema = [];
|