chore: update eslint to sort out imports (#1655)

* chore: update eslint to sort out imports

* turn warnings into errrors
This commit is contained in:
Andrew Tatomyr
2024-08-12 10:18:29 +03:00
committed by GitHub
parent 47aa04e97b
commit d0fc69c2bb
131 changed files with 916 additions and 355 deletions

View File

@@ -12,6 +12,7 @@ parserOptions:
sourceType: module
plugins:
- '@typescript-eslint'
- import
rules:
'@typescript-eslint/no-unused-vars':
- error
@@ -20,10 +21,20 @@ rules:
'@typescript-eslint/no-var-requires': off
'@typescript-eslint/no-empty-function': off
'@typescript-eslint/no-inferrable-types': off
'@typescript-eslint/ban-types': warn
'@typescript-eslint/ban-types': error
'@typescript-eslint/no-explicit-any': warn # TODO: make it error!
no-prototype-builtins: off
no-useless-escape: warn
no-useless-escape: error
'@typescript-eslint/consistent-type-imports':
- error
- prefer: type-imports
import/order:
- error
- groups:
- ['builtin', 'external', 'parent', 'sibling', 'index', 'object']
- [type]
'newlines-between': 'always'
import/no-duplicates: error
ignorePatterns:
- '**/__tests__/'
- 'packages/*/lib/'

View File

@@ -24,7 +24,8 @@
"cli-1.15": "npm:@redocly/cli@1.15.0",
"cli-1.16": "npm:@redocly/cli@1.16.0",
"cli-1.17": "npm:@redocly/cli@1.17.1",
"cli-1.18": "npm:@redocly/cli@1.18.0",
"cli-1.18": "npm:@redocly/cli@1.18.1",
"cli-1.19": "npm:@redocly/cli@1.19.0",
"cli-next": "file:../redocly-cli.tgz"
}
}

View File

@@ -13,8 +13,8 @@ module.exports = {
coverageThreshold: {
'packages/core/': {
statements: 80,
branches: 71,
functions: 73,
branches: 72,
functions: 74,
lines: 80,
},
'packages/cli/': {

542
package-lock.json generated
View File

@@ -20,6 +20,7 @@
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.22.0",
"eslint-plugin-import": "^2.29.1",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.7.0",
"json-schema-to-ts": "^3.0.0",
@@ -3743,6 +3744,12 @@
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz",
"integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw=="
},
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
"node_modules/@types/lodash": {
"version": "4.14.184",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.184.tgz",
@@ -4495,6 +4502,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array-includes": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz",
"integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0",
"get-intrinsic": "^1.2.4",
"is-string": "^1.0.7"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
@@ -4524,14 +4551,52 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array.prototype.findlastindex": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz",
"integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"es-shim-unscopables": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array.prototype.flat": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz",
"integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz",
"integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==",
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4",
"define-properties": "^1.2.0",
"es-abstract": "^1.22.1",
"es-shim-unscopables": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array.prototype.flatmap": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz",
"integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.2.0",
"es-abstract": "^1.22.1",
"es-shim-unscopables": "^1.0.0"
},
"engines": {
@@ -6083,11 +6148,11 @@
}
},
"node_modules/es-shim-unscopables": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
"integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz",
"integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==",
"dependencies": {
"has": "^1.0.3"
"hasown": "^2.0.0"
}
},
"node_modules/es-to-primitive": {
@@ -6217,6 +6282,135 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
"integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
"dependencies": {
"debug": "^3.2.7",
"is-core-module": "^2.13.0",
"resolve": "^1.22.4"
}
},
"node_modules/eslint-import-resolver-node/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-module-utils": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz",
"integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==",
"dev": true,
"dependencies": {
"debug": "^3.2.7"
},
"engines": {
"node": ">=4"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
}
}
},
"node_modules/eslint-module-utils/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-plugin-import": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"dev": true,
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
"array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0",
"hasown": "^2.0.0",
"is-core-module": "^2.13.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.fromentries": "^2.0.7",
"object.groupby": "^1.0.1",
"object.values": "^1.1.7",
"semver": "^6.3.1",
"tsconfig-paths": "^3.15.0"
},
"engines": {
"node": ">=4"
},
"peerDependencies": {
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
}
},
"node_modules/eslint-plugin-import/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/eslint-plugin-import/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-plugin-import/node_modules/doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"dependencies": {
"esutils": "^2.0.2"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/eslint-plugin-import/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/eslint-plugin-import/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@@ -7394,11 +7588,14 @@
}
},
"node_modules/is-core-module": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz",
"integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==",
"dependencies": {
"has": "^1.0.3"
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -10027,11 +10224,42 @@
"node": ">= 0.4"
}
},
"node_modules/object.fromentries": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz",
"integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/object.groupby": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz",
"integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/object.values": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz",
"integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==",
"peer": true,
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -11153,11 +11381,11 @@
"dev": true
},
"node_modules/resolve": {
"version": "1.22.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
"dependencies": {
"is-core-module": "^2.9.0",
"is-core-module": "^2.13.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
@@ -12477,6 +12705,39 @@
"typescript": ">=2.7"
}
},
"node_modules/tsconfig-paths": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
"integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
"dev": true,
"dependencies": {
"@types/json5": "^0.0.29",
"json5": "^1.0.2",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
}
},
"node_modules/tsconfig-paths/node_modules/json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/tsconfig-paths/node_modules/strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/tty-table": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/tty-table/-/tty-table-4.2.1.tgz",
@@ -16513,6 +16774,12 @@
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz",
"integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw=="
},
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
"@types/lodash": {
"version": "4.14.184",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.184.tgz",
@@ -17109,6 +17376,20 @@
"is-array-buffer": "^3.0.4"
}
},
"array-includes": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz",
"integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0",
"get-intrinsic": "^1.2.4",
"is-string": "^1.0.7"
}
},
"array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
@@ -17129,14 +17410,40 @@
"is-string": "^1.0.7"
}
},
"array.prototype.findlastindex": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz",
"integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"es-shim-unscopables": "^1.0.2"
}
},
"array.prototype.flat": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz",
"integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz",
"integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==",
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4",
"define-properties": "^1.2.0",
"es-abstract": "^1.22.1",
"es-shim-unscopables": "^1.0.0"
}
},
"array.prototype.flatmap": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz",
"integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.2.0",
"es-abstract": "^1.22.1",
"es-shim-unscopables": "^1.0.0"
}
},
@@ -18279,11 +18586,11 @@
}
},
"es-shim-unscopables": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
"integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz",
"integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==",
"requires": {
"has": "^1.0.3"
"hasown": "^2.0.0"
}
},
"es-to-primitive": {
@@ -18416,6 +18723,118 @@
}
}
},
"eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
"integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
"requires": {
"debug": "^3.2.7",
"is-core-module": "^2.13.0",
"resolve": "^1.22.4"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
}
}
},
"eslint-module-utils": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz",
"integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==",
"dev": true,
"requires": {
"debug": "^3.2.7"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
}
}
},
"eslint-plugin-import": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"dev": true,
"requires": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
"array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0",
"hasown": "^2.0.0",
"is-core-module": "^2.13.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.fromentries": "^2.0.7",
"object.groupby": "^1.0.1",
"object.values": "^1.1.7",
"semver": "^6.3.1",
"tsconfig-paths": "^3.15.0"
},
"dependencies": {
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true
}
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@@ -19244,11 +19663,11 @@
"integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="
},
"is-core-module": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz",
"integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==",
"requires": {
"has": "^1.0.3"
"hasown": "^2.0.2"
}
},
"is-data-view": {
@@ -21164,11 +21583,33 @@
"es-object-atoms": "^1.0.0"
}
},
"object.fromentries": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz",
"integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0"
}
},
"object.groupby": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz",
"integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2"
}
},
"object.values": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz",
"integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==",
"peer": true,
"requires": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
@@ -21996,11 +22437,11 @@
"dev": true
},
"resolve": {
"version": "1.22.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
"requires": {
"is-core-module": "^2.9.0",
"is-core-module": "^2.13.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
}
@@ -22976,6 +23417,35 @@
"yn": "3.1.1"
}
},
"tsconfig-paths": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
"integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
"dev": true,
"requires": {
"@types/json5": "^0.0.29",
"json5": "^1.0.2",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
},
"dependencies": {
"json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"requires": {
"minimist": "^1.2.0"
}
},
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
"dev": true
}
}
},
"tty-table": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/tty-table/-/tty-table-4.2.1.tgz",

