summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/no-sync.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/lib/rules/no-sync.js')
-rw-r--r--tools/eslint/lib/rules/no-sync.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/eslint/lib/rules/no-sync.js b/tools/eslint/lib/rules/no-sync.js
new file mode 100644
index 0000000000..1a9d27d637
--- /dev/null
+++ b/tools/eslint/lib/rules/no-sync.js
@@ -0,0 +1,28 @@
+/**
+ * @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 + "'.");
+ }
+ }
+ };
+
+};