Skip to content

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Nov 4, 2025

Prerequisites checklist

What is the purpose of this pull request?

Which language are you using?

JSON, JSON5, JSONC

What did you do?

no-duplicate-keys:

image

I expected fo\n\u006ft to appear in the error message, but it appears as fo(newline)ot.

sort-keys:

image

I expected bfo\n\u006ft and afo\n\u006ft to apper in the error message, but it appears as bfo(newline)ot and afo(newline)ot.

What did you expect to happen?

  • I expected fo\n\u006ft to appear in the error message, but it appears as fo(newline)ot.
  • I expected bfo\n\u006ft and afo\n\u006ft to apper in the error message, but it appears as bfo(newline)ot and afo(newline)ot.

Link to minimal reproducible Example

The following code would help identify the problem:

// eslint json/no-duplicate-keys: "error"

{
  "fo\not": 1,
  "fo\n\u006ft": 2
}
// eslint json/sort-keys: "error"

{
  "bfo\n\u006ft": 2, 
  "afo\n\u006ft": 1
}

What changes did you make? (Give an overview)

This PR was motivated by #151 (comment).

In this PR, I've updated the data property to show raw key values in messages instead of processed ones.

The no-duplicate-keys and sort-keys rules were mainly affected.

Also, I extracted the getKey and getRawKey helper functions into util.js, since they can be reused across multiple rules.

Related Issues

Ref: #151 (comment)

Is there anything you'd like reviewers to focus on?

N/A

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Nov 4, 2025
@eslintbot eslintbot added this to Triage Nov 4, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Nov 4, 2025
@lumirlumir lumirlumir moved this from Needs Triage to Implementing in Triage Nov 4, 2025
@lumirlumir lumirlumir marked this pull request as ready for review November 6, 2025 13:53
@lumirlumir lumirlumir moved this from Implementing to Needs Triage in Triage Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants