diff --git a/tools/lint/lib/checks/features.py b/tools/lint/lib/checks/features.py index bbb7214a45..a1d88e419f 100644 --- a/tools/lint/lib/checks/features.py +++ b/tools/lint/lib/checks/features.py @@ -1,3 +1,5 @@ +import re + from ..check import Check class CheckFeatures(Check): @@ -11,8 +13,9 @@ class CheckFeatures(Check): @staticmethod def _parse(content): features = [] - for line in content.split(): - if not line or line.startswith('#'): + for line in content.splitlines(): + line = re.sub(r'\s*#.*', '', line) + if not line: continue features.append(line) return features diff --git a/tools/lint/test/fixtures/features.txt b/tools/lint/test/fixtures/features.txt index a7d911ea60..a7f2ebc71e 100644 --- a/tools/lint/test/fixtures/features.txt +++ b/tools/lint/test/fixtures/features.txt @@ -1,4 +1,5 @@ -async-functions +# Here is a full-line comment: not-a-valid-feature +async-functions # This is a partial-line comment object-spread generators BigInt