Browse Source

todo tracking

CrazyDoctor 2 years ago
parent
commit
cdce31bcd3
1 changed files with 25 additions and 1 deletions
  1. 25 1
      index.js

+ 25 - 1
index.js

@@ -206,6 +206,29 @@ module.exports = {
 			},
 		},
 	},
+	'todo-comments': {
+		meta: {
+			type: 'suggestion',
+			docs: {
+				description: 'TODO tracking',
+				category: 'Other',
+				recommended: true
+			},
+			schema: []
+		},
+		create: function (context) {
+			const sourceCode = context.getSourceCode();
+			const comments = sourceCode.getAllComments();
+			for (const comment of comments) {
+				if (comment.value.toLowerCase().includes('todo')) {
+					context.report({
+						node: comment,
+						message: comment.value
+					});
+				}
+			}
+		}
+	}
 };
 
 /**
@@ -228,8 +251,9 @@ module.exports = {
  * 		'space-before-function-paren': ['error', 'never'],
  * 		'semi': ['error', 'always'],
  * 		'space-infix-ops': ['error'],
- * 		"indent": ['error', 'tab'],
+ * 		'indent': ['error', 'tab'],
  * 		'no-console': ['warn'],
+ *		'z8/todo-comments': ['warn']
  * 	},
  * 	'parserOptions': {
  * 		'ecmaVersion': 2022