refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
161
home/ags/node_modules/eslint-plugin-es-x/lib/util/define-prototype-method-handler/index.js
generated
vendored
161
home/ags/node_modules/eslint-plugin-es-x/lib/util/define-prototype-method-handler/index.js
generated
vendored
|
|
@ -1,161 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
const { getPropertyName } = require("@eslint-community/eslint-utils")
|
||||
const { buildObjectTypeChecker } = require("./object-type-checker")
|
||||
const { buildObjectTypeCheckerForTS } = require("./object-type-checker-for-ts")
|
||||
const { getSourceCode } = require("eslint-compat-utils")
|
||||
|
||||
/**
|
||||
* @typedef {object} CreateReportArgument
|
||||
* @property {true | 'aggressive'} objectTypeResult
|
||||
* @property {string} className
|
||||
* @property {string} propertyName
|
||||
* @property {MemberExpression} node
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} Options
|
||||
* @property { (arg: CreateReportArgument) => ReportDescriptor } [Options.createReport]
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define handlers to disallow prototype methods.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @param {Record<string, readonly string[]>} nameMap The method names to disallow. The key is class names and that value is method names.
|
||||
* @param {Options} [options] The options.
|
||||
* @returns {Record<string, (node: ASTNode) => void>} The defined handlers.
|
||||
*/
|
||||
function definePrototypeMethodHandler(context, nameMap, options) {
|
||||
const sourceCode = getSourceCode(context)
|
||||
const aggressiveOption = getAggressiveOption(context)
|
||||
const aggressiveResult = aggressiveOption ? "aggressive" : false
|
||||
|
||||
const objectTypeChecker =
|
||||
buildObjectTypeCheckerForTS(context, aggressiveResult) ||
|
||||
buildObjectTypeChecker(context, aggressiveResult)
|
||||
|
||||
/**
|
||||
* Check if the type of the given node is one of given class or not.
|
||||
* @param {MemberExpression} memberAccessNode The MemberExpression node.
|
||||
* @param {string} className The class name to disallow.
|
||||
* @returns {boolean | "aggressive"} `true` if should disallow it.
|
||||
*/
|
||||
function checkObjectType(memberAccessNode, className) {
|
||||
// If it's obvious, shortcut.
|
||||
if (memberAccessNode.object.type === "ArrayExpression") {
|
||||
return className === "Array"
|
||||
}
|
||||
if (
|
||||
memberAccessNode.object.type === "Literal" &&
|
||||
memberAccessNode.object.regex
|
||||
) {
|
||||
return className === "RegExp"
|
||||
}
|
||||
if (
|
||||
(memberAccessNode.object.type === "Literal" &&
|
||||
typeof memberAccessNode.object.value === "string") ||
|
||||
memberAccessNode.object.type === "TemplateLiteral"
|
||||
) {
|
||||
return className === "String"
|
||||
}
|
||||
if (
|
||||
memberAccessNode.object.type === "FunctionExpression" ||
|
||||
memberAccessNode.object.type === "ArrowFunctionExpression"
|
||||
) {
|
||||
return className === "Function"
|
||||
}
|
||||
|
||||
// Test object type.
|
||||
return objectTypeChecker(memberAccessNode, className)
|
||||
}
|
||||
|
||||
// For performance
|
||||
const nameMapEntries = Object.entries(nameMap)
|
||||
if (nameMapEntries.length === 1) {
|
||||
const [[className, methodNames]] = nameMapEntries
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
const propertyName = getPropertyName(
|
||||
node,
|
||||
sourceCode.getScope(node),
|
||||
)
|
||||
let objectTypeResult = undefined
|
||||
if (
|
||||
methodNames.includes(propertyName) &&
|
||||
(objectTypeResult = checkObjectType(node, className))
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "forbidden",
|
||||
data: {
|
||||
name: `${className}.prototype.${propertyName}`,
|
||||
},
|
||||
...((options &&
|
||||
options.createReport &&
|
||||
options.createReport({
|
||||
objectTypeResult,
|
||||
className,
|
||||
propertyName,
|
||||
node,
|
||||
})) ||
|
||||
{}),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
const propertyName = getPropertyName(
|
||||
node,
|
||||
sourceCode.getScope(node),
|
||||
)
|
||||
for (const [className, methodNames] of nameMapEntries) {
|
||||
let objectTypeResult = undefined
|
||||
if (
|
||||
methodNames.includes(propertyName) &&
|
||||
(objectTypeResult = checkObjectType(node, className))
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "forbidden",
|
||||
data: {
|
||||
name: `${className}.prototype.${propertyName}`,
|
||||
},
|
||||
...((options &&
|
||||
options.createReport &&
|
||||
options.createReport({
|
||||
objectTypeResult,
|
||||
className,
|
||||
propertyName,
|
||||
node,
|
||||
})) ||
|
||||
{}),
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get `aggressive` option value.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @returns {boolean} The gotten `aggressive` option value.
|
||||
*/
|
||||
function getAggressiveOption(context) {
|
||||
const options = context.options[0]
|
||||
const globalOptions = context.settings["es-x"]
|
||||
|
||||
if (options && typeof options.aggressive === "boolean") {
|
||||
return options.aggressive
|
||||
}
|
||||
if (globalOptions && typeof globalOptions.aggressive === "boolean") {
|
||||
return globalOptions.aggressive
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
module.exports = { definePrototypeMethodHandler }
|
||||
|
|
@ -1,322 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
const { getSourceCode } = require("eslint-compat-utils")
|
||||
const { optionalRequire } = require("../optional-require")
|
||||
/** @type {import("typescript")} */
|
||||
const ts = optionalRequire(require, "typescript")
|
||||
|
||||
module.exports = { buildObjectTypeCheckerForTS }
|
||||
|
||||
/**
|
||||
* @typedef {import("eslint").Rule.RuleContext} RuleContext
|
||||
* @typedef {import("estree").MemberExpression} MemberExpression
|
||||
*/
|
||||
/**
|
||||
* Build object type checker for TypeScript.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @param {boolean} aggressiveResult The value to return if the type cannot be determined.
|
||||
* @returns {((memberAccessNode: MemberExpression, className: string) => boolean | "aggressive") | null} Returns an object type checker. Returns null if TypeScript is not available.
|
||||
*/
|
||||
function buildObjectTypeCheckerForTS(context, aggressiveResult) {
|
||||
const sourceCode = getSourceCode(context)
|
||||
/** @type {ReadonlyMap<any, import("typescript").Node>} */
|
||||
const tsNodeMap = sourceCode.parserServices.esTreeNodeToTSNodeMap
|
||||
/** @type {import("typescript").TypeChecker} */
|
||||
const checker =
|
||||
sourceCode.parserServices.program &&
|
||||
sourceCode.parserServices.program.getTypeChecker()
|
||||
|
||||
const isTS = Boolean(ts && tsNodeMap && checker)
|
||||
if (!isTS) {
|
||||
return null
|
||||
}
|
||||
const hasFullType =
|
||||
sourceCode.parserServices.hasFullTypeInformation !== false
|
||||
|
||||
return function (memberAccessNode, className) {
|
||||
return (
|
||||
checkByPropertyDeclaration(memberAccessNode, className) ||
|
||||
checkByObjectExpressionType(memberAccessNode, className)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the type of the given node by the declaration of `node.property`.
|
||||
* @param {MemberExpression} memberAccessNode The MemberExpression node.
|
||||
* @param {string} className The class name to disallow.
|
||||
* @returns {boolean} `true` if should disallow it.
|
||||
*/
|
||||
function checkByPropertyDeclaration(memberAccessNode, className) {
|
||||
const tsNode = tsNodeMap.get(memberAccessNode.property)
|
||||
const symbol = tsNode && checker.getSymbolAtLocation(tsNode)
|
||||
const declarations = symbol && symbol.declarations
|
||||
|
||||
if (declarations) {
|
||||
for (const declaration of declarations) {
|
||||
const type = checker.getTypeAtLocation(declaration.parent)
|
||||
if (type && typeEquals(type, className)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the type of the given node by the type of `node.object`.
|
||||
* @param {MemberExpression} memberAccessNode The MemberExpression node.
|
||||
* @param {string} className The class name to disallow.
|
||||
* @returns {boolean} `true` if should disallow it.
|
||||
*/
|
||||
function checkByObjectExpressionType(memberAccessNode, className) {
|
||||
const tsNode = tsNodeMap.get(memberAccessNode.object)
|
||||
const type = checker.getTypeAtLocation(tsNode)
|
||||
return typeEquals(type, className)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the name of the given type is expected or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @param {string} className The expected type name.
|
||||
* @returns {boolean} `true` if should disallow it.
|
||||
*/
|
||||
function typeEquals(type, className) {
|
||||
// console.log(
|
||||
// "typeEquals(%o, %o)",
|
||||
// {
|
||||
// name: isClassOrInterface(type)
|
||||
// ? type.symbol.escapedName
|
||||
// : checker.typeToString(type),
|
||||
// flags: Object.entries(ts.TypeFlags)
|
||||
// .filter(
|
||||
// ([_id, flag]) =>
|
||||
// typeof flag === "number" &&
|
||||
// (type.flags & flag) === flag,
|
||||
// )
|
||||
// .map(([id]) => id)
|
||||
// .join("|"),
|
||||
// objectFlags:
|
||||
// type.objectFlags == null
|
||||
// ? undefined
|
||||
// : Object.entries(ts.ObjectFlags)
|
||||
// .filter(
|
||||
// ([_id, flag]) =>
|
||||
// typeof flag === "number" &&
|
||||
// (type.objectFlags & flag) === flag,
|
||||
// )
|
||||
// .map(([id]) => id)
|
||||
// .join("|"),
|
||||
// "symbol.flags": !type.symbol
|
||||
// ? undefined
|
||||
// : Object.entries(ts.SymbolFlags)
|
||||
// .filter(
|
||||
// ([_id, flag]) =>
|
||||
// typeof flag === "number" &&
|
||||
// (type.symbol.flags & flag) === flag,
|
||||
// )
|
||||
// .map(([id]) => id)
|
||||
// .join("|"),
|
||||
// },
|
||||
// className,
|
||||
// )
|
||||
if (isFunction(type)) {
|
||||
return className === "Function"
|
||||
}
|
||||
if (isAny(type) || isUnknown(type)) {
|
||||
return aggressiveResult
|
||||
}
|
||||
if (isAnonymousObject(type)) {
|
||||
// In non full-type mode, array types (e.g. `any[]`) become anonymous object type.
|
||||
return hasFullType ? false : aggressiveResult
|
||||
}
|
||||
|
||||
if (isStringLike(type)) {
|
||||
return className === "String"
|
||||
}
|
||||
if (isArrayLikeObject(type)) {
|
||||
return className === "Array"
|
||||
}
|
||||
|
||||
if (isReferenceObject(type) && type.target !== type) {
|
||||
return typeEquals(type.target, className)
|
||||
}
|
||||
if (isTypeParameter(type)) {
|
||||
const constraintType = getConstraintType(type)
|
||||
if (constraintType) {
|
||||
return typeEquals(constraintType, className)
|
||||
}
|
||||
return hasFullType ? false : aggressiveResult
|
||||
}
|
||||
if (isUnionOrIntersection(type)) {
|
||||
return type.types.some((t) => typeEquals(t, className))
|
||||
}
|
||||
|
||||
if (isClassOrInterface(type)) {
|
||||
return typeSymbolEscapedNameEquals(type, className)
|
||||
}
|
||||
return checker.typeToString(type) === className
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the symbol.escapedName of the given type is expected or not.
|
||||
* @param {import("typescript").InterfaceType} type The type to check.
|
||||
* @param {string} className The expected type name.
|
||||
* @returns {boolean} `true` if should disallow it.
|
||||
*/
|
||||
function typeSymbolEscapedNameEquals(type, className) {
|
||||
const symbol = type.symbol
|
||||
if (!className.includes(".")) {
|
||||
const escapedName = symbol.escapedName
|
||||
return (
|
||||
escapedName === className ||
|
||||
// ReadonlyArray, ReadonlyMap, ReadonlySet
|
||||
escapedName === `Readonly${className}` ||
|
||||
// CallableFunction
|
||||
(className === "Function" && escapedName === "CallableFunction")
|
||||
)
|
||||
}
|
||||
return checker.getFullyQualifiedName(symbol) === className
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the constraint type of a given type parameter type if exists.
|
||||
*
|
||||
* `type.getConstraint()` method doesn't return the constraint type of the
|
||||
* type parameter for some reason. So this gets the constraint type via AST.
|
||||
*
|
||||
* @param {import("typescript").TypeParameter} type The type parameter type to get.
|
||||
* @returns {import("typescript").Type | undefined} The constraint type.
|
||||
*/
|
||||
function getConstraintType(type) {
|
||||
const symbol = type.symbol
|
||||
const declarations = symbol && symbol.declarations
|
||||
const declaration = declarations && declarations[0]
|
||||
if (
|
||||
ts.isTypeParameterDeclaration(declaration) &&
|
||||
declaration.constraint != null
|
||||
) {
|
||||
return checker.getTypeFromTypeNode(declaration.constraint)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is an anonymous object type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").ObjectType} `true` if the type is an anonymous object type.
|
||||
*/
|
||||
function isAnonymousObject(type) {
|
||||
return isObject(type) && (type.objectFlags & ts.ObjectFlags.Anonymous) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is `any` or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {boolean} `true` if the type is `any`.
|
||||
*/
|
||||
function isAny(type) {
|
||||
return (type.flags & ts.TypeFlags.Any) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is an array-like type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").ObjectType} `true` if the type is an array-like type.
|
||||
*/
|
||||
function isArrayLikeObject(type) {
|
||||
return (
|
||||
isObject(type) &&
|
||||
(type.objectFlags &
|
||||
(ts.ObjectFlags.ArrayLiteral |
|
||||
ts.ObjectFlags.EvolvingArray |
|
||||
ts.ObjectFlags.Tuple)) !==
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is an interface type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").InterfaceType} `true` if the type is an interface type.
|
||||
*/
|
||||
function isClassOrInterface(type) {
|
||||
return (
|
||||
isObject(type) &&
|
||||
(type.objectFlags & ts.ObjectFlags.ClassOrInterface) !== 0
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is an object type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").ObjectType} `true` if the type is an object type.
|
||||
*/
|
||||
function isObject(type) {
|
||||
return (type.flags & ts.TypeFlags.Object) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is a reference type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").TypeReference} `true` if the type is a reference type.
|
||||
*/
|
||||
function isReferenceObject(type) {
|
||||
return isObject(type) && (type.objectFlags & ts.ObjectFlags.Reference) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is a string-like type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {boolean} `true` if the type is a string-like type.
|
||||
*/
|
||||
function isStringLike(type) {
|
||||
return (type.flags & ts.TypeFlags.StringLike) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is a type parameter type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {boolean} `true` if the type is a type parameter type.
|
||||
*/
|
||||
function isTypeParameter(type) {
|
||||
return (type.flags & ts.TypeFlags.TypeParameter) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is a union-or-intersection type or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {type is import("typescript").UnionOrIntersectionType} `true` if the type is a union-or-intersection type.
|
||||
*/
|
||||
function isUnionOrIntersection(type) {
|
||||
return (type.flags & ts.TypeFlags.UnionOrIntersection) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is `unknown` or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {boolean} `true` if the type is `unknown`.
|
||||
*/
|
||||
function isUnknown(type) {
|
||||
return (type.flags & ts.TypeFlags.Unknown) !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given type is `function` or not.
|
||||
* @param {import("typescript").Type} type The type to check.
|
||||
* @returns {boolean} `true` if the type is `function`.
|
||||
*/
|
||||
function isFunction(type) {
|
||||
if (
|
||||
type.symbol &&
|
||||
(type.symbol.flags &
|
||||
(ts.SymbolFlags.Function | ts.SymbolFlags.Method)) !==
|
||||
0
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
const signatures = type.getCallSignatures()
|
||||
return signatures.length > 0
|
||||
}
|
||||
|
|
@ -1,477 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
const { findVariable } = require("@eslint-community/eslint-utils")
|
||||
const { getSourceCode } = require("eslint-compat-utils")
|
||||
|
||||
module.exports = { buildObjectTypeChecker, buildExpressionTypeProvider }
|
||||
|
||||
/**
|
||||
* @typedef {import("eslint").Rule.RuleContext} RuleContext
|
||||
* @typedef {import("estree").MemberExpression} MemberExpression
|
||||
* @typedef {import("estree").Expression} Expression
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {"Array"
|
||||
* | "Date"
|
||||
* | "Function"
|
||||
* | "Intl.Collator"
|
||||
* | "Intl.DateTimeFormat"
|
||||
* | "Intl.ListFormat"
|
||||
* | "Intl.NumberFormat"
|
||||
* | "Intl.PluralRules"
|
||||
* | "Intl.RelativeTimeFormat"
|
||||
* | "Intl.Segmenter"
|
||||
* | "Promise"
|
||||
* | "RegExp"
|
||||
* | "String"
|
||||
* | "Symbol"
|
||||
* | "Int8Array"
|
||||
* | "Uint8Array"
|
||||
* | "Uint8ClampedArray"
|
||||
* | "Int16Array"
|
||||
* | "Uint16Array"
|
||||
* | "Int32Array"
|
||||
* | "Uint32Array"
|
||||
* | "Float32Array"
|
||||
* | "Float64Array"
|
||||
* | "BigInt64Array"
|
||||
* | "BigUint64Array"
|
||||
* | "Object"
|
||||
* | "Number"
|
||||
* | "Boolean"
|
||||
* | "BigInt"
|
||||
* | "null"
|
||||
* | "undefined"
|
||||
* } TypeName
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Record<
|
||||
* string,
|
||||
* WellKnownGlobalFunction
|
||||
* | WellKnownGlobalObject
|
||||
* | { type: "undefined" }
|
||||
* | { type: "Number" }
|
||||
* | undefined>
|
||||
* } WellKnownGlobals
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} WellKnownGlobalFunction
|
||||
* @property {"Function"} type
|
||||
* @property {TypeName} returnType
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} WellKnownGlobalObject
|
||||
* @property {"Object"} type
|
||||
* @property {WellKnownGlobals} properties
|
||||
*/
|
||||
|
||||
/** @type {WellKnownGlobals} */
|
||||
const WELLKNOWN_GLOBALS = {
|
||||
String: { type: "Function", returnType: "String" },
|
||||
Number: { type: "Function", returnType: "Number" },
|
||||
Boolean: { type: "Function", returnType: "Boolean" },
|
||||
Symbol: { type: "Function", returnType: "Symbol" },
|
||||
BigInt: { type: "Function", returnType: "BigInt" },
|
||||
Object: { type: "Function", returnType: "Object" },
|
||||
Function: { type: "Function", returnType: "Function" },
|
||||
Array: { type: "Function", returnType: "Array" },
|
||||
RegExp: { type: "Function", returnType: "RegExp" },
|
||||
Date: { type: "Function", returnType: "Date" },
|
||||
Promise: { type: "Function", returnType: "Promise" },
|
||||
Int8Array: { type: "Function", returnType: "Int8Array" },
|
||||
Uint8Array: { type: "Function", returnType: "Uint8Array" },
|
||||
Uint8ClampedArray: { type: "Function", returnType: "Uint8ClampedArray" },
|
||||
Int16Array: { type: "Function", returnType: "Int16Array" },
|
||||
Uint16Array: { type: "Function", returnType: "Uint16Array" },
|
||||
Int32Array: { type: "Function", returnType: "Int32Array" },
|
||||
Uint32Array: { type: "Function", returnType: "Uint32Array" },
|
||||
Float32Array: { type: "Function", returnType: "Float32Array" },
|
||||
Float64Array: { type: "Function", returnType: "Float64Array" },
|
||||
BigInt64Array: { type: "Function", returnType: "BigInt64Array" },
|
||||
BigUint64Array: { type: "Function", returnType: "BigUint64Array" },
|
||||
ArrayBuffer: { type: "Function", returnType: "ArrayBuffer" },
|
||||
SharedArrayBuffer: { type: "Function", returnType: "SharedArrayBuffer" },
|
||||
Intl: {
|
||||
type: "Object",
|
||||
properties: {
|
||||
Collator: { type: "Function", returnType: "Intl.Collator" },
|
||||
DateTimeFormat: {
|
||||
type: "Function",
|
||||
returnType: "Intl.DateTimeFormat",
|
||||
},
|
||||
ListFormat: {
|
||||
type: "Function",
|
||||
returnType: "Intl.ListFormat",
|
||||
},
|
||||
NumberFormat: {
|
||||
type: "Function",
|
||||
returnType: "Intl.NumberFormat",
|
||||
},
|
||||
PluralRules: {
|
||||
type: "Function",
|
||||
returnType: "Intl.PluralRules",
|
||||
},
|
||||
RelativeTimeFormat: {
|
||||
type: "Function",
|
||||
returnType: "Intl.RelativeTimeFormat",
|
||||
},
|
||||
Segmenter: { type: "Function", returnType: "Intl.Segmenter" },
|
||||
},
|
||||
},
|
||||
undefined: { type: "undefined" },
|
||||
NaN: { type: "Number" },
|
||||
Infinity: { type: "Number" },
|
||||
}
|
||||
|
||||
/**
|
||||
* Build object type checker.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @param {boolean} aggressiveResult The value to return if the type cannot be determined.
|
||||
* @returns {((memberAccessNode: MemberExpression, className: string) => boolean)} Returns an object type checker.
|
||||
*/
|
||||
function buildObjectTypeChecker(context, aggressiveResult) {
|
||||
const getType = buildExpressionTypeProvider(context)
|
||||
return function (memberAccessNode, className) {
|
||||
const type = getType(memberAccessNode.object)
|
||||
if (type == null) {
|
||||
return aggressiveResult
|
||||
}
|
||||
return type === className
|
||||
}
|
||||
}
|
||||
|
||||
const cache = new WeakMap()
|
||||
|
||||
/**
|
||||
* Build expression type provider.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @returns {((node: Expression) => TypeName | null)} Returns an expression type provider.
|
||||
*/
|
||||
function buildExpressionTypeProvider(context) {
|
||||
const key = getSourceCode(context).ast
|
||||
let result = cache.get(key)
|
||||
if (!result) {
|
||||
cache.set(key, (result = buildExpressionTypeProviderImpl(context)))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Build expression type provider.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @returns {((node: Expression) => TypeName | null)} Returns an expression type provider.
|
||||
*/
|
||||
function buildExpressionTypeProviderImpl(context) {
|
||||
/** @type {Record<Expression['type'], (node: Expression) => TypeName | null>} */
|
||||
const GET_TYPES = {
|
||||
ArrayExpression: () => "Array",
|
||||
ObjectExpression: () => "Object",
|
||||
ArrowFunctionExpression: () => "Function",
|
||||
FunctionExpression: () => "Function",
|
||||
Literal: getLiteralType,
|
||||
TemplateLiteral: () => "String",
|
||||
Identifier: getIdentifierType,
|
||||
/** @param {import("estree").BinaryExpression} node */
|
||||
BinaryExpression: (node) =>
|
||||
getOperatorType(node.operator, node.left, node.right),
|
||||
/** @param {import("estree").LogicalExpression} node */
|
||||
LogicalExpression: (node) =>
|
||||
getOperatorType(node.operator, node.left, node.right),
|
||||
/** @param {import("estree").AssignmentExpression} node */
|
||||
AssignmentExpression: (node) =>
|
||||
getOperatorType(node.operator, node.left, node.right),
|
||||
UnaryExpression: getUnaryExpressionType,
|
||||
UpdateExpression: () => "Number",
|
||||
ClassExpression: () => "Function",
|
||||
ChainExpression: (node) => getType(node.expression),
|
||||
/** @param {import("estree").SequenceExpression} node */
|
||||
SequenceExpression: (node) =>
|
||||
getType(node.expressions[node.expressions.length - 1]),
|
||||
CallExpression: getCallExpressionType,
|
||||
NewExpression: getCallExpressionType,
|
||||
TaggedTemplateExpression: getCallExpressionType,
|
||||
/** @param {import("estree").ConditionalExpression} node */
|
||||
ConditionalExpression(node) {
|
||||
const consequent = getType(node.consequent)
|
||||
const alternate = getType(node.alternate)
|
||||
return consequent === alternate ? consequent : null
|
||||
},
|
||||
}
|
||||
|
||||
const tracked = new Map()
|
||||
return getType
|
||||
|
||||
/**
|
||||
* Gets the type name of the given node.
|
||||
* @param {Expression} node The Expression node
|
||||
* @returns {TypeName | null} The type name of expression.
|
||||
*/
|
||||
function getType(node) {
|
||||
if (tracked.has(node)) {
|
||||
return tracked.get(node)
|
||||
}
|
||||
tracked.set(node, null)
|
||||
try {
|
||||
const result = GET_TYPES[node.type]?.(node) ?? null
|
||||
tracked.set(node, result)
|
||||
return result
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").Identifier} node
|
||||
* @returns {import("eslint").Scope.Variable | null}
|
||||
*/
|
||||
function findVariableFromIdentifier(node) {
|
||||
return findVariable(
|
||||
getSourceCode(context).scopeManager.globalScope,
|
||||
node,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").Literal} node
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
function getLiteralType(node) {
|
||||
if (node.regex) {
|
||||
return "RegExp"
|
||||
}
|
||||
if (node.bigint) {
|
||||
return "BigInt"
|
||||
}
|
||||
if (node.value == null) {
|
||||
return "null"
|
||||
}
|
||||
const valueType = typeof node.value
|
||||
if (valueType === "string") {
|
||||
return "String"
|
||||
}
|
||||
if (valueType === "number") {
|
||||
return "Number"
|
||||
}
|
||||
if (valueType === "boolean") {
|
||||
return "Boolean"
|
||||
}
|
||||
return valueType[0].toUpperCase() + valueType.slice(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").Identifier} node
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
function getIdentifierType(node) {
|
||||
const variable = findVariableFromIdentifier(node)
|
||||
if (variable) {
|
||||
if (variable.defs.length === 0) {
|
||||
// It is a global variable
|
||||
return WELLKNOWN_GLOBALS[node.name]?.type ?? null
|
||||
} else if (variable.defs.length === 1) {
|
||||
const def = variable.defs[0]
|
||||
if (def.type === "Variable") {
|
||||
if (
|
||||
// It has an initial value.
|
||||
def.node.init &&
|
||||
// It does not write new values.
|
||||
(def.parent.kind === "const" ||
|
||||
variable.references.every(
|
||||
(ref) =>
|
||||
ref.isReadOnly() ||
|
||||
ref.identifier === def.name,
|
||||
))
|
||||
) {
|
||||
// The type of the initial value is the type of the variable.
|
||||
return getType(def.node.init)
|
||||
}
|
||||
} else if (def.type === "FunctionName") {
|
||||
return "Function"
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").BinaryOperator
|
||||
* | import("estree").LogicalOperator
|
||||
* | import("estree").AssignmentOperator} operator
|
||||
* @param {import("estree").Expression} leftNode
|
||||
* @param {import("estree").Expression} rightNode
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
// eslint-disable-next-line complexity
|
||||
function getOperatorType(operator, leftNode, rightNode) {
|
||||
if (operator === "=") {
|
||||
return getType(rightNode)
|
||||
}
|
||||
if (operator === "+" || operator === "+=") {
|
||||
return getPlusOperatorType(leftNode, rightNode)
|
||||
}
|
||||
if (
|
||||
operator === "==" ||
|
||||
operator === "!=" ||
|
||||
operator === "===" ||
|
||||
operator === "!==" ||
|
||||
operator === "<" ||
|
||||
operator === "<=" ||
|
||||
operator === ">" ||
|
||||
operator === ">=" ||
|
||||
operator === "in" ||
|
||||
operator === "instanceof"
|
||||
) {
|
||||
return "Boolean"
|
||||
}
|
||||
if (
|
||||
operator === "-" ||
|
||||
operator === "-=" ||
|
||||
operator === "*" ||
|
||||
operator === "*=" ||
|
||||
operator === "/" ||
|
||||
operator === "/=" ||
|
||||
operator === "%" ||
|
||||
operator === "%=" ||
|
||||
operator === "^" ||
|
||||
operator === "^=" ||
|
||||
operator === "**" ||
|
||||
operator === "**=" ||
|
||||
operator === "&" ||
|
||||
operator === "&=" ||
|
||||
operator === "|" ||
|
||||
operator === "|="
|
||||
) {
|
||||
const left = getType(leftNode)
|
||||
const right = getType(rightNode)
|
||||
if (left === "BigInt" || right === "BigInt") {
|
||||
return "BigInt"
|
||||
}
|
||||
return left == null && right == null ? null : "Number"
|
||||
}
|
||||
if (
|
||||
operator === "<<" ||
|
||||
operator === "<<=" ||
|
||||
operator === ">>" ||
|
||||
operator === ">>=" ||
|
||||
operator === ">>>" ||
|
||||
operator === ">>>="
|
||||
) {
|
||||
return "Number"
|
||||
}
|
||||
if (
|
||||
operator === "&&" ||
|
||||
operator === "&&=" ||
|
||||
operator === "||" ||
|
||||
operator === "||=" ||
|
||||
operator === "??" ||
|
||||
operator === "??="
|
||||
) {
|
||||
const left = getType(leftNode)
|
||||
const right = getType(rightNode)
|
||||
return left === right ? left : null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").Expression} leftNode
|
||||
* @param {import("estree").Expression} rightNode
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
function getPlusOperatorType(leftNode, rightNode) {
|
||||
const left = getType(leftNode)
|
||||
const right = getType(rightNode)
|
||||
if (left === "String" || right === "String") {
|
||||
return "String"
|
||||
}
|
||||
if (left === "BigInt" || right === "BigInt") {
|
||||
return "BigInt"
|
||||
}
|
||||
if (right === "Number") {
|
||||
return "Number"
|
||||
}
|
||||
if (left === "Number") {
|
||||
if (right === "null" || right === "undefined") {
|
||||
return "Number"
|
||||
}
|
||||
}
|
||||
if (right == null) {
|
||||
return null
|
||||
}
|
||||
return "String"
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").UnaryExpression} node
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
function getUnaryExpressionType(node) {
|
||||
if (node.operator === "!" || node.operator === "delete") {
|
||||
return "Boolean"
|
||||
}
|
||||
if (node.operator === "+") {
|
||||
return "Number"
|
||||
}
|
||||
if (node.operator === "-" || node.operator === "~") {
|
||||
const argument = getType(node.argument)
|
||||
if (argument === "BigInt") {
|
||||
return argument
|
||||
}
|
||||
return argument == null ? null : "Number"
|
||||
}
|
||||
if (node.operator === "typeof") {
|
||||
return "String"
|
||||
}
|
||||
if (node.operator === "void") {
|
||||
return "undefined"
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").TaggedTemplateExpression} node
|
||||
* @returns {TypeName | null}
|
||||
*/
|
||||
|
||||
function getCallExpressionType(node) {
|
||||
const callee =
|
||||
node.type === "CallExpression" || node.type === "NewExpression"
|
||||
? node.callee
|
||||
: node.tag
|
||||
if (callee.type === "Identifier") {
|
||||
if (!isGlobalObject(callee)) {
|
||||
return null
|
||||
}
|
||||
const obj = WELLKNOWN_GLOBALS[callee.name]
|
||||
return obj?.type === "Function" ? obj.returnType : null
|
||||
} else if (callee.type === "MemberExpression") {
|
||||
if (
|
||||
callee.computed ||
|
||||
callee.property.type !== "Identifier" ||
|
||||
!isGlobalObject(callee.object)
|
||||
) {
|
||||
return null
|
||||
}
|
||||
const obj = WELLKNOWN_GLOBALS[callee.object.name]
|
||||
if (obj?.type === "Object") {
|
||||
const prop = obj.properties[callee.property.name]
|
||||
return prop?.type === "Function" ? prop.returnType : null
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("estree").Node} node
|
||||
* @returns {node is import("estree").Identifier}
|
||||
*/
|
||||
function isGlobalObject(node) {
|
||||
if (node.type !== "Identifier") {
|
||||
return false
|
||||
}
|
||||
const variable = findVariableFromIdentifier(node)
|
||||
return Boolean(variable && variable.defs.length === 0)
|
||||
}
|
||||
}
|
||||
109
home/ags/node_modules/eslint-plugin-es-x/lib/util/define-regexp-handler.js
generated
vendored
109
home/ags/node_modules/eslint-plugin-es-x/lib/util/define-regexp-handler.js
generated
vendored
|
|
@ -1,109 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
const { RegExpValidator } = require("@eslint-community/regexpp")
|
||||
const { getRegExpCalls } = require("../utils")
|
||||
const { getSourceCode } = require("eslint-compat-utils")
|
||||
|
||||
const allVisitorBuilder = new WeakMap()
|
||||
|
||||
/**
|
||||
* @typedef {RegExpValidator.Options & {onExit:()=>void}} RuleValidator
|
||||
*/
|
||||
/**
|
||||
* Define handlers to regexp nodes.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @param {(node: Node) => RuleValidator} visitorBuilder The regexp node visitor builder.
|
||||
* @returns {Record<string, (node: ASTNode) => void>} The defined handlers.
|
||||
*/
|
||||
function defineRegExpHandler(context, visitorBuilder) {
|
||||
const sourceCode = getSourceCode(context)
|
||||
const programNode = sourceCode.ast
|
||||
|
||||
let handler = {}
|
||||
let builders = allVisitorBuilder.get(programNode)
|
||||
if (!builders) {
|
||||
builders = []
|
||||
allVisitorBuilder.set(programNode, builders)
|
||||
handler = {
|
||||
"Literal[regex]"(node) {
|
||||
const { pattern, flags } = node.regex
|
||||
visitRegExp(builders, node, pattern || "", flags || "")
|
||||
},
|
||||
|
||||
"Program:exit"() {
|
||||
allVisitorBuilder.delete(programNode)
|
||||
|
||||
const scope = sourceCode.getScope(programNode)
|
||||
for (const { node, pattern, flags } of getRegExpCalls(scope)) {
|
||||
visitRegExp(builders, node, pattern || "", flags || "")
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
builders.push(visitorBuilder)
|
||||
|
||||
return handler
|
||||
}
|
||||
|
||||
module.exports = { defineRegExpHandler }
|
||||
|
||||
/**
|
||||
* Visit a given regular expression.
|
||||
* @param {((node: Node) => RuleValidator)[]} visitorBuilders The array of validator options builders.
|
||||
* @param {Node} node The AST node to report.
|
||||
* @param {string} pattern The pattern part of a RegExp.
|
||||
* @param {string} flags The flags part of a RegExp.
|
||||
* @returns {void}
|
||||
*/
|
||||
function visitRegExp(visitorBuilders, node, pattern, flags) {
|
||||
try {
|
||||
const visitors = visitorBuilders.map((r) => r(node, { pattern, flags }))
|
||||
const composedVisitor = composeRegExpVisitors(visitors)
|
||||
|
||||
new RegExpValidator(composedVisitor).validatePattern(
|
||||
pattern,
|
||||
0,
|
||||
pattern.length,
|
||||
flags.includes("u"),
|
||||
)
|
||||
|
||||
if (typeof composedVisitor.onExit === "function") {
|
||||
composedVisitor.onExit()
|
||||
}
|
||||
} catch (error) {
|
||||
//istanbul ignore else
|
||||
if (error.message.startsWith("Invalid regular expression:")) {
|
||||
return
|
||||
}
|
||||
//istanbul ignore next
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a single visitor handler that executes all the given visitors.
|
||||
* @param {RuleValidator[]} visitors
|
||||
* @returns {RuleValidator}
|
||||
*/
|
||||
function composeRegExpVisitors(visitors) {
|
||||
const result = {}
|
||||
|
||||
for (const visitor of visitors) {
|
||||
const entries = Object.entries(visitor)
|
||||
|
||||
for (const [key, fn] of entries) {
|
||||
const orig = result[key]
|
||||
if (orig) {
|
||||
result[key] = (...args) => {
|
||||
orig(...args)
|
||||
fn(...args)
|
||||
}
|
||||
} else {
|
||||
result[key] = fn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
19
home/ags/node_modules/eslint-plugin-es-x/lib/util/optional-require.js
generated
vendored
19
home/ags/node_modules/eslint-plugin-es-x/lib/util/optional-require.js
generated
vendored
|
|
@ -1,19 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
/**
|
||||
* Load a module optionally.
|
||||
* @param {Function} originalRequire The original `require` function.
|
||||
* @param {string} id The module specifier.
|
||||
*/
|
||||
function optionalRequire(originalRequire, id) {
|
||||
try {
|
||||
return originalRequire(id)
|
||||
} catch (error) {
|
||||
if (error && error.code === "MODULE_NOT_FOUND") {
|
||||
return undefined
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { optionalRequire }
|
||||
112
home/ags/node_modules/eslint-plugin-es-x/lib/util/unicode-properties.js
generated
vendored
112
home/ags/node_modules/eslint-plugin-es-x/lib/util/unicode-properties.js
generated
vendored
|
|
@ -1,112 +0,0 @@
|
|||
/* This file was generated with ECMAScript specifications. */
|
||||
"use strict"
|
||||
|
||||
class DataSet {
|
||||
constructor(
|
||||
raw2018,
|
||||
raw2019,
|
||||
raw2020,
|
||||
raw2021,
|
||||
raw2022,
|
||||
raw2023,
|
||||
raw2024,
|
||||
raw2025,
|
||||
) {
|
||||
this._raw2018 = raw2018
|
||||
this._raw2019 = raw2019
|
||||
this._raw2020 = raw2020
|
||||
this._raw2021 = raw2021
|
||||
this._raw2022 = raw2022
|
||||
this._raw2023 = raw2023
|
||||
this._raw2024 = raw2024
|
||||
this._raw2025 = raw2025
|
||||
}
|
||||
|
||||
get es2018() {
|
||||
return (
|
||||
this._set2018 || (this._set2018 = new Set(this._raw2018.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2019() {
|
||||
return (
|
||||
this._set2019 || (this._set2019 = new Set(this._raw2019.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2020() {
|
||||
return (
|
||||
this._set2020 || (this._set2020 = new Set(this._raw2020.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2021() {
|
||||
return (
|
||||
this._set2021 || (this._set2021 = new Set(this._raw2021.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2022() {
|
||||
return (
|
||||
this._set2022 || (this._set2022 = new Set(this._raw2022.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2023() {
|
||||
return (
|
||||
this._set2023 || (this._set2023 = new Set(this._raw2023.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2024() {
|
||||
return (
|
||||
this._set2024 || (this._set2024 = new Set(this._raw2024.split(" ")))
|
||||
)
|
||||
}
|
||||
|
||||
get es2025() {
|
||||
return (
|
||||
this._set2025 || (this._set2025 = new Set(this._raw2025.split(" ")))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const gcNameSet = new Set(["General_Category", "gc"])
|
||||
const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"])
|
||||
const gcValueSets = new DataSet(
|
||||
"C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
)
|
||||
const scValueSets = new DataSet(
|
||||
"Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy",
|
||||
"Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo",
|
||||
"Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho",
|
||||
"Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",
|
||||
"Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi",
|
||||
"Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",
|
||||
"",
|
||||
"",
|
||||
)
|
||||
const binPropertySets = new DataSet(
|
||||
"AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space",
|
||||
"Extended_Pictographic",
|
||||
"",
|
||||
"EBase EComp EMod EPres ExtPict",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
)
|
||||
module.exports = {
|
||||
gcNameSet,
|
||||
scNameSet,
|
||||
gcValueSets,
|
||||
scValueSets,
|
||||
binPropertySets,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue