mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tools: update ESLint to 7.24.0
Update ESLint to 7.24.0 PR-URL: https://github.com/nodejs/node/pull/38179 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
108
tools/node_modules/eslint-plugin-markdown/lib/processor.js
generated
vendored
108
tools/node_modules/eslint-plugin-markdown/lib/processor.js
generated
vendored
@@ -3,6 +3,25 @@
|
||||
* @author Brandon Mills
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('eslint/lib/shared/types').LintMessage} Message
|
||||
*
|
||||
* @typedef {Object} ASTNode
|
||||
* @property {string} type
|
||||
* @property {string} [lang]
|
||||
*
|
||||
* @typedef {Object} RangeMap
|
||||
* @property {number} js
|
||||
* @property {number} md
|
||||
*
|
||||
* @typedef {Object} BlockBase
|
||||
* @property {string} baseIndentText
|
||||
* @property {string[]} comments
|
||||
* @property {RangeMap[]} rangeMap
|
||||
*
|
||||
* @typedef {ASTNode & BlockBase} Block
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const unified = require("unified");
|
||||
@@ -16,31 +35,36 @@ const SUPPORTS_AUTOFIX = true;
|
||||
|
||||
const markdown = unified().use(remarkParse);
|
||||
|
||||
let blocks = [];
|
||||
/**
|
||||
* @type {Map<string, Block[]>}
|
||||
*/
|
||||
const blocksCache = new Map();
|
||||
|
||||
/**
|
||||
* Performs a depth-first traversal of the Markdown AST.
|
||||
* @param {ASTNode} node A Markdown AST node.
|
||||
* @param {Object} callbacks A map of node types to callbacks.
|
||||
* @param {Object} [parent] The node's parent AST node.
|
||||
* @param {{[key: string]: (node: ASTNode) => void}} callbacks A map of node types to callbacks.
|
||||
* @returns {void}
|
||||
*/
|
||||
function traverse(node, callbacks, parent) {
|
||||
function traverse(node, callbacks) {
|
||||
if (callbacks[node.type]) {
|
||||
callbacks[node.type](node, parent);
|
||||
callbacks[node.type](node);
|
||||
} else {
|
||||
callbacks["*"]();
|
||||
}
|
||||
|
||||
if (typeof node.children !== "undefined") {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
traverse(node.children[i], callbacks, node);
|
||||
traverse(node.children[i], callbacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts leading HTML comments to JS block comments.
|
||||
* Extracts `eslint-*` or `global` comments from HTML comments if present.
|
||||
* @param {string} html The text content of an HTML AST node.
|
||||
* @returns {string[]} An array of JS block comments.
|
||||
* @returns {string} The comment's text without the opening and closing tags or
|
||||
* an empty string if the text is not an ESLint HTML comment.
|
||||
*/
|
||||
function getComment(html) {
|
||||
const commentStart = "<!--";
|
||||
@@ -116,9 +140,9 @@ function getIndentText(text, node) {
|
||||
* delta at the beginning of each line.
|
||||
* @param {string} text The text of the file.
|
||||
* @param {ASTNode} node A Markdown code block AST node.
|
||||
* @param {comments} comments List of configuration comment strings that will be
|
||||
* @param {string[]} comments List of configuration comment strings that will be
|
||||
* inserted at the beginning of the code block.
|
||||
* @returns {Object[]} A list of offset-based adjustments, where lookups are
|
||||
* @returns {RangeMap[]} A list of offset-based adjustments, where lookups are
|
||||
* done based on the `js` key, which represents the range in the linted JS,
|
||||
* and the `md` key is the offset delta that, when added to the JS range,
|
||||
* returns the corresponding location in the original Markdown source.
|
||||
@@ -209,38 +233,46 @@ function getBlockRangeMap(text, node, comments) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts lintable JavaScript code blocks from Markdown text.
|
||||
* Extracts lintable code blocks from Markdown text.
|
||||
* @param {string} text The text of the file.
|
||||
* @returns {string[]} Source code strings to lint.
|
||||
* @param {string} filename The filename of the file
|
||||
* @returns {Array<{ filename: string, text: string }>} Source code blocks to lint.
|
||||
*/
|
||||
function preprocess(text) {
|
||||
function preprocess(text, filename) {
|
||||
const ast = markdown.parse(text);
|
||||
const blocks = [];
|
||||
|
||||
blocksCache.set(filename, blocks);
|
||||
|
||||
/**
|
||||
* During the depth-first traversal, keep track of any sequences of HTML
|
||||
* comment nodes containing `eslint-*` or `global` comments. If a code
|
||||
* block immediately follows such a sequence, insert the comments at the
|
||||
* top of the code block. Any non-ESLint comment or other node type breaks
|
||||
* and empties the sequence.
|
||||
* @type {string[]}
|
||||
*/
|
||||
let htmlComments = [];
|
||||
|
||||
blocks = [];
|
||||
traverse(ast, {
|
||||
code(node, parent) {
|
||||
const comments = [];
|
||||
|
||||
"*"() {
|
||||
htmlComments = [];
|
||||
},
|
||||
code(node) {
|
||||
if (node.lang) {
|
||||
let index = parent.children.indexOf(node) - 1;
|
||||
let previousNode = parent.children[index];
|
||||
|
||||
while (previousNode && previousNode.type === "html") {
|
||||
const comment = getComment(previousNode.value);
|
||||
|
||||
if (!comment) {
|
||||
break;
|
||||
}
|
||||
const comments = [];
|
||||
|
||||
for (const comment of htmlComments) {
|
||||
if (comment.trim() === "eslint-skip") {
|
||||
htmlComments = [];
|
||||
return;
|
||||
}
|
||||
|
||||
comments.unshift(`/*${comment}*/`);
|
||||
index--;
|
||||
previousNode = parent.children[index];
|
||||
comments.push(`/*${comment}*/`);
|
||||
}
|
||||
|
||||
htmlComments = [];
|
||||
|
||||
blocks.push({
|
||||
...node,
|
||||
baseIndentText: getIndentText(text, node),
|
||||
@@ -248,6 +280,15 @@ function preprocess(text) {
|
||||
rangeMap: getBlockRangeMap(text, node, comments)
|
||||
});
|
||||
}
|
||||
},
|
||||
html(node) {
|
||||
const comment = getComment(node.value);
|
||||
|
||||
if (comment) {
|
||||
htmlComments.push(comment);
|
||||
} else {
|
||||
htmlComments = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -264,7 +305,7 @@ function preprocess(text) {
|
||||
/**
|
||||
* Creates a map function that adjusts messages in a code block.
|
||||
* @param {Block} block A code block.
|
||||
* @returns {Function} A function that adjusts messages in a code block.
|
||||
* @returns {(message: Message) => Message} A function that adjusts messages in a code block.
|
||||
*/
|
||||
function adjustBlock(block) {
|
||||
const leadingCommentLines = block.comments.reduce((count, comment) => count + comment.split("\n").length, 0);
|
||||
@@ -332,9 +373,14 @@ function excludeUnsatisfiableRules(message) {
|
||||
* Transforms generated messages for output.
|
||||
* @param {Array<Message[]>} messages An array containing one array of messages
|
||||
* for each code block returned from `preprocess`.
|
||||
* @param {string} filename The filename of the file
|
||||
* @returns {Message[]} A flattened array of messages with mapped locations.
|
||||
*/
|
||||
function postprocess(messages) {
|
||||
function postprocess(messages, filename) {
|
||||
const blocks = blocksCache.get(filename);
|
||||
|
||||
blocksCache.delete(filename);
|
||||
|
||||
return [].concat(...messages.map((group, i) => {
|
||||
const adjust = adjustBlock(blocks[i]);
|
||||
|
||||
|
||||
2
tools/node_modules/eslint-plugin-markdown/package.json
generated
vendored
2
tools/node_modules/eslint-plugin-markdown/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint-plugin-markdown",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "An ESLint plugin to lint JavaScript in Markdown code fences.",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
|
||||
37
tools/node_modules/eslint/lib/rules/no-implicit-coercion.js
generated
vendored
37
tools/node_modules/eslint/lib/rules/no-implicit-coercion.js
generated
vendored
@@ -24,6 +24,7 @@ function parseOptions(options) {
|
||||
boolean: "boolean" in options ? options.boolean : true,
|
||||
number: "number" in options ? options.number : true,
|
||||
string: "string" in options ? options.string : true,
|
||||
disallowTemplateShorthand: "disallowTemplateShorthand" in options ? options.disallowTemplateShorthand : false,
|
||||
allow: options.allow || []
|
||||
};
|
||||
}
|
||||
@@ -180,6 +181,10 @@ module.exports = {
|
||||
type: "boolean",
|
||||
default: true
|
||||
},
|
||||
disallowTemplateShorthand: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
},
|
||||
allow: {
|
||||
type: "array",
|
||||
items: {
|
||||
@@ -299,6 +304,38 @@ module.exports = {
|
||||
|
||||
report(node, recommendation, true);
|
||||
}
|
||||
},
|
||||
|
||||
TemplateLiteral(node) {
|
||||
if (!options.disallowTemplateShorthand) {
|
||||
return;
|
||||
}
|
||||
|
||||
// tag`${foo}`
|
||||
if (node.parent.type === "TaggedTemplateExpression") {
|
||||
return;
|
||||
}
|
||||
|
||||
// `` or `${foo}${bar}`
|
||||
if (node.expressions.length !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// `prefix${foo}`
|
||||
if (node.quasis[0].value.cooked !== "") {
|
||||
return;
|
||||
}
|
||||
|
||||
// `${foo}postfix`
|
||||
if (node.quasis[1].value.cooked !== "") {
|
||||
return;
|
||||
}
|
||||
|
||||
const code = sourceCode.getText(node.expressions[0]);
|
||||
const recommendation = `String(${code})`;
|
||||
|
||||
report(node, recommendation, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
17
tools/node_modules/eslint/lib/rules/no-multi-assign.js
generated
vendored
17
tools/node_modules/eslint/lib/rules/no-multi-assign.js
generated
vendored
@@ -21,7 +21,16 @@ module.exports = {
|
||||
url: "https://eslint.org/docs/rules/no-multi-assign"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [{
|
||||
type: "object",
|
||||
properties: {
|
||||
ignoreNonDeclaration: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}],
|
||||
|
||||
messages: {
|
||||
unexpectedChain: "Unexpected chained assignment."
|
||||
@@ -33,10 +42,14 @@ module.exports = {
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
const options = context.options[0] || {
|
||||
ignoreNonDeclaration: false
|
||||
};
|
||||
const targetParent = options.ignoreNonDeclaration ? ["VariableDeclarator"] : ["AssignmentExpression", "VariableDeclarator"];
|
||||
|
||||
return {
|
||||
AssignmentExpression(node) {
|
||||
if (["AssignmentExpression", "VariableDeclarator"].indexOf(node.parent.type) !== -1) {
|
||||
if (targetParent.indexOf(node.parent.type) !== -1) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedChain"
|
||||
|
||||
23
tools/node_modules/eslint/lib/rules/no-unused-vars.js
generated
vendored
23
tools/node_modules/eslint/lib/rules/no-unused-vars.js
generated
vendored
@@ -196,6 +196,17 @@ module.exports = {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a node is a sibling of the rest property or not.
|
||||
* @param {ASTNode} node a node to check
|
||||
* @returns {boolean} True if the node is a sibling of the rest property, otherwise false.
|
||||
*/
|
||||
function hasRestSibling(node) {
|
||||
return node.type === "Property" &&
|
||||
node.parent.type === "ObjectPattern" &&
|
||||
REST_PROPERTY_TYPE.test(node.parent.properties[node.parent.properties.length - 1].type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a variable has a sibling rest property
|
||||
* @param {Variable} variable eslint-scope variable object.
|
||||
@@ -204,16 +215,10 @@ module.exports = {
|
||||
*/
|
||||
function hasRestSpreadSibling(variable) {
|
||||
if (config.ignoreRestSiblings) {
|
||||
return variable.defs.some(def => {
|
||||
const propertyNode = def.name.parent;
|
||||
const patternNode = propertyNode.parent;
|
||||
const hasRestSiblingDefinition = variable.defs.some(def => hasRestSibling(def.name.parent));
|
||||
const hasRestSiblingReference = variable.references.some(ref => hasRestSibling(ref.identifier.parent));
|
||||
|
||||
return (
|
||||
propertyNode.type === "Property" &&
|
||||
patternNode.type === "ObjectPattern" &&
|
||||
REST_PROPERTY_TYPE.test(patternNode.properties[patternNode.properties.length - 1].type)
|
||||
);
|
||||
});
|
||||
return hasRestSiblingDefinition || hasRestSiblingReference;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
6
tools/node_modules/eslint/node_modules/balanced-match/README.md
generated
vendored
6
tools/node_modules/eslint/node_modules/balanced-match/README.md
generated
vendored
@@ -66,6 +66,12 @@ With [npm](https://npmjs.org) do:
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
3
tools/node_modules/eslint/node_modules/balanced-match/index.js
generated
vendored
3
tools/node_modules/eslint/node_modules/balanced-match/index.js
generated
vendored
@@ -28,6 +28,9 @@ function range(a, b, str) {
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
if(a===b) {
|
||||
return [ai, bi];
|
||||
}
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
|
||||
7
tools/node_modules/eslint/node_modules/balanced-match/package.json
generated
vendored
7
tools/node_modules/eslint/node_modules/balanced-match/package.json
generated
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "balanced-match",
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
@@ -9,10 +9,9 @@
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"bench": "make bench"
|
||||
"test": "tape test/test.js",
|
||||
"bench": "matcha test/bench.js"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
|
||||
1
tools/node_modules/eslint/node_modules/globals/globals.json
generated
vendored
1
tools/node_modules/eslint/node_modules/globals/globals.json
generated
vendored
@@ -787,6 +787,7 @@
|
||||
"OscillatorNode": false,
|
||||
"outerHeight": false,
|
||||
"outerWidth": false,
|
||||
"OverconstrainedError": false,
|
||||
"PageTransitionEvent": false,
|
||||
"pageXOffset": false,
|
||||
"pageYOffset": false,
|
||||
|
||||
2
tools/node_modules/eslint/node_modules/globals/package.json
generated
vendored
2
tools/node_modules/eslint/node_modules/globals/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "globals",
|
||||
"version": "13.7.0",
|
||||
"version": "13.8.0",
|
||||
"description": "Global identifiers from different JavaScript environments",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/globals",
|
||||
|
||||
6
tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md
generated
vendored
6
tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md
generated
vendored
@@ -113,7 +113,7 @@ Performance of different validators by [json-schema-benchmark](https://github.co
|
||||
|
||||
## Install
|
||||
|
||||
To install version 7:
|
||||
To install version 8:
|
||||
|
||||
```
|
||||
npm install ajv
|
||||
@@ -154,7 +154,9 @@ Learn how to use Ajv and see more examples in the [Guide: getting started](https
|
||||
|
||||
See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases)
|
||||
|
||||
**Please note**: [Changes in version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)
|
||||
**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0)
|
||||
|
||||
[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)
|
||||
|
||||
[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
||||
exports.regexpCode = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
||||
class _CodeOrName {
|
||||
}
|
||||
exports._CodeOrName = _CodeOrName;
|
||||
@@ -140,4 +140,8 @@ function getProperty(key) {
|
||||
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
|
||||
}
|
||||
exports.getProperty = getProperty;
|
||||
function regexpCode(rx) {
|
||||
return new _Code(rx.toString());
|
||||
}
|
||||
exports.regexpCode = regexpCode;
|
||||
//# sourceMappingURL=code.js.map
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
||||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
||||
const code_1 = require("./code");
|
||||
const scope_1 = require("./scope");
|
||||
var code_2 = require("./code");
|
||||
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "strConcat", { enumerable: true, get: function ()
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
|
||||
Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
|
||||
Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
|
||||
var scope_2 = require("./scope");
|
||||
Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
|
||||
|
||||
@@ -38,11 +38,12 @@ function validateTuple(cxt, extraItems, schArr = cxt.schema) {
|
||||
cxt.ok(valid);
|
||||
});
|
||||
function checkStrictTuple(sch) {
|
||||
const { opts, errSchemaPath } = it;
|
||||
const l = schArr.length;
|
||||
const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
|
||||
if (it.opts.strictTuples && !fullTuple) {
|
||||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different`;
|
||||
util_1.checkStrictMode(it, msg, it.opts.strictTuples);
|
||||
if (opts.strictTuples && !fullTuple) {
|
||||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
|
||||
util_1.checkStrictMode(it, msg, opts.strictTuples);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,12 @@ const def = {
|
||||
}
|
||||
}
|
||||
function getFormat(fmtDef) {
|
||||
const fmt = gen.scopeValue("formats", {
|
||||
key: schema,
|
||||
ref: fmtDef,
|
||||
code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(schema)}` : undefined,
|
||||
});
|
||||
const code = fmtDef instanceof RegExp
|
||||
? codegen_1.regexpCode(fmtDef)
|
||||
: opts.code.formats
|
||||
? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(schema)}`
|
||||
: undefined;
|
||||
const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
|
||||
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
||||
return [fmtDef.type || "string", fmtDef.validate, codegen_1._ `${fmt}.validate`];
|
||||
}
|
||||
|
||||
20
tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json
generated
vendored
20
tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json
generated
vendored
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"name": "ajv",
|
||||
"version": "8.0.1",
|
||||
"version": "8.0.5",
|
||||
"description": "Another JSON Schema Validator",
|
||||
"main": "dist/ajv.js",
|
||||
"types": "dist/ajv.d.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"dist/",
|
||||
"scripts/",
|
||||
".tonic_example.js"
|
||||
".runkit_example.js"
|
||||
],
|
||||
"scripts": {
|
||||
"eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" scripts --ignore-pattern spec/JSON-Schema-Test-Suite",
|
||||
@@ -41,10 +40,7 @@
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ajv-validator/ajv.git"
|
||||
},
|
||||
"repository": "ajv-validator/ajv",
|
||||
"keywords": [
|
||||
"JSON",
|
||||
"schema",
|
||||
@@ -57,11 +53,9 @@
|
||||
],
|
||||
"author": "Evgeny Poberezkin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ajv-validator/ajv/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ajv-validator/ajv",
|
||||
"tonicExampleFilename": ".tonic_example.js",
|
||||
"bugs": "https://github.com/ajv-validator/ajv/issues",
|
||||
"homepage": "https://ajv.js.org",
|
||||
"runkitExampleFilename": ".runkit_example.js",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
@@ -86,7 +80,7 @@
|
||||
"eslint": "^7.8.1",
|
||||
"eslint-config-prettier": "^7.0.0",
|
||||
"glob": "^7.0.0",
|
||||
"husky": "^5.0.9",
|
||||
"husky": "^6.0.0",
|
||||
"if-node-version": "^1.0.0",
|
||||
"jimp": "^0.16.1",
|
||||
"js-beautify": "^1.7.3",
|
||||
|
||||
48
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js
generated
vendored
48
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js
generated
vendored
@@ -1,48 +0,0 @@
|
||||
"use strict"
|
||||
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
const browserify = require("browserify")
|
||||
const {minify} = require("terser")
|
||||
|
||||
const [sourceFile, outFile, globalName] = process.argv.slice(2)
|
||||
|
||||
const json = require(path.join(__dirname, "..", "package.json"))
|
||||
const bundleDir = path.join(__dirname, "..", "bundle")
|
||||
if (!fs.existsSync(bundleDir)) fs.mkdirSync(bundleDir)
|
||||
|
||||
browserify({standalone: globalName})
|
||||
.require(path.join(__dirname, "../dist", sourceFile), {expose: sourceFile})
|
||||
.bundle(saveAndMinify)
|
||||
|
||||
async function saveAndMinify(err, buf) {
|
||||
if (err) {
|
||||
console.error("browserify error:", err)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const bundlePath = path.join(bundleDir, outFile)
|
||||
const opts = {
|
||||
ecma: 2018,
|
||||
warnings: true,
|
||||
compress: {
|
||||
pure_getters: true,
|
||||
keep_infinity: true,
|
||||
unsafe_methods: true,
|
||||
},
|
||||
format: {
|
||||
preamble: `/* ${json.name} ${json.version} (${globalName}): ${json.description} */`,
|
||||
},
|
||||
sourceMap: {
|
||||
filename: outFile + ".min.js",
|
||||
url: outFile + ".min.js.map",
|
||||
},
|
||||
}
|
||||
|
||||
const result = await minify(buf.toString(), opts)
|
||||
|
||||
fs.writeFileSync(bundlePath + ".bundle.js", buf)
|
||||
fs.writeFileSync(bundlePath + ".min.js", result.code)
|
||||
fs.writeFileSync(bundlePath + ".min.js.map", result.map)
|
||||
if (result.warnings) result.warnings.forEach((msg) => console.warn("terser.minify warning:", msg))
|
||||
}
|
||||
20
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/get-ajv-packages
generated
vendored
20
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/get-ajv-packages
generated
vendored
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -a packages=(
|
||||
"ajv-keywords"
|
||||
"ajv-formats"
|
||||
"ajv-cli"
|
||||
"ajv-errors"
|
||||
"ajv-i18n"
|
||||
)
|
||||
|
||||
for package in "${packages[@]}"
|
||||
do
|
||||
echo "downloading $package README..."
|
||||
echo "---" > docs/packages/$package.md
|
||||
echo "editLink: https://github.com/ajv-validator/$package/edit/master/README.md" >> docs/packages/$package.md
|
||||
echo "---" >> docs/packages/$package.md
|
||||
echo "[$package repository](https://github.com/ajv-validator/$package)" >> docs/packages/$package.md
|
||||
echo "" >> docs/packages/$package.md
|
||||
curl -L https://raw.githubusercontent.com/ajv-validator/$package/master/README.md >> ./docs/packages/$package.md
|
||||
done
|
||||
@@ -1,57 +0,0 @@
|
||||
// Credit for the script goes to svelte:
|
||||
// https://github.com/sveltejs/svelte/blob/ce3a5791258ec6ecf8c1ea022cb871afe805a45c/site/scripts/get-contributors.js
|
||||
|
||||
const fs = require("fs")
|
||||
const fetch = require("node-fetch")
|
||||
const Jimp = require("jimp")
|
||||
|
||||
process.chdir(__dirname)
|
||||
|
||||
const base = `https://api.github.com/repos/ajv-validator/ajv/contributors`
|
||||
const {GH_TOKEN_PUBLIC} = process.env
|
||||
|
||||
const SIZE = 64
|
||||
|
||||
async function main() {
|
||||
const contributors = []
|
||||
let page = 1
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const res = await fetch(`${base}?per_page=100&page=${page++}`, {
|
||||
headers: {Authorization: `token ${GH_TOKEN_PUBLIC}`},
|
||||
})
|
||||
const list = await res.json()
|
||||
if (list.length === 0) break
|
||||
contributors.push(...list)
|
||||
}
|
||||
|
||||
const bots = ["dependabot-preview[bot]", "greenkeeper[bot]", "greenkeeperio-bot"]
|
||||
|
||||
const authors = contributors
|
||||
.filter((a) => !bots.includes(a.login))
|
||||
.sort((a, b) => b.contributions - a.contributions)
|
||||
|
||||
const sprite = new Jimp(SIZE * authors.length, SIZE)
|
||||
|
||||
for (let i = 0; i < authors.length; i += 1) {
|
||||
const author = authors[i]
|
||||
console.log(`${i + 1} / ${authors.length}: ${author.login}`)
|
||||
const image_data = await fetch(author.avatar_url)
|
||||
const buffer = await image_data.arrayBuffer()
|
||||
const image = await Jimp.read(buffer)
|
||||
image.resize(SIZE, SIZE)
|
||||
sprite.composite(image, i * SIZE, 0)
|
||||
}
|
||||
|
||||
await sprite.quality(80).write(`../docs/.vuepress/components/Contributors/contributors.jpg`)
|
||||
|
||||
const str = `[\n ${authors.map((a) => `"${a.login}"`).join(",\n ")},\n]\n`
|
||||
|
||||
fs.writeFileSync(
|
||||
`../docs/.vuepress/components/Contributors/_contributors.js`,
|
||||
`module.exports = ${str}`
|
||||
)
|
||||
}
|
||||
|
||||
main()
|
||||
32
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js
generated
vendored
32
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
"use strict"
|
||||
|
||||
const testSuitePaths = {
|
||||
draft6: "spec/JSON-Schema-Test-Suite/tests/draft6/",
|
||||
draft7: "spec/JSON-Schema-Test-Suite/tests/draft7/",
|
||||
draft2019: "spec/JSON-Schema-Test-Suite/tests/draft2019-09/",
|
||||
draft2020: "spec/JSON-Schema-Test-Suite/tests/draft2020-12/",
|
||||
tests: "spec/tests/",
|
||||
security: "spec/security/",
|
||||
extras: "spec/extras/",
|
||||
async: "spec/async/",
|
||||
}
|
||||
|
||||
const glob = require("glob")
|
||||
const fs = require("fs")
|
||||
|
||||
for (const suite in testSuitePaths) {
|
||||
const p = testSuitePaths[suite]
|
||||
const files = glob.sync(`${p}{**/,}*.json`)
|
||||
if (files.length === 0) {
|
||||
console.error(`Missing folder ${p}\nTry: git submodule update --init\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
const code = files
|
||||
.map((f) => {
|
||||
const name = f.replace(p, "").replace(/\.json$/, "")
|
||||
const testPath = f.replace(/^spec/, "..")
|
||||
return `\n {name: "${name}", test: require("${testPath}")},`
|
||||
})
|
||||
.reduce((list, f) => list + f)
|
||||
fs.writeFileSync(`./spec/_json/${suite}.js`, `module.exports = [${code}\n]\n`)
|
||||
}
|
||||
17
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-site
generated
vendored
17
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-site
generated
vendored
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
function copyReplace {
|
||||
sed "s/](.\/docs\//](.\//g" $1 > $2
|
||||
}
|
||||
|
||||
copyReplace CODE_OF_CONDUCT.md docs/code_of_conduct.md
|
||||
copyReplace CONTRIBUTING.md docs/contributing.md
|
||||
copyReplace LICENSE docs/license.md
|
||||
|
||||
echo "preparing contributors..."
|
||||
node scripts/get-contributors.js
|
||||
|
||||
echo "preparing packages..."
|
||||
./scripts/get-ajv-packages
|
||||
12
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests
generated
vendored
12
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests
generated
vendored
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p .browser
|
||||
|
||||
echo
|
||||
echo Preparing browser tests:
|
||||
|
||||
find spec -type f -name '*.spec.*s' | \
|
||||
xargs -I {} sh -c \
|
||||
'export f="{}"; echo $f; ./node_modules/.bin/browserify $f -p [ tsify -p ./spec/tsconfig.json ] -x ajv -u buffer -o $(echo $f | sed -e "s/spec/.browser/" | sed -e "s/.spec.ts/.spec.js/");'
|
||||
37
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles
generated
vendored
37
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles
generated
vendored
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
||||
npm run bundle
|
||||
|
||||
echo "About to publish $GITHUB_REF to ajv-dist..."
|
||||
|
||||
git config --global user.name "$GIT_USER_NAME"
|
||||
git config --global user.email "$GIT_USER_EMAIL"
|
||||
|
||||
git clone https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv-dist.git ../ajv-dist
|
||||
|
||||
rm -rf ../ajv-dist/dist
|
||||
mkdir ../ajv-dist/dist
|
||||
cp ./bundle/*.* ../ajv-dist/dist
|
||||
cd ../ajv-dist
|
||||
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
|
||||
sed -E "s/\"version\": \"([^\"]*)\"/\"version\": \"$VERSION\"/" package.json > new_package.json
|
||||
mv new_package.json package.json
|
||||
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
echo "Changes detected. Updating master branch..."
|
||||
git add -A
|
||||
git commit -m "$VERSION: updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
|
||||
git push --quiet origin master > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "Publishing tag..."
|
||||
git tag "v$VERSION"
|
||||
git push --tags > /dev/null 2>&1
|
||||
|
||||
echo "Done"
|
||||
fi
|
||||
25
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-site
generated
vendored
25
tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-site
generated
vendored
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
echo "About to publish $GITHUB_REF to gh-pages..."
|
||||
rm -rf ../gh-pages
|
||||
|
||||
npm run docs:build
|
||||
|
||||
git config --global user.name "$GIT_USER_NAME"
|
||||
git config --global user.email "$GIT_USER_EMAIL"
|
||||
git clone -b gh-pages --single-branch https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv.git ../gh-pages
|
||||
|
||||
rsync -a ./docs/.vuepress/dist/ ../gh-pages
|
||||
|
||||
cd ../gh-pages
|
||||
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
echo "Changes detected. Updating gh-pages branch..."
|
||||
git add -A
|
||||
git commit -m "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
|
||||
git push --quiet origin gh-pages > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
6
tools/node_modules/eslint/package.json
generated
vendored
6
tools/node_modules/eslint/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint",
|
||||
"version": "7.23.0",
|
||||
"version": "7.24.0",
|
||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||
"description": "An AST-based pattern checker for JavaScript.",
|
||||
"bin": {
|
||||
@@ -118,8 +118,8 @@
|
||||
"markdownlint": "^0.19.0",
|
||||
"markdownlint-cli": "^0.22.0",
|
||||
"memfs": "^3.0.1",
|
||||
"mocha": "^7.1.1",
|
||||
"mocha-junit-reporter": "^1.23.0",
|
||||
"mocha": "^8.3.2",
|
||||
"mocha-junit-reporter": "^2.0.0",
|
||||
"node-polyfill-webpack-plugin": "^1.0.3",
|
||||
"npm-license": "^0.3.3",
|
||||
"nyc": "^15.0.1",
|
||||
|
||||
Reference in New Issue
Block a user