@alexlit/lint-kit 117.3.0 → 117.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/config-eslint/package.json +5 -9
- package/packages/config-eslint/plugins/no-await-in-promise.js +1 -1
- package/packages/config-eslint/utils/create-config.js +3 -3
- package/scripts/.config.sh +1 -1
- package/packages/config-eslint/node_modules/@eslint/eslintrc/LICENSE +0 -19
- package/packages/config-eslint/node_modules/@eslint/eslintrc/README.md +0 -126
- package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +0 -79
- package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/environments.js +0 -215
- package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1143
- package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
- package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4371
- package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +0 -532
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +0 -510
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +0 -124
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +0 -145
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +0 -238
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +0 -19
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +0 -225
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +0 -1155
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +0 -318
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +0 -29
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index.js +0 -58
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +0 -191
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +0 -135
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +0 -370
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +0 -63
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +0 -96
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +0 -42
- package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +0 -149
- package/packages/config-eslint/node_modules/@eslint/eslintrc/package.json +0 -82
- package/packages/config-eslint/node_modules/@eslint/eslintrc/universal.js +0 -9
- package/packages/config-eslint/node_modules/ajv/.tonic_example.js +0 -20
- package/packages/config-eslint/node_modules/ajv/LICENSE +0 -22
- package/packages/config-eslint/node_modules/ajv/README.md +0 -1497
- package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +0 -7189
- package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +0 -3
- package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +0 -1
- package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +0 -397
- package/packages/config-eslint/node_modules/ajv/lib/ajv.js +0 -506
- package/packages/config-eslint/node_modules/ajv/lib/cache.js +0 -26
- package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +0 -90
- package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +0 -5
- package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +0 -34
- package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +0 -142
- package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +0 -387
- package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +0 -270
- package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +0 -66
- package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +0 -9
- package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +0 -20
- package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +0 -239
- package/packages/config-eslint/node_modules/ajv/lib/data.js +0 -49
- package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +0 -37
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +0 -113
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +0 -12
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +0 -12
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +0 -12
- package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +0 -32
- package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +0 -46
- package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +0 -51
- package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +0 -9
- package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +0 -11
- package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +0 -55
- package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +0 -191
- package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +0 -47
- package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +0 -203
- package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +0 -79
- package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +0 -30
- package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +0 -194
- package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +0 -106
- package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +0 -73
- package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +0 -98
- package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +0 -39
- package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +0 -22
- package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +0 -43
- package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +0 -54
- package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +0 -14
- package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +0 -245
- package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +0 -52
- package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +0 -85
- package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +0 -108
- package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +0 -62
- package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +0 -276
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +0 -3
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +0 -163
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +0 -80
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +0 -85
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -80
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +0 -42
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +0 -73
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +0 -14
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +0 -56
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +0 -81
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +0 -228
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +0 -168
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +0 -66
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +0 -150
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +0 -103
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +0 -33
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +0 -140
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +0 -80
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +0 -84
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +0 -73
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +0 -75
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +0 -335
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +0 -81
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +0 -124
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +0 -270
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -86
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +0 -482
- package/packages/config-eslint/node_modules/ajv/lib/keyword.js +0 -146
- package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +0 -17
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +0 -149
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +0 -154
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +0 -168
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +0 -94
- package/packages/config-eslint/node_modules/ajv/package.json +0 -106
- package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +0 -3
- package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +0 -61
- package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +0 -73
- package/packages/config-eslint/node_modules/ajv/scripts/info +0 -10
- package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +0 -12
- package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +0 -32
- package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +0 -23
- package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +0 -201
- package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +0 -105
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +0 -384
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +0 -27
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +0 -16
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +0 -12
- package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +0 -65
- package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +0 -315
- package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +0 -74
- package/packages/config-eslint/node_modules/espree/LICENSE +0 -25
- package/packages/config-eslint/node_modules/espree/README.md +0 -244
- package/packages/config-eslint/node_modules/espree/dist/espree.cjs +0 -883
- package/packages/config-eslint/node_modules/espree/espree.js +0 -177
- package/packages/config-eslint/node_modules/espree/lib/espree.js +0 -349
- package/packages/config-eslint/node_modules/espree/lib/features.js +0 -27
- package/packages/config-eslint/node_modules/espree/lib/options.js +0 -123
- package/packages/config-eslint/node_modules/espree/lib/token-translator.js +0 -263
- package/packages/config-eslint/node_modules/espree/lib/version.js +0 -3
- package/packages/config-eslint/node_modules/espree/package.json +0 -86
- package/packages/config-eslint/node_modules/globals/globals.json +0 -1998
- package/packages/config-eslint/node_modules/globals/index.d.ts +0 -2077
- package/packages/config-eslint/node_modules/globals/index.js +0 -2
- package/packages/config-eslint/node_modules/globals/license +0 -9
- package/packages/config-eslint/node_modules/globals/package.json +0 -58
- package/packages/config-eslint/node_modules/globals/readme.md +0 -44
- package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +0 -27
- package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +0 -8
- package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +0 -21
- package/packages/config-eslint/node_modules/json-schema-traverse/README.md +0 -83
- package/packages/config-eslint/node_modules/json-schema-traverse/index.js +0 -89
- package/packages/config-eslint/node_modules/json-schema-traverse/package.json +0 -43
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +0 -6
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +0 -125
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +0 -171
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "globals",
|
|
3
|
-
"version": "14.0.0",
|
|
4
|
-
"description": "Global identifiers from different JavaScript environments",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/globals",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"sideEffects": false,
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=18"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"test": "xo && ava && tsd",
|
|
19
|
-
"prepare": "npm run --silent update-types",
|
|
20
|
-
"update-builtin-globals": "node scripts/get-builtin-globals.mjs",
|
|
21
|
-
"update-types": "node scripts/generate-types.mjs > index.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"index.js",
|
|
25
|
-
"index.d.ts",
|
|
26
|
-
"globals.json"
|
|
27
|
-
],
|
|
28
|
-
"keywords": [
|
|
29
|
-
"globals",
|
|
30
|
-
"global",
|
|
31
|
-
"identifiers",
|
|
32
|
-
"variables",
|
|
33
|
-
"vars",
|
|
34
|
-
"jshint",
|
|
35
|
-
"eslint",
|
|
36
|
-
"environments"
|
|
37
|
-
],
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"ava": "^2.4.0",
|
|
40
|
-
"cheerio": "^1.0.0-rc.12",
|
|
41
|
-
"tsd": "^0.30.4",
|
|
42
|
-
"type-fest": "^4.10.2",
|
|
43
|
-
"xo": "^0.36.1"
|
|
44
|
-
},
|
|
45
|
-
"xo": {
|
|
46
|
-
"ignores": [
|
|
47
|
-
"get-browser-globals.js"
|
|
48
|
-
],
|
|
49
|
-
"rules": {
|
|
50
|
-
"node/no-unsupported-features/es-syntax": "off"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"tsd": {
|
|
54
|
-
"compilerOptions": {
|
|
55
|
-
"resolveJsonModule": true
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# globals
|
|
2
|
-
|
|
3
|
-
> Global identifiers from different JavaScript environments
|
|
4
|
-
|
|
5
|
-
It's just a [JSON file](globals.json), so use it in any environment.
|
|
6
|
-
|
|
7
|
-
This package is used by ESLint.
|
|
8
|
-
|
|
9
|
-
**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
npm install globals
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
const globals = require('globals');
|
|
21
|
-
|
|
22
|
-
console.log(globals.browser);
|
|
23
|
-
/*
|
|
24
|
-
{
|
|
25
|
-
addEventListener: false,
|
|
26
|
-
applicationCache: false,
|
|
27
|
-
ArrayBuffer: false,
|
|
28
|
-
atob: false,
|
|
29
|
-
…
|
|
30
|
-
}
|
|
31
|
-
*/
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise.
|
|
35
|
-
|
|
36
|
-
For Node.js this package provides two sets of globals:
|
|
37
|
-
|
|
38
|
-
- `globals.nodeBuiltin`: Globals available to all code running in Node.js.
|
|
39
|
-
These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
|
|
40
|
-
See: https://nodejs.org/api/globals.html
|
|
41
|
-
- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope").
|
|
42
|
-
See: https://nodejs.org/api/modules.html#modules_the_module_scope
|
|
43
|
-
|
|
44
|
-
When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
extends: eslint:recommended
|
|
2
|
-
env:
|
|
3
|
-
node: true
|
|
4
|
-
browser: true
|
|
5
|
-
rules:
|
|
6
|
-
block-scoped-var: 2
|
|
7
|
-
complexity: [2, 13]
|
|
8
|
-
curly: [2, multi-or-nest, consistent]
|
|
9
|
-
dot-location: [2, property]
|
|
10
|
-
dot-notation: 2
|
|
11
|
-
indent: [2, 2, SwitchCase: 1]
|
|
12
|
-
linebreak-style: [2, unix]
|
|
13
|
-
new-cap: 2
|
|
14
|
-
no-console: [2, allow: [warn, error]]
|
|
15
|
-
no-else-return: 2
|
|
16
|
-
no-eq-null: 2
|
|
17
|
-
no-fallthrough: 2
|
|
18
|
-
no-invalid-this: 2
|
|
19
|
-
no-return-assign: 2
|
|
20
|
-
no-shadow: 1
|
|
21
|
-
no-trailing-spaces: 2
|
|
22
|
-
no-use-before-define: [2, nofunc]
|
|
23
|
-
quotes: [2, single, avoid-escape]
|
|
24
|
-
semi: [2, always]
|
|
25
|
-
strict: [2, global]
|
|
26
|
-
valid-jsdoc: [2, requireReturn: false]
|
|
27
|
-
no-control-regex: 0
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 Evgeny Poberezkin
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# json-schema-traverse
|
|
2
|
-
Traverse JSON Schema passing each schema object to callback
|
|
3
|
-
|
|
4
|
-
[](https://travis-ci.org/epoberezkin/json-schema-traverse)
|
|
5
|
-
[](https://www.npmjs.com/package/json-schema-traverse)
|
|
6
|
-
[](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install json-schema-traverse
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Usage
|
|
17
|
-
|
|
18
|
-
```javascript
|
|
19
|
-
const traverse = require('json-schema-traverse');
|
|
20
|
-
const schema = {
|
|
21
|
-
properties: {
|
|
22
|
-
foo: {type: 'string'},
|
|
23
|
-
bar: {type: 'integer'}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
traverse(schema, {cb});
|
|
28
|
-
// cb is called 3 times with:
|
|
29
|
-
// 1. root schema
|
|
30
|
-
// 2. {type: 'string'}
|
|
31
|
-
// 3. {type: 'integer'}
|
|
32
|
-
|
|
33
|
-
// Or:
|
|
34
|
-
|
|
35
|
-
traverse(schema, {cb: {pre, post}});
|
|
36
|
-
// pre is called 3 times with:
|
|
37
|
-
// 1. root schema
|
|
38
|
-
// 2. {type: 'string'}
|
|
39
|
-
// 3. {type: 'integer'}
|
|
40
|
-
//
|
|
41
|
-
// post is called 3 times with:
|
|
42
|
-
// 1. {type: 'string'}
|
|
43
|
-
// 2. {type: 'integer'}
|
|
44
|
-
// 3. root schema
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed.
|
|
49
|
-
|
|
50
|
-
Callback is passed these parameters:
|
|
51
|
-
|
|
52
|
-
- _schema_: the current schema object
|
|
53
|
-
- _JSON pointer_: from the root schema to the current schema object
|
|
54
|
-
- _root schema_: the schema passed to `traverse` object
|
|
55
|
-
- _parent JSON pointer_: from the root schema to the parent schema object (see below)
|
|
56
|
-
- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.)
|
|
57
|
-
- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema
|
|
58
|
-
- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Traverse objects in all unknown keywords
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
const traverse = require('json-schema-traverse');
|
|
65
|
-
const schema = {
|
|
66
|
-
mySchema: {
|
|
67
|
-
minimum: 1,
|
|
68
|
-
maximum: 2
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
traverse(schema, {allKeys: true, cb});
|
|
73
|
-
// cb is called 2 times with:
|
|
74
|
-
// 1. root schema
|
|
75
|
-
// 2. mySchema
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Without option `allKeys: true` callback will be called only with root schema.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## License
|
|
82
|
-
|
|
83
|
-
[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE)
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var traverse = module.exports = function (schema, opts, cb) {
|
|
4
|
-
// Legacy support for v0.3.1 and earlier.
|
|
5
|
-
if (typeof opts == 'function') {
|
|
6
|
-
cb = opts;
|
|
7
|
-
opts = {};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
cb = opts.cb || cb;
|
|
11
|
-
var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};
|
|
12
|
-
var post = cb.post || function() {};
|
|
13
|
-
|
|
14
|
-
_traverse(opts, pre, post, schema, '', schema);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
traverse.keywords = {
|
|
19
|
-
additionalItems: true,
|
|
20
|
-
items: true,
|
|
21
|
-
contains: true,
|
|
22
|
-
additionalProperties: true,
|
|
23
|
-
propertyNames: true,
|
|
24
|
-
not: true
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
traverse.arrayKeywords = {
|
|
28
|
-
items: true,
|
|
29
|
-
allOf: true,
|
|
30
|
-
anyOf: true,
|
|
31
|
-
oneOf: true
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
traverse.propsKeywords = {
|
|
35
|
-
definitions: true,
|
|
36
|
-
properties: true,
|
|
37
|
-
patternProperties: true,
|
|
38
|
-
dependencies: true
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
traverse.skipKeywords = {
|
|
42
|
-
default: true,
|
|
43
|
-
enum: true,
|
|
44
|
-
const: true,
|
|
45
|
-
required: true,
|
|
46
|
-
maximum: true,
|
|
47
|
-
minimum: true,
|
|
48
|
-
exclusiveMaximum: true,
|
|
49
|
-
exclusiveMinimum: true,
|
|
50
|
-
multipleOf: true,
|
|
51
|
-
maxLength: true,
|
|
52
|
-
minLength: true,
|
|
53
|
-
pattern: true,
|
|
54
|
-
format: true,
|
|
55
|
-
maxItems: true,
|
|
56
|
-
minItems: true,
|
|
57
|
-
uniqueItems: true,
|
|
58
|
-
maxProperties: true,
|
|
59
|
-
minProperties: true
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
64
|
-
if (schema && typeof schema == 'object' && !Array.isArray(schema)) {
|
|
65
|
-
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
66
|
-
for (var key in schema) {
|
|
67
|
-
var sch = schema[key];
|
|
68
|
-
if (Array.isArray(sch)) {
|
|
69
|
-
if (key in traverse.arrayKeywords) {
|
|
70
|
-
for (var i=0; i<sch.length; i++)
|
|
71
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
|
72
|
-
}
|
|
73
|
-
} else if (key in traverse.propsKeywords) {
|
|
74
|
-
if (sch && typeof sch == 'object') {
|
|
75
|
-
for (var prop in sch)
|
|
76
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
77
|
-
}
|
|
78
|
-
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
|
79
|
-
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
function escapeJsonPtr(str) {
|
|
88
|
-
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
89
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "json-schema-traverse",
|
|
3
|
-
"version": "0.4.1",
|
|
4
|
-
"description": "Traverse JSON Schema passing each schema object to callback",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"eslint": "eslint index.js spec",
|
|
8
|
-
"test-spec": "mocha spec -R spec",
|
|
9
|
-
"test": "npm run eslint && nyc npm run test-spec"
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/epoberezkin/json-schema-traverse.git"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"JSON-Schema",
|
|
17
|
-
"traverse",
|
|
18
|
-
"iterate"
|
|
19
|
-
],
|
|
20
|
-
"author": "Evgeny Poberezkin",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/epoberezkin/json-schema-traverse/issues"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/epoberezkin/json-schema-traverse#readme",
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"coveralls": "^2.13.1",
|
|
28
|
-
"eslint": "^3.19.0",
|
|
29
|
-
"mocha": "^3.4.2",
|
|
30
|
-
"nyc": "^11.0.2",
|
|
31
|
-
"pre-commit": "^1.2.2"
|
|
32
|
-
},
|
|
33
|
-
"nyc": {
|
|
34
|
-
"exclude": [
|
|
35
|
-
"**/spec/**",
|
|
36
|
-
"node_modules"
|
|
37
|
-
],
|
|
38
|
-
"reporter": [
|
|
39
|
-
"lcov",
|
|
40
|
-
"text-summary"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var schema = {
|
|
4
|
-
additionalItems: subschema('additionalItems'),
|
|
5
|
-
items: subschema('items'),
|
|
6
|
-
contains: subschema('contains'),
|
|
7
|
-
additionalProperties: subschema('additionalProperties'),
|
|
8
|
-
propertyNames: subschema('propertyNames'),
|
|
9
|
-
not: subschema('not'),
|
|
10
|
-
allOf: [
|
|
11
|
-
subschema('allOf_0'),
|
|
12
|
-
subschema('allOf_1'),
|
|
13
|
-
{
|
|
14
|
-
items: [
|
|
15
|
-
subschema('items_0'),
|
|
16
|
-
subschema('items_1'),
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
anyOf: [
|
|
21
|
-
subschema('anyOf_0'),
|
|
22
|
-
subschema('anyOf_1'),
|
|
23
|
-
],
|
|
24
|
-
oneOf: [
|
|
25
|
-
subschema('oneOf_0'),
|
|
26
|
-
subschema('oneOf_1'),
|
|
27
|
-
],
|
|
28
|
-
definitions: {
|
|
29
|
-
foo: subschema('definitions_foo'),
|
|
30
|
-
bar: subschema('definitions_bar'),
|
|
31
|
-
},
|
|
32
|
-
properties: {
|
|
33
|
-
foo: subschema('properties_foo'),
|
|
34
|
-
bar: subschema('properties_bar'),
|
|
35
|
-
},
|
|
36
|
-
patternProperties: {
|
|
37
|
-
foo: subschema('patternProperties_foo'),
|
|
38
|
-
bar: subschema('patternProperties_bar'),
|
|
39
|
-
},
|
|
40
|
-
dependencies: {
|
|
41
|
-
foo: subschema('dependencies_foo'),
|
|
42
|
-
bar: subschema('dependencies_bar'),
|
|
43
|
-
},
|
|
44
|
-
required: ['foo', 'bar']
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function subschema(keyword) {
|
|
49
|
-
var sch = {
|
|
50
|
-
properties: {},
|
|
51
|
-
additionalProperties: false,
|
|
52
|
-
additionalItems: false,
|
|
53
|
-
anyOf: [
|
|
54
|
-
{format: 'email'},
|
|
55
|
-
{format: 'hostname'}
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
sch.properties['foo_' + keyword] = {title: 'foo'};
|
|
59
|
-
sch.properties['bar_' + keyword] = {title: 'bar'};
|
|
60
|
-
return sch;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
module.exports = {
|
|
65
|
-
schema: schema,
|
|
66
|
-
|
|
67
|
-
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
|
68
|
-
expectedCalls: [[schema, '', schema, undefined, undefined, undefined, undefined]]
|
|
69
|
-
.concat(expectedCalls('additionalItems'))
|
|
70
|
-
.concat(expectedCalls('items'))
|
|
71
|
-
.concat(expectedCalls('contains'))
|
|
72
|
-
.concat(expectedCalls('additionalProperties'))
|
|
73
|
-
.concat(expectedCalls('propertyNames'))
|
|
74
|
-
.concat(expectedCalls('not'))
|
|
75
|
-
.concat(expectedCallsChild('allOf', 0))
|
|
76
|
-
.concat(expectedCallsChild('allOf', 1))
|
|
77
|
-
.concat([
|
|
78
|
-
[schema.allOf[2], '/allOf/2', schema, '', 'allOf', schema, 2],
|
|
79
|
-
[schema.allOf[2].items[0], '/allOf/2/items/0', schema, '/allOf/2', 'items', schema.allOf[2], 0],
|
|
80
|
-
[schema.allOf[2].items[0].properties.foo_items_0, '/allOf/2/items/0/properties/foo_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'foo_items_0'],
|
|
81
|
-
[schema.allOf[2].items[0].properties.bar_items_0, '/allOf/2/items/0/properties/bar_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'bar_items_0'],
|
|
82
|
-
[schema.allOf[2].items[0].anyOf[0], '/allOf/2/items/0/anyOf/0', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 0],
|
|
83
|
-
[schema.allOf[2].items[0].anyOf[1], '/allOf/2/items/0/anyOf/1', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 1],
|
|
84
|
-
|
|
85
|
-
[schema.allOf[2].items[1], '/allOf/2/items/1', schema, '/allOf/2', 'items', schema.allOf[2], 1],
|
|
86
|
-
[schema.allOf[2].items[1].properties.foo_items_1, '/allOf/2/items/1/properties/foo_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'foo_items_1'],
|
|
87
|
-
[schema.allOf[2].items[1].properties.bar_items_1, '/allOf/2/items/1/properties/bar_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'bar_items_1'],
|
|
88
|
-
[schema.allOf[2].items[1].anyOf[0], '/allOf/2/items/1/anyOf/0', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 0],
|
|
89
|
-
[schema.allOf[2].items[1].anyOf[1], '/allOf/2/items/1/anyOf/1', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 1]
|
|
90
|
-
])
|
|
91
|
-
.concat(expectedCallsChild('anyOf', 0))
|
|
92
|
-
.concat(expectedCallsChild('anyOf', 1))
|
|
93
|
-
.concat(expectedCallsChild('oneOf', 0))
|
|
94
|
-
.concat(expectedCallsChild('oneOf', 1))
|
|
95
|
-
.concat(expectedCallsChild('definitions', 'foo'))
|
|
96
|
-
.concat(expectedCallsChild('definitions', 'bar'))
|
|
97
|
-
.concat(expectedCallsChild('properties', 'foo'))
|
|
98
|
-
.concat(expectedCallsChild('properties', 'bar'))
|
|
99
|
-
.concat(expectedCallsChild('patternProperties', 'foo'))
|
|
100
|
-
.concat(expectedCallsChild('patternProperties', 'bar'))
|
|
101
|
-
.concat(expectedCallsChild('dependencies', 'foo'))
|
|
102
|
-
.concat(expectedCallsChild('dependencies', 'bar'))
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
function expectedCalls(keyword) {
|
|
107
|
-
return [
|
|
108
|
-
[schema[keyword], `/${keyword}`, schema, '', keyword, schema, undefined],
|
|
109
|
-
[schema[keyword].properties[`foo_${keyword}`], `/${keyword}/properties/foo_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `foo_${keyword}`],
|
|
110
|
-
[schema[keyword].properties[`bar_${keyword}`], `/${keyword}/properties/bar_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `bar_${keyword}`],
|
|
111
|
-
[schema[keyword].anyOf[0], `/${keyword}/anyOf/0`, schema, `/${keyword}`, 'anyOf', schema[keyword], 0],
|
|
112
|
-
[schema[keyword].anyOf[1], `/${keyword}/anyOf/1`, schema, `/${keyword}`, 'anyOf', schema[keyword], 1]
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
function expectedCallsChild(keyword, i) {
|
|
118
|
-
return [
|
|
119
|
-
[schema[keyword][i], `/${keyword}/${i}`, schema, '', keyword, schema, i],
|
|
120
|
-
[schema[keyword][i].properties[`foo_${keyword}_${i}`], `/${keyword}/${i}/properties/foo_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `foo_${keyword}_${i}`],
|
|
121
|
-
[schema[keyword][i].properties[`bar_${keyword}_${i}`], `/${keyword}/${i}/properties/bar_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `bar_${keyword}_${i}`],
|
|
122
|
-
[schema[keyword][i].anyOf[0], `/${keyword}/${i}/anyOf/0`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 0],
|
|
123
|
-
[schema[keyword][i].anyOf[1], `/${keyword}/${i}/anyOf/1`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 1]
|
|
124
|
-
];
|
|
125
|
-
}
|