View File

@@ -67,6 +67,7 @@
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.22.0",
"eslint-plugin-import": "^2.29.1",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.7.0",
"json-schema-to-ts": "^3.0.0",

View File

@@ -1,7 +1,8 @@
import fetchWithTimeout from '../../utils/fetch-with-timeout';
import fetch from 'node-fetch';
import * as FormData from 'form-data';
import { getProxyAgent } from '@redocly/openapi-core';
import fetchWithTimeout from '../../utils/fetch-with-timeout';
import type { Response } from 'node-fetch';
import type { ReadStream } from 'fs';
import type {

View File

@@ -1,17 +1,17 @@
import { createElement } from 'react';
import { createStore, Redoc } from 'redoc';
import { Config, isAbsoluteUrl } from '@redocly/openapi-core';
import { renderToString } from 'react-dom/server';
import { ServerStyleSheet } from 'styled-components';
import { compile } from 'handlebars';
import { dirname, join, resolve } from 'path';
import { existsSync, lstatSync, readFileSync } from 'fs';
import type { BuildDocsOptions } from './types';
import { red } from 'colorette';
import { isAbsoluteUrl } from '@redocly/openapi-core';
import { exitWithError } from '../../utils/miscellaneous';
import type { Config } from '@redocly/openapi-core';
import type { BuildDocsOptions } from './types';
export function getObjectOrJSON(
openapiOptions: string | Record<string, unknown>,
config: Config

View File

@@ -1,8 +1,9 @@
import { Region, RedoclyClient } from '@redocly/openapi-core';
import { blue, green, gray } from 'colorette';
import { RedoclyClient } from '@redocly/openapi-core';
import { promptUser } from '../utils/miscellaneous';
import type { CommandArgs } from '../wrapper';
import type { Region } from '@redocly/openapi-core';
export function promptClientToken(domain: string) {
return promptUser(

View File

@@ -156,6 +156,7 @@ export async function previewDocs({
}
}
// eslint-disable-next-line @typescript-eslint/ban-types
export function debounce(func: Function, wait: number, immediate?: boolean) {
let timeout: NodeJS.Timeout | null;

View File

@@ -3,11 +3,11 @@ import * as colorette from 'colorette';
import { getPort } from 'get-port-please';
import { readFileSync, promises as fsPromises } from 'fs';
import * as path from 'path';
import { startHttpServer, startWsServer, respondWithGzip, mimeTypes } from './server';
import type { IncomingMessage } from 'http';
import { isSubdir } from '../../../utils/miscellaneous';
import type { IncomingMessage } from 'http';
function getPageHTML(
htmlTemplate: string,
redocOptions: object = {},
@@ -60,7 +60,8 @@ export default async function startPreviewServer(
getBundle,
getOptions,
useRedocPro,
}: { getBundle: Function; getOptions: Function; useRedocPro: boolean }
}: // eslint-disable-next-line @typescript-eslint/ban-types
{ getBundle: Function; getOptions: Function; useRedocPro: boolean }
) {
const defaultTemplate = path.join(__dirname, 'default.hbs');
const handler = async (request: IncomingMessage, response: any) => {

View File

@@ -1,6 +1,7 @@
import * as http from 'http';
import * as zlib from 'zlib';
import { ReadStream } from 'fs';
import type { ReadStream } from 'fs';
const SocketServer = require('simple-websocket/server.js');

View File

@@ -1,4 +1,4 @@
import { Product } from './types';
import type { Product } from './types';
export const PRODUCT_PACKAGES = {
realm: '@redocly/realm',

View File

@@ -1,4 +1,4 @@
import { PRODUCT_PACKAGES, PRODUCT_PLANS } from './constants';
import type { PRODUCT_PACKAGES, PRODUCT_PLANS } from './constants';
export type Product = keyof typeof PRODUCT_PACKAGES;
export type ProductPlan = typeof PRODUCT_PLANS[number];

View File

@@ -6,13 +6,10 @@ import { yellow, green, blue, red } from 'colorette';
import { createHash } from 'crypto';
import {
bundle,
Config,
RedoclyClient,
IGNORE_FILE,
BundleOutputFormat,
getTotals,
slash,
Region,
getMergedConfig,
getProxyAgent,
} from '@redocly/openapi-core';
@@ -26,11 +23,13 @@ import {
import { promptClientToken } from './login';
import { handlePush as handleCMSPush } from '../cms/commands/push';
import type { Config, BundleOutputFormat, Region } from '@redocly/openapi-core';
import type { CommandArgs } from '../wrapper';
const DEFAULT_VERSION = 'latest';
export const DESTINATION_REGEX =
// eslint-disable-next-line no-useless-escape
/^(@(?<organizationId>[\w\-\s]+)\/)?(?<name>[^@]*)@(?<version>[\w\.\-]+)$/;
export type PushOptions = {

View File

@@ -1,7 +1,6 @@
import { performance } from 'perf_hooks';
import * as colors from 'colorette';
import {
StyleguideConfig,
normalizeTypes,
BaseResolver,
resolveDocument,
@@ -12,11 +11,16 @@ import {
Stats,
bundle,
} from '@redocly/openapi-core';
import { getFallbackApisOrExit } from '../utils/miscellaneous';
import { printExecutionTime } from '../utils/miscellaneous';
import { getFallbackApisOrExit, printExecutionTime } from '../utils/miscellaneous';
import type { StatsAccumulator, StatsName, WalkContext, OutputFormat } from '@redocly/openapi-core';
import type { CommandArgs } from '../wrapper';
import type {
StatsAccumulator,
StatsName,
WalkContext,
OutputFormat,
StyleguideConfig,
} from '@redocly/openapi-core';
const statsAccumulator: StatsAccumulator = {
refs: { metric: '🚗 References', total: 0, color: 'red', items: new Set() },

View File

@@ -3,27 +3,33 @@
import './utils/assert-node-version';
import * as yargs from 'yargs';
import * as colors from 'colorette';
import { outputExtensions, PushArguments, regionChoices } from './types';
import { RedoclyClient } from '@redocly/openapi-core';
import { outputExtensions, regionChoices } from './types';
import { previewDocs } from './commands/preview-docs';
import { handleStats } from './commands/stats';
import { handleSplit } from './commands/split';
import { handleJoin } from './commands/join';
import { handlePushStatus, PushStatusOptions } from './cms/commands/push-status';
import { handlePushStatus } from './cms/commands/push-status';
import { handleLint } from './commands/lint';
import { handleBundle } from './commands/bundle';
import { handleLogin } from './commands/login';
import { handlerBuildCommand } from './commands/build-docs';
import { cacheLatestVersion, notifyUpdateCliVersion } from './utils/update-version-notifier';
import {
cacheLatestVersion,
notifyUpdateCliVersion,
version,
} from './utils/update-version-notifier';
import { commandWrapper } from './wrapper';
import { version } from './utils/update-version-notifier';
import type { Arguments } from 'yargs';
import type { OutputFormat, RuleSeverity } from '@redocly/openapi-core';
import type { BuildDocsArgv } from './commands/build-docs/types';
import { previewProject } from './commands/preview-project';
import { PRODUCT_PLANS } from './commands/preview-project/constants';
import { commonPushHandler } from './commands/push';
import type { Arguments } from 'yargs';
import type { OutputFormat, RuleSeverity } from '@redocly/openapi-core';
import type { BuildDocsArgv } from './commands/build-docs/types';
import type { PushStatusOptions } from './cms/commands/push-status';
import type { PushArguments } from './types';
if (!('replaceAll' in String.prototype)) {
require('core-js/actual/string/replace-all');
}

View File

@@ -9,9 +9,8 @@ import type { StatsOptions } from './commands/stats';
import type { SplitOptions } from './commands/split';
import type { PreviewDocsOptions } from './commands/preview-docs';
import type { BuildDocsArgv } from './commands/build-docs/types';
import type { PushOptions as PushBhOptions } from './cms/commands/push';
import type { PushStatusOptions } from './cms/commands/push-status';
import type { PushOptions as CMSPushOptions } from './cms/commands/push';
import type { PushStatusOptions } from './cms/commands/push-status';
import type { PreviewProjectOptions } from './commands/preview-project/types';
export type Totals = {
@@ -31,7 +30,7 @@ export type CommandOptions =
| SplitOptions
| JoinOptions
| PushOptions
| PushBhOptions
| CMSPushOptions
| LintOptions
| BundleOptions
| LoginOptions

View File

@@ -1,4 +1,4 @@
import { Arguments } from 'yargs';
import type { Arguments } from 'yargs';
export function getCommandNameFromArgs(argv: Arguments | undefined): string | number {
return argv?._?.[0] ?? '';

View File

@@ -1,8 +1,9 @@
import { parseYaml } from '../js-yaml';
import { Document, Source } from '../resolve';
import { Oas3RuleSet } from '../oas-types';
import { Source } from '../resolve';
import { StyleguideConfig, mergeExtends, resolvePlugins } from '../config';
import type { Document } from '../resolve';
import type { Oas3RuleSet } from '../oas-types';
import type { RuleConfig, Plugin, ResolvedStyleguideConfig } from '../config/types';
export function parseYamlToDocument(body: string, absoluteRef: string = ''): Document {

View File

@@ -9,7 +9,7 @@ import {
SpecMajorVersion,
SpecVersion,
} from './oas-types';
import { isAbsoluteUrl, isRef, Location, refBaseName } from './ref-utils';
import { isAbsoluteUrl, isRef, refBaseName } from './ref-utils';
import { initRules } from './config/rules';
import { reportUnresolvedRef } from './rules/no-unresolved-refs';
import { dequal, isPlainObject, isTruthy } from './utils';
@@ -18,6 +18,7 @@ import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './decorato
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './decorators/oas3/remove-unused-components';
import { ConfigTypes } from './types/redocly-yaml';
import type { Location } from './ref-utils';
import type { Oas3Visitor, Oas2Visitor } from './visitors';
import type { NormalizedNodeType, NodeType } from './types';
import type { WalkContext, UserContext, ResolveResult, NormalizedProblem } from './walk';

View File

@@ -2,16 +2,11 @@ import recommended from './recommended';
import recommendedStrict from './recommended-strict';
import all from './all';
import minimal from './minimal';
import { rules as oas3Rules } from '../rules/oas3';
import { rules as oas2Rules } from '../rules/oas2';
import { rules as async2Rules } from '../rules/async2';
import { rules as async3Rules } from '../rules/async3';
import { rules as arazzoRules } from '../rules/arazzo';
import { preprocessors as oas3Preprocessors } from '../rules/oas3';
import { preprocessors as oas2Preprocessors } from '../rules/oas2';
import { preprocessors as async2Preprocessors } from '../rules/async2';
import { preprocessors as async3Preprocessors } from '../rules/async3';
import { preprocessors as arazzoPreprocessors } from '../rules/arazzo';
import { rules as oas3Rules, preprocessors as oas3Preprocessors } from '../rules/oas3';
import { rules as oas2Rules, preprocessors as oas2Preprocessors } from '../rules/oas2';
import { rules as async2Rules, preprocessors as async2Preprocessors } from '../rules/async2';
import { rules as async3Rules, preprocessors as async3Preprocessors } from '../rules/async3';
import { rules as arazzoRules, preprocessors as arazzoPreprocessors } from '../rules/arazzo';
import { decorators as oas3Decorators } from '../decorators/oas3';
import { decorators as oas2Decorators } from '../decorators/oas2';
import { decorators as async2Decorators } from '../decorators/async2';

View File

@@ -1,6 +1,6 @@
import * as path from 'path';
import { isAbsoluteUrl } from '../ref-utils';
import { pickDefined } from '../utils';
import { pickDefined, isNotString, isString, isDefined, keysOf } from '../utils';
import { resolveDocument, BaseResolver } from '../resolve';
import { defaultPlugin } from './builtIn';
import {
@@ -12,7 +12,6 @@ import {
transformConfig,
} from './utils';
import { isBrowser } from '../env';
import { isNotString, isString, isDefined, keysOf } from '../utils';
import { Config } from './config';
import { colorize, logger } from '../logger';
import { asserts, buildAssertCustomFunction } from '../rules/common/assertions/asserts';

View File

@@ -2,18 +2,19 @@ import * as fs from 'fs';
import * as path from 'path';
import { parseYaml, stringifyYaml } from '../js-yaml';
import { slash, doesYamlFileExist } from '../utils';
import { NormalizedProblem } from '../walk';
import {
SpecVersion,
SpecMajorVersion,
import { SpecVersion, SpecMajorVersion } from '../oas-types';
import { isBrowser } from '../env';
import { getResolveConfig } from './utils';
import { isAbsoluteUrl } from '../ref-utils';
import type { NormalizedProblem } from '../walk';
import type {
Oas2RuleSet,
Oas3RuleSet,
Async2RuleSet,
Async3RuleSet,
ArazzoRuleSet,
} from '../oas-types';
import { isBrowser } from '../env';
import type { NodeType } from '../types';
import type {
DecoratorConfig,
@@ -29,8 +30,6 @@ import type {
Telemetry,
ThemeRawConfig,
} from './types';
import { getResolveConfig } from './utils';
import { isAbsoluteUrl } from '../ref-utils';
export const IGNORE_FILE = '.redocly.lint-ignore.yaml';
const IGNORE_BANNER =

View File

@@ -3,17 +3,17 @@ import * as path from 'path';
import { RedoclyClient } from '../redocly';
import { isEmptyObject } from '../utils';
import { parseYaml } from '../js-yaml';
import { Config } from './config';
import { ConfigValidationError, transformConfig, deepCloneMapWithJSON } from './utils';
import { resolveConfig, resolveConfigFileAndRefs } from './config-resolvers';
import { bundleConfig } from '../bundle';
import { BaseResolver } from '../resolve';
import { isBrowser } from '../env';
import { DOMAINS } from '../redocly/domains';
import type { Config } from './config';
import type { Document, ResolvedRefMap } from '../resolve';
import type { RegionalToken, RegionalTokenWithValidity } from '../redocly/redocly-client-types';
import type { RawConfig, RawUniversalConfig, Region } from './types';
import { DOMAINS } from '../redocly/domains';
async function addConfigMetadata({
rawConfig,

View File

@@ -1,3 +1,4 @@
import type { Location } from '../ref-utils';
import type { ProblemSeverity, UserContext } from '../walk';
import type {
Oas3PreprocessorsSet,
@@ -19,11 +20,9 @@ import type {
ArazzoDecoratorsSet,
RuleMap,
} from '../oas-types';
import type { NodeType } from '../types';
import { Location } from '../ref-utils';
import type { SkipFunctionContext } from '../visitors';
import {
import type {
BuiltInAsync2RuleId,
BuiltInAsync3RuleId,
BuiltInCommonOASRuleId,
@@ -171,6 +170,7 @@ export type RawResolveConfig = {
export type HttpResolveConfig = {
headers: ResolveHeader[];
// eslint-disable-next-line @typescript-eslint/ban-types
customFetch?: Function;
};

View File

@@ -6,6 +6,8 @@ import {
showWarningForDeprecatedField,
} from '../utils';
import { Config } from './config';
import { logger, colorize } from '../logger';
import type {
Api,
DeprecatedInApi,
@@ -21,7 +23,6 @@ import type {
StyleguideRawConfig,
ThemeConfig,
} from './types';
import { logger, colorize } from '../logger';
export function parsePresetName(presetName: string): { pluginId: string; configName: string } {
if (presetName.indexOf('/') > -1) {

View File

@@ -1,7 +1,8 @@
import { UserContext } from '../../../walk';
import { isRef } from '../../../ref-utils';
import { isEmptyArray, isEmptyObject, isPlainObject } from '../../../utils';
import type { UserContext } from '../../../walk';
export function filter(node: any, ctx: UserContext, criteria: (item: any) => boolean) {
const { parent, key } = ctx;
let didDelete = false;

View File

@@ -1,6 +1,7 @@
import { Oas2Decorator, Oas3Decorator } from '../../../visitors';
import { checkIfMatchByStrategy, filter } from './filter-helper';
import type { Oas2Decorator, Oas3Decorator } from '../../../visitors';
const DEFAULT_STRATEGY = 'any';
export const FilterIn: Oas3Decorator | Oas2Decorator = ({ property, value, matchStrategy }) => {

View File

@@ -1,6 +1,7 @@
import { Oas2Decorator, Oas3Decorator } from '../../../visitors';
import { checkIfMatchByStrategy, filter } from './filter-helper';
import type { Oas2Decorator, Oas3Decorator } from '../../../visitors';
const DEFAULT_STRATEGY = 'any';
export const FilterOut: Oas3Decorator | Oas2Decorator = ({ property, value, matchStrategy }) => {

View File

@@ -1,6 +1,7 @@
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import { readFileAsStringSync } from '../../utils';
import { UserContext } from '../../walk';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { UserContext } from '../../walk';
export const InfoDescriptionOverride: Oas3Decorator | Oas2Decorator = ({ filePath }) => {
return {

View File

@@ -1,4 +1,4 @@
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
export const InfoOverride: Oas3Decorator | Oas2Decorator = (newInfo) => {
return {

View File

@@ -1,8 +1,9 @@
import { Oas3Decorator } from '../../visitors';
import { Oas3Operation, Oas3RequestBody, Oas3Response } from '../../typings/openapi';
import { yamlAndJsonSyncReader } from '../../utils';
import { isRef } from '../../ref-utils';
import { NonUndefined, ResolveFn, UserContext } from '../../walk';
import type { Oas3Decorator } from '../../visitors';
import type { Oas3Operation, Oas3RequestBody, Oas3Response } from '../../typings/openapi';
import type { NonUndefined, ResolveFn, UserContext } from '../../walk';
export const MediaTypeExamplesOverride: Oas3Decorator = ({ operationIds }) => {
return {

View File

@@ -1,8 +1,9 @@
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import { readFileAsStringSync } from '../../utils';
import { UserContext } from '../../walk';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationDescriptionOverride: Oas3Decorator | Oas2Decorator = ({ operationIds }) => {
return {

View File

@@ -1,7 +1,7 @@
import { UserContext } from '../../walk';
import { isRedoclyRegistryURL } from '../../redocly/domains';
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
export const RegistryDependencies: Oas3Decorator | Oas2Decorator = () => {
const registryDependencies = new Set<string>();

View File

@@ -1,8 +1,9 @@
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import { isEmptyArray, isEmptyObject, isPlainObject } from '../../utils';
import { UserContext } from '../../walk';
import { isRef } from '../../ref-utils';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { UserContext } from '../../walk';
const DEFAULT_INTERNAL_PROPERTY_NAME = 'x-internal';
export const RemoveXInternal: Oas3Decorator | Oas2Decorator = ({ internalFlagProperty }) => {

View File

@@ -1,6 +1,7 @@
import { Oas3Decorator, Oas2Decorator } from '../../visitors';
import { readFileAsStringSync } from '../../utils';
import { UserContext } from '../../walk';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { UserContext } from '../../walk';
export const TagDescriptionOverride: Oas3Decorator | Oas2Decorator = ({ tagNames }) => {
return {

View File

@@ -1,4 +1,3 @@
import { Oas2Decorator } from '../../visitors';
import { RegistryDependencies } from '../common/registry-dependencies';
import { OperationDescriptionOverride } from '../common/operation-description-override';
import { TagDescriptionOverride } from '../common/tag-description-override';
@@ -8,6 +7,8 @@ import { RemoveXInternal } from '../common/remove-x-internal';
import { FilterIn } from '../common/filters/filter-in';
import { FilterOut } from '../common/filters/filter-out';
import type { Oas2Decorator } from '../../visitors';
export const decorators = {
'registry-dependencies': RegistryDependencies as Oas2Decorator,
'operation-description-override': OperationDescriptionOverride as Oas2Decorator,

View File

@@ -1,6 +1,6 @@
import { Location } from '../../ref-utils';
import { isEmptyObject } from '../../utils';
import type { Location } from '../../ref-utils';
import type { Oas2Decorator } from '../../visitors';
import type { Oas2Components, Oas2Definition } from '../../typings/swagger';

View File

@@ -1,4 +1,3 @@
import { Oas3Decorator } from '../../visitors';
import { RegistryDependencies } from '../common/registry-dependencies';
import { OperationDescriptionOverride } from '../common/operation-description-override';
import { TagDescriptionOverride } from '../common/tag-description-override';
@@ -9,6 +8,8 @@ import { FilterIn } from '../common/filters/filter-in';
import { FilterOut } from '../common/filters/filter-out';
import { MediaTypeExamplesOverride } from '../common/media-type-examples-override';
import type { Oas3Decorator } from '../../visitors';
export const decorators = {
'registry-dependencies': RegistryDependencies as Oas3Decorator,
'operation-description-override': OperationDescriptionOverride as Oas3Decorator,

View File

@@ -1,6 +1,6 @@
import { Location } from '../../ref-utils';
import { isEmptyObject } from '../../utils';
import type { Location } from '../../ref-utils';
import type { Oas3Decorator } from '../../visitors';
import type { Oas3Components, Oas3Definition } from '../../typings/openapi';

View File

@@ -1,8 +1,9 @@
import * as yamlAst from 'yaml-ast-parser';
import { unescapePointer } from '../ref-utils';
import { LineColLocationObject, Loc, LocationObject } from '../walk';
import { colorize, colorOptions } from '../logger';
import type { LineColLocationObject, Loc, LocationObject } from '../walk';
type YAMLMapping = yamlAst.YAMLMapping & { kind: yamlAst.Kind.MAPPING };
type YAMLMap = yamlAst.YamlMap & { kind: yamlAst.Kind.MAP };
type YAMLAnchorReference = yamlAst.YAMLAnchorReference & { kind: yamlAst.Kind.ANCHOR_REF };

View File

@@ -1,14 +1,19 @@
import * as path from 'path';
import { colorOptions, colorize, logger } from '../logger';
import { output } from '../output';
const coreVersion = require('../../package.json').version;
import { NormalizedProblem, ProblemSeverity, LineColLocationObject, LocationObject } from '../walk';
import { getCodeframe, getLineColLocation } from './codeframes';
import { env, isBrowser } from '../env';
import { isAbsoluteUrl } from '../ref-utils';
import type {
NormalizedProblem,
ProblemSeverity,
LineColLocationObject,
LocationObject,
} from '../walk';
const coreVersion = require('../../package.json').version;
export type Totals = {
errors: number;
warnings: number;

View File

@@ -1,7 +1,9 @@
// TODO: add a type for "types" https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/js-yaml/index.d.ts
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { JSON_SCHEMA, types, LoadOptions, DumpOptions, load, dump } from 'js-yaml';
import { JSON_SCHEMA, types, load, dump } from 'js-yaml';
import type { LoadOptions, DumpOptions } from 'js-yaml';
const DEFAULT_SCHEMA_WITHOUT_TIMESTAMP = JSON_SCHEMA.extend({
implicit: [types.merge],

View File

@@ -2,7 +2,7 @@ import { rootRedoclyConfigSchema } from '@redocly/config';
import { BaseResolver, resolveDocument, makeDocumentFromString } from './resolve';
import { normalizeVisitors } from './visitors';
import { walkDocument } from './walk';
import { StyleguideConfig, Config, initRules } from './config';
import { initRules } from './config';
import { normalizeTypes } from './types';
import { releaseAjvInstance } from './rules/ajv';
import { SpecVersion, getMajorSpecVersion, detectSpec, getTypes } from './oas-types';
@@ -10,6 +10,7 @@ import { createConfigTypes } from './types/redocly-yaml';
import { Spec } from './rules/common/spec';
import { NoUnresolvedRefs } from './rules/no-unresolved-refs';
import type { StyleguideConfig, Config } from './config';
import type { Document, ResolvedRefMap } from './resolve';
import type { ProblemSeverity, WalkContext } from './walk';
import type { NodeType } from './types';

View File

@@ -1,9 +1,9 @@
import * as colorette from 'colorette';
export { options as colorOptions } from 'colorette';
import { isBrowser } from './env';
import { identity } from './utils';
export { options as colorOptions } from 'colorette';
export const colorize = new Proxy(colorette, {
get(target: typeof colorette, prop: string): typeof identity {
if (isBrowser) {

View File

@@ -1,3 +1,19 @@
import { Oas2Types } from './types/oas2';
import { Oas3Types } from './types/oas3';
import { Oas3_1Types } from './types/oas3_1';
import { AsyncApi2Types } from './types/asyncapi2';
import { AsyncApi3Types } from './types/asyncapi3';
import { ArazzoTypes } from './types/arazzo';
import { isPlainObject } from './utils';
import type {
BuiltInAsync2RuleId,
BuiltInAsync3RuleId,
BuiltInCommonOASRuleId,
BuiltInArazzoRuleId,
BuiltInOAS2RuleId,
BuiltInOAS3RuleId,
} from './types/redocly-yaml';
import type {
Oas3Rule,
Oas3Preprocessor,
@@ -10,21 +26,6 @@ import type {
ArazzoPreprocessor,
ArazzoRule,
} from './visitors';
import { Oas2Types } from './types/oas2';
import { Oas3Types } from './types/oas3';
import { Oas3_1Types } from './types/oas3_1';
import { AsyncApi2Types } from './types/asyncapi2';
import { AsyncApi3Types } from './types/asyncapi3';
import { ArazzoTypes } from './types/arazzo';
import type {
BuiltInAsync2RuleId,
BuiltInAsync3RuleId,
BuiltInCommonOASRuleId,
BuiltInArazzoRuleId,
BuiltInOAS2RuleId,
BuiltInOAS3RuleId,
} from './types/redocly-yaml';
import { isPlainObject } from './utils';
export enum SpecVersion {
OAS2 = 'oas2',

View File

@@ -1,4 +1,4 @@
import { Region } from '../config/types';
import type { Region } from '../config/types';
let redoclyDomain = 'redocly.com';

View File

@@ -3,11 +3,8 @@ import { resolve } from 'path';
import { homedir } from 'os';
import { RegistryApi } from './registry-api';
import { env } from '../env';
import { RegionalToken, RegionalTokenWithValidity } from './redocly-client-types';
import { isNotEmptyObject } from '../utils';
import { colorize } from '../logger';
import type { AccessTokens, Region } from '../config/types';
import {
AVAILABLE_REGIONS,
DEFAULT_REGION,
@@ -16,6 +13,9 @@ import {
setRedoclyDomain,
} from './domains';
import type { RegionalToken, RegionalTokenWithValidity } from './redocly-client-types';
import type { AccessTokens, Region } from '../config/types';
export const TOKEN_FILENAME = '.redocly-config.json';
export class RedoclyClient {

View File

@@ -1,4 +1,8 @@
import fetch, { RequestInit, HeadersInit } from 'node-fetch';
import fetch from 'node-fetch';
import { getProxyAgent, isNotEmptyObject } from '../utils';
import { getRedoclyDomain } from './domains';
import type { RequestInit, HeadersInit } from 'node-fetch';
import type {
NotFoundProblemResponse,
PrepareFileuploadOKResponse,
@@ -6,8 +10,6 @@ import type {
PushApiParams,
} from './registry-api-types';
import type { AccessTokens, Region } from '../config/types';
import { getProxyAgent, isNotEmptyObject } from '../utils';
import { getRedoclyDomain } from './domains';
const version = require('../../package.json').version;

View File

@@ -1,7 +1,8 @@
import { Source } from './resolve';
import { OasRef } from './typings/openapi';
import { isTruthy } from './utils';
import type { Source } from './resolve';
import type { OasRef } from './typings/openapi';
export function joinPointer(base: string, key: string | number) {
if (base === '') base = '#/';
return base[base.length - 1] === '/' ? base + key : base + '/' + key;
@@ -60,6 +61,7 @@ export function pointerBaseName(pointer: string) {
}
export function refBaseName(ref: string) {
// eslint-disable-next-line no-useless-escape
const parts = ref.split(/[\/\\]/); // split by '\' and '/'
return parts[parts.length - 1].replace(/\.[^.]+$/, ''); // replace extension with empty string
}

View File

@@ -1,11 +1,13 @@
import * as fs from 'fs';
import * as path from 'path';
import { OasRef } from './typings/openapi';
import { isRef, joinPointer, escapePointer, parseRef, isAbsoluteUrl, isAnchor } from './ref-utils';
import type { YAMLNode, LoadOptions } from 'yaml-ast-parser';
import { NormalizedNodeType, isNamedType, SpecExtension } from './types';
import { isNamedType, SpecExtension } from './types';
import { readFileFromUrl, parseYaml, nextTick } from './utils';
import { ResolveConfig } from './config/types';
import type { YAMLNode, LoadOptions } from 'yaml-ast-parser';
import type { NormalizedNodeType } from './types';
import type { ResolveConfig } from './config/types';
import type { OasRef } from './typings/openapi';
export type CollectedRefs = Map<string /* absoluteFilePath */, Document>;

View File

@@ -1,6 +1,7 @@
import Ajv from '@redocly/ajv/dist/2020';
import { Location, escapePointer } from '../ref-utils';
import { escapePointer } from '../ref-utils';
import type { Location } from '../ref-utils';
import type { ValidateFunction, ErrorObject } from '@redocly/ajv/dist/2020';
import type { ResolveFn } from '../walk';

View File

@@ -1,8 +1,9 @@
import { ArazzoRule } from '../../visitors';
import { Spec } from '../common/spec';
import type { ArazzoRuleSet } from '../../oas-types';
import { Assertions } from '../common/assertions';
import type { ArazzoRule } from '../../visitors';
import type { ArazzoRuleSet } from '../../oas-types';
export const rules: ArazzoRuleSet<'built-in'> = {
spec: Spec as ArazzoRule,
assertions: Assertions as ArazzoRule,

View File

@@ -1,5 +1,5 @@
import { Async2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Async2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const ChannelsKebabCase: Async2Rule = () => {
return {

View File

@@ -1,4 +1,3 @@
import { Async2Rule } from '../../visitors';
import { Assertions } from '../common/assertions';
import { Spec } from '../common/spec';
import { InfoContact } from '../common/info-contact';
@@ -7,6 +6,8 @@ import { TagDescription } from '../common/tag-description';
import { TagsAlphabetical } from '../common/tags-alphabetical';
import { ChannelsKebabCase } from './channels-kebab-case';
import { NoChannelTrailingSlash } from './no-channel-trailing-slash';
import type { Async2Rule } from '../../visitors';
import type { Async2RuleSet } from '../../oas-types';
export const rules: Async2RuleSet<'built-in'> = {

View File

@@ -1,5 +1,5 @@
import { Async2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Async2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const NoChannelTrailingSlash: Async2Rule = () => {
return {

View File

@@ -1,6 +1,6 @@
import { Channel } from '../../typings/asyncapi3';
import { Async3Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Channel } from '../../typings/asyncapi3';
import type { Async3Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const ChannelsKebabCase: Async3Rule = () => {
return {

View File

@@ -1,4 +1,3 @@
import { Async3Rule } from '../../visitors';
import { Assertions } from '../common/assertions';
import { Spec } from '../common/spec';
import { InfoContact } from '../common/info-contact';
@@ -7,6 +6,8 @@ import { TagDescription } from '../common/tag-description';
import { TagsAlphabetical } from '../common/tags-alphabetical';
import { ChannelsKebabCase } from './channels-kebab-case';
import { NoChannelTrailingSlash } from './no-channel-trailing-slash';
import type { Async3Rule } from '../../visitors';
import type { Async3RuleSet } from '../../oas-types';
export const rules: Async3RuleSet<'built-in'> = {

View File

@@ -1,6 +1,6 @@
import { Async3Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { Channel } from '../../typings/asyncapi3';
import type { Async3Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Channel } from '../../typings/asyncapi3';
export const NoChannelTrailingSlash: Async3Rule = () => {
return {

View File

@@ -1,13 +1,9 @@
import { AssertionContext, AssertResult, CustomFunction } from 'core/src/config/types';
import { Location } from '../../../ref-utils';
import { isPlainObject, isString as runOnValue, isTruthy } from '../../../utils';
import {
OrderOptions,
OrderDirection,
isOrdered,
getIntersectionLength,
regexFromString,
} from './utils';
import { isOrdered, getIntersectionLength, regexFromString } from './utils';
import type { AssertionContext, AssertResult, CustomFunction } from '../../../config/types';
import type { Location } from '../../../ref-utils';
import type { OrderOptions, OrderDirection } from './utils';
export type AssertionFnContext = AssertionContext & { baseLocation: Location; rawValue?: any };

View File

@@ -1,8 +1,7 @@
import { asserts } from './asserts';
import { buildSubjectVisitor, buildVisitorObject } from './utils';
import { isString } from '../../../utils';
import type { AssertionFn } from './asserts';
import type { asserts, AssertionFn } from './asserts';
import type {
ArazzoVisitor,
Async2Visitor,

View File

@@ -1,7 +1,10 @@
import { asserts, runOnKeysSet, runOnValuesSet, Asserts } from './asserts';
import { asserts, runOnKeysSet, runOnValuesSet } from './asserts';
import { colorize } from '../../../logger';
import { isRef } from '../../../ref-utils';
import { isTruthy, keysOf, isString } from '../../../utils';
import type { UserContext } from 'core/src/walk';
import type { Asserts } from './asserts';
import type { AssertionContext, AssertResult } from '../../../config';
import type { Assertion, AssertionDefinition, AssertionLocators } from '.';
import type {
@@ -10,7 +13,6 @@ import type {
SkipFunctionContext,
VisitFunction,
} from '../../../visitors';
import { UserContext } from 'core/src/walk';
export type OrderDirection = 'asc' | 'desc';

View File

@@ -1,6 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { missingRequiredField } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
export const InfoContact: Oas3Rule | Oas2Rule = () => {
return {
Info(info, { report, location }) {

View File

@@ -1,6 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { validateDefinedAndNonEmpty } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
export const InfoLicenseUrl: Oas3Rule | Oas2Rule = () => {
return {
License(license, ctx) {

View File

@@ -1,6 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { missingRequiredField } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
export const InfoLicense: Oas3Rule | Oas2Rule = () => {
return {
Info(info, { report }) {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { Oas3Paths } from '../../typings/openapi';
import { Oas2Paths } from '../../typings/swagger';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas3Paths } from '../../typings/openapi';
import type { Oas2Paths } from '../../typings/swagger';
export const NoAmbiguousPaths: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,8 +1,9 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { matchesJsonSchemaType, oasTypeOf } from '../utils';
import { Oas2Schema } from '../../typings/swagger';
import { Oas3Schema } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Schema } from '../../typings/swagger';
import type { Oas3Schema } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const NoEnumTypeMismatch: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,9 +1,10 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2PathItem } from '../../typings/swagger';
import { Oas3PathItem } from '../../typings/openapi';
import { UserContext } from '../../walk';
import { isPathParameter, splitCamelCaseIntoWords } from '../../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2PathItem } from '../../typings/swagger';
import type { Oas3PathItem } from '../../typings/openapi';
import type { UserContext } from '../../walk';
const httpMethods = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];
export const NoHttpVerbsInPaths: Oas3Rule | Oas2Rule = ({ splitIntoWords }) => {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { Oas3Paths } from '../../typings/openapi';
import { Oas2Paths } from '../../typings/swagger';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas3Paths } from '../../typings/openapi';
import type { Oas2Paths } from '../../typings/swagger';
export const NoIdenticalPaths: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,8 @@
import { UserContext } from '../../walk';
import { Oas3Parameter } from '../../typings/openapi';
import { getAdditionalPropertiesOption, validateExample } from '../utils';
import type { UserContext } from '../../walk';
import type { Oas3Parameter } from '../../typings/openapi';
export const NoInvalidParameterExamples: any = (opts: any) => {
const allowAdditionalProperties = getAdditionalPropertiesOption(opts) ?? false;
return {

View File

@@ -1,5 +1,5 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const NoPathTrailingSlash: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,9 +1,10 @@
import { Oas2Rule, Oas3Rule } from '../../visitors';
import { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import { Oas2Schema } from 'core/src/typings/swagger';
import { UserContext } from 'core/src/walk';
import { isRef } from '../../ref-utils';
import type { Oas2Rule, Oas3Rule } from '../../visitors';
import type { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import type { Oas2Schema } from 'core/src/typings/swagger';
import type { UserContext } from 'core/src/walk';
export const NoRequiredSchemaPropertiesUndefined: Oas3Rule | Oas2Rule = () => {
return {
Schema: {

View File

@@ -1,7 +1,8 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { validateResponseCodes } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const Operation2xxResponse: Oas3Rule | Oas2Rule = ({ validateWebhooks }) => {
return {
Paths: {

View File

@@ -1,7 +1,8 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { validateResponseCodes } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const Operation4xxResponse: Oas3Rule | Oas2Rule = ({ validateWebhooks }) => {
return {
Paths: {

View File

@@ -1,8 +1,9 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { validateDefinedAndNonEmpty } from '../utils';
import { UserContext } from '../../walk';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
export const OperationDescription: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationIdUnique: Oas3Rule | Oas2Rule = () => {
const seenOperations = new Set();

View File

@@ -1,8 +1,9 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
// eslint-disable-next-line no-useless-escape
const validUrlSymbols = /^[A-Za-z0-9-._~:/?#\[\]@!\$&'()*+,;=]*$/;
export const OperationIdUrlSafe: Oas3Rule | Oas2Rule = () => {

View File

@@ -1,8 +1,9 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { validateDefinedAndNonEmpty } from '../utils';
import { UserContext } from '../../walk';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
export const OperationOperationId: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Parameter } from '../../typings/swagger';
import { Oas3Parameter } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Parameter } from '../../typings/swagger';
import type { Oas3Parameter } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationParametersUnique: Oas3Rule | Oas2Rule = () => {
let seenPathParams: Set<string>;

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationSingularTag: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,8 +1,9 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { validateDefinedAndNonEmpty } from '../utils';
import { UserContext } from '../../walk';
import { Oas2Operation } from '../../typings/swagger';
import { Oas3Operation } from '../../typings/openapi';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
export const OperationSummary: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Definition, Oas2Operation } from '../../typings/swagger';
import { Oas3Definition, Oas3Operation } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Definition, Oas2Operation } from '../../typings/swagger';
import type { Oas3Definition, Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationTagDefined: Oas3Rule | Oas2Rule = () => {
let definedTags: Set<string>;

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Parameter } from '../../typings/swagger';
import { Oas3Parameter } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Parameter } from '../../typings/swagger';
import type { Oas3Parameter } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const ParameterDescription: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,5 +1,5 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const PathDeclarationMustExist: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas2Rule, Oas3Rule } from '../../visitors';
import { Oas2PathItem } from '../../typings/swagger';
import { Oas3PathItem } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas2Rule, Oas3Rule } from '../../visitors';
import type { Oas2PathItem } from '../../typings/swagger';
import type { Oas3PathItem } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const PathExcludesPatterns: Oas3Rule | Oas2Rule = ({ patterns }) => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2PathItem } from '../../typings/swagger';
import { Oas3PathItem } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2PathItem } from '../../typings/swagger';
import type { Oas3PathItem } from '../../typings/openapi';
import type { UserContext } from '../../walk';
const defaultOrder = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];

View File

@@ -1,5 +1,5 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const PathNotIncludeQuery: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Parameter } from '../../typings/swagger';
import { Oas3Parameter } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Parameter } from '../../typings/swagger';
import type { Oas3Parameter } from '../../typings/openapi';
import type { UserContext } from '../../walk';
const pathRegex = /\{([a-zA-Z0-9_.-]+)\}+/g;

View File

@@ -1,8 +1,9 @@
import * as pluralize from 'pluralize';
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { isPathParameter } from '../../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const PathSegmentPlural: Oas3Rule | Oas2Rule = (opts) => {
const { ignoreLastPathSegment, exceptions } = opts;
return {

View File

@@ -1,5 +1,5 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const PathsKebabCase: Oas3Rule | Oas2Rule = () => {
return {

View File

@@ -1,7 +1,7 @@
import { UserContext } from '../../walk';
import { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import { Oas2Schema } from 'core/src/typings/swagger';
import { Oas3Rule } from 'core/src/visitors';
import type { UserContext } from '../../walk';
import type { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import type { Oas2Schema } from 'core/src/typings/swagger';
import type { Oas3Rule } from 'core/src/visitors';
export const RequiredStringPropertyMissingMinLength: Oas3Rule = () => {
let skipSchemaProperties: boolean;

View File

@@ -1,9 +1,10 @@
import { Oas2Rule, Oas3Rule } from '../../visitors';
import { UserContext } from '../../walk';
import { Oas3Response } from '../../typings/openapi';
import { Oas2Response } from '../../typings/swagger';
import { getMatchingStatusCodeRange } from '../../utils';
import type { Oas2Rule, Oas3Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas3Response } from '../../typings/openapi';
import type { Oas2Response } from '../../typings/swagger';
export const ResponseContainsHeader: Oas3Rule | Oas2Rule = (options) => {
const names: Record<string, string[]> = options.names || {};
return {

View File

@@ -1,8 +1,9 @@
import { SpecVersion } from '../../oas-types';
import type { Oas2Rule, Oas3Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas2Schema } from '../../typings/swagger';
import type { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import { SpecVersion } from '../../oas-types';
const SCALAR_TYPES = ['string', 'integer', 'number', 'boolean', 'null'];

View File

@@ -1,13 +1,13 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Location } from '../../ref-utils';
import { UserContext } from '../../walk';
import {
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Location } from '../../ref-utils';
import type { UserContext } from '../../walk';
import type {
Oas2Definition,
Oas2Operation,
Oas2PathItem,
Oas2SecurityScheme,
} from '../../typings/swagger';
import {
import type {
Oas3Definition,
Oas3Operation,
Oas3PathItem,

View File

@@ -1,6 +1,7 @@
import { Oas2Rule, Oas3Rule } from '../../visitors';
import { isRef } from '../../ref-utils';
import type { Oas2Rule, Oas3Rule } from '../../visitors';
export const SpecStrictRefs: Oas3Rule | Oas2Rule = () => {
const nodesToSkip = [
'Schema',

View File

@@ -1,9 +1,10 @@
import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, ArazzoRule } from '../../visitors';
import { isNamedType, SpecExtension } from '../../types';
import { oasTypeOf, matchesJsonSchemaType, getSuggest, validateSchemaEnumType } from '../utils';
import { isRef } from '../../ref-utils';
import { isPlainObject } from '../../utils';
import { UserContext } from '../../walk';
import type { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, ArazzoRule } from '../../visitors';
export const Spec: Oas3Rule | Oas2Rule | Async2Rule | Async3Rule | ArazzoRule = () => {
return {

View File

@@ -1,6 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { validateDefinedAndNonEmpty } from '../utils';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
export const TagDescription: Oas3Rule | Oas2Rule = () => {
return {
Tag(tag, ctx) {

View File

@@ -1,7 +1,7 @@
import { Oas3Rule, Oas2Rule } from '../../visitors';
import { Oas2Definition, Oas2Tag } from '../../typings/swagger';
import { Oas3Definition, Oas3Tag } from '../../typings/openapi';
import { UserContext } from '../../walk';
import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Definition, Oas2Tag } from '../../typings/swagger';
import type { Oas3Definition, Oas3Tag } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const TagsAlphabetical: Oas3Rule | Oas2Rule = ({ ignoreCase = false }) => {
return {

View File

@@ -1,7 +1,8 @@
import { Oas3Rule } from '../visitors';
import { YamlParseError } from '../resolve';
import { ResolveResult, Problem } from '../walk';
import { Location } from '../ref-utils';
import type { Oas3Rule } from '../visitors';
import type { ResolveResult, Problem } from '../walk';
import type { Location } from '../ref-utils';
export const NoUnresolvedRefs: Oas3Rule = () => {
return {

View File

@@ -1,4 +1,4 @@
import { Oas2Rule } from '../../visitors';
import type { Oas2Rule } from '../../visitors';
export type BooleanParameterPrefixesOptions = {
prefixes?: string[];

Some files were not shown because too many files have changed in this diff Show More