Skip to content

Commit

Permalink
test: Matching escaped and unescaped keys (#70)
Browse files Browse the repository at this point in the history
* test: Matching escaped and unescaped keys.

Refs #68

* Update momoa, uncomment test and ensure it now passes.

* fmt
  • Loading branch information
hildjj authored Dec 4, 2024
1 parent a0374aa commit 2211d6f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"license": "Apache-2.0",
"dependencies": {
"@eslint/plugin-kit": "^0.2.3",
"@humanwhocodes/momoa": "^3.3.3"
"@humanwhocodes/momoa": "^3.3.4"
},
"devDependencies": {
"@eslint/core": "^0.6.0",
Expand Down
55 changes: 55 additions & 0 deletions tests/rules/no-duplicate-keys.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,60 @@ ruleTester.run("no-duplicate-keys", rule, {
},
],
},
{
code: '{"f\\u006fot": 1, "fo\\u006ft": 2}',
errors: [
{
messageId: "duplicateKey",
data: { key: "foot" },
line: 1,
column: 18,
endLine: 1,
endColumn: 29,
},
],
},
{
code: '{"f\\u006fot": 1, "fo\\u006ft": 2}',
language: "json/jsonc",
errors: [
{
messageId: "duplicateKey",
data: { key: "foot" },
line: 1,
column: 18,
endLine: 1,
endColumn: 29,
},
],
},
{
code: '{"f\\u006fot": 1, "fo\\u006ft": 2}',
language: "json/json5",
errors: [
{
messageId: "duplicateKey",
data: { key: "foot" },
line: 1,
column: 18,
endLine: 1,
endColumn: 29,
},
],
},
{
code: "{f\\u006fot: 1, fo\\u006ft: 2}",
language: "json/json5",
errors: [
{
messageId: "duplicateKey",
data: { key: "foot" },
line: 1,
column: 16,
endLine: 1,
endColumn: 25,
},
],
},
],
});

0 comments on commit 2211d6f

Please sign in to comment.