Revert "throw a TypeError if identifier validation fails (#106… (#10650)
This reverts commit c7d8b8a37752f42163128cf4d5e8b54c2637cec4.
This commit is contained in:
parent
f8eb290da1
commit
bf48fca6a0
@ -1,5 +1,5 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import isIdentifierName from "../validators/isIdentifierName";
|
import isValidIdentifier from "../validators/isValidIdentifier";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BINARY_OPERATORS,
|
BINARY_OPERATORS,
|
||||||
@ -406,8 +406,8 @@ defineType("Identifier", {
|
|||||||
...patternLikeCommon,
|
...patternLikeCommon,
|
||||||
name: {
|
name: {
|
||||||
validate: chain(function(node, key, val) {
|
validate: chain(function(node, key, val) {
|
||||||
if (!isIdentifierName(val)) {
|
if (!isValidIdentifier(val)) {
|
||||||
throw new TypeError(`"${val}" is not a valid identifer name`);
|
// throw new TypeError(`"${val}" is not a valid identifer name`);
|
||||||
}
|
}
|
||||||
}, assertValueType("string")),
|
}, assertValueType("string")),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -109,7 +109,6 @@ export {
|
|||||||
default as isValidES3Identifier,
|
default as isValidES3Identifier,
|
||||||
} from "./validators/isValidES3Identifier";
|
} from "./validators/isValidES3Identifier";
|
||||||
export { default as isValidIdentifier } from "./validators/isValidIdentifier";
|
export { default as isValidIdentifier } from "./validators/isValidIdentifier";
|
||||||
export { default as isIdentifierName } from "./validators/isIdentifierName";
|
|
||||||
export { default as isVar } from "./validators/isVar";
|
export { default as isVar } from "./validators/isVar";
|
||||||
export { default as matchesPattern } from "./validators/matchesPattern";
|
export { default as matchesPattern } from "./validators/matchesPattern";
|
||||||
export { default as validate } from "./validators/validate";
|
export { default as validate } from "./validators/validate";
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
// @flow
|
|
||||||
import esutils from "esutils";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the input `name` is a valid identifier name.
|
|
||||||
*/
|
|
||||||
export default function isIdentifierName(name: string): boolean {
|
|
||||||
return esutils.keyword.isIdentifierNameES6(name);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user