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

test: Matching escaped and unescaped keys #70

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

hildjj
Copy link
Contributor

@hildjj hildjj commented Dec 3, 2024

Prerequisites checklist

What is the purpose of this pull request?

Ensure that escaped and unescaped keys of objects that evaluate to the same string still trigger rules that prevent duplicate keys.

What changes did you make? (Give an overview)

Added tests with o replaced with \\u006f in strategic places. Note that the double-backslash is necessary so that the JSON parser is processing the backslash, not the JS parser running the tests.

Related Issues

Refs #68

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

Note that this is affected by
humanwhocodes/momoa#164
in the sense that in JSON5 mode, unquoted escaped
keys are not yet unescaped in the same was as
all other keys, and will not trigger this lint
yet. When the momoa issue is fixed, released, and we have updated to that version, uncomment the
last test in no-duplicate-keys.test.js.

Suggest that we create a separate issue in this
repo to track that change.

Note that this is affected by
humanwhocodes/momoa#164
in the sense that in JSON5 mode, unquoted escaped
keys are not yet unescaped in the same was as
all other keys, and will not trigger this lint
yet.  When the momoa issue is fixed, released, and
we have updated to that version, uncomment the
last test in no-duplicate-keys.test.js.

Suggest that we create a separate issue in this
repo to track that change.

Refs eslint#68
@nzakas
Copy link
Member

nzakas commented Dec 3, 2024

I'll get to work on the Momoa issue so we can get everything merged together.

@nzakas
Copy link
Member

nzakas commented Dec 3, 2024

Okay, new version of Momoa is pushed. You can update it in this PR.

nzakas
nzakas previously approved these changes Dec 3, 2024
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@nzakas
Copy link
Member

nzakas commented Dec 3, 2024

Looks like there's a formatting error. Can you run npm run fmt and re-push?

@mdjermanovic mdjermanovic changed the title test: Matching escaped and unescaped keys. test: Matching escaped and unescaped keys Dec 4, 2024
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 2211d6f into eslint:main Dec 4, 2024
16 checks passed
@hildjj hildjj deleted the escaped-keys branch December 4, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants