Add ESLint rule for commented out import statements
This is something I've been caught out with a few times when moving code
round, and thought it would be a good ESLint rule. I've enabled the rule
as part of this CL as we currently have few issues that need fixes.
Bug: none
Change-Id: I72c6aad3e4258fbda280e062f98823a068c6bfc8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4076326
Reviewed-by: Andres Olivares <[email protected]>
Commit-Queue: Jack Franklin <[email protected]>
diff --git a/.eslintrc.js b/.eslintrc.js
index 047d8a4..a40429e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// clang-format off
+
const path = require('path');
const rulesDirPlugin = require('eslint-plugin-rulesdir');
rulesDirPlugin.RULES_DIR = path.join(__dirname, 'scripts', 'eslint_rules', 'lib');
@@ -120,6 +122,9 @@
// Try to spot '// console.log()' left over from debugging
'rulesdir/commented_out_console': 2,
+ // Prevent imports being commented out rather than deleted.
+ 'rulesdir/commented_out_import': 2,
+
// DevTools specific rules
'rulesdir/es_modules_import': 2,
'rulesdir/check_license_header': 2,
@@ -180,3 +185,5 @@
}
}]
};
+
+// clang-format on