Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Dangling commas in JSONC #41

Open
1 task done
hildjj opened this issue Oct 15, 2024 · 1 comment · May be fixed by #42
Open
1 task done

Feature: Dangling commas in JSONC #41

hildjj opened this issue Oct 15, 2024 · 1 comment · May be fixed by #42
Assignees
Labels
accepted enhancement New feature or request

Comments

@hildjj
Copy link

hildjj commented Oct 15, 2024

Environment

ESLint version: 9.12.0
@eslint/json version: 0.5.0
Node version: 22.9.0
npm version: 10.9.0
Operating System: MacOS 15.0.1

What problem do you want to solve?

The json plugin parses JSONC files with @humanwhocodes/momoa. In version 3.3.0 of momoa, there is now the option to allow trailing commas in JSONC files, using the allowTrailingCommas: true option. See the decision for more information.

As a new feature in @eslint/json, it would be nice to either:
a) Turn on this option by default for JSONC
b) Allow setting this in the languageOptions for JSONC, with default to true
c) Allow setting this in the languageOptions for JSONC, with default to false

Because many common JSONC files (all of the vscode config files and the tsconfig.json file) allow trailing commas, a-c are my order of preference. However, since the Microsoft JSONC parser defaults to false, it is completely reasonable to pick c.

link to momoa issue.

What do you think is the correct solution?

Turn on allowTrailingCommas in the call to momoa.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@hildjj hildjj added the enhancement New feature or request label Oct 15, 2024
@hildjj hildjj changed the title Change Request: (fill in) Feature: Dangling commas in JSONC Oct 16, 2024
@nzakas
Copy link
Member

nzakas commented Oct 16, 2024

I'll work on this. There's a specific way I'd like to implement this.

@nzakas nzakas self-assigned this Oct 16, 2024
nzakas added a commit that referenced this issue Oct 16, 2024
@nzakas nzakas linked a pull request Oct 16, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted enhancement New feature or request
Projects
Status: Ready to Implement
Development

Successfully merging a pull request may close this issue.

2 participants