From 9ad124c257da806091283d40794c8152c3f3c924 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Sun, 12 Mar 2023 00:24:21 -0800 Subject: [PATCH] Ensure ESLint actually runs (#1572) In project mode, ESLint succeeds without doing anything when called without any files, so pass it the current directory. --- CHANGELOG.md | 3 +++ megalinter/linters/EslintLinter.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c14a9079964..83b39e1314e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Medias - Linter enhancements & fixes + - Ensure ESLint actually runs in project mode rather than silently doing + nothing, by @Kurt-von-Laven + [#2455](https://github.com/oxsecurity/megalinter/pull/2455). - Core diff --git a/megalinter/linters/EslintLinter.py b/megalinter/linters/EslintLinter.py index 22c489b3b2a..ecf78f01bdf 100644 --- a/megalinter/linters/EslintLinter.py +++ b/megalinter/linters/EslintLinter.py @@ -12,4 +12,6 @@ def build_lint_command(self, file=None): cmd = super().build_lint_command(file) if "--ignore-path" in cmd or "--ignore-pattern" in cmd: cmd = list(filter(lambda a: a != "--no-ignore", cmd)) + if self.cli_lint_mode == "project": + cmd.append(".") return cmd