tools: update ESLint to 7.31.0

Update ESLint to 7.31.0

PR-URL: https://github.com/nodejs/node/pull/39424
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
cjihrig
2021-07-17 23:17:23 -04:00
parent 72ccf9f532
commit 31e8c63a73
28 changed files with 143 additions and 290 deletions

42
tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/LICENSE generated vendored Normal file → Executable file
View File

@@ -1,21 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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
MIT License
Copyright (c) Microsoft Corporation.
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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

10
tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/README.md generated vendored Normal file → Executable file
View File

@@ -5,12 +5,12 @@
This package contains type definitions for Mdast (https://github.com/syntax-tree/mdast).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast.
Additional Details
* Last updated: Sat, 07 Sep 2019 00:45:19 GMT
* Dependencies: @types/unist
### Additional Details
* Last updated: Fri, 16 Jul 2021 17:31:26 GMT
* Dependencies: [@types/unist](https://npmjs.com/package/@types/unist)
* Global values: none
# Credits
These definitions were written by Jun Lu <https://github.com/lujun2>.
These definitions were written by [Christian Murphy](https://github.com/ChristianMurphy), [Jun Lu](https://github.com/lujun2), [Remco Haszing](https://github.com/remcohaszing), and [Titus Wormer](https://github.com/wooorm).

24
tools/node_modules/eslint-plugin-markdown/node_modules/@types/mdast/package.json generated vendored Normal file → Executable file
View File

@@ -1,17 +1,33 @@
{
"name": "@types/mdast",
"version": "3.0.3",
"version": "3.0.7",
"description": "TypeScript definitions for Mdast",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast",
"license": "MIT",
"contributors": [
{
"name": "Christian Murphy",
"url": "https://github.com/ChristianMurphy",
"githubUsername": "ChristianMurphy"
},
{
"name": "Jun Lu",
"url": "https://github.com/lujun2",
"githubUsername": "lujun2"
},
{
"name": "Remco Haszing",
"url": "https://github.com/remcohaszing",
"githubUsername": "remcohaszing"
},
{
"name": "Titus Wormer",
"url": "https://github.com/wooorm",
"githubUsername": "wooorm"
}
],
"main": "",
"types": "index",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
@@ -21,6 +37,6 @@
"dependencies": {
"@types/unist": "*"
},
"typesPublisherContentHash": "14d7fdbd7f31ef3975bd5e967ada84235c102b1be369cba397ced8b95ebe4e57",
"typeScriptVersion": "3.0"
"typesPublisherContentHash": "666079441041567c5bdfa2b8ff46e900b18d544357be5b8cdcecfb412129e903",
"typeScriptVersion": "3.6"
}

View File

@@ -6,113 +6,11 @@ This package contains type definitions for Unist (https://github.com/syntax-tree
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/index.d.ts)
````ts
// Type definitions for non-npm package Unist 2.0
// Project: https://github.com/syntax-tree/unist
// Definitions by: bizen241 <https://github.com/bizen241>
// Jun Lu <https://github.com/lujun2>
// Hernan Rajchert <https://github.com/hrajchert>
// Titus Wormer <https://github.com/wooorm>
// Junyoung Choi <https://github.com/rokt33r>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/**
* Syntactic units in unist syntax trees are called nodes.
*/
export interface Node {
/**
* The variant of a node.
*/
type: string;
/**
* Information from the ecosystem.
*/
data?: Data | undefined;
/**
* Location of a node in a source document.
* Must not be present if a node is generated.
*/
position?: Position | undefined;
[key: string]: unknown;
}
/**
* Information associated by the ecosystem with the node.
* Space is guaranteed to never be specified by unist or specifications
* implementing unist.
*/
export interface Data {
[key: string]: unknown;
}
/**
* Location of a node in a source file.
*/
export interface Position {
/**
* Place of the first character of the parsed source region.
*/
start: Point;
/**
* Place of the first character after the parsed source region.
*/
end: Point;
/**
* Start column at each index (plus start line) in the source region,
* for elements that span multiple lines.
*/
indent?: number[] | undefined;
}
/**
* One place in a source file.
*/
export interface Point {
/**
* Line in a source file (1-indexed integer).
*/
line: number;
/**
* Column in a source file (1-indexed integer).
*/
column: number;
/**
* Character in a source file (0-indexed integer).
*/
offset?: number | undefined;
}
/**
* Nodes containing other nodes.
*/
export interface Parent extends Node {
/**
* List representing the children of a node.
*/
children: Node[];
}
/**
* Nodes containing a value.
*/
export interface Literal extends Node {
value: unknown;
}
````
### Additional Details
* Last updated: Fri, 02 Jul 2021 18:04:49 GMT
* Last updated: Thu, 15 Jul 2021 00:31:23 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), and [Junyoung Choi](https://github.com/rokt33r).
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), and [JounQin](https://github.com/JounQin).

View File

@@ -1,6 +1,6 @@
{
"name": "@types/unist",
"version": "2.0.4",
"version": "2.0.6",
"description": "TypeScript definitions for Unist",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
"license": "MIT",
@@ -29,6 +29,16 @@
"name": "Junyoung Choi",
"url": "https://github.com/rokt33r",
"githubUsername": "rokt33r"
},
{
"name": "Ben Moon",
"url": "https://github.com/GuiltyDolphin",
"githubUsername": "GuiltyDolphin"
},
{
"name": "JounQin",
"url": "https://github.com/JounQin",
"githubUsername": "JounQin"
}
],
"main": "",
@@ -40,6 +50,6 @@
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "373f3a8c09fdf9fa50470b9d6b720dbe014e0fe93cb797a34481c4231e8fab59",
"typesPublisherContentHash": "da5f2c3f967fa07869161991244bb7f9a237ac20494b902ffcb9108deb9b4e12",
"typeScriptVersion": "3.6"
}

View File

@@ -1,6 +1,6 @@
{
"name": "debug",
"version": "4.3.1",
"version": "4.3.2",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"

View File

@@ -60,6 +60,8 @@ function setup(env) {
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug(...args) {
// Disabled?
@@ -120,7 +122,17 @@ function setup(env) {
Object.defineProperty(debug, 'enabled', {
enumerable: true,
configurable: false,
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: v => {
enableOverride = v;
}
@@ -149,6 +161,7 @@ function setup(env) {
*/
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];

View File

@@ -288,7 +288,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://coinbase.com"><img src="https://avatars.githubusercontent.com/u/1885080?v=4" alt="Coinbase" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://retool.com/"><img src="https://images.opencollective.com/retool/98ea68e/logo.png" alt="Retool" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://www.practiceignition.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Practice Ignition" height="32"></a></p>
<p><a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://www.practiceignition.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Practice Ignition" height="32"></a></p>
<!--sponsorsend-->
## <a name="technology-sponsors"></a>Technology Sponsors

View File

@@ -104,18 +104,18 @@ module.exports = {
} else if (node.type === "ArrowFunctionExpression") {
// `=>` token
loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc.start;
loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc;
} else if (
node.parent.type === "MethodDefinition" ||
(node.parent.type === "Property" && node.parent.method)
) {
// Method name.
loc = node.parent.key.loc.start;
loc = node.parent.key.loc;
} else {
// Function name or `function` keyword.
loc = (node.id || node).loc.start;
loc = (node.id || context.getSourceCode().getFirstToken(node)).loc;
}
if (!name) {

View File

@@ -117,7 +117,7 @@ module.exports = {
],
messages: {
unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'."
unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'. Use parentheses to clarify the intended order of operations."
}
},

View File

@@ -76,8 +76,8 @@ module.exports = {
fixable: "code",
messages: {
replaced: "Assignment can be replaced with operator assignment.",
unexpected: "Unexpected operator assignment shorthand."
replaced: "Assignment (=) can be replaced with operator assignment ({{operator}}=).",
unexpected: "Unexpected operator assignment ({{operator}}=) shorthand."
}
},
@@ -113,6 +113,7 @@ module.exports = {
context.report({
node,
messageId: "replaced",
data: { operator },
fix(fixer) {
if (canBeFixed(left) && canBeFixed(expr.left)) {
const equalsToken = getOperatorToken(node);
@@ -139,7 +140,8 @@ module.exports = {
*/
context.report({
node,
messageId: "replaced"
messageId: "replaced",
data: { operator }
});
}
}
@@ -155,6 +157,7 @@ module.exports = {
context.report({
node,
messageId: "unexpected",
data: { operator: node.operator },
fix(fixer) {
if (canBeFixed(node.left)) {
const firstToken = sourceCode.getFirstToken(node);

View File

@@ -495,7 +495,7 @@ class ConfigArrayFactory {
basePath
);
if (fs.existsSync(ctx.filePath)) {
if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) {
let configData;
try {

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint/eslintrc",
"version": "0.4.2",
"version": "0.4.3",
"description": "The legacy ESLintRC config file format for ESLint",
"main": "lib/index.js",
"files": [
@@ -40,7 +40,7 @@
"eslint-plugin-jsdoc": "^32.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"fs-teardown": "^0.1.0",
"fs-teardown": "0.1.1",
"mocha": "^8.1.1",
"shelljs": "^0.8.4",
"sinon": "^9.2.0",

View File

@@ -2,7 +2,7 @@
"name": "acorn-jsx",
"description": "Modern, fast React.js JSX parser",
"homepage": "https://github.com/acornjs/acorn-jsx",
"version": "5.3.1",
"version": "5.3.2",
"maintainers": [
{
"name": "Ingvar Stepanyan",

View File

@@ -1,6 +1,6 @@
{
"name": "debug",
"version": "4.3.1",
"version": "4.3.2",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"

View File

@@ -60,6 +60,8 @@ function setup(env) {
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug(...args) {
// Disabled?
@@ -120,7 +122,17 @@ function setup(env) {
Object.defineProperty(debug, 'enabled', {
enumerable: true,
configurable: false,
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: v => {
enableOverride = v;
}
@@ -149,6 +161,7 @@ function setup(env) {
*/
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];

View File

@@ -1,6 +1,6 @@
# flatted
[![Downloads](https://img.shields.io/npm/dm/flatted.svg)](https://www.npmjs.com/package/flatted) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/flatted?branch=master) [![Build Status](https://travis-ci.org/WebReflection/flatted.svg?branch=master)](https://travis-ci.org/WebReflection/flatted) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) ![WebReflection status](https://offline.report/status/webreflection.svg)
[![Downloads](https://img.shields.io/npm/dm/flatted.svg)](https://www.npmjs.com/package/flatted) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/flatted?branch=main) [![Build Status](https://travis-ci.com/WebReflection/flatted.svg?branch=main)](https://travis-ci.com/WebReflection/flatted) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) ![WebReflection status](https://offline.report/status/webreflection.svg)
![snow flake](./flatted.jpg)

View File

@@ -1,6 +1,6 @@
{
"name": "flatted",
"version": "3.2.0",
"version": "3.2.1",
"description": "A super light and fast circular JSON parser.",
"unpkg": "min.js",
"types": "types.d.ts",
@@ -12,8 +12,9 @@
"rollup:babel": "rollup --config rollup/babel.config.js && sed -i.bck 's/^var /self./' index.js && rm -rf index.js.bck && drop-babel-typeof index.js",
"min": "terser index.js -c -m -o min.js",
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c;cat min.js | brotli | wc -c; cat es.js | brotli | wc -c",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "nyc node test/index.js"
"coveralls": "c8 report --reporter=text-lcov | coveralls",
"test": "c8 node test/index.js",
"test:php": "php php/test.php"
},
"repository": {
"type": "git",
@@ -36,13 +37,13 @@
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"ascjs": "^5.0.1",
"c8": "^7.7.3",
"circular-json": "^0.5.9",
"circular-json-es6": "^2.0.2",
"coveralls": "^3.1.1",
"drop-babel-typeof": "^1.0.3",
"jsan": "^3.1.13",
"nyc": "^15.1.0",
"rollup": "^2.52.6",
"rollup": "^2.52.8",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",

View File

@@ -1,118 +0,0 @@
<?php
error_reporting(E_ALL | E_STRICT);
require_once('flatted.php');
class console {
public static function assert($condition, $message) {
if (!$condition) {
echo $message."\n";
exit(1);
}
}
}
console::assert(Flatted::stringify([null, null]) === '[[null,null]]', 'multiple null failed');
$a = array();
$o = new stdClass;
console::assert(Flatted::stringify($a) === '[[]]', 'empty Array');
console::assert(Flatted::stringify($o) === '[{}]', 'empty Object');
$a[] = &$a;
$o->o = &$o;
console::assert(Flatted::stringify($a) === '[["0"]]', 'recursive Array');
console::assert(Flatted::stringify($o) === '[{"o":"0"}]', 'recursive Object');
$b = Flatted::parse(Flatted::stringify($a));
console::assert(is_array($b) && $b[0] === $b, 'restoring recursive Array');
$a[] = 1;
$a[] = 'two';
$a[] = true;
$o->one = 1;
$o->two = 'two';
$o->three = true;
console::assert(Flatted::stringify($a) === '[["0",1,"1",true],"two"]', 'values in Array');
console::assert(Flatted::stringify($o) === '[{"o":"0","one":1,"two":"1","three":true},"two"]', 'values in Object');
$a[] = &$o;
$o->a = &$a;
console::assert(Flatted::stringify($a) === '[["0",1,"1",true,"2"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0"}]', 'object in Array');
console::assert(Flatted::stringify($o) === '[{"o":"0","one":1,"two":"1","three":true,"a":"2"},"two",["2",1,"1",true,"0"]]', 'array in Object');
$a[] = array('test' => 'OK');
$a[] = [1, 2, 3];
$o->test = array('test' => 'OK');
$o->array = [1, 2, 3];
console::assert(Flatted::stringify($a) === '[["0",1,"1",true,"2","3","4"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0","test":"3","array":"4"},{"test":"5"},[1,2,3],"OK"]', 'objects in Array');
console::assert(Flatted::stringify($o) === '[{"o":"0","one":1,"two":"1","three":true,"a":"2","test":"3","array":"4"},"two",["2",1,"1",true,"0","3","4"],{"test":"5"},[1,2,3],"OK"]', 'objects in Object');
$a2 = Flatted::parse(Flatted::stringify($a));
$o2 = Flatted::parse(Flatted::stringify($o));
console::assert($a2[0] === $a2, 'parsed Array');
console::assert($o2->o === $o2, 'parsed Object');
console::assert(
$a2[1] === 1 &&
$a2[2] === 'two' &&
$a2[3] === true &&
$a2[4] instanceof stdClass &&
json_encode($a2[5]) === json_encode(array('test' => 'OK')) &&
json_encode($a2[6]) === json_encode([1, 2, 3]),
'array values are all OK'
);
console::assert($a2[4] === $a2[4]->o && $a2 === $a2[4]->o->a, 'array recursive values are OK');
console::assert(
$o2->one === 1 &&
$o2->two === 'two' &&
$o2->three === true &&
is_array($o2->a) &&
json_encode($o2->test) === json_encode(array('test' => 'OK')) &&
json_encode($o2->array) === json_encode([1, 2, 3]),
'object values are all OK'
);
console::assert($o2->a === $o2->a[0] && $o2 === $o2->a[4], 'object recursive values are OK');
console::assert(Flatted::parse(Flatted::stringify(1)) === 1, 'numbers can be parsed too');
console::assert(Flatted::parse(Flatted::stringify(false)) === false, 'booleans can be parsed too');
console::assert(Flatted::parse(Flatted::stringify(null)) === null, 'null can be parsed too');
console::assert(Flatted::parse(Flatted::stringify('test')) === 'test', 'strings can be parsed too');
$str = Flatted::parse('[{"prop":"1","a":"2","b":"3"},{"value":123},["4","5"],{"e":"6","t":"7","p":4},{},{"b":"8"},"f",{"a":"9"},["10"],"sup",{"a":1,"d":2,"c":"7","z":"11","h":1},{"g":2,"a":"7","b":"12","f":6},{"r":4,"u":"7","c":5}]');
console::assert(
$str->b->t->a === 'sup' &&
$str->a[1]->b[0]->c === $str->b->t,
'str is fine'
);
$oo = Flatted::parse('[{"a":"1","b":"0","c":"2"},{"aa":"3"},{"ca":"4","cb":"5","cc":"6","cd":"7","ce":"8","cf":"9"},{"aaa":"10"},{"caa":"4"},{"cba":"5"},{"cca":"2"},{"cda":"4"},"value2","value3","value1"]');
console::assert(
$oo->a->aa->aaa = 'value1'
&& $oo === $oo->b
&& $oo === $oo->b
&& $oo->c->ca->caa === $oo->c->ca
&& $oo->c->cb->cba === $oo->c->cb
&& $oo->c->cc->cca === $oo->c
&& $oo->c->cd->cda === $oo->c->ca->caa
&& $oo->c->ce === 'value2'
&& $oo->c->cf === 'value3',
'parse is correct'
);
echo "OK\n";
?>

View File

@@ -442,15 +442,24 @@
"CSSImportRule": false,
"CSSKeyframeRule": false,
"CSSKeyframesRule": false,
"CSSMatrixComponent": false,
"CSSMediaRule": false,
"CSSNamespaceRule": false,
"CSSPageRule": false,
"CSSPerspective": false,
"CSSRotate": false,
"CSSRule": false,
"CSSRuleList": false,
"CSSScale": false,
"CSSSkew": false,
"CSSSkewX": false,
"CSSSkewY": false,
"CSSStyleDeclaration": false,
"CSSStyleRule": false,
"CSSStyleSheet": false,
"CSSSupportsRule": false,
"CSSTransformValue": false,
"CSSTranslate": false,
"CustomElementRegistry": false,
"customElements": false,
"CustomEvent": false,

View File

@@ -1,6 +1,6 @@
{
"name": "globals",
"version": "13.9.0",
"version": "13.10.0",
"description": "Global identifiers from different JavaScript environments",
"license": "MIT",
"repository": "sindresorhus/globals",

View File

@@ -105,8 +105,8 @@ Performance of different validators by [json-schema-benchmark](https://github.co
- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6):
- all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html))
- [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions:
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.md#discriminator).
- keyword [nullable](https://ajv.js.org/json-schema.md#nullable).
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator).
- keyword [nullable](https://ajv.js.org/json-schema.html#nullable).
- full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available)
- support of recursive references between schemas
- correct string lengths for strings with unicode pairs
@@ -161,6 +161,11 @@ const schema = {
additionalProperties: false,
}
const data = {
foo: 1,
bar: "abc"
}
const validate = ajv.compile(schema)
const valid = validate(data)
if (!valid) console.log(validate.errors)

View File

@@ -5,7 +5,7 @@ const codegen_1 = require("./codegen");
const util_1 = require("./util");
const names_1 = require("./names");
exports.keywordError = {
message: ({ keyword }) => codegen_1.str `should pass "${keyword}" keyword validation`,
message: ({ keyword }) => codegen_1.str `must pass "${keyword}" keyword validation`,
};
exports.keyword$DataError = {
message: ({ keyword, schemaType }) => schemaType

View File

@@ -180,7 +180,7 @@ function serializeType(cxt) {
serializeString(cxt);
break;
case "timestamp":
gen.if(codegen_1._ `${data} instanceof Date`, () => gen.add(names_1.default.json, codegen_1._ `${data}.toISOString()`), () => serializeString(cxt));
gen.if(codegen_1._ `${data} instanceof Date`, () => gen.add(names_1.default.json, codegen_1._ `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt));
break;
default:
serializeNumber(cxt);

View File

@@ -303,7 +303,10 @@ class KeywordCxt {
}
}
result(condition, successAction, failAction) {
this.gen.if(codegen_1.not(condition));
this.failResult(codegen_1.not(condition), successAction, failAction);
}
failResult(condition, successAction, failAction) {
this.gen.if(condition);
if (failAction)
failAction();
else
@@ -322,7 +325,7 @@ class KeywordCxt {
}
}
pass(condition, failAction) {
this.result(condition, undefined, failAction);
this.failResult(codegen_1.not(condition), undefined, failAction);
}
fail(condition) {
if (condition === undefined) {

View File

@@ -18,7 +18,7 @@ const def = {
createErrors: false,
allErrors: false,
}, valid);
cxt.result(valid, () => cxt.error(), () => cxt.reset());
cxt.failResult(valid, () => cxt.reset(), () => cxt.error());
},
error: { message: "must NOT be valid" },
};

View File

@@ -1,6 +1,6 @@
{
"name": "ajv",
"version": "8.6.0",
"version": "8.6.2",
"description": "Another JSON Schema Validator",
"main": "dist/ajv.js",
"types": "dist/ajv.d.ts",
@@ -70,7 +70,7 @@
"@rollup/plugin-typescript": "^8.2.1",
"@types/chai": "^4.2.12",
"@types/mocha": "^8.0.3",
"@types/node": "^15.0.2",
"@types/node": "^16.3.2",
"@types/require-from-string": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
@@ -83,7 +83,7 @@
"eslint": "^7.8.1",
"eslint-config-prettier": "^7.0.0",
"glob": "^7.0.0",
"husky": "^6.0.0",
"husky": "^7.0.1",
"if-node-version": "^1.0.0",
"jimp": "^0.16.1",
"js-beautify": "^1.7.3",

View File

@@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "7.30.0",
"version": "7.31.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"description": "An AST-based pattern checker for JavaScript.",
"bin": {
@@ -44,7 +44,7 @@
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"@babel/code-frame": "7.12.11",
"@eslint/eslintrc": "^0.4.2",
"@eslint/eslintrc": "^0.4.3",
"@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
@@ -103,7 +103,7 @@
"eslint-release": "^2.0.0",
"eslump": "^3.0.0",
"esprima": "^4.0.1",
"fs-teardown": "^0.1.0",
"fs-teardown": "0.1.1",
"glob": "^7.1.6",
"jsdoc": "^3.5.5",
"karma": "^6.1.1",