forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional rule options for
object-literal-key-quotes
(palantir#1733)
- Loading branch information
Showing
11 changed files
with
284 additions
and
25 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
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
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
50 changes: 50 additions & 0 deletions
50
test/rules/object-literal-key-quotes/consistent-as-needed/test.js.lint
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,50 @@ | ||
|
||
const o = { | ||
'hello': 123, | ||
~~~~~~~ [Unnecessarily quoted property 'hello' found.] | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const v = { | ||
"hello": 123, | ||
~~~~~~~ [Unnecessarily quoted property 'hello' found.] | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const s = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const r = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const p = { | ||
hello: 123, | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const q = { | ||
hello: 123, | ||
~~~~~ [Unquoted property 'hello' found.] | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
"bird": 2, | ||
~~~~~~ [Unnecessarily quoted property 'bird' found.] | ||
egg: 3, | ||
} | ||
}; | ||
const u = { | ||
hello: 123, | ||
bye: 45, | ||
nested: { | ||
"bird": 1, | ||
~~~~~~ [Unnecessarily quoted property 'bird' found.] | ||
"egg": 2, | ||
~~~~~ [Unnecessarily quoted property 'egg' found.] | ||
} | ||
}; |
50 changes: 50 additions & 0 deletions
50
test/rules/object-literal-key-quotes/consistent-as-needed/test.ts.lint
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,50 @@ | ||
|
||
const o = { | ||
'hello': 123, | ||
~~~~~~~ [Unnecessarily quoted property 'hello' found.] | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const v = { | ||
"hello": 123, | ||
~~~~~~~ [Unnecessarily quoted property 'hello' found.] | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const s = { | ||
hello: 123, | ||
bye: 45, | ||
}; | ||
const r = { | ||
"hello": 123, | ||
"bye-bye": 45, | ||
}; | ||
const p = { | ||
hello: 123, | ||
"bye": 45, | ||
~~~~~ [Unnecessarily quoted property 'bye' found.] | ||
}; | ||
const q = { | ||
hello: 123, | ||
~~~~~ [Unquoted property 'hello' found.] | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
"bird": 2, | ||
~~~~~~ [Unnecessarily quoted property 'bird' found.] | ||
egg: 3, | ||
} | ||
}; | ||
const u = { | ||
hello: 123, | ||
bye: 45, | ||
nested: { | ||
"bird": 1, | ||
~~~~~~ [Unnecessarily quoted property 'bird' found.] | ||
"egg": 2, | ||
~~~~~ [Unnecessarily quoted property 'egg' found.] | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
test/rules/object-literal-key-quotes/consistent-as-needed/tslint.json
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,8 @@ | ||
{ | ||
"rules": { | ||
"object-literal-key-quotes": [true, "consistent-as-needed"] | ||
}, | ||
"jsRules": { | ||
"object-literal-key-quotes": [true, "consistent-as-needed"] | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
test/rules/object-literal-key-quotes/consistent/test.js.lint
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 = { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
hello: 123, | ||
"bye": 45, | ||
}; | ||
const q = { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
hello: 123, | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
"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/test.ts.lint
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 = { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
hello: 123, | ||
"bye": 45, | ||
}; | ||
const q = { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
hello: 123, | ||
"bye-bye": 45, | ||
}; | ||
const t = { | ||
hello: 123, | ||
bye-bye: 45, | ||
nested: { | ||
~ [All property names in this object literal must be consistently quoted or unquoted.] | ||
"bird": 2, | ||
egg: 3, | ||
} | ||
}; | ||
const u = { | ||
hello: 123, | ||
bye: 45, | ||
nested: { | ||
"bird": 1, | ||
"egg": 2, | ||
} | ||
}; |
Oops, something went wrong.