UNPKG

737 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to check for properties whose identifier ends with the string Sync
3 * @author Matt DuVall<http://mattduvall.com/>
4 */
5
6/*jshint node:true*/
7
8//------------------------------------------------------------------------------
9// Rule Definition
10//------------------------------------------------------------------------------
11
12module.exports = function(context) {
13
14 "use strict";
15
16 return {
17
18 "MemberExpression": function(node) {
19 var propertyName = node.property.name,
20 syncRegex = /.*Sync$/;
21
22 if (syncRegex.exec(propertyName) !== null) {
23 context.report(node, "Unexpected sync method: '" + propertyName + "'.");
24 }
25 }
26 };
27
28};