This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fix for object-literal-key-quotes (#1953)
- Loading branch information
1 parent
7d9f7e7
commit b7741b0
Showing
7 changed files
with
169 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const o = { | ||
'hello': 123, | ||
"goodbye": 234, // failure | ||
"quote": 345, | ||
"needs quote": 789, | ||
"hyphens-need-quotes": null, | ||
[computed]: 456, | ||
"123": "hello", // failure | ||
"1e4": "something", // failure | ||
".123": "float", // failure | ||
'123': 'numbers do not need quotes', | ||
'010': 'but this one does.', | ||
'.123': 'as does this one', | ||
"fn"() { return }, | ||
"true": 0, // failure | ||
"0x0": 0, | ||
"true": 0, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const o = { | ||
'hello': 123, | ||
"goodbye": 234, // failure | ||
"quote": 345, | ||
"needs quote": 789, | ||
"hyphens-need-quotes": null, | ||
[computed]: 456, | ||
"123": "hello", // failure | ||
"1e4": "something", // failure | ||
".123": "float", // failure | ||
'123': 'numbers do not need quotes', | ||
'010': 'but this one does.', | ||
'.123': 'as does this one', | ||
"fn"() { return }, | ||
"true": 0, // failure | ||
"0x0": 0, | ||
"true": 0, | ||
}; |
19 changes: 19 additions & 0 deletions
19
test/rules/object-literal-key-quotes/as-needed/test.js.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const o = { | ||
hello: 123, // failure | ||
goodbye: 234, | ||
quote: 345, // failure | ||
"needs quote": 789, | ||
"hyphens-need-quotes": null, | ||
[computed]: 456, | ||
123: "hello", | ||
1e4: "something", | ||
.123: "float", | ||
123: 'numbers do not need quotes', // failure | ||
'010': 'but this one does.', | ||
'.123': 'as does this one', | ||
fn() { return }, | ||
true: 0, | ||
"0x0": 0, | ||
true: 0, // failure | ||
'': 'always quote the empty string', | ||
}; |
20 changes: 20 additions & 0 deletions
20
test/rules/object-literal-key-quotes/as-needed/test.ts.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const o = { | ||
hello: 123, // failure | ||
goodbye: 234, | ||
quote: 345, // failure | ||
"needs quote": 789, | ||
"hyphens-need-quotes": null, | ||
[computed]: 456, | ||
123: "hello", | ||
1e4: "something", | ||
.123: "float", | ||
123: 'numbers do not need quotes', // failure | ||
'010': 'but this one does.', | ||
'.123': 'as does this one', | ||
fn() { return }, | ||
true: 0, | ||
"0x0": 0, | ||
true: 0, // failure | ||
'': 'always quote the empty string', | ||
...{}, | ||
}; |
41 changes: 41 additions & 0 deletions
41
test/rules/object-literal-key-quotes/consistent-as-needed/test.js.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
const o = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const v = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const s = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const r = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const p = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const q = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
bird: 2, | ||
egg: 3, | ||
} | ||
}; | ||
const u = { | ||
hello: 123, | ||
bye: 45, | ||
nested: { | ||
bird: 1, | ||
egg: 2, | ||
} | ||
}; |
44 changes: 44 additions & 0 deletions
44
test/rules/object-literal-key-quotes/consistent-as-needed/test.ts.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
const o = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const v = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const s = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const r = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const p = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const q = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
bird: 2, | ||
egg: 3, | ||
} | ||
}; | ||
const u = { | ||
hello: 123, | ||
bye: 45, | ||
nested: { | ||
bird: 1, | ||
egg: 2, | ||
} | ||
}; | ||
const v = { | ||
...o, | ||
}; |