Update checked-in dependencies
This commit is contained in:
parent
5d6442e87d
commit
026e833827
36 changed files with 1972 additions and 643 deletions
110
node_modules/.package-lock.json
generated
vendored
110
node_modules/.package-lock.json
generated
vendored
|
|
@ -448,9 +448,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "8.50.0",
|
"version": "8.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
|
||||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
"integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
|
|
@ -934,21 +934,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/uuid": {
|
"node_modules/@types/uuid": {
|
||||||
"version": "9.0.4",
|
"version": "9.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz",
|
||||||
"integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA=="
|
"integrity": "sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz",
|
||||||
"integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
|
"integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/type-utils": "6.7.3",
|
"@typescript-eslint/type-utils": "6.7.5",
|
||||||
"@typescript-eslint/utils": "6.7.3",
|
"@typescript-eslint/utils": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.2.4",
|
"ignore": "^5.2.4",
|
||||||
|
|
@ -974,15 +974,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz",
|
||||||
"integrity": "sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==",
|
"integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
@ -1002,13 +1002,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz",
|
||||||
"integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
|
"integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
"@typescript-eslint/visitor-keys": "6.7.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
|
|
@ -1019,13 +1019,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz",
|
||||||
"integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
|
"integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"@typescript-eslint/utils": "6.7.3",
|
"@typescript-eslint/utils": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^1.0.1"
|
"ts-api-utils": "^1.0.1"
|
||||||
},
|
},
|
||||||
|
|
@ -1046,9 +1046,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz",
|
||||||
"integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
|
"integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
|
|
@ -1059,13 +1059,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz",
|
||||||
"integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
|
"integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
|
|
@ -1086,17 +1086,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz",
|
||||||
"integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
|
"integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/json-schema": "^7.0.12",
|
"@types/json-schema": "^7.0.12",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"semver": "^7.5.4"
|
"semver": "^7.5.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
@ -1111,12 +1111,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz",
|
||||||
"integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
|
"integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"eslint-visitor-keys": "^3.4.1"
|
"eslint-visitor-keys": "^3.4.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
@ -2470,15 +2470,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.50.0",
|
"version": "8.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
|
||||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
"integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
"@eslint/eslintrc": "^2.1.2",
|
"@eslint/eslintrc": "^2.1.2",
|
||||||
"@eslint/js": "8.50.0",
|
"@eslint/js": "8.51.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.11",
|
"@humanwhocodes/config-array": "^0.11.11",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
|
|
@ -5445,9 +5445,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/sinon": {
|
"node_modules/sinon": {
|
||||||
"version": "16.0.0",
|
"version": "16.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.1.0.tgz",
|
||||||
"integrity": "sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ==",
|
"integrity": "sha512-ZSgzF0vwmoa8pq0GEynqfdnpEDyP1PkYmEChnkjW0Vyh8IDlyFEJ+fkMhCP0il6d5cJjPl2PUsnUSAuP5sttOQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinonjs/commons": "^3.0.0",
|
"@sinonjs/commons": "^3.0.0",
|
||||||
|
|
|
||||||
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@eslint/js",
|
"name": "@eslint/js",
|
||||||
"version": "8.50.0",
|
"version": "8.51.0",
|
||||||
"description": "ESLint JavaScript language implementation",
|
"description": "ESLint JavaScript language implementation",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
|
|
|
||||||
2
node_modules/@types/uuid/README.md
generated
vendored
2
node_modules/@types/uuid/README.md
generated
vendored
|
|
@ -8,7 +8,7 @@ This package contains type definitions for uuid (https://github.com/uuidjs/uuid)
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid.
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid.
|
||||||
|
|
||||||
### Additional Details
|
### Additional Details
|
||||||
* Last updated: Thu, 14 Sep 2023 14:21:18 GMT
|
* Last updated: Fri, 06 Oct 2023 23:05:45 GMT
|
||||||
* Dependencies: none
|
* Dependencies: none
|
||||||
* Global values: none
|
* Global values: none
|
||||||
|
|
||||||
|
|
|
||||||
4
node_modules/@types/uuid/index.d.mts
generated
vendored
4
node_modules/@types/uuid/index.d.mts
generated
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
import uuid from './index.js';
|
import uuid from "./index.js";
|
||||||
export import v1 = uuid.v1;
|
export import v1 = uuid.v1;
|
||||||
export import v3 = uuid.v3;
|
export import v3 = uuid.v3;
|
||||||
export import v4 = uuid.v4;
|
export import v4 = uuid.v4;
|
||||||
|
|
@ -7,4 +7,4 @@ export import NIL = uuid.NIL;
|
||||||
export import version = uuid.version;
|
export import version = uuid.version;
|
||||||
export import validate = uuid.validate;
|
export import validate = uuid.validate;
|
||||||
export import stringify = uuid.stringify;
|
export import stringify = uuid.stringify;
|
||||||
export import parse = uuid.parse;
|
export import parse = uuid.parse;
|
||||||
|
|
|
||||||
4
node_modules/@types/uuid/package.json
generated
vendored
4
node_modules/@types/uuid/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@types/uuid",
|
"name": "@types/uuid",
|
||||||
"version": "9.0.4",
|
"version": "9.0.5",
|
||||||
"description": "TypeScript definitions for uuid",
|
"description": "TypeScript definitions for uuid",
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"typesPublisherContentHash": "bce6069b94fc3e504545efe5646f5e5d0ccbb6a2cfaf3d36698b945952fa4fec",
|
"typesPublisherContentHash": "321106d7a0649dc4bbe8cbc573e0812a78e7208fb095cae5b3497341fad32196",
|
||||||
"typeScriptVersion": "4.5",
|
"typeScriptVersion": "4.5",
|
||||||
"exports": {
|
"exports": {
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
||||||
|
|
@ -117,19 +117,17 @@ exports.default = (0, util_1.createRule)({
|
||||||
evaluatedLength.value === evaluatedString.value.length);
|
evaluatedLength.value === evaluatedString.value.length);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Check if a given node is a negative index expression
|
* Returns true if `node` is `-substring.length` or
|
||||||
*
|
* `parentString.length - substring.length`
|
||||||
* E.g. `s.slice(- <expr>)`, `s.substring(s.length - <expr>)`
|
|
||||||
*
|
|
||||||
* @param node The node to check.
|
|
||||||
* @param expectedIndexedNode The node which is expected as the receiver of index expression.
|
|
||||||
*/
|
*/
|
||||||
function isNegativeIndexExpression(node, expectedIndexedNode) {
|
function isLengthAheadOfEnd(node, substring, parentString) {
|
||||||
return ((node.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
return ((node.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||||
node.operator === '-') ||
|
node.operator === '-' &&
|
||||||
|
isLengthExpression(node.argument, substring)) ||
|
||||||
(node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
|
(node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
|
||||||
node.operator === '-' &&
|
node.operator === '-' &&
|
||||||
isLengthExpression(node.left, expectedIndexedNode)));
|
isLengthExpression(node.left, parentString) &&
|
||||||
|
isLengthExpression(node.right, substring)));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Check if a given node is the expression of the last index.
|
* Check if a given node is the expression of the last index.
|
||||||
|
|
@ -405,14 +403,34 @@ exports.default = (0, util_1.createRule)({
|
||||||
if (!isEqualityComparison(parentNode) || !isStringType(node.object)) {
|
if (!isEqualityComparison(parentNode) || !isStringType(node.object)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isEndsWith = (callNode.arguments.length === 1 ||
|
let isEndsWith = false;
|
||||||
(callNode.arguments.length === 2 &&
|
let isStartsWith = false;
|
||||||
isLengthExpression(callNode.arguments[1], node.object))) &&
|
if (callNode.arguments.length === 1) {
|
||||||
isNegativeIndexExpression(callNode.arguments[0], node.object);
|
if (
|
||||||
const isStartsWith = !isEndsWith &&
|
// foo.slice(-bar.length) === bar
|
||||||
callNode.arguments.length === 2 &&
|
// foo.slice(foo.length - bar.length) === bar
|
||||||
|
isLengthAheadOfEnd(callNode.arguments[0], parentNode.right, node.object)) {
|
||||||
|
isEndsWith = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (callNode.arguments.length === 2) {
|
||||||
|
if (
|
||||||
|
// foo.slice(0, bar.length) === bar
|
||||||
isNumber(callNode.arguments[0], 0) &&
|
isNumber(callNode.arguments[0], 0) &&
|
||||||
!isNegativeIndexExpression(callNode.arguments[1], node.object);
|
isLengthExpression(callNode.arguments[1], parentNode.right)) {
|
||||||
|
isStartsWith = true;
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
// foo.slice(foo.length - bar.length, foo.length) === bar
|
||||||
|
// foo.slice(foo.length - bar.length, 0) === bar
|
||||||
|
// foo.slice(-bar.length, foo.length) === bar
|
||||||
|
// foo.slice(-bar.length, 0) === bar
|
||||||
|
(isLengthExpression(callNode.arguments[1], node.object) ||
|
||||||
|
isNumber(callNode.arguments[1], 0)) &&
|
||||||
|
isLengthAheadOfEnd(callNode.arguments[0], parentNode.right, node.object)) {
|
||||||
|
isEndsWith = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!isStartsWith && !isEndsWith) {
|
if (!isStartsWith && !isEndsWith) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
|
|
@ -76,7 +76,7 @@ declare function acceptsBoolean(arg: boolean): void;
|
||||||
acceptsBoolean(foo != null && foo.bar);
|
acceptsBoolean(foo != null && foo.bar);
|
||||||
|
|
||||||
// ❌ typechecks UNSUCCESSFULLY as the expression returns `boolean | undefined`
|
// ❌ typechecks UNSUCCESSFULLY as the expression returns `boolean | undefined`
|
||||||
acceptsBoolean(foo != null && foo.bar);
|
acceptsBoolean(foo?.bar);
|
||||||
```
|
```
|
||||||
|
|
||||||
This style of code isn't super common - which means having this option set to `true` _should_ be safe in most codebases. However we default it to `false` due to its unsafe nature. We have provided this option for convenience because it increases the autofix cases covered by the rule. If you set option to `true` the onus is entirely on you and your team to ensure that each fix is correct and safe and that it does not break the build.
|
This style of code isn't super common - which means having this option set to `true` _should_ be safe in most codebases. However we default it to `false` due to its unsafe nature. We have provided this option for convenience because it increases the autofix cases covered by the rule. If you set option to `true` the onus is entirely on you and your team to ensure that each fix is correct and safe and that it does not break the build.
|
||||||
|
|
|
||||||
16
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/eslint-plugin",
|
"name": "@typescript-eslint/eslint-plugin",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "TypeScript plugin for ESLint",
|
"description": "TypeScript plugin for ESLint",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -57,10 +57,10 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/type-utils": "6.7.3",
|
"@typescript-eslint/type-utils": "6.7.5",
|
||||||
"@typescript-eslint/utils": "6.7.3",
|
"@typescript-eslint/utils": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.2.4",
|
"ignore": "^5.2.4",
|
||||||
|
|
@ -73,8 +73,8 @@
|
||||||
"@types/marked": "*",
|
"@types/marked": "*",
|
||||||
"@types/natural-compare": "*",
|
"@types/natural-compare": "*",
|
||||||
"@types/prettier": "*",
|
"@types/prettier": "*",
|
||||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.7.3",
|
"@typescript-eslint/rule-schema-to-typescript-types": "6.7.5",
|
||||||
"@typescript-eslint/rule-tester": "6.7.3",
|
"@typescript-eslint/rule-tester": "6.7.5",
|
||||||
"ajv": "^6.12.6",
|
"ajv": "^6.12.6",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"cross-fetch": "*",
|
"cross-fetch": "*",
|
||||||
|
|
@ -103,5 +103,5 @@
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
"url": "https://opencollective.com/typescript-eslint"
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
node_modules/@typescript-eslint/parser/package.json
generated
vendored
12
node_modules/@typescript-eslint/parser/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/parser",
|
"name": "@typescript-eslint/parser",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -51,10 +51,10 @@
|
||||||
"eslint": "^7.0.0 || ^8.0.0"
|
"eslint": "^7.0.0 || ^8.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -82,5 +82,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
10
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/scope-manager",
|
"name": "@typescript-eslint/scope-manager",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "TypeScript scope analyser for ESLint",
|
"description": "TypeScript scope analyser for ESLint",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -44,12 +44,12 @@
|
||||||
"typecheck": "nx typecheck"
|
"typecheck": "nx typecheck"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
"@typescript-eslint/visitor-keys": "6.7.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "*",
|
"@types/glob": "*",
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"glob": "*",
|
"glob": "*",
|
||||||
"jest-specific-snapshot": "*",
|
"jest-specific-snapshot": "*",
|
||||||
"make-dir": "*",
|
"make-dir": "*",
|
||||||
|
|
@ -67,5 +67,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
10
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/type-utils",
|
"name": "@typescript-eslint/type-utils",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "Type utilities for working with TypeScript + ESLint together",
|
"description": "Type utilities for working with TypeScript + ESLint together",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -45,13 +45,13 @@
|
||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"@typescript-eslint/utils": "6.7.3",
|
"@typescript-eslint/utils": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^1.0.1"
|
"ts-api-utils": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "6.7.3",
|
"@typescript-eslint/parser": "6.7.5",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
"downlevel-dts": "*",
|
"downlevel-dts": "*",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
|
|
@ -78,5 +78,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
node_modules/@typescript-eslint/types/package.json
generated
vendored
4
node_modules/@typescript-eslint/types/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/types",
|
"name": "@typescript-eslint/types",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "Types for the TypeScript-ESTree AST spec",
|
"description": "Types for the TypeScript-ESTree AST spec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -90,5 +90,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
8
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/typescript-estree",
|
"name": "@typescript-eslint/typescript-estree",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -52,8 +52,8 @@
|
||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
|
|
@ -88,5 +88,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
node_modules/@typescript-eslint/utils/package.json
generated
vendored
12
node_modules/@typescript-eslint/utils/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/utils",
|
"name": "@typescript-eslint/utils",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "Utilities for working with TypeScript + ESLint together",
|
"description": "Utilities for working with TypeScript + ESLint together",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -68,16 +68,16 @@
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/json-schema": "^7.0.12",
|
"@types/json-schema": "^7.0.12",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"@typescript-eslint/scope-manager": "6.7.3",
|
"@typescript-eslint/scope-manager": "6.7.5",
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||||
"semver": "^7.5.4"
|
"semver": "^7.5.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "^7.0.0 || ^8.0.0"
|
"eslint": "^7.0.0 || ^8.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "6.7.3",
|
"@typescript-eslint/parser": "6.7.5",
|
||||||
"downlevel-dts": "*",
|
"downlevel-dts": "*",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4",
|
||||||
|
|
@ -95,5 +95,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
6
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@typescript-eslint/visitor-keys",
|
"name": "@typescript-eslint/visitor-keys",
|
||||||
"version": "6.7.3",
|
"version": "6.7.5",
|
||||||
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.7.3",
|
"@typescript-eslint/types": "6.7.5",
|
||||||
"eslint-visitor-keys": "^3.4.1"
|
"eslint-visitor-keys": "^3.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -67,5 +67,5 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
node_modules/eslint/README.md
generated
vendored
4
node_modules/eslint/README.md
generated
vendored
|
|
@ -288,8 +288,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
||||||
<h3>Platinum Sponsors</h3>
|
<h3>Platinum Sponsors</h3>
|
||||||
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
||||||
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||||
<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
<p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
||||||
<!--sponsorsend-->
|
<!--sponsorsend-->
|
||||||
|
|
||||||
## Technology Sponsors
|
## Technology Sponsors
|
||||||
|
|
|
||||||
19
node_modules/eslint/bin/eslint.js
generated
vendored
19
node_modules/eslint/bin/eslint.js
generated
vendored
|
|
@ -92,6 +92,14 @@ function getErrorMessage(error) {
|
||||||
return util.format("%o", error);
|
return util.format("%o", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks error messages that are shown to the user so we only ever show the
|
||||||
|
* same message once.
|
||||||
|
* @type {Set<string>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const displayedErrors = new Set();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Catch and report unexpected error.
|
* Catch and report unexpected error.
|
||||||
* @param {any} error The thrown error object.
|
* @param {any} error The thrown error object.
|
||||||
|
|
@ -101,14 +109,17 @@ function onFatalError(error) {
|
||||||
process.exitCode = 2;
|
process.exitCode = 2;
|
||||||
|
|
||||||
const { version } = require("../package.json");
|
const { version } = require("../package.json");
|
||||||
const message = getErrorMessage(error);
|
const message = `
|
||||||
|
|
||||||
console.error(`
|
|
||||||
Oops! Something went wrong! :(
|
Oops! Something went wrong! :(
|
||||||
|
|
||||||
ESLint: ${version}
|
ESLint: ${version}
|
||||||
|
|
||||||
${message}`);
|
${getErrorMessage(error)}`;
|
||||||
|
|
||||||
|
if (!displayedErrors.has(message)) {
|
||||||
|
console.error(message);
|
||||||
|
displayedErrors.add(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
8
node_modules/eslint/lib/cli.js
generated
vendored
8
node_modules/eslint/lib/cli.js
generated
vendored
|
|
@ -91,7 +91,8 @@ async function translateOptions({
|
||||||
reportUnusedDisableDirectives,
|
reportUnusedDisableDirectives,
|
||||||
resolvePluginsRelativeTo,
|
resolvePluginsRelativeTo,
|
||||||
rule,
|
rule,
|
||||||
rulesdir
|
rulesdir,
|
||||||
|
warnIgnored
|
||||||
}, configType) {
|
}, configType) {
|
||||||
|
|
||||||
let overrideConfig, overrideConfigFile;
|
let overrideConfig, overrideConfigFile;
|
||||||
|
|
@ -182,6 +183,7 @@ async function translateOptions({
|
||||||
|
|
||||||
if (configType === "flat") {
|
if (configType === "flat") {
|
||||||
options.ignorePatterns = ignorePattern;
|
options.ignorePatterns = ignorePattern;
|
||||||
|
options.warnIgnored = warnIgnored;
|
||||||
} else {
|
} else {
|
||||||
options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
||||||
options.rulePaths = rulesdir;
|
options.rulePaths = rulesdir;
|
||||||
|
|
@ -385,7 +387,9 @@ const cli = {
|
||||||
if (useStdin) {
|
if (useStdin) {
|
||||||
results = await engine.lintText(text, {
|
results = await engine.lintText(text, {
|
||||||
filePath: options.stdinFilename,
|
filePath: options.stdinFilename,
|
||||||
warnIgnored: true
|
|
||||||
|
// flatConfig respects CLI flag and constructor warnIgnored, eslintrc forces true for backwards compatibility
|
||||||
|
warnIgnored: usingFlatConfig ? void 0 : true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
results = await engine.lintFiles(files);
|
results = await engine.lintFiles(files);
|
||||||
|
|
|
||||||
4
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
4
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
|
|
@ -179,9 +179,7 @@ class InvalidRuleSeverityError extends Error {
|
||||||
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
|
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
|
||||||
*/
|
*/
|
||||||
function assertIsRuleSeverity(ruleId, value) {
|
function assertIsRuleSeverity(ruleId, value) {
|
||||||
const severity = typeof value === "string"
|
const severity = ruleSeverities.get(value);
|
||||||
? ruleSeverities.get(value.toLowerCase())
|
|
||||||
: ruleSeverities.get(value);
|
|
||||||
|
|
||||||
if (typeof severity === "undefined") {
|
if (typeof severity === "undefined") {
|
||||||
throw new InvalidRuleSeverityError(ruleId, value);
|
throw new InvalidRuleSeverityError(ruleId, value);
|
||||||
|
|
|
||||||
11
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
11
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
|
|
@ -594,9 +594,9 @@ function createIgnoreResult(filePath, baseDir) {
|
||||||
const isInNodeModules = baseDir && path.dirname(path.relative(baseDir, filePath)).split(path.sep).includes("node_modules");
|
const isInNodeModules = baseDir && path.dirname(path.relative(baseDir, filePath)).split(path.sep).includes("node_modules");
|
||||||
|
|
||||||
if (isInNodeModules) {
|
if (isInNodeModules) {
|
||||||
message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to override.";
|
message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning.";
|
||||||
} else {
|
} else {
|
||||||
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
|
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -676,6 +676,7 @@ function processOptions({
|
||||||
overrideConfigFile = null,
|
overrideConfigFile = null,
|
||||||
plugins = {},
|
plugins = {},
|
||||||
reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that.
|
reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that.
|
||||||
|
warnIgnored = true,
|
||||||
...unknownOptions
|
...unknownOptions
|
||||||
}) {
|
}) {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
@ -781,6 +782,9 @@ function processOptions({
|
||||||
) {
|
) {
|
||||||
errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.");
|
errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.");
|
||||||
}
|
}
|
||||||
|
if (typeof warnIgnored !== "boolean") {
|
||||||
|
errors.push("'warnIgnored' must be a boolean.");
|
||||||
|
}
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
throw new ESLintInvalidOptionsError(errors);
|
throw new ESLintInvalidOptionsError(errors);
|
||||||
}
|
}
|
||||||
|
|
@ -802,7 +806,8 @@ function processOptions({
|
||||||
globInputPaths,
|
globInputPaths,
|
||||||
ignore,
|
ignore,
|
||||||
ignorePatterns,
|
ignorePatterns,
|
||||||
reportUnusedDisableDirectives
|
reportUnusedDisableDirectives,
|
||||||
|
warnIgnored
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
21
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
21
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
|
|
@ -84,6 +84,7 @@ const LintResultCache = require("../cli-engine/lint-result-cache");
|
||||||
* when a string.
|
* when a string.
|
||||||
* @property {Record<string,Plugin>} [plugins] An array of plugin implementations.
|
* @property {Record<string,Plugin>} [plugins] An array of plugin implementations.
|
||||||
* @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives.
|
* @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives.
|
||||||
|
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -749,7 +750,8 @@ class FlatESLint {
|
||||||
fixTypes,
|
fixTypes,
|
||||||
reportUnusedDisableDirectives,
|
reportUnusedDisableDirectives,
|
||||||
globInputPaths,
|
globInputPaths,
|
||||||
errorOnUnmatchedPattern
|
errorOnUnmatchedPattern,
|
||||||
|
warnIgnored
|
||||||
} = eslintOptions;
|
} = eslintOptions;
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
const fixTypesSet = fixTypes ? new Set(fixTypes) : null;
|
const fixTypesSet = fixTypes ? new Set(fixTypes) : null;
|
||||||
|
|
@ -795,7 +797,11 @@ class FlatESLint {
|
||||||
* pattern, then notify the user.
|
* pattern, then notify the user.
|
||||||
*/
|
*/
|
||||||
if (ignored) {
|
if (ignored) {
|
||||||
return createIgnoreResult(filePath, cwd);
|
if (warnIgnored) {
|
||||||
|
return createIgnoreResult(filePath, cwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return void 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = configs.getConfig(filePath);
|
const config = configs.getConfig(filePath);
|
||||||
|
|
@ -908,7 +914,7 @@ class FlatESLint {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
filePath,
|
filePath,
|
||||||
warnIgnored = false,
|
warnIgnored,
|
||||||
...unknownOptions
|
...unknownOptions
|
||||||
} = options || {};
|
} = options || {};
|
||||||
|
|
||||||
|
|
@ -922,7 +928,7 @@ class FlatESLint {
|
||||||
throw new Error("'options.filePath' must be a non-empty string or undefined");
|
throw new Error("'options.filePath' must be a non-empty string or undefined");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof warnIgnored !== "boolean") {
|
if (typeof warnIgnored !== "boolean" && typeof warnIgnored !== "undefined") {
|
||||||
throw new Error("'options.warnIgnored' must be a boolean or undefined");
|
throw new Error("'options.warnIgnored' must be a boolean or undefined");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -937,7 +943,8 @@ class FlatESLint {
|
||||||
allowInlineConfig,
|
allowInlineConfig,
|
||||||
cwd,
|
cwd,
|
||||||
fix,
|
fix,
|
||||||
reportUnusedDisableDirectives
|
reportUnusedDisableDirectives,
|
||||||
|
warnIgnored: constructorWarnIgnored
|
||||||
} = eslintOptions;
|
} = eslintOptions;
|
||||||
const results = [];
|
const results = [];
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
@ -945,7 +952,9 @@ class FlatESLint {
|
||||||
|
|
||||||
// Clear the last used config arrays.
|
// Clear the last used config arrays.
|
||||||
if (resolvedFilename && await this.isPathIgnored(resolvedFilename)) {
|
if (resolvedFilename && await this.isPathIgnored(resolvedFilename)) {
|
||||||
if (warnIgnored) {
|
const shouldWarnIgnored = typeof warnIgnored === "boolean" ? warnIgnored : constructorWarnIgnored;
|
||||||
|
|
||||||
|
if (shouldWarnIgnored) {
|
||||||
results.push(createIgnoreResult(resolvedFilename, cwd));
|
results.push(createIgnoreResult(resolvedFilename, cwd));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
2
node_modules/eslint/lib/linter/apply-disable-directives.js
generated
vendored
2
node_modules/eslint/lib/linter/apply-disable-directives.js
generated
vendored
|
|
@ -87,7 +87,7 @@ function createIndividualDirectivesRemoval(directives, commentToken) {
|
||||||
return directives.map(directive => {
|
return directives.map(directive => {
|
||||||
const { ruleId } = directive;
|
const { ruleId } = directive;
|
||||||
|
|
||||||
const regex = new RegExp(String.raw`(?:^|\s*,\s*)${escapeRegExp(ruleId)}(?:\s*,\s*|$)`, "u");
|
const regex = new RegExp(String.raw`(?:^|\s*,\s*)(?<quote>['"]?)${escapeRegExp(ruleId)}\k<quote>(?:\s*,\s*|$)`, "u");
|
||||||
const match = regex.exec(listText);
|
const match = regex.exec(listText);
|
||||||
const matchedText = match[0];
|
const matchedText = match[0];
|
||||||
const matchStartOffset = listStartOffset + match.index;
|
const matchStartOffset = listStartOffset + match.index;
|
||||||
|
|
|
||||||
1351
node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js
generated
vendored
1351
node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js
generated
vendored
File diff suppressed because it is too large
Load diff
160
node_modules/eslint/lib/linter/code-path-analysis/code-path.js
generated
vendored
160
node_modules/eslint/lib/linter/code-path-analysis/code-path.js
generated
vendored
|
|
@ -80,7 +80,9 @@ class CodePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initial code path segment.
|
* The initial code path segment. This is the segment that is at the head
|
||||||
|
* of the code path.
|
||||||
|
* This is a passthrough to the underlying `CodePathState`.
|
||||||
* @type {CodePathSegment}
|
* @type {CodePathSegment}
|
||||||
*/
|
*/
|
||||||
get initialSegment() {
|
get initialSegment() {
|
||||||
|
|
@ -88,8 +90,10 @@ class CodePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Final code path segments.
|
* Final code path segments. These are the terminal (tail) segments in the
|
||||||
* This array is a mix of `returnedSegments` and `thrownSegments`.
|
* code path, which is the combination of `returnedSegments` and `thrownSegments`.
|
||||||
|
* All segments in this array are reachable.
|
||||||
|
* This is a passthrough to the underlying `CodePathState`.
|
||||||
* @type {CodePathSegment[]}
|
* @type {CodePathSegment[]}
|
||||||
*/
|
*/
|
||||||
get finalSegments() {
|
get finalSegments() {
|
||||||
|
|
@ -97,9 +101,14 @@ class CodePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Final code path segments which is with `return` statements.
|
* Final code path segments that represent normal completion of the code path.
|
||||||
* This array contains the last path segment if it's reachable.
|
* For functions, this means both explicit `return` statements and implicit returns,
|
||||||
* Since the reachable last path returns `undefined`.
|
* such as the last reachable segment in a function that does not have an
|
||||||
|
* explicit `return` as this implicitly returns `undefined`. For scripts,
|
||||||
|
* modules, class field initializers, and class static blocks, this means
|
||||||
|
* all lines of code have been executed.
|
||||||
|
* These segments are also present in `finalSegments`.
|
||||||
|
* This is a passthrough to the underlying `CodePathState`.
|
||||||
* @type {CodePathSegment[]}
|
* @type {CodePathSegment[]}
|
||||||
*/
|
*/
|
||||||
get returnedSegments() {
|
get returnedSegments() {
|
||||||
|
|
@ -107,7 +116,9 @@ class CodePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Final code path segments which is with `throw` statements.
|
* Final code path segments that represent `throw` statements.
|
||||||
|
* This is a passthrough to the underlying `CodePathState`.
|
||||||
|
* These segments are also present in `finalSegments`.
|
||||||
* @type {CodePathSegment[]}
|
* @type {CodePathSegment[]}
|
||||||
*/
|
*/
|
||||||
get thrownSegments() {
|
get thrownSegments() {
|
||||||
|
|
@ -115,7 +126,12 @@ class CodePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current code path segments.
|
* Tracks the traversal of the code path through each segment. This array
|
||||||
|
* starts empty and segments are added or removed as the code path is
|
||||||
|
* traversed. This array always ends up empty at the end of a code path
|
||||||
|
* traversal. The `CodePathState` uses this to track its progress through
|
||||||
|
* the code path.
|
||||||
|
* This is a passthrough to the underlying `CodePathState`.
|
||||||
* @type {CodePathSegment[]}
|
* @type {CodePathSegment[]}
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
|
@ -126,46 +142,70 @@ class CodePath {
|
||||||
/**
|
/**
|
||||||
* Traverses all segments in this code path.
|
* Traverses all segments in this code path.
|
||||||
*
|
*
|
||||||
* codePath.traverseSegments(function(segment, controller) {
|
* codePath.traverseSegments((segment, controller) => {
|
||||||
* // do something.
|
* // do something.
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* This method enumerates segments in order from the head.
|
* This method enumerates segments in order from the head.
|
||||||
*
|
*
|
||||||
* The `controller` object has two methods.
|
* The `controller` argument has two methods:
|
||||||
*
|
*
|
||||||
* - `controller.skip()` - Skip the following segments in this branch.
|
* - `skip()` - skips the following segments in this branch
|
||||||
* - `controller.break()` - Skip all following segments.
|
* - `break()` - skips all following segments in the traversal
|
||||||
* @param {Object} [options] Omittable.
|
*
|
||||||
* @param {CodePathSegment} [options.first] The first segment to traverse.
|
* A note on the parameters: the `options` argument is optional. This means
|
||||||
* @param {CodePathSegment} [options.last] The last segment to traverse.
|
* the first argument might be an options object or the callback function.
|
||||||
|
* @param {Object} [optionsOrCallback] Optional first and last segments to traverse.
|
||||||
|
* @param {CodePathSegment} [optionsOrCallback.first] The first segment to traverse.
|
||||||
|
* @param {CodePathSegment} [optionsOrCallback.last] The last segment to traverse.
|
||||||
* @param {Function} callback A callback function.
|
* @param {Function} callback A callback function.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
traverseSegments(options, callback) {
|
traverseSegments(optionsOrCallback, callback) {
|
||||||
|
|
||||||
|
// normalize the arguments into a callback and options
|
||||||
let resolvedOptions;
|
let resolvedOptions;
|
||||||
let resolvedCallback;
|
let resolvedCallback;
|
||||||
|
|
||||||
if (typeof options === "function") {
|
if (typeof optionsOrCallback === "function") {
|
||||||
resolvedCallback = options;
|
resolvedCallback = optionsOrCallback;
|
||||||
resolvedOptions = {};
|
resolvedOptions = {};
|
||||||
} else {
|
} else {
|
||||||
resolvedOptions = options || {};
|
resolvedOptions = optionsOrCallback || {};
|
||||||
resolvedCallback = callback;
|
resolvedCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine where to start traversing from based on the options
|
||||||
const startSegment = resolvedOptions.first || this.internal.initialSegment;
|
const startSegment = resolvedOptions.first || this.internal.initialSegment;
|
||||||
const lastSegment = resolvedOptions.last;
|
const lastSegment = resolvedOptions.last;
|
||||||
|
|
||||||
let item = null;
|
// set up initial location information
|
||||||
|
let record = null;
|
||||||
let index = 0;
|
let index = 0;
|
||||||
let end = 0;
|
let end = 0;
|
||||||
let segment = null;
|
let segment = null;
|
||||||
const visited = Object.create(null);
|
|
||||||
|
// segments that have already been visited during traversal
|
||||||
|
const visited = new Set();
|
||||||
|
|
||||||
|
// tracks the traversal steps
|
||||||
const stack = [[startSegment, 0]];
|
const stack = [[startSegment, 0]];
|
||||||
|
|
||||||
|
// tracks the last skipped segment during traversal
|
||||||
let skippedSegment = null;
|
let skippedSegment = null;
|
||||||
|
|
||||||
|
// indicates if we exited early from the traversal
|
||||||
let broken = false;
|
let broken = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maintains traversal state.
|
||||||
|
*/
|
||||||
const controller = {
|
const controller = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skip the following segments in this branch.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
skip() {
|
skip() {
|
||||||
if (stack.length <= 1) {
|
if (stack.length <= 1) {
|
||||||
broken = true;
|
broken = true;
|
||||||
|
|
@ -173,32 +213,52 @@ class CodePath {
|
||||||
skippedSegment = stack[stack.length - 2][0];
|
skippedSegment = stack[stack.length - 2][0];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop traversal completely - do not traverse to any
|
||||||
|
* other segments.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
break() {
|
break() {
|
||||||
broken = true;
|
broken = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks a given previous segment has been visited.
|
* Checks if a given previous segment has been visited.
|
||||||
* @param {CodePathSegment} prevSegment A previous segment to check.
|
* @param {CodePathSegment} prevSegment A previous segment to check.
|
||||||
* @returns {boolean} `true` if the segment has been visited.
|
* @returns {boolean} `true` if the segment has been visited.
|
||||||
*/
|
*/
|
||||||
function isVisited(prevSegment) {
|
function isVisited(prevSegment) {
|
||||||
return (
|
return (
|
||||||
visited[prevSegment.id] ||
|
visited.has(prevSegment) ||
|
||||||
segment.isLoopedPrevSegment(prevSegment)
|
segment.isLoopedPrevSegment(prevSegment)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the traversal
|
||||||
while (stack.length > 0) {
|
while (stack.length > 0) {
|
||||||
item = stack[stack.length - 1];
|
|
||||||
segment = item[0];
|
/*
|
||||||
index = item[1];
|
* This isn't a pure stack. We use the top record all the time
|
||||||
|
* but don't always pop it off. The record is popped only if
|
||||||
|
* one of the following is true:
|
||||||
|
*
|
||||||
|
* 1) We have already visited the segment.
|
||||||
|
* 2) We have not visited *all* of the previous segments.
|
||||||
|
* 3) We have traversed past the available next segments.
|
||||||
|
*
|
||||||
|
* Otherwise, we just read the value and sometimes modify the
|
||||||
|
* record as we traverse.
|
||||||
|
*/
|
||||||
|
record = stack[stack.length - 1];
|
||||||
|
segment = record[0];
|
||||||
|
index = record[1];
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
|
|
||||||
// Skip if this segment has been visited already.
|
// Skip if this segment has been visited already.
|
||||||
if (visited[segment.id]) {
|
if (visited.has(segment)) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -212,18 +272,29 @@ class CodePath {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the flag of skipping if all branches have been skipped.
|
// Reset the skipping flag if all branches have been skipped.
|
||||||
if (skippedSegment && segment.prevSegments.includes(skippedSegment)) {
|
if (skippedSegment && segment.prevSegments.includes(skippedSegment)) {
|
||||||
skippedSegment = null;
|
skippedSegment = null;
|
||||||
}
|
}
|
||||||
visited[segment.id] = true;
|
visited.add(segment);
|
||||||
|
|
||||||
// Call the callback when the first time.
|
/*
|
||||||
|
* If the most recent segment hasn't been skipped, then we call
|
||||||
|
* the callback, passing in the segment and the controller.
|
||||||
|
*/
|
||||||
if (!skippedSegment) {
|
if (!skippedSegment) {
|
||||||
resolvedCallback.call(this, segment, controller);
|
resolvedCallback.call(this, segment, controller);
|
||||||
|
|
||||||
|
// exit if we're at the last segment
|
||||||
if (segment === lastSegment) {
|
if (segment === lastSegment) {
|
||||||
controller.skip();
|
controller.skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the previous statement was executed, or if the callback
|
||||||
|
* called a method on the controller, we might need to exit the
|
||||||
|
* loop, so check for that and break accordingly.
|
||||||
|
*/
|
||||||
if (broken) {
|
if (broken) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -233,12 +304,35 @@ class CodePath {
|
||||||
// Update the stack.
|
// Update the stack.
|
||||||
end = segment.nextSegments.length - 1;
|
end = segment.nextSegments.length - 1;
|
||||||
if (index < end) {
|
if (index < end) {
|
||||||
item[1] += 1;
|
|
||||||
|
/*
|
||||||
|
* If we haven't yet visited all of the next segments, update
|
||||||
|
* the current top record on the stack to the next index to visit
|
||||||
|
* and then push a record for the current segment on top.
|
||||||
|
*
|
||||||
|
* Setting the current top record's index lets us know how many
|
||||||
|
* times we've been here and ensures that the segment won't be
|
||||||
|
* reprocessed (because we only process segments with an index
|
||||||
|
* of 0).
|
||||||
|
*/
|
||||||
|
record[1] += 1;
|
||||||
stack.push([segment.nextSegments[index], 0]);
|
stack.push([segment.nextSegments[index], 0]);
|
||||||
} else if (index === end) {
|
} else if (index === end) {
|
||||||
item[0] = segment.nextSegments[index];
|
|
||||||
item[1] = 0;
|
/*
|
||||||
|
* If we are at the last next segment, then reset the top record
|
||||||
|
* in the stack to next segment and set its index to 0 so it will
|
||||||
|
* be processed next.
|
||||||
|
*/
|
||||||
|
record[0] = segment.nextSegments[index];
|
||||||
|
record[1] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If index > end, that means we have no more segments that need
|
||||||
|
* processing. So, we pop that record off of the stack in order to
|
||||||
|
* continue traversing at the next level up.
|
||||||
|
*/
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
245
node_modules/eslint/lib/linter/code-path-analysis/fork-context.js
generated
vendored
245
node_modules/eslint/lib/linter/code-path-analysis/fork-context.js
generated
vendored
|
|
@ -21,8 +21,8 @@ const assert = require("assert"),
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether or not a given segment is reachable.
|
* Determines whether or not a given segment is reachable.
|
||||||
* @param {CodePathSegment} segment A segment to get.
|
* @param {CodePathSegment} segment The segment to check.
|
||||||
* @returns {boolean} `true` if the segment is reachable.
|
* @returns {boolean} `true` if the segment is reachable.
|
||||||
*/
|
*/
|
||||||
function isReachable(segment) {
|
function isReachable(segment) {
|
||||||
|
|
@ -30,32 +30,64 @@ function isReachable(segment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new segments from the specific range of `context.segmentsList`.
|
* Creates a new segment for each fork in the given context and appends it
|
||||||
|
* to the end of the specified range of segments. Ultimately, this ends up calling
|
||||||
|
* `new CodePathSegment()` for each of the forks using the `create` argument
|
||||||
|
* as a wrapper around special behavior.
|
||||||
|
*
|
||||||
|
* The `startIndex` and `endIndex` arguments specify a range of segments in
|
||||||
|
* `context` that should become `allPrevSegments` for the newly created
|
||||||
|
* `CodePathSegment` objects.
|
||||||
*
|
*
|
||||||
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
|
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
|
||||||
* `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`.
|
* `end` is `-1`, this creates two new segments, `[g, h]`. This `g` is appended to
|
||||||
* This `h` is from `b`, `d`, and `f`.
|
* the end of the path from `a`, `c`, and `e`. This `h` is appended to the end of
|
||||||
* @param {ForkContext} context An instance.
|
* `b`, `d`, and `f`.
|
||||||
* @param {number} begin The first index of the previous segments.
|
* @param {ForkContext} context An instance from which the previous segments
|
||||||
* @param {number} end The last index of the previous segments.
|
* will be obtained.
|
||||||
* @param {Function} create A factory function of new segments.
|
* @param {number} startIndex The index of the first segment in the context
|
||||||
* @returns {CodePathSegment[]} New segments.
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @param {number} endIndex The index of the last segment in the context
|
||||||
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @param {Function} create A function that creates new `CodePathSegment`
|
||||||
|
* instances in a particular way. See the `CodePathSegment.new*` methods.
|
||||||
|
* @returns {Array<CodePathSegment>} An array of the newly-created segments.
|
||||||
*/
|
*/
|
||||||
function makeSegments(context, begin, end, create) {
|
function createSegments(context, startIndex, endIndex, create) {
|
||||||
|
|
||||||
|
/** @type {Array<Array<CodePathSegment>>} */
|
||||||
const list = context.segmentsList;
|
const list = context.segmentsList;
|
||||||
|
|
||||||
const normalizedBegin = begin >= 0 ? begin : list.length + begin;
|
/*
|
||||||
const normalizedEnd = end >= 0 ? end : list.length + end;
|
* Both `startIndex` and `endIndex` work the same way: if the number is zero
|
||||||
|
* or more, then the number is used as-is. If the number is negative,
|
||||||
|
* then that number is added to the length of the segments list to
|
||||||
|
* determine the index to use. That means -1 for either argument
|
||||||
|
* is the last element, -2 is the second to last, and so on.
|
||||||
|
*
|
||||||
|
* So if `startIndex` is 0, `endIndex` is -1, and `list.length` is 3, the
|
||||||
|
* effective `startIndex` is 0 and the effective `endIndex` is 2, so this function
|
||||||
|
* will include items at indices 0, 1, and 2.
|
||||||
|
*
|
||||||
|
* Therefore, if `startIndex` is -1 and `endIndex` is -1, that means we'll only
|
||||||
|
* be using the last segment in `list`.
|
||||||
|
*/
|
||||||
|
const normalizedBegin = startIndex >= 0 ? startIndex : list.length + startIndex;
|
||||||
|
const normalizedEnd = endIndex >= 0 ? endIndex : list.length + endIndex;
|
||||||
|
|
||||||
|
/** @type {Array<CodePathSegment>} */
|
||||||
const segments = [];
|
const segments = [];
|
||||||
|
|
||||||
for (let i = 0; i < context.count; ++i) {
|
for (let i = 0; i < context.count; ++i) {
|
||||||
|
|
||||||
|
// this is passed into `new CodePathSegment` to add to code path.
|
||||||
const allPrevSegments = [];
|
const allPrevSegments = [];
|
||||||
|
|
||||||
for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
|
for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
|
||||||
allPrevSegments.push(list[j][i]);
|
allPrevSegments.push(list[j][i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// note: `create` is just a wrapper that augments `new CodePathSegment`.
|
||||||
segments.push(create(context.idGenerator.next(), allPrevSegments));
|
segments.push(create(context.idGenerator.next(), allPrevSegments));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,28 +95,57 @@ function makeSegments(context, begin, end, create) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `segments` becomes doubly in a `finally` block. Then if a code path exits by a
|
* Inside of a `finally` block we end up with two parallel paths. If the code path
|
||||||
* control statement (such as `break`, `continue`) from the `finally` block, the
|
* exits by a control statement (such as `break` or `continue`) from the `finally`
|
||||||
* destination's segments may be half of the source segments. In that case, this
|
* block, then we need to merge the remaining parallel paths back into one.
|
||||||
* merges segments.
|
* @param {ForkContext} context The fork context to work on.
|
||||||
* @param {ForkContext} context An instance.
|
* @param {Array<CodePathSegment>} segments Segments to merge.
|
||||||
* @param {CodePathSegment[]} segments Segments to merge.
|
* @returns {Array<CodePathSegment>} The merged segments.
|
||||||
* @returns {CodePathSegment[]} The merged segments.
|
|
||||||
*/
|
*/
|
||||||
function mergeExtraSegments(context, segments) {
|
function mergeExtraSegments(context, segments) {
|
||||||
let currentSegments = segments;
|
let currentSegments = segments;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to ensure that the array returned from this function contains no more
|
||||||
|
* than the number of segments that the context allows. `context.count` indicates
|
||||||
|
* how many items should be in the returned array to ensure that the new segment
|
||||||
|
* entries will line up with the already existing segment entries.
|
||||||
|
*/
|
||||||
while (currentSegments.length > context.count) {
|
while (currentSegments.length > context.count) {
|
||||||
const merged = [];
|
const merged = [];
|
||||||
|
|
||||||
for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) {
|
/*
|
||||||
|
* Because `context.count` is a factor of 2 inside of a `finally` block,
|
||||||
|
* we can divide the segment count by 2 to merge the paths together.
|
||||||
|
* This loops through each segment in the list and creates a new `CodePathSegment`
|
||||||
|
* that has the segment and the segment two slots away as previous segments.
|
||||||
|
*
|
||||||
|
* If `currentSegments` is [a,b,c,d], this will create new segments e and f, such
|
||||||
|
* that:
|
||||||
|
*
|
||||||
|
* When `i` is 0:
|
||||||
|
* a->e
|
||||||
|
* c->e
|
||||||
|
*
|
||||||
|
* When `i` is 1:
|
||||||
|
* b->f
|
||||||
|
* d->f
|
||||||
|
*/
|
||||||
|
for (let i = 0, length = Math.floor(currentSegments.length / 2); i < length; ++i) {
|
||||||
merged.push(CodePathSegment.newNext(
|
merged.push(CodePathSegment.newNext(
|
||||||
context.idGenerator.next(),
|
context.idGenerator.next(),
|
||||||
[currentSegments[i], currentSegments[i + length]]
|
[currentSegments[i], currentSegments[i + length]]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go through the loop condition one more time to see if we have the
|
||||||
|
* number of segments for the context. If not, we'll keep merging paths
|
||||||
|
* of the merged segments until we get there.
|
||||||
|
*/
|
||||||
currentSegments = merged;
|
currentSegments = merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentSegments;
|
return currentSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,25 +154,55 @@ function mergeExtraSegments(context, segments) {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class to manage forking.
|
* Manages the forking of code paths.
|
||||||
*/
|
*/
|
||||||
class ForkContext {
|
class ForkContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates a new instance.
|
||||||
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
||||||
* @param {ForkContext|null} upper An upper fork context.
|
* @param {ForkContext|null} upper The preceding fork context.
|
||||||
* @param {number} count A number of parallel segments.
|
* @param {number} count The number of parallel segments in each element
|
||||||
|
* of `segmentsList`.
|
||||||
*/
|
*/
|
||||||
constructor(idGenerator, upper, count) {
|
constructor(idGenerator, upper, count) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID generator that will generate segment IDs for any new
|
||||||
|
* segments that are created.
|
||||||
|
* @type {IdGenerator}
|
||||||
|
*/
|
||||||
this.idGenerator = idGenerator;
|
this.idGenerator = idGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preceding fork context.
|
||||||
|
* @type {ForkContext|null}
|
||||||
|
*/
|
||||||
this.upper = upper;
|
this.upper = upper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of elements in each element of `segmentsList`. In most
|
||||||
|
* cases, this is 1 but can be 2 when there is a `finally` present,
|
||||||
|
* which forks the code path outside of normal flow. In the case of nested
|
||||||
|
* `finally` blocks, this can be a multiple of 2.
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
this.count = count;
|
this.count = count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The segments within this context. Each element in this array has
|
||||||
|
* `count` elements that represent one step in each fork. For example,
|
||||||
|
* when `segmentsList` is `[[a, b], [c, d], [e, f]]`, there is one path
|
||||||
|
* a->c->e and one path b->d->f, and `count` is 2 because each element
|
||||||
|
* is an array with two elements.
|
||||||
|
* @type {Array<Array<CodePathSegment>>}
|
||||||
|
*/
|
||||||
this.segmentsList = [];
|
this.segmentsList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The head segments.
|
* The segments that begin this fork context.
|
||||||
* @type {CodePathSegment[]}
|
* @type {Array<CodePathSegment>}
|
||||||
*/
|
*/
|
||||||
get head() {
|
get head() {
|
||||||
const list = this.segmentsList;
|
const list = this.segmentsList;
|
||||||
|
|
@ -120,7 +211,7 @@ class ForkContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag which shows empty.
|
* Indicates if the context contains no segments.
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get empty() {
|
get empty() {
|
||||||
|
|
@ -128,7 +219,7 @@ class ForkContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag which shows reachable.
|
* Indicates if there are any segments that are reachable.
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get reachable() {
|
get reachable() {
|
||||||
|
|
@ -138,75 +229,82 @@ class ForkContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new segments from this context.
|
* Creates new segments in this context and appends them to the end of the
|
||||||
* @param {number} begin The first index of previous segments.
|
* already existing `CodePathSegment`s specified by `startIndex` and
|
||||||
* @param {number} end The last index of previous segments.
|
* `endIndex`.
|
||||||
* @returns {CodePathSegment[]} New segments.
|
* @param {number} startIndex The index of the first segment in the context
|
||||||
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @param {number} endIndex The index of the last segment in the context
|
||||||
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||||
*/
|
*/
|
||||||
makeNext(begin, end) {
|
makeNext(startIndex, endIndex) {
|
||||||
return makeSegments(this, begin, end, CodePathSegment.newNext);
|
return createSegments(this, startIndex, endIndex, CodePathSegment.newNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new segments from this context.
|
* Creates new unreachable segments in this context and appends them to the end of the
|
||||||
* The new segments is always unreachable.
|
* already existing `CodePathSegment`s specified by `startIndex` and
|
||||||
* @param {number} begin The first index of previous segments.
|
* `endIndex`.
|
||||||
* @param {number} end The last index of previous segments.
|
* @param {number} startIndex The index of the first segment in the context
|
||||||
* @returns {CodePathSegment[]} New segments.
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @param {number} endIndex The index of the last segment in the context
|
||||||
|
* that should be specified as previous segments for the newly created segments.
|
||||||
|
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||||
*/
|
*/
|
||||||
makeUnreachable(begin, end) {
|
makeUnreachable(startIndex, endIndex) {
|
||||||
return makeSegments(this, begin, end, CodePathSegment.newUnreachable);
|
return createSegments(this, startIndex, endIndex, CodePathSegment.newUnreachable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new segments from this context.
|
* Creates new segments in this context and does not append them to the end
|
||||||
* The new segments don't have connections for previous segments.
|
* of the already existing `CodePathSegment`s specified by `startIndex` and
|
||||||
* But these inherit the reachable flag from this context.
|
* `endIndex`. The `startIndex` and `endIndex` are only used to determine if
|
||||||
* @param {number} begin The first index of previous segments.
|
* the new segments should be reachable. If any of the segments in this range
|
||||||
* @param {number} end The last index of previous segments.
|
* are reachable then the new segments are also reachable; otherwise, the new
|
||||||
* @returns {CodePathSegment[]} New segments.
|
* segments are unreachable.
|
||||||
|
* @param {number} startIndex The index of the first segment in the context
|
||||||
|
* that should be considered for reachability.
|
||||||
|
* @param {number} endIndex The index of the last segment in the context
|
||||||
|
* that should be considered for reachability.
|
||||||
|
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||||
*/
|
*/
|
||||||
makeDisconnected(begin, end) {
|
makeDisconnected(startIndex, endIndex) {
|
||||||
return makeSegments(this, begin, end, CodePathSegment.newDisconnected);
|
return createSegments(this, startIndex, endIndex, CodePathSegment.newDisconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds segments into this context.
|
* Adds segments to the head of this context.
|
||||||
* The added segments become the head.
|
* @param {Array<CodePathSegment>} segments The segments to add.
|
||||||
* @param {CodePathSegment[]} segments Segments to add.
|
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
add(segments) {
|
add(segments) {
|
||||||
assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
|
assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
|
||||||
|
|
||||||
this.segmentsList.push(mergeExtraSegments(this, segments));
|
this.segmentsList.push(mergeExtraSegments(this, segments));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces the head segments with given segments.
|
* Replaces the head segments with the given segments.
|
||||||
* The current head segments are removed.
|
* The current head segments are removed.
|
||||||
* @param {CodePathSegment[]} segments Segments to add.
|
* @param {Array<CodePathSegment>} replacementHeadSegments The new head segments.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
replaceHead(segments) {
|
replaceHead(replacementHeadSegments) {
|
||||||
assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
|
assert(
|
||||||
|
replacementHeadSegments.length >= this.count,
|
||||||
this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments));
|
`${replacementHeadSegments.length} >= ${this.count}`
|
||||||
|
);
|
||||||
|
this.segmentsList.splice(-1, 1, mergeExtraSegments(this, replacementHeadSegments));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds all segments of a given fork context into this context.
|
* Adds all segments of a given fork context into this context.
|
||||||
* @param {ForkContext} context A fork context to add.
|
* @param {ForkContext} otherForkContext The fork context to add from.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
addAll(context) {
|
addAll(otherForkContext) {
|
||||||
assert(context.count === this.count);
|
assert(otherForkContext.count === this.count);
|
||||||
|
this.segmentsList.push(...otherForkContext.segmentsList);
|
||||||
const source = context.segmentsList;
|
|
||||||
|
|
||||||
for (let i = 0; i < source.length; ++i) {
|
|
||||||
this.segmentsList.push(source[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -218,7 +316,8 @@ class ForkContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the root fork context.
|
* Creates a new root context, meaning that there are no parent
|
||||||
|
* fork contexts.
|
||||||
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
||||||
* @returns {ForkContext} New fork context.
|
* @returns {ForkContext} New fork context.
|
||||||
*/
|
*/
|
||||||
|
|
@ -233,14 +332,16 @@ class ForkContext {
|
||||||
/**
|
/**
|
||||||
* Creates an empty fork context preceded by a given context.
|
* Creates an empty fork context preceded by a given context.
|
||||||
* @param {ForkContext} parentContext The parent fork context.
|
* @param {ForkContext} parentContext The parent fork context.
|
||||||
* @param {boolean} forkLeavingPath A flag which shows inside of `finally` block.
|
* @param {boolean} shouldForkLeavingPath Indicates that we are inside of
|
||||||
|
* a `finally` block and should therefore fork the path that leaves
|
||||||
|
* `finally`.
|
||||||
* @returns {ForkContext} New fork context.
|
* @returns {ForkContext} New fork context.
|
||||||
*/
|
*/
|
||||||
static newEmpty(parentContext, forkLeavingPath) {
|
static newEmpty(parentContext, shouldForkLeavingPath) {
|
||||||
return new ForkContext(
|
return new ForkContext(
|
||||||
parentContext.idGenerator,
|
parentContext.idGenerator,
|
||||||
parentContext,
|
parentContext,
|
||||||
(forkLeavingPath ? 2 : 1) * parentContext.count
|
(shouldForkLeavingPath ? 2 : 1) * parentContext.count
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
2
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
|
|
@ -139,7 +139,7 @@ module.exports = class ConfigCommentParser {
|
||||||
const items = {};
|
const items = {};
|
||||||
|
|
||||||
string.split(",").forEach(name => {
|
string.split(",").forEach(name => {
|
||||||
const trimmedName = name.trim();
|
const trimmedName = name.trim().replace(/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/us, "$<ruleId>");
|
||||||
|
|
||||||
if (trimmedName) {
|
if (trimmedName) {
|
||||||
items[trimmedName] = true;
|
items[trimmedName] = true;
|
||||||
|
|
|
||||||
13
node_modules/eslint/lib/options.js
generated
vendored
13
node_modules/eslint/lib/options.js
generated
vendored
|
|
@ -55,6 +55,7 @@ const optionator = require("optionator");
|
||||||
* @property {string} [stdinFilename] Specify filename to process STDIN as
|
* @property {string} [stdinFilename] Specify filename to process STDIN as
|
||||||
* @property {boolean} quiet Report errors only
|
* @property {boolean} quiet Report errors only
|
||||||
* @property {boolean} [version] Output the version number
|
* @property {boolean} [version] Output the version number
|
||||||
|
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||||
* @property {string[]} _ Positional filenames or patterns
|
* @property {string[]} _ Positional filenames or patterns
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -139,6 +140,17 @@ module.exports = function(usingFlatConfig) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let warnIgnoredFlag;
|
||||||
|
|
||||||
|
if (usingFlatConfig) {
|
||||||
|
warnIgnoredFlag = {
|
||||||
|
option: "warn-ignored",
|
||||||
|
type: "Boolean",
|
||||||
|
default: "true",
|
||||||
|
description: "Suppress warnings when the file list includes ignored files"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return optionator({
|
return optionator({
|
||||||
prepend: "eslint [options] file.js [file.js] [dir]",
|
prepend: "eslint [options] file.js [file.js] [dir]",
|
||||||
defaults: {
|
defaults: {
|
||||||
|
|
@ -349,6 +361,7 @@ module.exports = function(usingFlatConfig) {
|
||||||
default: "false",
|
default: "false",
|
||||||
description: "Exit with exit code 2 in case of fatal error"
|
description: "Exit with exit code 2 in case of fatal error"
|
||||||
},
|
},
|
||||||
|
warnIgnoredFlag,
|
||||||
{
|
{
|
||||||
option: "debug",
|
option: "debug",
|
||||||
type: "Boolean",
|
type: "Boolean",
|
||||||
|
|
|
||||||
34
node_modules/eslint/lib/rules/logical-assignment-operators.js
generated
vendored
34
node_modules/eslint/lib/rules/logical-assignment-operators.js
generated
vendored
|
|
@ -150,6 +150,31 @@ function isInsideWithBlock(node) {
|
||||||
return node.parent.type === "WithStatement" && node.parent.body === node ? true : isInsideWithBlock(node.parent);
|
return node.parent.type === "WithStatement" && node.parent.body === node ? true : isInsideWithBlock(node.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the leftmost operand of a consecutive logical expression.
|
||||||
|
* @param {SourceCode} sourceCode The ESLint source code object
|
||||||
|
* @param {LogicalExpression} node LogicalExpression
|
||||||
|
* @returns {Expression} Leftmost operand
|
||||||
|
*/
|
||||||
|
function getLeftmostOperand(sourceCode, node) {
|
||||||
|
let left = node.left;
|
||||||
|
|
||||||
|
while (left.type === "LogicalExpression" && left.operator === node.operator) {
|
||||||
|
|
||||||
|
if (astUtils.isParenthesised(sourceCode, left)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It should have associativity,
|
||||||
|
* but ignore it if use parentheses to make the evaluation order clear.
|
||||||
|
*/
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
left = left.left;
|
||||||
|
}
|
||||||
|
return left;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Rule Definition
|
// Rule Definition
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -318,7 +343,10 @@ module.exports = {
|
||||||
|
|
||||||
// foo = foo || bar
|
// foo = foo || bar
|
||||||
"AssignmentExpression[operator='='][right.type='LogicalExpression']"(assignment) {
|
"AssignmentExpression[operator='='][right.type='LogicalExpression']"(assignment) {
|
||||||
if (!astUtils.isSameReference(assignment.left, assignment.right.left)) {
|
const leftOperand = getLeftmostOperand(sourceCode, assignment.right);
|
||||||
|
|
||||||
|
if (!astUtils.isSameReference(assignment.left, leftOperand)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,10 +370,10 @@ module.exports = {
|
||||||
yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator);
|
yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator);
|
||||||
|
|
||||||
// -> foo ||= bar
|
// -> foo ||= bar
|
||||||
const logicalOperatorToken = getOperatorToken(assignment.right);
|
const logicalOperatorToken = getOperatorToken(leftOperand.parent);
|
||||||
const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken);
|
const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken);
|
||||||
|
|
||||||
yield ruleFixer.removeRange([assignment.right.range[0], firstRightOperandToken.range[0]]);
|
yield ruleFixer.removeRange([leftOperand.parent.range[0], firstRightOperandToken.range[0]]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
4
node_modules/eslint/package.json
generated
vendored
4
node_modules/eslint/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "eslint",
|
"name": "eslint",
|
||||||
"version": "8.50.0",
|
"version": "8.51.0",
|
||||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||||
"description": "An AST-based pattern checker for JavaScript.",
|
"description": "An AST-based pattern checker for JavaScript.",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
"@eslint/eslintrc": "^2.1.2",
|
"@eslint/eslintrc": "^2.1.2",
|
||||||
"@eslint/js": "8.50.0",
|
"@eslint/js": "8.51.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.11",
|
"@humanwhocodes/config-array": "^0.11.11",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
|
|
|
||||||
18
node_modules/sinon/CONTRIBUTING.md
generated
vendored
18
node_modules/sinon/CONTRIBUTING.md
generated
vendored
|
|
@ -104,6 +104,22 @@ $ npm run prettier:write
|
||||||
|
|
||||||
To ensure consistent reporting of lint warnings, you should use the same versions of ESLint and Prettier as defined in `package.json` (which is what the CI servers use).
|
To ensure consistent reporting of lint warnings, you should use the same versions of ESLint and Prettier as defined in `package.json` (which is what the CI servers use).
|
||||||
|
|
||||||
|
### Tooling
|
||||||
|
|
||||||
|
To transparently handle all issues with different tool versions we recommend using [_ASDF: The Multiple Runtime Manager_][asdf]. You would then need the Ruby and Node plugins.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
```
|
||||||
|
asdf plugin add ruby
|
||||||
|
asdf plugin add nodejs
|
||||||
|
asdf install
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
[asdf]: https://asdf-vm.com
|
||||||
|
|
||||||
### Run the tests
|
### Run the tests
|
||||||
|
|
||||||
Following command runs unit tests in PhantomJS, Node and WebWorker
|
Following command runs unit tests in PhantomJS, Node and WebWorker
|
||||||
|
|
@ -133,4 +149,4 @@ Build requires Node. Under the hood [Browserify](http://browserify.org/) is used
|
||||||
|
|
||||||
To build run
|
To build run
|
||||||
|
|
||||||
$ node build.js
|
$ node build.cjs
|
||||||
|
|
|
||||||
112
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
112
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
|
|
@ -35,6 +35,40 @@ function applyOnEach(fakes, method) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function throwOnAccessors(descriptor) {
|
||||||
|
if (typeof descriptor.get === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof descriptor.set === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifySameType(object, property, replacement) {
|
||||||
|
if (typeof object[property] !== typeof replacement) {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace ${typeof object[
|
||||||
|
property
|
||||||
|
]} with ${typeof replacement}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForValidArguments(descriptor, property, replacement) {
|
||||||
|
if (typeof descriptor === "undefined") {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace non-existent property ${valueToString(
|
||||||
|
property
|
||||||
|
)}. Perhaps you meant sandbox.define()?`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof replacement === "undefined") {
|
||||||
|
throw new TypeError("Expected replacement argument to be defined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Sandbox() {
|
function Sandbox() {
|
||||||
const sandbox = this;
|
const sandbox = this;
|
||||||
let fakeRestorers = [];
|
let fakeRestorers = [];
|
||||||
|
|
@ -66,11 +100,6 @@ function Sandbox() {
|
||||||
return collection;
|
return collection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is for testing only
|
|
||||||
sandbox.getRestorers = function () {
|
|
||||||
return fakeRestorers;
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.createStubInstance = function createStubInstance() {
|
sandbox.createStubInstance = function createStubInstance() {
|
||||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||||
|
|
||||||
|
|
@ -196,11 +225,22 @@ function Sandbox() {
|
||||||
sandbox.injectedKeys.length = 0;
|
sandbox.injectedKeys.length = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getFakeRestorer(object, property) {
|
/**
|
||||||
|
* Creates a restorer function for the property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {boolean} forceAssignment
|
||||||
|
* @returns {Function} restorer function
|
||||||
|
*/
|
||||||
|
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
const value = object[property];
|
||||||
|
|
||||||
function restorer() {
|
function restorer() {
|
||||||
if (descriptor?.isOwn) {
|
if (forceAssignment) {
|
||||||
|
object[property] = value;
|
||||||
|
} else if (descriptor?.isOwn) {
|
||||||
Object.defineProperty(object, property, descriptor);
|
Object.defineProperty(object, property, descriptor);
|
||||||
} else {
|
} else {
|
||||||
delete object[property];
|
delete object[property];
|
||||||
|
|
@ -225,36 +265,19 @@ function Sandbox() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace an existing property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {*} replacement a fake, stub, spy or any other value
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
sandbox.replace = function replace(object, property, replacement) {
|
sandbox.replace = function replace(object, property, replacement) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
if (typeof descriptor === "undefined") {
|
throwOnAccessors(descriptor);
|
||||||
throw new TypeError(
|
verifySameType(object, property, replacement);
|
||||||
`Cannot replace non-existent property ${valueToString(
|
|
||||||
property
|
|
||||||
)}. Perhaps you meant sandbox.define()?`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof replacement === "undefined") {
|
|
||||||
throw new TypeError("Expected replacement argument to be defined");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.get === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.set === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof object[property] !== typeof replacement) {
|
|
||||||
throw new TypeError(
|
|
||||||
`Cannot replace ${typeof object[
|
|
||||||
property
|
|
||||||
]} with ${typeof replacement}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
verifyNotReplaced(object, property);
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
|
@ -266,6 +289,25 @@ function Sandbox() {
|
||||||
return replacement;
|
return replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||||
|
object,
|
||||||
|
property,
|
||||||
|
replacement
|
||||||
|
) {
|
||||||
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
|
verifySameType(object, property, replacement);
|
||||||
|
|
||||||
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
// store a function for restoring the replaced property
|
||||||
|
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||||
|
|
||||||
|
object[property] = replacement;
|
||||||
|
|
||||||
|
return replacement;
|
||||||
|
};
|
||||||
|
|
||||||
sandbox.define = function define(object, property, value) {
|
sandbox.define = function define(object, property, value) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
|
||||||
|
|
|
||||||
7
node_modules/sinon/package.json
generated
vendored
7
node_modules/sinon/package.json
generated
vendored
|
|
@ -15,7 +15,7 @@
|
||||||
"xhr",
|
"xhr",
|
||||||
"assert"
|
"assert"
|
||||||
],
|
],
|
||||||
"version": "16.0.0",
|
"version": "16.1.0",
|
||||||
"homepage": "https://sinonjs.org/",
|
"homepage": "https://sinonjs.org/",
|
||||||
"author": "Christian Johansen",
|
"author": "Christian Johansen",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -44,9 +44,10 @@
|
||||||
"test": "npm run test-node && npm run test-headless && npm run test-webworker",
|
"test": "npm run test-node && npm run test-headless && npm run test-webworker",
|
||||||
"check-dependencies": "dependency-check package.json --no-dev --ignore-module esm",
|
"check-dependencies": "dependency-check package.json --no-dev --ignore-module esm",
|
||||||
"build": "node ./build.cjs",
|
"build": "node ./build.cjs",
|
||||||
|
"dev-docs": "cd docs; cp -rl release-source releases/dev; npm run serve-docs",
|
||||||
"build-docs": "cd docs; bundle exec jekyll build",
|
"build-docs": "cd docs; bundle exec jekyll build",
|
||||||
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose",
|
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose --livereload",
|
||||||
"lint": "eslint --max-warnings 99 '**/*.{js,cjs,mjs}'",
|
"lint": "eslint --max-warnings 101 '**/*.{js,cjs,mjs}'",
|
||||||
"unimported": "unimported .",
|
"unimported": "unimported .",
|
||||||
"pretest-webworker": "npm run build",
|
"pretest-webworker": "npm run build",
|
||||||
"prebuild": "rimraf pkg && npm run check-dependencies",
|
"prebuild": "rimraf pkg && npm run check-dependencies",
|
||||||
|
|
|
||||||
116
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
116
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
/* Sinon.JS 16.0.0, 2023-09-13, @license BSD-3 */let sinon;(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
/* Sinon.JS 16.1.0, 2023-10-05, @license BSD-3 */let sinon;(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
sinon = require("./sinon");
|
sinon = require("./sinon");
|
||||||
|
|
@ -2898,6 +2898,40 @@ function applyOnEach(fakes, method) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function throwOnAccessors(descriptor) {
|
||||||
|
if (typeof descriptor.get === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof descriptor.set === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifySameType(object, property, replacement) {
|
||||||
|
if (typeof object[property] !== typeof replacement) {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace ${typeof object[
|
||||||
|
property
|
||||||
|
]} with ${typeof replacement}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForValidArguments(descriptor, property, replacement) {
|
||||||
|
if (typeof descriptor === "undefined") {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace non-existent property ${valueToString(
|
||||||
|
property
|
||||||
|
)}. Perhaps you meant sandbox.define()?`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof replacement === "undefined") {
|
||||||
|
throw new TypeError("Expected replacement argument to be defined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Sandbox() {
|
function Sandbox() {
|
||||||
const sandbox = this;
|
const sandbox = this;
|
||||||
let fakeRestorers = [];
|
let fakeRestorers = [];
|
||||||
|
|
@ -2929,11 +2963,6 @@ function Sandbox() {
|
||||||
return collection;
|
return collection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is for testing only
|
|
||||||
sandbox.getRestorers = function () {
|
|
||||||
return fakeRestorers;
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.createStubInstance = function createStubInstance() {
|
sandbox.createStubInstance = function createStubInstance() {
|
||||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||||
|
|
||||||
|
|
@ -3059,11 +3088,22 @@ function Sandbox() {
|
||||||
sandbox.injectedKeys.length = 0;
|
sandbox.injectedKeys.length = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getFakeRestorer(object, property) {
|
/**
|
||||||
|
* Creates a restorer function for the property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {boolean} forceAssignment
|
||||||
|
* @returns {Function} restorer function
|
||||||
|
*/
|
||||||
|
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
const value = object[property];
|
||||||
|
|
||||||
function restorer() {
|
function restorer() {
|
||||||
if (descriptor?.isOwn) {
|
if (forceAssignment) {
|
||||||
|
object[property] = value;
|
||||||
|
} else if (descriptor?.isOwn) {
|
||||||
Object.defineProperty(object, property, descriptor);
|
Object.defineProperty(object, property, descriptor);
|
||||||
} else {
|
} else {
|
||||||
delete object[property];
|
delete object[property];
|
||||||
|
|
@ -3088,36 +3128,19 @@ function Sandbox() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace an existing property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {*} replacement a fake, stub, spy or any other value
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
sandbox.replace = function replace(object, property, replacement) {
|
sandbox.replace = function replace(object, property, replacement) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
if (typeof descriptor === "undefined") {
|
throwOnAccessors(descriptor);
|
||||||
throw new TypeError(
|
verifySameType(object, property, replacement);
|
||||||
`Cannot replace non-existent property ${valueToString(
|
|
||||||
property
|
|
||||||
)}. Perhaps you meant sandbox.define()?`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof replacement === "undefined") {
|
|
||||||
throw new TypeError("Expected replacement argument to be defined");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.get === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.set === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof object[property] !== typeof replacement) {
|
|
||||||
throw new TypeError(
|
|
||||||
`Cannot replace ${typeof object[
|
|
||||||
property
|
|
||||||
]} with ${typeof replacement}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
verifyNotReplaced(object, property);
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
|
@ -3129,6 +3152,25 @@ function Sandbox() {
|
||||||
return replacement;
|
return replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||||
|
object,
|
||||||
|
property,
|
||||||
|
replacement
|
||||||
|
) {
|
||||||
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
|
verifySameType(object, property, replacement);
|
||||||
|
|
||||||
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
// store a function for restoring the replaced property
|
||||||
|
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||||
|
|
||||||
|
object[property] = replacement;
|
||||||
|
|
||||||
|
return replacement;
|
||||||
|
};
|
||||||
|
|
||||||
sandbox.define = function define(object, property, value) {
|
sandbox.define = function define(object, property, value) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
|
||||||
|
|
@ -17797,8 +17839,6 @@ const _serverPrototype = sinon.serverPrototype;
|
||||||
export { _serverPrototype as serverPrototype };
|
export { _serverPrototype as serverPrototype };
|
||||||
const _getFakes = sinon.getFakes;
|
const _getFakes = sinon.getFakes;
|
||||||
export { _getFakes as getFakes };
|
export { _getFakes as getFakes };
|
||||||
const _getRestorers = sinon.getRestorers;
|
|
||||||
export { _getRestorers as getRestorers };
|
|
||||||
const _createStubInstance = sinon.createStubInstance;
|
const _createStubInstance = sinon.createStubInstance;
|
||||||
export { _createStubInstance as createStubInstance };
|
export { _createStubInstance as createStubInstance };
|
||||||
const _inject = sinon.inject;
|
const _inject = sinon.inject;
|
||||||
|
|
|
||||||
114
node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
114
node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
/* Sinon.JS 16.0.0, 2023-09-13, @license BSD-3 */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.sinon = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
/* Sinon.JS 16.1.0, 2023-10-05, @license BSD-3 */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.sinon = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const behavior = require("./sinon/behavior");
|
const behavior = require("./sinon/behavior");
|
||||||
|
|
@ -2893,6 +2893,40 @@ function applyOnEach(fakes, method) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function throwOnAccessors(descriptor) {
|
||||||
|
if (typeof descriptor.get === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof descriptor.set === "function") {
|
||||||
|
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifySameType(object, property, replacement) {
|
||||||
|
if (typeof object[property] !== typeof replacement) {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace ${typeof object[
|
||||||
|
property
|
||||||
|
]} with ${typeof replacement}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForValidArguments(descriptor, property, replacement) {
|
||||||
|
if (typeof descriptor === "undefined") {
|
||||||
|
throw new TypeError(
|
||||||
|
`Cannot replace non-existent property ${valueToString(
|
||||||
|
property
|
||||||
|
)}. Perhaps you meant sandbox.define()?`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof replacement === "undefined") {
|
||||||
|
throw new TypeError("Expected replacement argument to be defined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Sandbox() {
|
function Sandbox() {
|
||||||
const sandbox = this;
|
const sandbox = this;
|
||||||
let fakeRestorers = [];
|
let fakeRestorers = [];
|
||||||
|
|
@ -2924,11 +2958,6 @@ function Sandbox() {
|
||||||
return collection;
|
return collection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is for testing only
|
|
||||||
sandbox.getRestorers = function () {
|
|
||||||
return fakeRestorers;
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.createStubInstance = function createStubInstance() {
|
sandbox.createStubInstance = function createStubInstance() {
|
||||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||||
|
|
||||||
|
|
@ -3054,11 +3083,22 @@ function Sandbox() {
|
||||||
sandbox.injectedKeys.length = 0;
|
sandbox.injectedKeys.length = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getFakeRestorer(object, property) {
|
/**
|
||||||
|
* Creates a restorer function for the property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {boolean} forceAssignment
|
||||||
|
* @returns {Function} restorer function
|
||||||
|
*/
|
||||||
|
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
const value = object[property];
|
||||||
|
|
||||||
function restorer() {
|
function restorer() {
|
||||||
if (descriptor?.isOwn) {
|
if (forceAssignment) {
|
||||||
|
object[property] = value;
|
||||||
|
} else if (descriptor?.isOwn) {
|
||||||
Object.defineProperty(object, property, descriptor);
|
Object.defineProperty(object, property, descriptor);
|
||||||
} else {
|
} else {
|
||||||
delete object[property];
|
delete object[property];
|
||||||
|
|
@ -3083,36 +3123,19 @@ function Sandbox() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace an existing property
|
||||||
|
*
|
||||||
|
* @param {object|Function} object
|
||||||
|
* @param {string} property
|
||||||
|
* @param {*} replacement a fake, stub, spy or any other value
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
sandbox.replace = function replace(object, property, replacement) {
|
sandbox.replace = function replace(object, property, replacement) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
if (typeof descriptor === "undefined") {
|
throwOnAccessors(descriptor);
|
||||||
throw new TypeError(
|
verifySameType(object, property, replacement);
|
||||||
`Cannot replace non-existent property ${valueToString(
|
|
||||||
property
|
|
||||||
)}. Perhaps you meant sandbox.define()?`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof replacement === "undefined") {
|
|
||||||
throw new TypeError("Expected replacement argument to be defined");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.get === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof descriptor.set === "function") {
|
|
||||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof object[property] !== typeof replacement) {
|
|
||||||
throw new TypeError(
|
|
||||||
`Cannot replace ${typeof object[
|
|
||||||
property
|
|
||||||
]} with ${typeof replacement}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
verifyNotReplaced(object, property);
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
|
@ -3124,6 +3147,25 @@ function Sandbox() {
|
||||||
return replacement;
|
return replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||||
|
object,
|
||||||
|
property,
|
||||||
|
replacement
|
||||||
|
) {
|
||||||
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
checkForValidArguments(descriptor, property, replacement);
|
||||||
|
verifySameType(object, property, replacement);
|
||||||
|
|
||||||
|
verifyNotReplaced(object, property);
|
||||||
|
|
||||||
|
// store a function for restoring the replaced property
|
||||||
|
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||||
|
|
||||||
|
object[property] = replacement;
|
||||||
|
|
||||||
|
return replacement;
|
||||||
|
};
|
||||||
|
|
||||||
sandbox.define = function define(object, property, value) {
|
sandbox.define = function define(object, property, value) {
|
||||||
const descriptor = getPropertyDescriptor(object, property);
|
const descriptor = getPropertyDescriptor(object, property);
|
||||||
|
|
||||||
|
|
|
||||||
116
node_modules/sinon/pkg/sinon.js
generated
vendored
116
node_modules/sinon/pkg/sinon.js
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue