fix(js): quote property name as es5 compatible (#5157)
This commit is contained in:
1 parent
d7e96adac0
commit
3e05f210bb
3 files changed
+36
-1
No files matched your search
@@ -28,7 +28,7 @@ const {
|
||||
isNextLineEmptyAfterIndex,
|
||||
getNextNonSpaceNonCommentCharacterIndex
|
||||
} = require("../common/util-shared");
|
||||
const isIdentifierName = require("esutils").keyword.isIdentifierNameES6;
|
||||
const isIdentifierName = require("esutils").keyword.isIdentifierNameES5;
|
||||
const embed = require("./embed");
|
||||
const clean = require("./clean");
|
||||
const insertPragma = require("./pragma").insertPragma;
|
||||
|
||||
@@ -30,6 +30,36 @@ function b(object, key) {
|
||||
|
||||
`;
|
||||
|
||||
exports[`objects.js - flow-verify 1`] = `
|
||||
const obj = {
|
||||
'a': true,
|
||||
b: true,
|
||||
"𐊧": true,
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const obj = {
|
||||
a: true,
|
||||
b: true,
|
||||
"𐊧": true
|
||||
};
|
||||
|
||||
`;
|
||||
|
||||
exports[`objects.js - flow-verify 2`] = `
|
||||
const obj = {
|
||||
'a': true,
|
||||
b: true,
|
||||
"𐊧": true,
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const obj = {
|
||||
a: true,
|
||||
b: true,
|
||||
'𐊧': true
|
||||
};
|
||||
|
||||
`;
|
||||
|
||||
exports[`strings.js - flow-verify 1`] = `
|
||||
// Prevent strings from being parsed as directives
|
||||
// See https://github.com/prettier/prettier/pull/1560#issue-227225960
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
const obj = {
|
||||
'a': true,
|
||||
b: true,
|
||||
"𐊧": true,
|
||||
}
|
||||
Reference in new issue
Block a user