Skip to content

Commit

Permalink
Merge a1eb1fb into f098b51
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Aug 24, 2020
2 parents f098b51 + a1eb1fb commit c17bb9a
Show file tree
Hide file tree
Showing 156 changed files with 4,887 additions and 4,030 deletions.
92 changes: 68 additions & 24 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,74 @@
extends: eslint:recommended
parserOptions:
ecmaVersion: 6
env:
es6: true
node: true
browser: true
extends:
- "eslint:recommended"
- prettier
parserOptions:
ecmaVersion: 2018
sourceType: module
overrides:
- files: ["*.ts"]
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
- "prettier/@typescript-eslint"
parser: "@typescript-eslint/parser"
parserOptions:
project: ["./tsconfig.json"]
plugins: ["@typescript-eslint"]
rules:
no-var: 0
"@typescript-eslint/restrict-template-expressions": [error, allowBoolean: true]
"@typescript-eslint/ban-types": off
"@typescript-eslint/no-empty-interface": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-unsafe-call": off
"@typescript-eslint/no-unsafe-member-access": off
"@typescript-eslint/no-unsafe-assignment": off
"@typescript-eslint/restrict-plus-operands": off
"@typescript-eslint/no-unsafe-return": off
"@typescript-eslint/no-var-requires": off
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/no-this-alias": off
"@typescript-eslint/no-implied-eval": off
rules:
block-scoped-var: 2
callback-return: 2
complexity: [2, 16]
curly: [2, multi-or-nest, consistent]
dot-location: [2, property]
dot-notation: 2
linebreak-style: [2, unix]
new-cap: 2
no-console: [2, allow: [warn, error]]
no-else-return: 2
no-eq-null: 2
no-extra-semi: 0
no-fallthrough: 2
no-invalid-this: 2
no-return-assign: 2
no-shadow: 1
no-trailing-spaces: 2
no-use-before-define: [2, nofunc]
block-scoped-var: error
callback-return: error
complexity: [error, 17]
curly: [error, multi-line, consistent]
dot-location: [error, property]
dot-notation: error
eqeqeq: [error, smart]
id-match: error
linebreak-style: [error, unix]
new-cap: error
no-console: [error, allow: [warn, error]]
no-debugger: error
no-duplicate-imports: error
no-else-return: error
no-eq-null: error
no-eval: error
no-fallthrough: error
no-invalid-this: error
no-new-wrappers: error
no-path-concat: error
no-redeclare: error
no-return-assign: error
no-sequences: error
no-shadow: warn
no-template-curly-in-string: error
no-trailing-spaces: error
no-undef-init: error
no-use-before-define: [error, nofunc]
prefer-arrow-callback: error
prefer-const: error
radix: error
semi: 0
strict: [2, global]
valid-jsdoc: [2, requireReturn: false]
valid-jsdoc: [error, requireReturn: false]
no-control-regex: 0
no-useless-escape: 2
no-useless-escape: error
no-void: error
# no-var: error
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,9 +1128,9 @@ Defaults:
inlineRefs: true,
passContext: false,
loopRequired: Infinity,
loopEnum: Infinity,
ownProperties: false,
multipleOfPrecision: false,
errorDataPath: 'object', // deprecated
messages: true,
sourceCode: false,
processCode: undefined, // function (str: string, schema: object): string {}
Expand Down Expand Up @@ -1230,9 +1230,9 @@ Defaults:
- integer number - to limit the maximum number of keywords of the schema that will be inlined.
- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance.
- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance.
- _loopEnum_: by default `enum` keyword is compiled into a single expression. In case of a very large number of allowed values it may result in a large validation function. Pass integer to set the number of values above which `enum` keyword will be validated in a loop.
- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst.
- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations).
- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`.
- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)).
- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call).
- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options:
Expand Down
16 changes: 8 additions & 8 deletions lib/ajv.d.ts → lib/ajv.d._ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
declare var ajv: {
(options?: ajv.Options): ajv.Ajv
new (options?: ajv.Options): ajv.Ajv
ValidationError: typeof AjvErrors.ValidationError
MissingRefError: typeof AjvErrors.MissingRefError
$dataMetaSchema: object
}

declare namespace AjvErrors {
class ValidationError extends Error {
constructor(errors: Array<ajv.ErrorObject>)
Expand All @@ -26,6 +18,14 @@ declare namespace AjvErrors {
}
}

declare const ajv: {
(options?: ajv.Options): ajv.Ajv
new (options?: ajv.Options): ajv.Ajv
ValidationError: typeof AjvErrors.ValidationError
MissingRefError: typeof AjvErrors.MissingRefError
$dataMetaSchema: object
}

declare namespace ajv {
type ValidationError = AjvErrors.ValidationError

Expand Down
Loading

0 comments on commit c17bb9a

Please sign in to comment.