Skip to content

Add JSON Linter to File Linting #3817

@raclim

Description

@raclim

This issue is part of the ongoing work to upgrade CodeMirror from v5 to v6 (see the parent issue for additional context). This issue references the develop-codemirror-v6 branch, and not the main develop branch.

Increasing Access

As we're preparing to release the new CodeMirror v6 feature, we want to ensure that commonly used file types receive consistent editor feedback. At the moment, JavaScript, HTML, and CSS files have linting feedback, but JSON files will not raise syntax errors. Adding a JSON linter will help users more easily catch and correct any errors in these files.

Feature Details

The editor's linting behavior is currently setup in stateUtils.js, specifically within the getFileLinter() function on line 233. The image below shows what linting would look like:

Image

Suggestions to Start

  • Review how linting is setup for each case in getFileLinter() for HTML, CSS, and JavaScript. Afterwards, add a case for JSON using CodeMirror's linting infrastructure (@codemirror/lint).
  • Ensure that the linter detects invalid JSON syntax and highlights the correct location within the editor.

Metadata

Metadata

Assignees

Labels

Area:EditorFor CodeMirror-related featuresEnhancementImprovement to an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions