Skip to content

JSON tab: built-in linter panel with auto-run on edit #7966

Description

@andrewtelnov

Overview

Integrate survey-core/linter into the Creator JSON tab. Results are shown in a panel docked to the right of the JSON editor. The linter is enabled by default and can be turned off via a Creator property.

Behavior

Panel

  • Docked to the right of the JSON text editor in the JSON tab.
  • Shows the list of checks that were performed and the final result (passed / issues found).
  • All check names, descriptions, and issue messages use Creator localization strings (editorLocalization), not hardcoded English.

When the linter runs

  • Automatically, after the user stops modifying the JSON text. The delay is configurable in milliseconds (proposed: creator.linterDelay, default 1000).
  • The linter runs only when the JSON is syntactically valid and the new model is ready. While the JSON has syntax errors, the linter does not run and the panel keeps its previous state (or shows "waiting for valid JSON").
  • Runs once when the JSON tab is first shown.

Issue display

  • Linter issues are also merged into the existing JSON error list in the bottom panel, displayed as warnings, alongside (after) the JSON syntax/schema errors that are already shown there.
  • Clicking a linter warning in the bottom panel navigates to the corresponding line in the JSON editor (linter issues carry the JSON path of the node they are about).

Non-blocking

  • Linter warnings never block anything: the user can leave the JSON tab, switch tabs, and apply the JSON regardless of linter results. Only the existing JSON syntax errors keep their current behavior.

API

  • Property to enable/disable the feature (proposed: creator.showLinterPanel, default true).
  • Property for the debounce delay in ms (proposed: creator.linterDelay, default 1000).

Out of scope

  • Running the linter on save (separate investigation issue: #XXXX).
  • Linter results in the Designer tab.
  • Performance work for very large surveys (reusing an existing model instead of creating a new one) — tracked separately.

Acceptance criteria

  • Panel appears in the JSON tab by default and can be disabled via the property.
  • Linter runs on tab open and re-runs linterDelay ms after the last edit, only on valid JSON.
  • Check list and result are fully localized through Creator localization.
  • Linter issues appear as warnings in the bottom JSON error list, after syntax errors, with click-to-line navigation.
  • No linter state blocks tab switching or applying the JSON.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions