Skip to content

Fix MegaLinter ESLint profile failure when @eslint/json is unavailable - #28

Closed
szmyty with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-lint-selected-megalinter-profile
Closed

Fix MegaLinter ESLint profile failure when @eslint/json is unavailable#28
szmyty with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-lint-selected-megalinter-profile

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The Lint selected MegaLinter profile job was failing because ESLint config hard-required @eslint/json, but that package is not guaranteed in MegaLinter’s runtime image. This change makes JSON lint integration optional so non-JSON lint targets continue to run.

  • Root-cause correction (ESLint config loading)

    • Updated egolint/.config/lint/javascript/eslint.config.mjs to treat @eslint/json as optional.
    • Added targeted MODULE_NOT_FOUND handling for @eslint/json only; other module resolution errors are still surfaced.
  • Conditional JSON rule registration

    • JSON/JSONC/JSON5 config blocks are now added only when @eslint/json resolves.
    • Prevents global config bootstrap failure from an optional plugin.
  • Regression coverage

    • Added a policy test in egolint/tests/test_megalinter_policy.py that executes the ESLint config in a temporary Node workspace without @eslint/json and verifies JSON-specific blocks are omitted.
const jsonPlugin = (() => {
  try {
    return require("@eslint/json");
  } catch (error) {
    if (error?.code === "MODULE_NOT_FOUND" &&
        String(error.message).includes("@eslint/json")) {
      return null;
    }
    throw error;
  }
})();

const jsonConfigs = jsonPlugin ? [/* json/jsonc/json5 blocks */] : [];

Copilot AI and others added 2 commits August 14, 2026 13:42
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Co-authored-by: szmyty <14865041+szmyty@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job lint selected MegaLinter profile Fix MegaLinter ESLint profile failure when @eslint/json is unavailable Aug 14, 2026
Copilot AI requested a review from szmyty August 14, 2026 13:46
@szmyty

szmyty commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@copilot Can this be closed now that the other PR was merged?

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Can this be closed now that the other PR was merged?

Yes — this can be closed. The fix is already on main from the merged PR (#30), so this branch is superseded.

@szmyty szmyty closed this Aug 14, 2026
@devactivity-app

Copy link
Copy Markdown

Pull Request Summary by devActivity

Metrics

Cycle Time: 35m Comments: 2

Achievements

@szmyty
szmyty deleted the copilot/fix-lint-selected-megalinter-profile branch August 14, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants