ags
This commit is contained in:
parent
eddf7cecb8
commit
aea798d119
16631 changed files with 1480363 additions and 257 deletions
188
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js
generated
vendored
Normal file
188
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-builtins.js
generated
vendored
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
* @author Toru Nagashima
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
const { READ } = require("@eslint-community/eslint-utils")
|
||||
const {
|
||||
checkUnsupportedBuiltins,
|
||||
messages,
|
||||
} = require("../../util/check-unsupported-builtins")
|
||||
const enumeratePropertyNames = require("../../util/enumerate-property-names")
|
||||
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
|
||||
|
||||
const trackMap = {
|
||||
globals: {
|
||||
AggregateError: {
|
||||
[READ]: { supported: "15.0.0" },
|
||||
},
|
||||
Array: {
|
||||
from: { [READ]: { supported: "4.0.0" } },
|
||||
of: { [READ]: { supported: "4.0.0" } },
|
||||
},
|
||||
BigInt: {
|
||||
[READ]: { supported: "10.4.0" },
|
||||
},
|
||||
FinalizationRegistry: {
|
||||
[READ]: { supported: "14.6.0" },
|
||||
},
|
||||
Map: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
},
|
||||
Math: {
|
||||
acosh: { [READ]: { supported: "0.12.0" } },
|
||||
asinh: { [READ]: { supported: "0.12.0" } },
|
||||
atanh: { [READ]: { supported: "0.12.0" } },
|
||||
cbrt: { [READ]: { supported: "0.12.0" } },
|
||||
clz32: { [READ]: { supported: "0.12.0" } },
|
||||
cosh: { [READ]: { supported: "0.12.0" } },
|
||||
expm1: { [READ]: { supported: "0.12.0" } },
|
||||
fround: { [READ]: { supported: "0.12.0" } },
|
||||
hypot: { [READ]: { supported: "0.12.0" } },
|
||||
imul: { [READ]: { supported: "0.12.0" } },
|
||||
log10: { [READ]: { supported: "0.12.0" } },
|
||||
log1p: { [READ]: { supported: "0.12.0" } },
|
||||
log2: { [READ]: { supported: "0.12.0" } },
|
||||
sign: { [READ]: { supported: "0.12.0" } },
|
||||
sinh: { [READ]: { supported: "0.12.0" } },
|
||||
tanh: { [READ]: { supported: "0.12.0" } },
|
||||
trunc: { [READ]: { supported: "0.12.0" } },
|
||||
},
|
||||
Number: {
|
||||
EPSILON: { [READ]: { supported: "0.12.0" } },
|
||||
isFinite: { [READ]: { supported: "0.10.0" } },
|
||||
isInteger: { [READ]: { supported: "0.12.0" } },
|
||||
isNaN: { [READ]: { supported: "0.10.0" } },
|
||||
isSafeInteger: { [READ]: { supported: "0.12.0" } },
|
||||
MAX_SAFE_INTEGER: { [READ]: { supported: "0.12.0" } },
|
||||
MIN_SAFE_INTEGER: { [READ]: { supported: "0.12.0" } },
|
||||
parseFloat: { [READ]: { supported: "0.12.0" } },
|
||||
parseInt: { [READ]: { supported: "0.12.0" } },
|
||||
},
|
||||
Object: {
|
||||
assign: { [READ]: { supported: "4.0.0" } },
|
||||
fromEntries: { [READ]: { supported: "12.0.0" } },
|
||||
getOwnPropertySymbols: { [READ]: { supported: "0.12.0" } },
|
||||
is: { [READ]: { supported: "0.10.0" } },
|
||||
setPrototypeOf: { [READ]: { supported: "0.12.0" } },
|
||||
values: { [READ]: { supported: "7.0.0" } },
|
||||
entries: { [READ]: { supported: "7.0.0" } },
|
||||
getOwnPropertyDescriptors: { [READ]: { supported: "7.0.0" } },
|
||||
},
|
||||
Promise: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
allSettled: { [READ]: { supported: "12.9.0" } },
|
||||
any: { [READ]: { supported: "15.0.0" } },
|
||||
},
|
||||
Proxy: {
|
||||
[READ]: { supported: "6.0.0" },
|
||||
},
|
||||
Reflect: {
|
||||
[READ]: { supported: "6.0.0" },
|
||||
},
|
||||
Set: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
},
|
||||
String: {
|
||||
fromCodePoint: { [READ]: { supported: "4.0.0" } },
|
||||
raw: { [READ]: { supported: "4.0.0" } },
|
||||
},
|
||||
Symbol: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
},
|
||||
Int8Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Uint8Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Uint8ClampedArray: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Int16Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Uint16Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Int32Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Uint32Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
BigInt64Array: {
|
||||
[READ]: { supported: "10.4.0" },
|
||||
},
|
||||
BigUint64Array: {
|
||||
[READ]: { supported: "10.4.0" },
|
||||
},
|
||||
Float32Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
Float64Array: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
DataView: {
|
||||
[READ]: { supported: "0.10.0" },
|
||||
},
|
||||
WeakMap: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
},
|
||||
WeakRef: {
|
||||
[READ]: { supported: "14.6.0" },
|
||||
},
|
||||
WeakSet: {
|
||||
[READ]: { supported: "0.12.0" },
|
||||
},
|
||||
Atomics: {
|
||||
[READ]: { supported: "8.10.0" },
|
||||
},
|
||||
SharedArrayBuffer: {
|
||||
[READ]: { supported: "8.10.0" },
|
||||
},
|
||||
globalThis: {
|
||||
[READ]: { supported: "12.0.0" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description:
|
||||
"disallow unsupported ECMAScript built-ins on the specified version",
|
||||
recommended: true,
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-unsupported-features/es-builtins.md",
|
||||
},
|
||||
type: "problem",
|
||||
fixable: null,
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
version: getConfiguredNodeVersion.schema,
|
||||
ignores: {
|
||||
type: "array",
|
||||
items: {
|
||||
enum: Array.from(
|
||||
enumeratePropertyNames(trackMap.globals)
|
||||
),
|
||||
},
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages,
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
"Program:exit"() {
|
||||
checkUnsupportedBuiltins(context, trackMap)
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
692
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js
generated
vendored
Normal file
692
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/es-syntax.js
generated
vendored
Normal file
|
|
@ -0,0 +1,692 @@
|
|||
/**
|
||||
* @author Toru Nagashima
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
const { rules: esRules } = require("eslint-plugin-es-x")
|
||||
const { getInnermostScope } = require("@eslint-community/eslint-utils")
|
||||
const { Range } = require("semver")
|
||||
const rangeSubset = require("semver/ranges/subset")
|
||||
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
|
||||
const getSemverRange = require("../../util/get-semver-range")
|
||||
const mergeVisitorsInPlace = require("../../util/merge-visitors-in-place")
|
||||
|
||||
const getOrSet = /^(?:g|s)et$/u
|
||||
const features = {
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2015
|
||||
//--------------------------------------------------------------------------
|
||||
arrowFunctions: {
|
||||
ruleId: "no-arrow-functions",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-arrow-functions",
|
||||
},
|
||||
],
|
||||
},
|
||||
binaryNumericLiterals: {
|
||||
ruleId: "no-binary-numeric-literals",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-binary-numeric-literals",
|
||||
},
|
||||
],
|
||||
},
|
||||
blockScopedFunctions: {
|
||||
ruleId: "no-block-scoped-functions",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
test: info => !info.isStrict,
|
||||
messageId: "no-block-scoped-functions-sloppy",
|
||||
},
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-block-scoped-functions-strict",
|
||||
},
|
||||
],
|
||||
},
|
||||
blockScopedVariables: {
|
||||
ruleId: "no-block-scoped-variables",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
test: info => !info.isStrict,
|
||||
messageId: "no-block-scoped-variables-sloppy",
|
||||
},
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-block-scoped-variables-strict",
|
||||
},
|
||||
],
|
||||
},
|
||||
classes: {
|
||||
ruleId: "no-classes",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
test: info => !info.isStrict,
|
||||
messageId: "no-classes-sloppy",
|
||||
},
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-classes-strict",
|
||||
},
|
||||
],
|
||||
},
|
||||
computedProperties: {
|
||||
ruleId: "no-computed-properties",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-computed-properties",
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultParameters: {
|
||||
ruleId: "no-default-parameters",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
messageId: "no-default-parameters",
|
||||
},
|
||||
],
|
||||
},
|
||||
destructuring: {
|
||||
ruleId: "no-destructuring",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
messageId: "no-destructuring",
|
||||
},
|
||||
],
|
||||
},
|
||||
forOfLoops: {
|
||||
ruleId: "no-for-of-loops",
|
||||
cases: [
|
||||
{
|
||||
supported: "0.12.0",
|
||||
messageId: "no-for-of-loops",
|
||||
},
|
||||
],
|
||||
},
|
||||
generators: {
|
||||
ruleId: "no-generators",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-generators",
|
||||
},
|
||||
],
|
||||
},
|
||||
modules: {
|
||||
ruleId: "no-modules",
|
||||
cases: [
|
||||
{
|
||||
supported: new Range("^12.17 || >=13.2"),
|
||||
messageId: "no-modules",
|
||||
},
|
||||
],
|
||||
},
|
||||
"new.target": {
|
||||
ruleId: "no-new-target",
|
||||
cases: [
|
||||
{
|
||||
supported: "5.0.0",
|
||||
messageId: "no-new-target",
|
||||
},
|
||||
],
|
||||
},
|
||||
objectSuperProperties: {
|
||||
ruleId: "no-object-super-properties",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-object-super-properties",
|
||||
},
|
||||
],
|
||||
},
|
||||
octalNumericLiterals: {
|
||||
ruleId: "no-octal-numeric-literals",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-octal-numeric-literals",
|
||||
},
|
||||
],
|
||||
},
|
||||
propertyShorthands: {
|
||||
ruleId: "no-property-shorthands",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
test: info =>
|
||||
info.node.shorthand && getOrSet.test(info.node.key.name),
|
||||
messageId: "no-property-shorthands-getset",
|
||||
},
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-property-shorthands",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpU: {
|
||||
ruleId: "no-regexp-u-flag",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
messageId: "no-regexp-u-flag",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpY: {
|
||||
ruleId: "no-regexp-y-flag",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
messageId: "no-regexp-y-flag",
|
||||
},
|
||||
],
|
||||
},
|
||||
restParameters: {
|
||||
ruleId: "no-rest-parameters",
|
||||
cases: [
|
||||
{
|
||||
supported: "6.0.0",
|
||||
messageId: "no-rest-parameters",
|
||||
},
|
||||
],
|
||||
},
|
||||
spreadElements: {
|
||||
ruleId: "no-spread-elements",
|
||||
cases: [
|
||||
{
|
||||
supported: "5.0.0",
|
||||
messageId: "no-spread-elements",
|
||||
},
|
||||
],
|
||||
},
|
||||
templateLiterals: {
|
||||
ruleId: "no-template-literals",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-template-literals",
|
||||
},
|
||||
],
|
||||
},
|
||||
unicodeCodePointEscapes: {
|
||||
ruleId: "no-unicode-codepoint-escapes",
|
||||
cases: [
|
||||
{
|
||||
supported: "4.0.0",
|
||||
messageId: "no-unicode-codepoint-escapes",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2016
|
||||
//--------------------------------------------------------------------------
|
||||
exponentialOperators: {
|
||||
ruleId: "no-exponential-operators",
|
||||
cases: [
|
||||
{
|
||||
supported: "7.0.0",
|
||||
messageId: "no-exponential-operators",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2017
|
||||
//--------------------------------------------------------------------------
|
||||
asyncFunctions: {
|
||||
ruleId: "no-async-functions",
|
||||
cases: [
|
||||
{
|
||||
supported: "7.6.0",
|
||||
messageId: "no-async-functions",
|
||||
},
|
||||
],
|
||||
},
|
||||
trailingCommasInFunctions: {
|
||||
ruleId: "no-trailing-function-commas",
|
||||
cases: [
|
||||
{
|
||||
supported: "8.0.0",
|
||||
messageId: "no-trailing-function-commas",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2018
|
||||
//--------------------------------------------------------------------------
|
||||
asyncIteration: {
|
||||
ruleId: "no-async-iteration",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.0.0",
|
||||
messageId: "no-async-iteration",
|
||||
},
|
||||
],
|
||||
},
|
||||
malformedTemplateLiterals: {
|
||||
ruleId: "no-malformed-template-literals",
|
||||
cases: [
|
||||
{
|
||||
supported: "8.10.0",
|
||||
messageId: "no-malformed-template-literals",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpLookbehind: {
|
||||
ruleId: "no-regexp-lookbehind-assertions",
|
||||
cases: [
|
||||
{
|
||||
supported: "8.10.0",
|
||||
messageId: "no-regexp-lookbehind-assertions",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpNamedCaptureGroups: {
|
||||
ruleId: "no-regexp-named-capture-groups",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.0.0",
|
||||
messageId: "no-regexp-named-capture-groups",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpS: {
|
||||
ruleId: "no-regexp-s-flag",
|
||||
cases: [
|
||||
{
|
||||
supported: "8.10.0",
|
||||
messageId: "no-regexp-s-flag",
|
||||
},
|
||||
],
|
||||
},
|
||||
regexpUnicodeProperties: {
|
||||
ruleId: "no-regexp-unicode-property-escapes",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.0.0",
|
||||
messageId: "no-regexp-unicode-property-escapes",
|
||||
},
|
||||
],
|
||||
},
|
||||
restSpreadProperties: {
|
||||
ruleId: "no-rest-spread-properties",
|
||||
cases: [
|
||||
{
|
||||
supported: "8.3.0",
|
||||
messageId: "no-rest-spread-properties",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2019
|
||||
//--------------------------------------------------------------------------
|
||||
jsonSuperset: {
|
||||
ruleId: "no-json-superset",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.0.0",
|
||||
messageId: "no-json-superset",
|
||||
},
|
||||
],
|
||||
},
|
||||
optionalCatchBinding: {
|
||||
ruleId: "no-optional-catch-binding",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.0.0",
|
||||
messageId: "no-optional-catch-binding",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2020
|
||||
//--------------------------------------------------------------------------
|
||||
bigint: {
|
||||
ruleId: "no-bigint",
|
||||
cases: [
|
||||
{
|
||||
supported: "10.4.0",
|
||||
test: info => info.node.type === "Literal",
|
||||
messageId: "no-bigint",
|
||||
},
|
||||
{
|
||||
supported: null,
|
||||
test: ({ node }) =>
|
||||
node.type === "Literal" &&
|
||||
(node.parent.type === "Property" ||
|
||||
node.parent.type === "MethodDefinition") &&
|
||||
!node.parent.computed &&
|
||||
node.parent.key === node,
|
||||
messageId: "no-bigint-property-names",
|
||||
},
|
||||
],
|
||||
},
|
||||
dynamicImport: {
|
||||
ruleId: "no-dynamic-import",
|
||||
cases: [
|
||||
{
|
||||
supported: new Range("^12.17 || >=13.2"),
|
||||
messageId: "no-dynamic-import",
|
||||
},
|
||||
],
|
||||
},
|
||||
optionalChaining: {
|
||||
ruleId: "no-optional-chaining",
|
||||
cases: [
|
||||
{
|
||||
supported: "14.0.0",
|
||||
messageId: "no-optional-chaining",
|
||||
},
|
||||
],
|
||||
},
|
||||
nullishCoalescingOperators: {
|
||||
ruleId: "no-nullish-coalescing-operators",
|
||||
cases: [
|
||||
{
|
||||
supported: "14.0.0",
|
||||
messageId: "no-nullish-coalescing-operators",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ES2021
|
||||
//--------------------------------------------------------------------------
|
||||
logicalAssignmentOperators: {
|
||||
ruleId: "no-logical-assignment-operators",
|
||||
cases: [
|
||||
{
|
||||
supported: "15.0.0",
|
||||
messageId: "no-logical-assignment-operators",
|
||||
},
|
||||
],
|
||||
},
|
||||
numericSeparators: {
|
||||
ruleId: "no-numeric-separators",
|
||||
cases: [
|
||||
{
|
||||
supported: "12.5.0",
|
||||
messageId: "no-numeric-separators",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
const keywords = Object.keys(features)
|
||||
|
||||
/**
|
||||
* Parses the options.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @returns {{version:Range,ignores:Set<string>}} Parsed value.
|
||||
*/
|
||||
function parseOptions(context) {
|
||||
const raw = context.options[0] || {}
|
||||
const version = getConfiguredNodeVersion(context)
|
||||
const ignores = new Set(raw.ignores || [])
|
||||
|
||||
return Object.freeze({ version, ignores })
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the scope that a given node belongs to.
|
||||
* @param {Scope} initialScope The initial scope to find.
|
||||
* @param {Node} node The AST node.
|
||||
* @returns {Scope} The scope that the node belongs to.
|
||||
*/
|
||||
function normalizeScope(initialScope, node) {
|
||||
let scope = getInnermostScope(initialScope, node)
|
||||
|
||||
while (scope && scope.block === node) {
|
||||
scope = scope.upper
|
||||
}
|
||||
|
||||
return scope
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the visitor object as merging the rules of eslint-plugin-es-x.
|
||||
* @param {RuleContext} context The rule context.
|
||||
* @param {{version:Range,ignores:Set<string>}} options The options.
|
||||
* @returns {object} The defined visitor.
|
||||
*/
|
||||
function defineVisitor(context, options) {
|
||||
const testInfoPrototype = {
|
||||
get isStrict() {
|
||||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9
|
||||
const scope = sourceCode.getScope?.(this.node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9
|
||||
return normalizeScope(scope, this.node).isStrict
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a given case object is full-supported on the configured node version.
|
||||
* @param {{supported:string}} aCase The case object to check.
|
||||
* @returns {boolean} `true` if it's supporting.
|
||||
*/
|
||||
function isNotSupportingVersion(aCase) {
|
||||
if (!aCase.supported) {
|
||||
return true
|
||||
}
|
||||
|
||||
const supported =
|
||||
typeof aCase.supported === "string"
|
||||
? getSemverRange(`>=${aCase.supported}`)
|
||||
: aCase.supported
|
||||
return !rangeSubset(options.version, supported)
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the predicate function to check whether a given case object is supported on the configured node version.
|
||||
* @param {Node} node The node which is reported.
|
||||
* @returns {function(aCase:{supported:string}):boolean} The predicate function.
|
||||
*/
|
||||
function isNotSupportingOn(node) {
|
||||
return aCase =>
|
||||
isNotSupportingVersion(aCase) &&
|
||||
(!aCase.test || aCase.test({ node, __proto__: testInfoPrototype }))
|
||||
}
|
||||
|
||||
return (
|
||||
keywords
|
||||
// Omit full-supported features and ignored features by options
|
||||
// because this rule never reports those.
|
||||
.filter(
|
||||
keyword =>
|
||||
!options.ignores.has(keyword) &&
|
||||
features[keyword].cases.some(isNotSupportingVersion)
|
||||
)
|
||||
// Merge remaining features with overriding `context.report()`.
|
||||
.reduce((visitor, keyword) => {
|
||||
const { ruleId, cases } = features[keyword]
|
||||
const rule = esRules[ruleId]
|
||||
const thisContext = {
|
||||
__proto__: context,
|
||||
|
||||
// Override `context.report()` then:
|
||||
// - ignore if it's supported.
|
||||
// - override reporting messages.
|
||||
report(descriptor) {
|
||||
// Set additional information.
|
||||
if (descriptor.data) {
|
||||
descriptor.data.version = options.version.raw
|
||||
} else {
|
||||
descriptor.data = { version: options.version.raw }
|
||||
}
|
||||
descriptor.fix = undefined
|
||||
|
||||
// Test and report.
|
||||
const node = descriptor.node
|
||||
const hitCase = cases.find(isNotSupportingOn(node))
|
||||
if (hitCase) {
|
||||
descriptor.messageId = hitCase.messageId
|
||||
descriptor.data.supported = hitCase.supported
|
||||
super.report(descriptor)
|
||||
}
|
||||
},
|
||||
}
|
||||
return mergeVisitorsInPlace(visitor, rule.create(thisContext))
|
||||
}, {})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description:
|
||||
"disallow unsupported ECMAScript syntax on the specified version",
|
||||
recommended: true,
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-unsupported-features/es-syntax.md",
|
||||
},
|
||||
type: "problem",
|
||||
fixable: null,
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
version: getConfiguredNodeVersion.schema,
|
||||
ignores: {
|
||||
type: "array",
|
||||
items: {
|
||||
enum: Object.keys(features),
|
||||
},
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
//------------------------------------------------------------------
|
||||
// ES2015
|
||||
//------------------------------------------------------------------
|
||||
"no-arrow-functions":
|
||||
"Arrow functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-binary-numeric-literals":
|
||||
"Binary numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-block-scoped-functions-strict":
|
||||
"Block-scoped functions in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-block-scoped-functions-sloppy":
|
||||
"Block-scoped functions in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-block-scoped-variables-strict":
|
||||
"Block-scoped variables in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-block-scoped-variables-sloppy":
|
||||
"Block-scoped variables in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-classes-strict":
|
||||
"Classes in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-classes-sloppy":
|
||||
"Classes in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-computed-properties":
|
||||
"Computed properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-default-parameters":
|
||||
"Default parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-destructuring":
|
||||
"Destructuring is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-for-of-loops":
|
||||
"'for-of' loops are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-generators":
|
||||
"Generator functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-modules":
|
||||
"Import and export declarations are not supported yet.",
|
||||
"no-new-target":
|
||||
"'new.target' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-object-super-properties":
|
||||
"'super' in object literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-octal-numeric-literals":
|
||||
"Octal numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-property-shorthands":
|
||||
"Property shorthands are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-property-shorthands-getset":
|
||||
"Property shorthands of 'get' and 'set' are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-u-flag":
|
||||
"RegExp 'u' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-y-flag":
|
||||
"RegExp 'y' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-rest-parameters":
|
||||
"Rest parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-spread-elements":
|
||||
"Spread elements are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-template-literals":
|
||||
"Template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-unicode-codepoint-escapes":
|
||||
"Unicode code point escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2016
|
||||
//------------------------------------------------------------------
|
||||
"no-exponential-operators":
|
||||
"Exponential operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2017
|
||||
//------------------------------------------------------------------
|
||||
"no-async-functions":
|
||||
"Async functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-trailing-function-commas":
|
||||
"Trailing commas in function syntax are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2018
|
||||
//------------------------------------------------------------------
|
||||
"no-async-iteration":
|
||||
"Async iteration is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-malformed-template-literals":
|
||||
"Malformed template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-lookbehind-assertions":
|
||||
"RegExp lookbehind assertions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-named-capture-groups":
|
||||
"RegExp named capture groups are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-s-flag":
|
||||
"RegExp 's' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-regexp-unicode-property-escapes":
|
||||
"RegExp Unicode property escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-rest-spread-properties":
|
||||
"Rest/spread properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2019
|
||||
//------------------------------------------------------------------
|
||||
"no-json-superset":
|
||||
"'\\u{{code}}' in string literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-optional-catch-binding":
|
||||
"The omission of 'catch' binding is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2020
|
||||
//------------------------------------------------------------------
|
||||
"no-bigint":
|
||||
"Bigint literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-bigint-property-names":
|
||||
"Bigint literal property names are not supported yet.",
|
||||
"no-dynamic-import":
|
||||
"'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-optional-chaining":
|
||||
"Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-nullish-coalescing-operators":
|
||||
"Nullish coalescing operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// ES2021
|
||||
//------------------------------------------------------------------
|
||||
"no-logical-assignment-operators":
|
||||
"Logical assignment operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
"no-numeric-separators":
|
||||
"Numeric separators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return defineVisitor(context, parseOptions(context))
|
||||
},
|
||||
}
|
||||
415
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js
generated
vendored
Normal file
415
home/ags/node_modules/eslint-plugin-n/lib/rules/no-unsupported-features/node-builtins.js
generated
vendored
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
/**
|
||||
* @author Toru Nagashima
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
const { READ } = require("@eslint-community/eslint-utils")
|
||||
const {
|
||||
checkUnsupportedBuiltins,
|
||||
messages,
|
||||
} = require("../../util/check-unsupported-builtins")
|
||||
const enumeratePropertyNames = require("../../util/enumerate-property-names")
|
||||
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
|
||||
const extendTrackMapWithNodePrefix = require("../../util/extend-trackmap-with-node-prefix")
|
||||
|
||||
const trackMap = {
|
||||
globals: {
|
||||
queueMicrotask: {
|
||||
[READ]: { supported: "12.0.0", experimental: "11.0.0" },
|
||||
},
|
||||
require: {
|
||||
resolve: {
|
||||
paths: { [READ]: { supported: "8.9.0" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
modules: {
|
||||
assert: {
|
||||
strict: {
|
||||
[READ]: { supported: "9.9.0", backported: ["8.13.0"] },
|
||||
doesNotReject: { [READ]: { supported: "10.0.0" } },
|
||||
rejects: { [READ]: { supported: "10.0.0" } },
|
||||
},
|
||||
deepStrictEqual: { [READ]: { supported: "4.0.0" } },
|
||||
doesNotReject: { [READ]: { supported: "10.0.0" } },
|
||||
notDeepStrictEqual: { [READ]: { supported: "4.0.0" } },
|
||||
rejects: { [READ]: { supported: "10.0.0" } },
|
||||
CallTracker: {
|
||||
[READ]: { supported: null, experimental: "14.2.0" },
|
||||
},
|
||||
},
|
||||
async_hooks: {
|
||||
[READ]: { supported: "8.0.0" },
|
||||
createHook: { [READ]: { supported: "8.1.0" } },
|
||||
AsyncLocalStorage: {
|
||||
[READ]: { supported: "13.10.0", backported: ["12.17.0"] },
|
||||
},
|
||||
},
|
||||
buffer: {
|
||||
Buffer: {
|
||||
alloc: { [READ]: { supported: "4.5.0" } },
|
||||
allocUnsafe: { [READ]: { supported: "4.5.0" } },
|
||||
allocUnsafeSlow: { [READ]: { supported: "4.5.0" } },
|
||||
from: { [READ]: { supported: "4.5.0" } },
|
||||
},
|
||||
kMaxLength: { [READ]: { supported: "3.0.0" } },
|
||||
transcode: { [READ]: { supported: "7.1.0" } },
|
||||
constants: { [READ]: { supported: "8.2.0" } },
|
||||
Blob: { [READ]: { supported: null, experimental: "15.7.0" } },
|
||||
},
|
||||
child_process: {
|
||||
ChildProcess: { [READ]: { supported: "2.2.0" } },
|
||||
},
|
||||
console: {
|
||||
clear: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } },
|
||||
count: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } },
|
||||
countReset: {
|
||||
[READ]: { supported: "8.3.0", backported: ["6.13.0"] },
|
||||
},
|
||||
debug: { [READ]: { supported: "8.0.0" } },
|
||||
dirxml: { [READ]: { supported: "8.0.0" } },
|
||||
group: { [READ]: { supported: "8.5.0" } },
|
||||
groupCollapsed: { [READ]: { supported: "8.5.0" } },
|
||||
groupEnd: { [READ]: { supported: "8.5.0" } },
|
||||
table: { [READ]: { supported: "10.0.0" } },
|
||||
markTimeline: { [READ]: { supported: "8.0.0" } },
|
||||
profile: { [READ]: { supported: "8.0.0" } },
|
||||
profileEnd: { [READ]: { supported: "8.0.0" } },
|
||||
timeLog: { [READ]: { supported: "10.7.0" } },
|
||||
timeStamp: { [READ]: { supported: "8.0.0" } },
|
||||
timeline: { [READ]: { supported: "8.0.0" } },
|
||||
timelineEnd: { [READ]: { supported: "8.0.0" } },
|
||||
},
|
||||
crypto: {
|
||||
Certificate: {
|
||||
exportChallenge: { [READ]: { supported: "9.0.0" } },
|
||||
exportPublicKey: { [READ]: { supported: "9.0.0" } },
|
||||
verifySpkac: { [READ]: { supported: "9.0.0" } },
|
||||
},
|
||||
ECDH: { [READ]: { supported: "8.8.0", backported: ["6.13.0"] } },
|
||||
KeyObject: { [READ]: { supported: "11.6.0" } },
|
||||
createPrivateKey: { [READ]: { supported: "11.6.0" } },
|
||||
createPublicKey: { [READ]: { supported: "11.6.0" } },
|
||||
createSecretKey: { [READ]: { supported: "11.6.0" } },
|
||||
constants: { [READ]: { supported: "6.3.0" } },
|
||||
fips: { [READ]: { supported: "6.0.0" } },
|
||||
generateKeyPair: { [READ]: { supported: "10.12.0" } },
|
||||
generateKeyPairSync: { [READ]: { supported: "10.12.0" } },
|
||||
getCurves: { [READ]: { supported: "2.3.0" } },
|
||||
getFips: { [READ]: { supported: "10.0.0" } },
|
||||
privateEncrypt: { [READ]: { supported: "1.1.0" } },
|
||||
publicDecrypt: { [READ]: { supported: "1.1.0" } },
|
||||
randomFillSync: {
|
||||
[READ]: { supported: "7.10.0", backported: ["6.13.0"] },
|
||||
},
|
||||
randomFill: {
|
||||
[READ]: { supported: "7.10.0", backported: ["6.13.0"] },
|
||||
},
|
||||
scrypt: { [READ]: { supported: "10.5.0" } },
|
||||
scryptSync: { [READ]: { supported: "10.5.0" } },
|
||||
setFips: { [READ]: { supported: "10.0.0" } },
|
||||
sign: { [READ]: { supported: "12.0.0" } },
|
||||
timingSafeEqual: { [READ]: { supported: "6.6.0" } },
|
||||
verify: { [READ]: { supported: "12.0.0" } },
|
||||
},
|
||||
dns: {
|
||||
Resolver: { [READ]: { supported: "8.3.0" } },
|
||||
resolvePtr: { [READ]: { supported: "6.0.0" } },
|
||||
promises: {
|
||||
[READ]: {
|
||||
supported: "11.14.0",
|
||||
backported: ["10.17.0"],
|
||||
experimental: "10.6.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
events: {
|
||||
EventEmitter: {
|
||||
once: {
|
||||
[READ]: { supported: "11.13.0", backported: ["10.16.0"] },
|
||||
},
|
||||
},
|
||||
once: { [READ]: { supported: "11.13.0", backported: ["10.16.0"] } },
|
||||
},
|
||||
fs: {
|
||||
Dirent: { [READ]: { supported: "10.10.0" } },
|
||||
copyFile: { [READ]: { supported: "8.5.0" } },
|
||||
copyFileSync: { [READ]: { supported: "8.5.0" } },
|
||||
mkdtemp: { [READ]: { supported: "5.10.0" } },
|
||||
mkdtempSync: { [READ]: { supported: "5.10.0" } },
|
||||
realpath: {
|
||||
native: { [READ]: { supported: "9.2.0" } },
|
||||
},
|
||||
realpathSync: {
|
||||
native: { [READ]: { supported: "9.2.0" } },
|
||||
},
|
||||
promises: {
|
||||
[READ]: {
|
||||
supported: "11.14.0",
|
||||
backported: ["10.17.0"],
|
||||
experimental: "10.1.0",
|
||||
},
|
||||
},
|
||||
writev: { [READ]: { supported: "12.9.0" } },
|
||||
writevSync: { [READ]: { supported: "12.9.0" } },
|
||||
readv: {
|
||||
[READ]: { supported: "13.13.0", backported: ["12.17.0"] },
|
||||
},
|
||||
readvSync: {
|
||||
[READ]: { supported: "13.13.0", backported: ["12.17.0"] },
|
||||
},
|
||||
lutimes: {
|
||||
[READ]: { supported: "14.5.0", backported: ["12.19.0"] },
|
||||
},
|
||||
lutimesSync: {
|
||||
[READ]: { supported: "14.5.0", backported: ["12.19.0"] },
|
||||
},
|
||||
opendir: {
|
||||
[READ]: { supported: "12.12.0" },
|
||||
},
|
||||
opendirSync: {
|
||||
[READ]: { supported: "12.12.0" },
|
||||
},
|
||||
rm: {
|
||||
[READ]: { supported: "14.14.0" },
|
||||
},
|
||||
rmSync: {
|
||||
[READ]: { supported: "14.14.0" },
|
||||
},
|
||||
read: {
|
||||
[READ]: { supported: "13.11.0", backported: ["12.17.0"] },
|
||||
},
|
||||
readSync: {
|
||||
[READ]: { supported: "13.11.0", backported: ["12.17.0"] },
|
||||
},
|
||||
Dir: {
|
||||
[READ]: { supported: "12.12.0" },
|
||||
},
|
||||
StatWatcher: {
|
||||
[READ]: { supported: "14.3.0", backported: ["12.20.0"] },
|
||||
},
|
||||
},
|
||||
"fs/promises": {
|
||||
[READ]: {
|
||||
supported: "14.0.0",
|
||||
},
|
||||
},
|
||||
http2: {
|
||||
[READ]: {
|
||||
supported: "10.10.0",
|
||||
backported: ["8.13.0"],
|
||||
experimental: "8.4.0",
|
||||
},
|
||||
},
|
||||
inspector: {
|
||||
[READ]: { supported: null, experimental: "8.0.0" },
|
||||
},
|
||||
module: {
|
||||
Module: {
|
||||
builtinModules: {
|
||||
[READ]: {
|
||||
supported: "9.3.0",
|
||||
backported: ["6.13.0", "8.10.0"],
|
||||
},
|
||||
},
|
||||
createRequireFromPath: { [READ]: { supported: "10.12.0" } },
|
||||
createRequire: { [READ]: { supported: "12.2.0" } },
|
||||
syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } },
|
||||
},
|
||||
builtinModules: {
|
||||
[READ]: {
|
||||
supported: "9.3.0",
|
||||
backported: ["6.13.0", "8.10.0"],
|
||||
},
|
||||
},
|
||||
createRequireFromPath: { [READ]: { supported: "10.12.0" } },
|
||||
createRequire: { [READ]: { supported: "12.2.0" } },
|
||||
syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } },
|
||||
},
|
||||
os: {
|
||||
constants: {
|
||||
[READ]: { supported: "6.3.0" },
|
||||
priority: { [READ]: { supported: "10.10.0" } },
|
||||
},
|
||||
getPriority: { [READ]: { supported: "10.10.0" } },
|
||||
homedir: { [READ]: { supported: "2.3.0" } },
|
||||
setPriority: { [READ]: { supported: "10.10.0" } },
|
||||
userInfo: { [READ]: { supported: "6.0.0" } },
|
||||
},
|
||||
path: {
|
||||
toNamespacedPath: { [READ]: { supported: "9.0.0" } },
|
||||
},
|
||||
perf_hooks: {
|
||||
[READ]: { supported: "8.5.0" },
|
||||
monitorEventLoopDelay: { [READ]: { supported: "11.10.0" } },
|
||||
},
|
||||
process: {
|
||||
allowedNodeEnvironmentFlags: { [READ]: { supported: "10.10.0" } },
|
||||
argv0: { [READ]: { supported: "6.4.0" } },
|
||||
channel: { [READ]: { supported: "7.1.0" } },
|
||||
cpuUsage: { [READ]: { supported: "6.1.0" } },
|
||||
emitWarning: { [READ]: { supported: "6.0.0" } },
|
||||
getegid: { [READ]: { supported: "2.0.0" } },
|
||||
geteuid: { [READ]: { supported: "2.0.0" } },
|
||||
hasUncaughtExceptionCaptureCallback: {
|
||||
[READ]: { supported: "9.3.0" },
|
||||
},
|
||||
hrtime: {
|
||||
bigint: { [READ]: { supported: "10.7.0" } },
|
||||
},
|
||||
ppid: {
|
||||
[READ]: {
|
||||
supported: "9.2.0",
|
||||
backported: ["6.13.0", "8.10.0"],
|
||||
},
|
||||
},
|
||||
release: { [READ]: { supported: "3.0.0" } },
|
||||
report: { [READ]: { supported: "14.0.0", experimental: "11.8.0" } },
|
||||
resourceUsage: { [READ]: { supported: "12.6.0" } },
|
||||
setegid: { [READ]: { supported: "2.0.0" } },
|
||||
seteuid: { [READ]: { supported: "2.0.0" } },
|
||||
setUncaughtExceptionCaptureCallback: {
|
||||
[READ]: { supported: "9.3.0" },
|
||||
},
|
||||
stdout: {
|
||||
getColorDepth: { [READ]: { supported: "9.9.0" } },
|
||||
hasColor: { [READ]: { supported: "11.13.0" } },
|
||||
},
|
||||
stderr: {
|
||||
getColorDepth: { [READ]: { supported: "9.9.0" } },
|
||||
hasColor: { [READ]: { supported: "11.13.0" } },
|
||||
},
|
||||
},
|
||||
stream: {
|
||||
Readable: {
|
||||
from: {
|
||||
[READ]: { supported: "12.3.0", backported: ["10.17.0"] },
|
||||
},
|
||||
},
|
||||
finished: { [READ]: { supported: "10.0.0" } },
|
||||
pipeline: { [READ]: { supported: "10.0.0" } },
|
||||
},
|
||||
trace_events: {
|
||||
[READ]: { supported: "10.0.0" },
|
||||
},
|
||||
url: {
|
||||
URL: { [READ]: { supported: "7.0.0", backported: ["6.13.0"] } },
|
||||
URLSearchParams: {
|
||||
[READ]: { supported: "7.5.0", backported: ["6.13.0"] },
|
||||
},
|
||||
domainToASCII: { [READ]: { supported: "7.4.0" } },
|
||||
domainToUnicode: { [READ]: { supported: "7.4.0" } },
|
||||
},
|
||||
util: {
|
||||
callbackify: { [READ]: { supported: "8.2.0" } },
|
||||
formatWithOptions: { [READ]: { supported: "10.0.0" } },
|
||||
getSystemErrorName: {
|
||||
[READ]: { supported: "9.7.0", backported: ["8.12.0"] },
|
||||
},
|
||||
inspect: {
|
||||
custom: { [READ]: { supported: "6.6.0" } },
|
||||
defaultOptions: { [READ]: { supported: "6.4.0" } },
|
||||
replDefaults: { [READ]: { supported: "11.12.0" } },
|
||||
},
|
||||
isDeepStrictEqual: { [READ]: { supported: "9.0.0" } },
|
||||
promisify: { [READ]: { supported: "8.0.0" } },
|
||||
TextDecoder: {
|
||||
[READ]: { supported: "8.9.0", experimental: "8.3.0" },
|
||||
},
|
||||
TextEncoder: {
|
||||
[READ]: { supported: "8.9.0", experimental: "8.3.0" },
|
||||
},
|
||||
types: {
|
||||
[READ]: { supported: "10.0.0" },
|
||||
isBoxedPrimitive: { [READ]: { supported: "10.11.0" } },
|
||||
},
|
||||
},
|
||||
v8: {
|
||||
[READ]: { supported: "1.0.0" },
|
||||
DefaultDeserializer: { [READ]: { supported: "8.0.0" } },
|
||||
DefaultSerializer: { [READ]: { supported: "8.0.0" } },
|
||||
Deserializer: { [READ]: { supported: "8.0.0" } },
|
||||
Serializer: { [READ]: { supported: "8.0.0" } },
|
||||
cachedDataVersionTag: { [READ]: { supported: "8.0.0" } },
|
||||
deserialize: { [READ]: { supported: "8.0.0" } },
|
||||
getHeapCodeStatistics: { [READ]: { supported: "12.8.0" } },
|
||||
getHeapSnapshot: { [READ]: { supported: "11.13.0" } },
|
||||
getHeapSpaceStatistics: { [READ]: { supported: "6.0.0" } },
|
||||
serialize: { [READ]: { supported: "8.0.0" } },
|
||||
writeHeapSnapshot: { [READ]: { supported: "11.13.0" } },
|
||||
},
|
||||
vm: {
|
||||
Module: { [READ]: { supported: "9.6.0" } },
|
||||
compileFunction: { [READ]: { supported: "10.10.0" } },
|
||||
},
|
||||
worker_threads: {
|
||||
[READ]: { supported: "12.11.0", experimental: "10.5.0" },
|
||||
},
|
||||
},
|
||||
}
|
||||
Object.assign(trackMap.globals, {
|
||||
Buffer: trackMap.modules.buffer.Buffer,
|
||||
TextDecoder: {
|
||||
...trackMap.modules.util.TextDecoder,
|
||||
[READ]: { supported: "11.0.0" },
|
||||
},
|
||||
TextEncoder: {
|
||||
...trackMap.modules.util.TextEncoder,
|
||||
[READ]: { supported: "11.0.0" },
|
||||
},
|
||||
URL: {
|
||||
...trackMap.modules.url.URL,
|
||||
[READ]: { supported: "10.0.0" },
|
||||
},
|
||||
URLSearchParams: {
|
||||
...trackMap.modules.url.URLSearchParams,
|
||||
[READ]: { supported: "10.0.0" },
|
||||
},
|
||||
console: trackMap.modules.console,
|
||||
process: trackMap.modules.process,
|
||||
})
|
||||
|
||||
trackMap.modules = extendTrackMapWithNodePrefix(trackMap.modules)
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description:
|
||||
"disallow unsupported Node.js built-in APIs on the specified version",
|
||||
recommended: true,
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-unsupported-features/node-builtins.md",
|
||||
},
|
||||
type: "problem",
|
||||
fixable: null,
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
version: getConfiguredNodeVersion.schema,
|
||||
ignores: {
|
||||
type: "array",
|
||||
items: {
|
||||
enum: Array.from(
|
||||
new Set([
|
||||
...enumeratePropertyNames(trackMap.globals),
|
||||
...enumeratePropertyNames(trackMap.modules),
|
||||
])
|
||||
),
|
||||
},
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages,
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
"Program:exit"() {
|
||||
checkUnsupportedBuiltins(context, trackMap)
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue