update
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import React from 'react';
|
||||
import makeEventProps, { allEvents } from './index.js';
|
||||
describe('makeEventProps()', function () {
|
||||
var fakeEvent = {};
|
||||
it('returns object with valid and only valid event callbacks', function () {
|
||||
var props = {
|
||||
onClick: vi.fn(),
|
||||
someInvalidProp: vi.fn(),
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
expect(result).toMatchObject({ onClick: expect.any(Function) });
|
||||
});
|
||||
it('calls getArgs function on event invoke if given', function () {
|
||||
var props = {
|
||||
onClick: vi.fn(),
|
||||
someInvalidProp: vi.fn(),
|
||||
};
|
||||
var getArgs = vi.fn();
|
||||
var result = makeEventProps(props, getArgs);
|
||||
// getArgs shall not be invoked before a given event is fired
|
||||
expect(getArgs).not.toHaveBeenCalled();
|
||||
result.onClick(fakeEvent);
|
||||
expect(getArgs).toHaveBeenCalledTimes(1);
|
||||
expect(getArgs).toHaveBeenCalledWith('onClick');
|
||||
});
|
||||
it('properly calls callbacks given in props given no getArgs function', function () {
|
||||
var props = {
|
||||
onClick: vi.fn(),
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
result.onClick(fakeEvent);
|
||||
expect(props.onClick).toHaveBeenCalledWith(fakeEvent);
|
||||
});
|
||||
it('properly calls callbacks given in props given getArgs function', function () {
|
||||
var props = {
|
||||
onClick: vi.fn(),
|
||||
};
|
||||
var getArgs = vi.fn();
|
||||
var args = {};
|
||||
getArgs.mockReturnValue(args);
|
||||
var result = makeEventProps(props, getArgs);
|
||||
result.onClick(fakeEvent);
|
||||
expect(props.onClick).toHaveBeenCalledWith(fakeEvent, args);
|
||||
});
|
||||
it('should not filter out valid event props', function () {
|
||||
var props = {
|
||||
onClick: vi.fn(),
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
// @ts-expect-no-error
|
||||
result.onClick;
|
||||
});
|
||||
it('should filter out invalid event props', function () {
|
||||
var props = {
|
||||
someInvalidProp: vi.fn(),
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
// @ts-expect-error-next-line
|
||||
result.someInvalidProp;
|
||||
});
|
||||
it('should allow valid onClick handler to be passed', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-no-error
|
||||
makeEventProps(props);
|
||||
});
|
||||
it('should not allow invalid onClick handler to be passed', function () {
|
||||
var props = {
|
||||
onClick: 'potato',
|
||||
};
|
||||
// @ts-expect-error-next-line
|
||||
makeEventProps(props);
|
||||
});
|
||||
it('should allow onClick handler with extra args to be passed if getArgs is provided', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-no-error
|
||||
makeEventProps(props, function () { return 'hello'; });
|
||||
});
|
||||
it('should not allow onClick handler with extra args to be passed if getArgs is not provided', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-error-next-line
|
||||
makeEventProps(props);
|
||||
});
|
||||
it('should not allow onClick handler with extra args to be passed if getArgs is provided but returns different type', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-error-next-line
|
||||
makeEventProps(props, function () { return 5; });
|
||||
});
|
||||
it('should allow div onClick handler to be passed to div', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
// @ts-expect-no-error
|
||||
_jsx("div", { onClick: result.onClick });
|
||||
});
|
||||
it('should not allow div onClick handler to be passed to button', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
var result = makeEventProps(props);
|
||||
// @ts-expect-error-next-line
|
||||
_jsx("button", { onClick: result.onClick });
|
||||
});
|
||||
it('should allow div onClick handler with extra args to be passed to div if getArgs is provided', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
var result = makeEventProps(props, function () { return 'hello'; });
|
||||
// @ts-expect-no-error
|
||||
_jsx("div", { onClick: result.onClick });
|
||||
});
|
||||
it('should not allow div onClick handler with extra args to be passed to button if getArgs is provided', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
var result = makeEventProps(props, function () { return 'hello'; });
|
||||
// @ts-expect-error-next-line
|
||||
_jsx("button", { onClick: result.onClick });
|
||||
});
|
||||
it('should allow onClick handler with valid extra args to be passed with args explicitly typed', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-no-error
|
||||
makeEventProps(props, function () { return 'hello'; });
|
||||
});
|
||||
it('should not allow onClick handler with invalid extra args to be passed with args explicitly typed', function () {
|
||||
var props = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
onClick: function (event, args) {
|
||||
// Intentionally empty
|
||||
},
|
||||
};
|
||||
// @ts-expect-error-next-line
|
||||
makeEventProps(props, function () { return 'hello'; });
|
||||
});
|
||||
it('should allow getArgs returning valid type to be passed with args explicitly typed', function () {
|
||||
var props = {};
|
||||
// @ts-expect-no-error
|
||||
makeEventProps(props, function () { return 'hello'; });
|
||||
});
|
||||
it('should not allow getArgs returning invalid type to be passed with args explicitly typed', function () {
|
||||
var props = {};
|
||||
// @ts-expect-error-next-line
|
||||
makeEventProps(props, function () { return 5; });
|
||||
});
|
||||
});
|
||||
describe('allEvents', function () {
|
||||
it('should contain all events', function () {
|
||||
var sortedAllEvents = new Set(__spreadArray([], allEvents, true).sort());
|
||||
expect(sortedAllEvents).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (it) {
|
||||
const { pattern } = it;
|
||||
|
||||
return `
|
||||
You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.
|
||||
|
||||
If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.
|
||||
|
||||
If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.
|
||||
|
||||
* If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
|
||||
https://eslint.org/docs/latest/use/configure/ignore
|
||||
|
||||
* If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
|
||||
https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions
|
||||
|
||||
* If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.
|
||||
`.trimStart();
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P"},C:{"1":"0 9 zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB qC rC"},D:{"1":"0 9 AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B"},E:{"1":"G zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A B C L M sC SC tC uC vC wC TC FC GC xC yC"},F:{"1":"0 xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 iD jD kD lD mD IC JC KC nD","2":"J dD eD fD gD hD TC"},Q:{"16":"oD"},R:{"16":"pD"},S:{"2":"qD","16":"rD"}},B:5,C:"WebAssembly Non-trapping float-to-int Conversion",D:true};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,586 @@
|
||||
/**
|
||||
* @fileoverview A module that filters reported problems based on `eslint-disable` and `eslint-enable` comments
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("../shared/types").LintMessage} LintMessage */
|
||||
/** @typedef {import("@eslint/core").Language} Language */
|
||||
/** @typedef {import("@eslint/core").Position} Position */
|
||||
/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Module Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const escapeRegExp = require("escape-string-regexp");
|
||||
const {
|
||||
Legacy: { ConfigOps },
|
||||
} = require("@eslint/eslintrc/universal");
|
||||
|
||||
/**
|
||||
* Compares the locations of two objects in a source file
|
||||
* @param {Position} itemA The first object
|
||||
* @param {Position} itemB The second object
|
||||
* @returns {number} A value less than 1 if itemA appears before itemB in the source file, greater than 1 if
|
||||
* itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location.
|
||||
*/
|
||||
function compareLocations(itemA, itemB) {
|
||||
return itemA.line - itemB.line || itemA.column - itemB.column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups a set of directives into sub-arrays by their parent comment.
|
||||
* @param {Iterable<Directive>} directives Unused directives to be removed.
|
||||
* @returns {Directive[][]} Directives grouped by their parent comment.
|
||||
*/
|
||||
function groupByParentDirective(directives) {
|
||||
const groups = new Map();
|
||||
|
||||
for (const directive of directives) {
|
||||
const {
|
||||
unprocessedDirective: { parentDirective },
|
||||
} = directive;
|
||||
|
||||
if (groups.has(parentDirective)) {
|
||||
groups.get(parentDirective).push(directive);
|
||||
} else {
|
||||
groups.set(parentDirective, [directive]);
|
||||
}
|
||||
}
|
||||
|
||||
return [...groups.values()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates removal details for a set of directives within the same comment.
|
||||
* @param {Directive[]} directives Unused directives to be removed.
|
||||
* @param {{node: Token, value: string}} parentDirective Data about the backing directive.
|
||||
* @param {SourceCode} sourceCode The source code object for the file being linted.
|
||||
* @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
|
||||
*/
|
||||
function createIndividualDirectivesRemoval(
|
||||
directives,
|
||||
parentDirective,
|
||||
sourceCode,
|
||||
) {
|
||||
/*
|
||||
* Get the list of the rules text without any surrounding whitespace. In order to preserve the original
|
||||
* formatting, we don't want to change that whitespace.
|
||||
*
|
||||
* // eslint-disable-line rule-one , rule-two , rule-three -- comment
|
||||
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*/
|
||||
const listText = parentDirective.value.trim();
|
||||
|
||||
// Calculate where it starts in the source code text
|
||||
const listStart = sourceCode.text.indexOf(
|
||||
listText,
|
||||
sourceCode.getRange(parentDirective.node)[0],
|
||||
);
|
||||
|
||||
/*
|
||||
* We can assume that `listText` contains multiple elements.
|
||||
* Otherwise, this function wouldn't be called - if there is
|
||||
* only one rule in the list, then the whole comment must be removed.
|
||||
*/
|
||||
|
||||
return directives.map(directive => {
|
||||
const { ruleId } = directive;
|
||||
|
||||
const regex = new RegExp(
|
||||
String.raw`(?:^|\s*,\s*)(?<quote>['"]?)${escapeRegExp(ruleId)}\k<quote>(?:\s*,\s*|$)`,
|
||||
"u",
|
||||
);
|
||||
const match = regex.exec(listText);
|
||||
const matchedText = match[0];
|
||||
const matchStart = listStart + match.index;
|
||||
const matchEnd = matchStart + matchedText.length;
|
||||
|
||||
const firstIndexOfComma = matchedText.indexOf(",");
|
||||
const lastIndexOfComma = matchedText.lastIndexOf(",");
|
||||
|
||||
let removalStart, removalEnd;
|
||||
|
||||
if (firstIndexOfComma !== lastIndexOfComma) {
|
||||
/*
|
||||
* Since there are two commas, this must one of the elements in the middle of the list.
|
||||
* Matched range starts where the previous rule name ends, and ends where the next rule name starts.
|
||||
*
|
||||
* // eslint-disable-line rule-one , rule-two , rule-three -- comment
|
||||
* ^^^^^^^^^^^^^^
|
||||
*
|
||||
* We want to remove only the content between the two commas, and also one of the commas.
|
||||
*
|
||||
* // eslint-disable-line rule-one , rule-two , rule-three -- comment
|
||||
* ^^^^^^^^^^^
|
||||
*/
|
||||
removalStart = matchStart + firstIndexOfComma;
|
||||
removalEnd = matchStart + lastIndexOfComma;
|
||||
} else {
|
||||
/*
|
||||
* This is either the first element or the last element.
|
||||
*
|
||||
* If this is the first element, matched range starts where the first rule name starts
|
||||
* and ends where the second rule name starts. This is exactly the range we want
|
||||
* to remove so that the second rule name will start where the first one was starting
|
||||
* and thus preserve the original formatting.
|
||||
*
|
||||
* // eslint-disable-line rule-one , rule-two , rule-three -- comment
|
||||
* ^^^^^^^^^^^
|
||||
*
|
||||
* Similarly, if this is the last element, we've already matched the range we want to
|
||||
* remove. The previous rule name will end where the last one was ending, relative
|
||||
* to the content on the right side.
|
||||
*
|
||||
* // eslint-disable-line rule-one , rule-two , rule-three -- comment
|
||||
* ^^^^^^^^^^^^^
|
||||
*/
|
||||
removalStart = matchStart;
|
||||
removalEnd = matchEnd;
|
||||
}
|
||||
|
||||
return {
|
||||
description: `'${ruleId}'`,
|
||||
fix: {
|
||||
range: [removalStart, removalEnd],
|
||||
text: "",
|
||||
},
|
||||
unprocessedDirective: directive.unprocessedDirective,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a description of deleting an entire unused disable directive.
|
||||
* @param {Directive[]} directives Unused directives to be removed.
|
||||
* @param {Token} node The backing Comment token.
|
||||
* @param {SourceCode} sourceCode The source code object for the file being linted.
|
||||
* @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output problem.
|
||||
*/
|
||||
function createDirectiveRemoval(directives, node, sourceCode) {
|
||||
const range = sourceCode.getRange(node);
|
||||
const ruleIds = directives
|
||||
.filter(directive => directive.ruleId)
|
||||
.map(directive => `'${directive.ruleId}'`);
|
||||
|
||||
return {
|
||||
description:
|
||||
ruleIds.length <= 2
|
||||
? ruleIds.join(" or ")
|
||||
: `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds.at(-1)}`,
|
||||
fix: {
|
||||
range,
|
||||
text: " ",
|
||||
},
|
||||
unprocessedDirective: directives[0].unprocessedDirective,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses details from directives to create output Problems.
|
||||
* @param {Iterable<Directive>} allDirectives Unused directives to be removed.
|
||||
* @param {SourceCode} sourceCode The source code object for the file being linted.
|
||||
* @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
|
||||
*/
|
||||
function processUnusedDirectives(allDirectives, sourceCode) {
|
||||
const directiveGroups = groupByParentDirective(allDirectives);
|
||||
|
||||
return directiveGroups.flatMap(directives => {
|
||||
const { parentDirective } = directives[0].unprocessedDirective;
|
||||
const remainingRuleIds = new Set(parentDirective.ruleIds);
|
||||
|
||||
for (const directive of directives) {
|
||||
remainingRuleIds.delete(directive.ruleId);
|
||||
}
|
||||
|
||||
return remainingRuleIds.size
|
||||
? createIndividualDirectivesRemoval(
|
||||
directives,
|
||||
parentDirective,
|
||||
sourceCode,
|
||||
)
|
||||
: [
|
||||
createDirectiveRemoval(
|
||||
directives,
|
||||
parentDirective.node,
|
||||
sourceCode,
|
||||
),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect eslint-enable comments that are removing suppressions by eslint-disable comments.
|
||||
* @param {Directive[]} directives The directives to check.
|
||||
* @returns {Set<Directive>} The used eslint-enable comments
|
||||
*/
|
||||
function collectUsedEnableDirectives(directives) {
|
||||
/**
|
||||
* A Map of `eslint-enable` keyed by ruleIds that may be marked as used.
|
||||
* If `eslint-enable` does not have a ruleId, the key will be `null`.
|
||||
* @type {Map<string|null, Directive>}
|
||||
*/
|
||||
const enabledRules = new Map();
|
||||
|
||||
/**
|
||||
* A Set of `eslint-enable` marked as used.
|
||||
* It is also the return value of `collectUsedEnableDirectives` function.
|
||||
* @type {Set<Directive>}
|
||||
*/
|
||||
const usedEnableDirectives = new Set();
|
||||
|
||||
/*
|
||||
* Checks the directives backwards to see if the encountered `eslint-enable` is used by the previous `eslint-disable`,
|
||||
* and if so, stores the `eslint-enable` in `usedEnableDirectives`.
|
||||
*/
|
||||
for (let index = directives.length - 1; index >= 0; index--) {
|
||||
const directive = directives[index];
|
||||
|
||||
if (directive.type === "disable") {
|
||||
if (enabledRules.size === 0) {
|
||||
continue;
|
||||
}
|
||||
if (directive.ruleId === null) {
|
||||
// If encounter `eslint-disable` without ruleId,
|
||||
// mark all `eslint-enable` currently held in enabledRules as used.
|
||||
// e.g.
|
||||
// /* eslint-disable */ <- current directive
|
||||
// /* eslint-enable rule-id1 */ <- used
|
||||
// /* eslint-enable rule-id2 */ <- used
|
||||
// /* eslint-enable */ <- used
|
||||
for (const enableDirective of enabledRules.values()) {
|
||||
usedEnableDirectives.add(enableDirective);
|
||||
}
|
||||
enabledRules.clear();
|
||||
} else {
|
||||
const enableDirective = enabledRules.get(directive.ruleId);
|
||||
|
||||
if (enableDirective) {
|
||||
// If encounter `eslint-disable` with ruleId, and there is an `eslint-enable` with the same ruleId in enabledRules,
|
||||
// mark `eslint-enable` with ruleId as used.
|
||||
// e.g.
|
||||
// /* eslint-disable rule-id */ <- current directive
|
||||
// /* eslint-enable rule-id */ <- used
|
||||
usedEnableDirectives.add(enableDirective);
|
||||
} else {
|
||||
const enabledDirectiveWithoutRuleId =
|
||||
enabledRules.get(null);
|
||||
|
||||
if (enabledDirectiveWithoutRuleId) {
|
||||
// If encounter `eslint-disable` with ruleId, and there is no `eslint-enable` with the same ruleId in enabledRules,
|
||||
// mark `eslint-enable` without ruleId as used.
|
||||
// e.g.
|
||||
// /* eslint-disable rule-id */ <- current directive
|
||||
// /* eslint-enable */ <- used
|
||||
usedEnableDirectives.add(enabledDirectiveWithoutRuleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (directive.type === "enable") {
|
||||
if (directive.ruleId === null) {
|
||||
// If encounter `eslint-enable` without ruleId, the `eslint-enable` that follows it are unused.
|
||||
// So clear enabledRules.
|
||||
// e.g.
|
||||
// /* eslint-enable */ <- current directive
|
||||
// /* eslint-enable rule-id *// <- unused
|
||||
// /* eslint-enable */ <- unused
|
||||
enabledRules.clear();
|
||||
enabledRules.set(null, directive);
|
||||
} else {
|
||||
enabledRules.set(directive.ruleId, directive);
|
||||
}
|
||||
}
|
||||
}
|
||||
return usedEnableDirectives;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the same as the exported function, except that it
|
||||
* doesn't handle disable-line and disable-next-line directives, and it always reports unused
|
||||
* disable directives.
|
||||
* @param {Object} options options for applying directives. This is the same as the options
|
||||
* for the exported function, except that `reportUnusedDisableDirectives` is not supported
|
||||
* (this function always reports unused disable directives).
|
||||
* @returns {{problems: LintMessage[], unusedDirectives: LintMessage[]}} An object with a list
|
||||
* of problems (including suppressed ones) and unused eslint-disable directives
|
||||
*/
|
||||
function applyDirectives(options) {
|
||||
const problems = [];
|
||||
const usedDisableDirectives = new Set();
|
||||
const { sourceCode } = options;
|
||||
|
||||
for (const problem of options.problems) {
|
||||
let disableDirectivesForProblem = [];
|
||||
let nextDirectiveIndex = 0;
|
||||
|
||||
while (
|
||||
nextDirectiveIndex < options.directives.length &&
|
||||
compareLocations(options.directives[nextDirectiveIndex], problem) <=
|
||||
0
|
||||
) {
|
||||
const directive = options.directives[nextDirectiveIndex++];
|
||||
|
||||
if (
|
||||
directive.ruleId === null ||
|
||||
directive.ruleId === problem.ruleId
|
||||
) {
|
||||
switch (directive.type) {
|
||||
case "disable":
|
||||
disableDirectivesForProblem.push(directive);
|
||||
break;
|
||||
|
||||
case "enable":
|
||||
disableDirectivesForProblem = [];
|
||||
break;
|
||||
|
||||
// no default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (disableDirectivesForProblem.length > 0) {
|
||||
const suppressions = disableDirectivesForProblem.map(directive => ({
|
||||
kind: "directive",
|
||||
justification: directive.unprocessedDirective.justification,
|
||||
}));
|
||||
|
||||
if (problem.suppressions) {
|
||||
problem.suppressions =
|
||||
problem.suppressions.concat(suppressions);
|
||||
} else {
|
||||
problem.suppressions = suppressions;
|
||||
usedDisableDirectives.add(disableDirectivesForProblem.at(-1));
|
||||
}
|
||||
}
|
||||
|
||||
problems.push(problem);
|
||||
}
|
||||
|
||||
const unusedDisableDirectivesToReport = options.directives.filter(
|
||||
directive =>
|
||||
directive.type === "disable" &&
|
||||
!usedDisableDirectives.has(directive) &&
|
||||
!options.rulesToIgnore.has(directive.ruleId),
|
||||
);
|
||||
|
||||
const unusedEnableDirectivesToReport = new Set(
|
||||
options.directives.filter(
|
||||
directive =>
|
||||
directive.unprocessedDirective.type === "enable" &&
|
||||
!options.rulesToIgnore.has(directive.ruleId),
|
||||
),
|
||||
);
|
||||
|
||||
/*
|
||||
* If directives has the eslint-enable directive,
|
||||
* check whether the eslint-enable comment is used.
|
||||
*/
|
||||
if (unusedEnableDirectivesToReport.size > 0) {
|
||||
for (const directive of collectUsedEnableDirectives(
|
||||
options.directives,
|
||||
)) {
|
||||
unusedEnableDirectivesToReport.delete(directive);
|
||||
}
|
||||
}
|
||||
|
||||
const processed = processUnusedDirectives(
|
||||
unusedDisableDirectivesToReport,
|
||||
sourceCode,
|
||||
).concat(
|
||||
processUnusedDirectives(unusedEnableDirectivesToReport, sourceCode),
|
||||
);
|
||||
const columnOffset = options.language.columnStart === 1 ? 0 : 1;
|
||||
const lineOffset = options.language.lineStart === 1 ? 0 : 1;
|
||||
|
||||
const unusedDirectives = processed.map(
|
||||
({ description, fix, unprocessedDirective }) => {
|
||||
const { parentDirective, type, line, column } =
|
||||
unprocessedDirective;
|
||||
|
||||
let message;
|
||||
|
||||
if (type === "enable") {
|
||||
message = description
|
||||
? `Unused eslint-enable directive (no matching eslint-disable directives were found for ${description}).`
|
||||
: "Unused eslint-enable directive (no matching eslint-disable directives were found).";
|
||||
} else {
|
||||
message = description
|
||||
? `Unused eslint-disable directive (no problems were reported from ${description}).`
|
||||
: "Unused eslint-disable directive (no problems were reported).";
|
||||
}
|
||||
|
||||
const loc = sourceCode.getLoc(parentDirective.node);
|
||||
|
||||
return {
|
||||
ruleId: null,
|
||||
message,
|
||||
line:
|
||||
type === "disable-next-line"
|
||||
? loc.start.line + lineOffset
|
||||
: line,
|
||||
column:
|
||||
type === "disable-next-line"
|
||||
? loc.start.column + columnOffset
|
||||
: column,
|
||||
severity:
|
||||
options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
|
||||
nodeType: null,
|
||||
...(options.disableFixes ? {} : { fix }),
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
return { problems, unusedDirectives };
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of directive comments (i.e. metadata about eslint-disable and eslint-enable comments) and a list
|
||||
* of reported problems, adds the suppression information to the problems.
|
||||
* @param {Object} options Information about directives and problems
|
||||
* @param {Language} options.language The language being linted.
|
||||
* @param {SourceCode} options.sourceCode The source code object for the file being linted.
|
||||
* @param {{
|
||||
* type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
|
||||
* ruleId: (string|null),
|
||||
* line: number,
|
||||
* column: number,
|
||||
* justification: string
|
||||
* }} options.directives Directive comments found in the file, with one-based columns.
|
||||
* Two directive comments can only have the same location if they also have the same type (e.g. a single eslint-disable
|
||||
* comment for two different rules is represented as two directives).
|
||||
* @param {{ruleId: (string|null), line: number, column: number}[]} options.problems
|
||||
* A list of problems reported by rules, sorted by increasing location in the file, with one-based columns.
|
||||
* @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives
|
||||
* @param {RulesConfig} options.configuredRules The rules configuration.
|
||||
* @param {Function} options.ruleFilter A predicate function to filter which rules should be executed.
|
||||
* @param {boolean} options.disableFixes If true, it doesn't make `fix` properties.
|
||||
* @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
|
||||
* An object with a list of reported problems, the suppressed of which contain the suppression information.
|
||||
*/
|
||||
module.exports = ({
|
||||
language,
|
||||
sourceCode,
|
||||
directives,
|
||||
disableFixes,
|
||||
problems,
|
||||
configuredRules,
|
||||
ruleFilter,
|
||||
reportUnusedDisableDirectives = "off",
|
||||
}) => {
|
||||
const blockDirectives = directives
|
||||
.filter(
|
||||
directive =>
|
||||
directive.type === "disable" || directive.type === "enable",
|
||||
)
|
||||
.map(directive =>
|
||||
Object.assign({}, directive, { unprocessedDirective: directive }),
|
||||
)
|
||||
.sort(compareLocations);
|
||||
|
||||
const lineDirectives = directives
|
||||
.flatMap(directive => {
|
||||
switch (directive.type) {
|
||||
case "disable":
|
||||
case "enable":
|
||||
return [];
|
||||
|
||||
case "disable-line":
|
||||
return [
|
||||
{
|
||||
type: "disable",
|
||||
line: directive.line,
|
||||
column: 1,
|
||||
ruleId: directive.ruleId,
|
||||
unprocessedDirective: directive,
|
||||
},
|
||||
{
|
||||
type: "enable",
|
||||
line: directive.line + 1,
|
||||
column: 0,
|
||||
ruleId: directive.ruleId,
|
||||
unprocessedDirective: directive,
|
||||
},
|
||||
];
|
||||
|
||||
case "disable-next-line":
|
||||
return [
|
||||
{
|
||||
type: "disable",
|
||||
line: directive.line + 1,
|
||||
column: 1,
|
||||
ruleId: directive.ruleId,
|
||||
unprocessedDirective: directive,
|
||||
},
|
||||
{
|
||||
type: "enable",
|
||||
line: directive.line + 2,
|
||||
column: 0,
|
||||
ruleId: directive.ruleId,
|
||||
unprocessedDirective: directive,
|
||||
},
|
||||
];
|
||||
|
||||
default:
|
||||
throw new TypeError(
|
||||
`Unrecognized directive type '${directive.type}'`,
|
||||
);
|
||||
}
|
||||
})
|
||||
.sort(compareLocations);
|
||||
|
||||
// This determines a list of rules that are not being run by the given ruleFilter, if present.
|
||||
const rulesToIgnore =
|
||||
configuredRules && ruleFilter
|
||||
? new Set(
|
||||
Object.keys(configuredRules).filter(ruleId => {
|
||||
const severity = ConfigOps.getRuleSeverity(
|
||||
configuredRules[ruleId],
|
||||
);
|
||||
|
||||
// Ignore for disabled rules.
|
||||
if (severity === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !ruleFilter({ severity, ruleId });
|
||||
}),
|
||||
)
|
||||
: new Set();
|
||||
|
||||
// If no ruleId is supplied that means this directive is applied to all rules, so we can't determine if it's unused if any rules are filtered out.
|
||||
if (rulesToIgnore.size > 0) {
|
||||
rulesToIgnore.add(null);
|
||||
}
|
||||
|
||||
const blockDirectivesResult = applyDirectives({
|
||||
language,
|
||||
sourceCode,
|
||||
problems,
|
||||
directives: blockDirectives,
|
||||
disableFixes,
|
||||
reportUnusedDisableDirectives,
|
||||
rulesToIgnore,
|
||||
});
|
||||
const lineDirectivesResult = applyDirectives({
|
||||
language,
|
||||
sourceCode,
|
||||
problems: blockDirectivesResult.problems,
|
||||
directives: lineDirectives,
|
||||
disableFixes,
|
||||
reportUnusedDisableDirectives,
|
||||
rulesToIgnore,
|
||||
});
|
||||
|
||||
return reportUnusedDisableDirectives !== "off"
|
||||
? lineDirectivesResult.problems
|
||||
.concat(blockDirectivesResult.unusedDirectives)
|
||||
.concat(lineDirectivesResult.unusedDirectives)
|
||||
.sort(compareLocations)
|
||||
: lineDirectivesResult.problems;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"K D E mC"},B:{"1":"C L M G N O P","2":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"2":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"2":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"2":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C H FC kC GC"},L:{"2":"I"},M:{"2":"EC"},N:{"1":"A B"},O:{"2":"HC"},P:{"2":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"2":"qD rD"}},B:6,C:"JPEG XR image format",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t"},C:{"2":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"1":"0 9 u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t"},E:{"1":"KC gC hC iC jC 3C","2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C"},F:{"1":"0 g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"2":"EC"},N:{"2":"A B"},O:{"2":"HC"},P:{"1":"4 5 6 7 8","2":"1 2 3 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"2":"qD rD"}},B:5,C:"View Transitions API (single-document)",D:true};
|
||||
@@ -0,0 +1,7 @@
|
||||
`react-router` is the primary package in the React Router project.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm i react-router
|
||||
```
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @fileoverview disallow use of the Buffer() constructor
|
||||
* @author Teddy Katz
|
||||
* @deprecated in ESLint v7.0.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Node.js rules were moved out of ESLint core.",
|
||||
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
|
||||
deprecatedSince: "7.0.0",
|
||||
availableUntil: null,
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
|
||||
plugin: {
|
||||
name: "eslint-plugin-n",
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n",
|
||||
},
|
||||
rule: {
|
||||
name: "no-deprecated-api",
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/no-deprecated-api.md",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "Disallow use of the `Buffer()` constructor",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-buffer-constructor",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
deprecated:
|
||||
"{{expr}} is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
//----------------------------------------------------------------------
|
||||
// Public
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
"CallExpression[callee.name='Buffer'], NewExpression[callee.name='Buffer']"(
|
||||
node,
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "deprecated",
|
||||
data: {
|
||||
expr:
|
||||
node.type === "CallExpression"
|
||||
? "Buffer()"
|
||||
: "new Buffer()",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _superPropSet;
|
||||
var _set = require("./set.js");
|
||||
var _getPrototypeOf = require("./getPrototypeOf.js");
|
||||
function _superPropSet(classArg, property, value, receiver, isStrict, prototype) {
|
||||
return (0, _set.default)((0, _getPrototypeOf.default)(prototype ? classArg.prototype : classArg), property, value, receiver, isStrict);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=superPropSet.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useRouter.js","sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { getRouterContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = React.useContext(getRouterContext())\n warning(\n !((opts?.warn ?? true) && !value),\n 'useRouter must be used inside a <RouterProvider> component!',\n )\n return value as any\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,UAAwD,MAE5D;AACV,QAAM,QAAQ,MAAM,WAAW,iBAAA,CAAkB;AACjD;AAAA,IACE,IAAG,6BAAM,SAAQ,SAAS,CAAC;AAAA,IAC3B;AAAA,EACF;AACO,SAAA;AACT;"}
|
||||
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ConfigPrinter = exports.ChainFormatter = void 0;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
const ChainFormatter = exports.ChainFormatter = {
|
||||
Programmatic: 0,
|
||||
Config: 1
|
||||
};
|
||||
const Formatter = {
|
||||
title(type, callerName, filepath) {
|
||||
let title = "";
|
||||
if (type === ChainFormatter.Programmatic) {
|
||||
title = "programmatic options";
|
||||
if (callerName) {
|
||||
title += " from " + callerName;
|
||||
}
|
||||
} else {
|
||||
title = "config " + filepath;
|
||||
}
|
||||
return title;
|
||||
},
|
||||
loc(index, envName) {
|
||||
let loc = "";
|
||||
if (index != null) {
|
||||
loc += `.overrides[${index}]`;
|
||||
}
|
||||
if (envName != null) {
|
||||
loc += `.env["${envName}"]`;
|
||||
}
|
||||
return loc;
|
||||
},
|
||||
*optionsAndDescriptors(opt) {
|
||||
const content = Object.assign({}, opt.options);
|
||||
delete content.overrides;
|
||||
delete content.env;
|
||||
const pluginDescriptors = [...(yield* opt.plugins())];
|
||||
if (pluginDescriptors.length) {
|
||||
content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));
|
||||
}
|
||||
const presetDescriptors = [...(yield* opt.presets())];
|
||||
if (presetDescriptors.length) {
|
||||
content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));
|
||||
}
|
||||
return JSON.stringify(content, undefined, 2);
|
||||
}
|
||||
};
|
||||
function descriptorToConfig(d) {
|
||||
var _d$file;
|
||||
let name = (_d$file = d.file) == null ? void 0 : _d$file.request;
|
||||
if (name == null) {
|
||||
if (typeof d.value === "object") {
|
||||
name = d.value;
|
||||
} else if (typeof d.value === "function") {
|
||||
name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`;
|
||||
}
|
||||
}
|
||||
if (name == null) {
|
||||
name = "[Unknown]";
|
||||
}
|
||||
if (d.options === undefined) {
|
||||
return name;
|
||||
} else if (d.name == null) {
|
||||
return [name, d.options];
|
||||
} else {
|
||||
return [name, d.options, d.name];
|
||||
}
|
||||
}
|
||||
class ConfigPrinter {
|
||||
constructor() {
|
||||
this._stack = [];
|
||||
}
|
||||
configure(enabled, type, {
|
||||
callerName,
|
||||
filepath
|
||||
}) {
|
||||
if (!enabled) return () => {};
|
||||
return (content, index, envName) => {
|
||||
this._stack.push({
|
||||
type,
|
||||
callerName,
|
||||
filepath,
|
||||
content,
|
||||
index,
|
||||
envName
|
||||
});
|
||||
};
|
||||
}
|
||||
static *format(config) {
|
||||
let title = Formatter.title(config.type, config.callerName, config.filepath);
|
||||
const loc = Formatter.loc(config.index, config.envName);
|
||||
if (loc) title += ` ${loc}`;
|
||||
const content = yield* Formatter.optionsAndDescriptors(config.content);
|
||||
return `${title}\n${content}`;
|
||||
}
|
||||
*output() {
|
||||
if (this._stack.length === 0) return "";
|
||||
const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s)));
|
||||
return configs.join("\n\n");
|
||||
}
|
||||
}
|
||||
exports.ConfigPrinter = ConfigPrinter;
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=printer.js.map
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @fileoverview Rule to disallow assignments to native objects or read-only global variables
|
||||
* @author Ilya Volodin
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [{ exceptions: [] }],
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow assignments to native objects or read-only global variables",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-global-assign",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
exceptions: {
|
||||
type: "array",
|
||||
items: { type: "string" },
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
globalShouldNotBeModified:
|
||||
"Read-only global '{{name}}' should not be modified.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const [{ exceptions }] = context.options;
|
||||
|
||||
/**
|
||||
* Reports write references.
|
||||
* @param {Reference} reference A reference to check.
|
||||
* @param {int} index The index of the reference in the references.
|
||||
* @param {Reference[]} references The array that the reference belongs to.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkReference(reference, index, references) {
|
||||
const identifier = reference.identifier;
|
||||
|
||||
if (
|
||||
reference.init === false &&
|
||||
reference.isWrite() &&
|
||||
/*
|
||||
* Destructuring assignments can have multiple default value,
|
||||
* so possibly there are multiple writeable references for the same identifier.
|
||||
*/
|
||||
(index === 0 || references[index - 1].identifier !== identifier)
|
||||
) {
|
||||
context.report({
|
||||
node: identifier,
|
||||
messageId: "globalShouldNotBeModified",
|
||||
data: {
|
||||
name: identifier.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports write references if a given variable is read-only builtin.
|
||||
* @param {Variable} variable A variable to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkVariable(variable) {
|
||||
if (
|
||||
variable.writeable === false &&
|
||||
!exceptions.includes(variable.name)
|
||||
) {
|
||||
variable.references.forEach(checkReference);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Program(node) {
|
||||
const globalScope = sourceCode.getScope(node);
|
||||
|
||||
globalScope.variables.forEach(checkVariable);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,201 @@
|
||||
# word-wrap [](https://www.npmjs.com/package/word-wrap) [](https://npmjs.org/package/word-wrap) [](https://npmjs.org/package/word-wrap) [](https://travis-ci.org/jonschlinkert/word-wrap)
|
||||
|
||||
> Wrap words to a specified length.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save word-wrap
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var wrap = require('word-wrap');
|
||||
|
||||
wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
|
||||
```
|
||||
|
||||
Results in:
|
||||
|
||||
```
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing
|
||||
elit, sed do eiusmod tempor incididunt ut labore
|
||||
et dolore magna aliqua. Ut enim ad minim veniam,
|
||||
quis nostrud exercitation ullamco laboris nisi ut
|
||||
aliquip ex ea commodo consequat.
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||

|
||||
|
||||
### options.width
|
||||
|
||||
Type: `Number`
|
||||
|
||||
Default: `50`
|
||||
|
||||
The width of the text before wrapping to a new line.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
wrap(str, {width: 60});
|
||||
```
|
||||
|
||||
### options.indent
|
||||
|
||||
Type: `String`
|
||||
|
||||
Default: `` (two spaces)
|
||||
|
||||
The string to use at the beginning of each line.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
wrap(str, {indent: ' '});
|
||||
```
|
||||
|
||||
### options.newline
|
||||
|
||||
Type: `String`
|
||||
|
||||
Default: `\n`
|
||||
|
||||
The string to use at the end of each line.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
wrap(str, {newline: '\n\n'});
|
||||
```
|
||||
|
||||
### options.escape
|
||||
|
||||
Type: `function`
|
||||
|
||||
Default: `function(str){return str;}`
|
||||
|
||||
An escape function to run on each line after splitting them.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
var xmlescape = require('xml-escape');
|
||||
wrap(str, {
|
||||
escape: function(string){
|
||||
return xmlescape(string);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### options.trim
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Default: `false`
|
||||
|
||||
Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
wrap(str, {trim: true});
|
||||
```
|
||||
|
||||
### options.cut
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Default: `false`
|
||||
|
||||
Break a word between any two letters when the word is longer than the specified width.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
wrap(str, {cut: true});
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.")
|
||||
* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.")
|
||||
* [unique-words](https://www.npmjs.com/package/unique-words): Returns an array of unique words, or the number of occurrences of each word in… [more](https://github.com/jonschlinkert/unique-words) | [homepage](https://github.com/jonschlinkert/unique-words "Returns an array of unique words, or the number of occurrences of each word in a string or list.")
|
||||
* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 47 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 7 | [OlafConijn](https://github.com/OlafConijn) |
|
||||
| 3 | [doowb](https://github.com/doowb) |
|
||||
| 2 | [aashutoshrathi](https://github.com/aashutoshrathi) |
|
||||
| 2 | [lordvlad](https://github.com/lordvlad) |
|
||||
| 2 | [hildjj](https://github.com/hildjj) |
|
||||
| 1 | [danilosampaio](https://github.com/danilosampaio) |
|
||||
| 1 | [2fd](https://github.com/2fd) |
|
||||
| 1 | [leonard-thieu](https://github.com/leonard-thieu) |
|
||||
| 1 | [mohd-akram](https://github.com/mohd-akram) |
|
||||
| 1 | [toddself](https://github.com/toddself) |
|
||||
| 1 | [wolfgang42](https://github.com/wolfgang42) |
|
||||
| 1 | [zachhale](https://github.com/zachhale) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2023, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 22, 2023._
|
||||
@@ -0,0 +1,255 @@
|
||||
module.exports = {
|
||||
quot: '\u0022',
|
||||
amp: '&',
|
||||
apos: '\u0027',
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
nbsp: '\u00A0',
|
||||
iexcl: '\u00A1',
|
||||
cent: '\u00A2',
|
||||
pound: '\u00A3',
|
||||
curren: '\u00A4',
|
||||
yen: '\u00A5',
|
||||
brvbar: '\u00A6',
|
||||
sect: '\u00A7',
|
||||
uml: '\u00A8',
|
||||
copy: '\u00A9',
|
||||
ordf: '\u00AA',
|
||||
laquo: '\u00AB',
|
||||
not: '\u00AC',
|
||||
shy: '\u00AD',
|
||||
reg: '\u00AE',
|
||||
macr: '\u00AF',
|
||||
deg: '\u00B0',
|
||||
plusmn: '\u00B1',
|
||||
sup2: '\u00B2',
|
||||
sup3: '\u00B3',
|
||||
acute: '\u00B4',
|
||||
micro: '\u00B5',
|
||||
para: '\u00B6',
|
||||
middot: '\u00B7',
|
||||
cedil: '\u00B8',
|
||||
sup1: '\u00B9',
|
||||
ordm: '\u00BA',
|
||||
raquo: '\u00BB',
|
||||
frac14: '\u00BC',
|
||||
frac12: '\u00BD',
|
||||
frac34: '\u00BE',
|
||||
iquest: '\u00BF',
|
||||
Agrave: '\u00C0',
|
||||
Aacute: '\u00C1',
|
||||
Acirc: '\u00C2',
|
||||
Atilde: '\u00C3',
|
||||
Auml: '\u00C4',
|
||||
Aring: '\u00C5',
|
||||
AElig: '\u00C6',
|
||||
Ccedil: '\u00C7',
|
||||
Egrave: '\u00C8',
|
||||
Eacute: '\u00C9',
|
||||
Ecirc: '\u00CA',
|
||||
Euml: '\u00CB',
|
||||
Igrave: '\u00CC',
|
||||
Iacute: '\u00CD',
|
||||
Icirc: '\u00CE',
|
||||
Iuml: '\u00CF',
|
||||
ETH: '\u00D0',
|
||||
Ntilde: '\u00D1',
|
||||
Ograve: '\u00D2',
|
||||
Oacute: '\u00D3',
|
||||
Ocirc: '\u00D4',
|
||||
Otilde: '\u00D5',
|
||||
Ouml: '\u00D6',
|
||||
times: '\u00D7',
|
||||
Oslash: '\u00D8',
|
||||
Ugrave: '\u00D9',
|
||||
Uacute: '\u00DA',
|
||||
Ucirc: '\u00DB',
|
||||
Uuml: '\u00DC',
|
||||
Yacute: '\u00DD',
|
||||
THORN: '\u00DE',
|
||||
szlig: '\u00DF',
|
||||
agrave: '\u00E0',
|
||||
aacute: '\u00E1',
|
||||
acirc: '\u00E2',
|
||||
atilde: '\u00E3',
|
||||
auml: '\u00E4',
|
||||
aring: '\u00E5',
|
||||
aelig: '\u00E6',
|
||||
ccedil: '\u00E7',
|
||||
egrave: '\u00E8',
|
||||
eacute: '\u00E9',
|
||||
ecirc: '\u00EA',
|
||||
euml: '\u00EB',
|
||||
igrave: '\u00EC',
|
||||
iacute: '\u00ED',
|
||||
icirc: '\u00EE',
|
||||
iuml: '\u00EF',
|
||||
eth: '\u00F0',
|
||||
ntilde: '\u00F1',
|
||||
ograve: '\u00F2',
|
||||
oacute: '\u00F3',
|
||||
ocirc: '\u00F4',
|
||||
otilde: '\u00F5',
|
||||
ouml: '\u00F6',
|
||||
divide: '\u00F7',
|
||||
oslash: '\u00F8',
|
||||
ugrave: '\u00F9',
|
||||
uacute: '\u00FA',
|
||||
ucirc: '\u00FB',
|
||||
uuml: '\u00FC',
|
||||
yacute: '\u00FD',
|
||||
thorn: '\u00FE',
|
||||
yuml: '\u00FF',
|
||||
OElig: '\u0152',
|
||||
oelig: '\u0153',
|
||||
Scaron: '\u0160',
|
||||
scaron: '\u0161',
|
||||
Yuml: '\u0178',
|
||||
fnof: '\u0192',
|
||||
circ: '\u02C6',
|
||||
tilde: '\u02DC',
|
||||
Alpha: '\u0391',
|
||||
Beta: '\u0392',
|
||||
Gamma: '\u0393',
|
||||
Delta: '\u0394',
|
||||
Epsilon: '\u0395',
|
||||
Zeta: '\u0396',
|
||||
Eta: '\u0397',
|
||||
Theta: '\u0398',
|
||||
Iota: '\u0399',
|
||||
Kappa: '\u039A',
|
||||
Lambda: '\u039B',
|
||||
Mu: '\u039C',
|
||||
Nu: '\u039D',
|
||||
Xi: '\u039E',
|
||||
Omicron: '\u039F',
|
||||
Pi: '\u03A0',
|
||||
Rho: '\u03A1',
|
||||
Sigma: '\u03A3',
|
||||
Tau: '\u03A4',
|
||||
Upsilon: '\u03A5',
|
||||
Phi: '\u03A6',
|
||||
Chi: '\u03A7',
|
||||
Psi: '\u03A8',
|
||||
Omega: '\u03A9',
|
||||
alpha: '\u03B1',
|
||||
beta: '\u03B2',
|
||||
gamma: '\u03B3',
|
||||
delta: '\u03B4',
|
||||
epsilon: '\u03B5',
|
||||
zeta: '\u03B6',
|
||||
eta: '\u03B7',
|
||||
theta: '\u03B8',
|
||||
iota: '\u03B9',
|
||||
kappa: '\u03BA',
|
||||
lambda: '\u03BB',
|
||||
mu: '\u03BC',
|
||||
nu: '\u03BD',
|
||||
xi: '\u03BE',
|
||||
omicron: '\u03BF',
|
||||
pi: '\u03C0',
|
||||
rho: '\u03C1',
|
||||
sigmaf: '\u03C2',
|
||||
sigma: '\u03C3',
|
||||
tau: '\u03C4',
|
||||
upsilon: '\u03C5',
|
||||
phi: '\u03C6',
|
||||
chi: '\u03C7',
|
||||
psi: '\u03C8',
|
||||
omega: '\u03C9',
|
||||
thetasym: '\u03D1',
|
||||
upsih: '\u03D2',
|
||||
piv: '\u03D6',
|
||||
ensp: '\u2002',
|
||||
emsp: '\u2003',
|
||||
thinsp: '\u2009',
|
||||
zwnj: '\u200C',
|
||||
zwj: '\u200D',
|
||||
lrm: '\u200E',
|
||||
rlm: '\u200F',
|
||||
ndash: '\u2013',
|
||||
mdash: '\u2014',
|
||||
lsquo: '\u2018',
|
||||
rsquo: '\u2019',
|
||||
sbquo: '\u201A',
|
||||
ldquo: '\u201C',
|
||||
rdquo: '\u201D',
|
||||
bdquo: '\u201E',
|
||||
dagger: '\u2020',
|
||||
Dagger: '\u2021',
|
||||
bull: '\u2022',
|
||||
hellip: '\u2026',
|
||||
permil: '\u2030',
|
||||
prime: '\u2032',
|
||||
Prime: '\u2033',
|
||||
lsaquo: '\u2039',
|
||||
rsaquo: '\u203A',
|
||||
oline: '\u203E',
|
||||
frasl: '\u2044',
|
||||
euro: '\u20AC',
|
||||
image: '\u2111',
|
||||
weierp: '\u2118',
|
||||
real: '\u211C',
|
||||
trade: '\u2122',
|
||||
alefsym: '\u2135',
|
||||
larr: '\u2190',
|
||||
uarr: '\u2191',
|
||||
rarr: '\u2192',
|
||||
darr: '\u2193',
|
||||
harr: '\u2194',
|
||||
crarr: '\u21B5',
|
||||
lArr: '\u21D0',
|
||||
uArr: '\u21D1',
|
||||
rArr: '\u21D2',
|
||||
dArr: '\u21D3',
|
||||
hArr: '\u21D4',
|
||||
forall: '\u2200',
|
||||
part: '\u2202',
|
||||
exist: '\u2203',
|
||||
empty: '\u2205',
|
||||
nabla: '\u2207',
|
||||
isin: '\u2208',
|
||||
notin: '\u2209',
|
||||
ni: '\u220B',
|
||||
prod: '\u220F',
|
||||
sum: '\u2211',
|
||||
minus: '\u2212',
|
||||
lowast: '\u2217',
|
||||
radic: '\u221A',
|
||||
prop: '\u221D',
|
||||
infin: '\u221E',
|
||||
ang: '\u2220',
|
||||
and: '\u2227',
|
||||
or: '\u2228',
|
||||
cap: '\u2229',
|
||||
cup: '\u222A',
|
||||
'int': '\u222B',
|
||||
there4: '\u2234',
|
||||
sim: '\u223C',
|
||||
cong: '\u2245',
|
||||
asymp: '\u2248',
|
||||
ne: '\u2260',
|
||||
equiv: '\u2261',
|
||||
le: '\u2264',
|
||||
ge: '\u2265',
|
||||
sub: '\u2282',
|
||||
sup: '\u2283',
|
||||
nsub: '\u2284',
|
||||
sube: '\u2286',
|
||||
supe: '\u2287',
|
||||
oplus: '\u2295',
|
||||
otimes: '\u2297',
|
||||
perp: '\u22A5',
|
||||
sdot: '\u22C5',
|
||||
lceil: '\u2308',
|
||||
rceil: '\u2309',
|
||||
lfloor: '\u230A',
|
||||
rfloor: '\u230B',
|
||||
lang: '\u2329',
|
||||
rang: '\u232A',
|
||||
loz: '\u25CA',
|
||||
spades: '\u2660',
|
||||
clubs: '\u2663',
|
||||
hearts: '\u2665',
|
||||
diams: '\u2666'
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
export class BaseCMapReaderFactory {
|
||||
constructor({ baseUrl, isCompressed }: {
|
||||
baseUrl?: null | undefined;
|
||||
isCompressed?: boolean | undefined;
|
||||
});
|
||||
baseUrl: any;
|
||||
isCompressed: boolean;
|
||||
fetch({ name }: {
|
||||
name: any;
|
||||
}): Promise<{
|
||||
cMapData: Uint8Array;
|
||||
isCompressed: boolean;
|
||||
}>;
|
||||
/**
|
||||
* @ignore
|
||||
* @returns {Promise<Uint8Array>}
|
||||
*/
|
||||
_fetch(url: any): Promise<Uint8Array>;
|
||||
}
|
||||
export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["formatters","require","_builder","smart","exports","createTemplateBuilder","statement","statements","expression","program","_default","default","Object","assign","bind","undefined","ast"],"sources":["../src/index.ts"],"sourcesContent":["import * as formatters from \"./formatters.ts\";\nimport createTemplateBuilder from \"./builder.ts\";\n\nexport const smart = createTemplateBuilder(formatters.smart);\nexport const statement = createTemplateBuilder(formatters.statement);\nexport const statements = createTemplateBuilder(formatters.statements);\nexport const expression = createTemplateBuilder(formatters.expression);\nexport const program = createTemplateBuilder(formatters.program);\n\ntype DefaultTemplateBuilder = typeof smart & {\n smart: typeof smart;\n statement: typeof statement;\n statements: typeof statements;\n expression: typeof expression;\n program: typeof program;\n};\n\nexport default Object.assign(smart.bind(undefined) as DefaultTemplateBuilder, {\n smart,\n statement,\n statements,\n expression,\n program,\n ast: smart.ast,\n});\n\nexport type {\n PublicOpts as Options,\n PublicReplacements as Replacements,\n} from \"./options.ts\";\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,gBAAqB,EAACL,UAAU,CAACG,KAAK,CAAC;AACrD,MAAMG,SAAS,GAAAF,OAAA,CAAAE,SAAA,GAAG,IAAAD,gBAAqB,EAACL,UAAU,CAACM,SAAS,CAAC;AAC7D,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,IAAAF,gBAAqB,EAACL,UAAU,CAACO,UAAU,CAAC;AAC/D,MAAMC,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG,IAAAH,gBAAqB,EAACL,UAAU,CAACQ,UAAU,CAAC;AAC/D,MAAMC,OAAO,GAAAL,OAAA,CAAAK,OAAA,GAAG,IAAAJ,gBAAqB,EAACL,UAAU,CAACS,OAAO,CAAC;AAAC,IAAAC,QAAA,GAAAN,OAAA,CAAAO,OAAA,GAUlDC,MAAM,CAACC,MAAM,CAACV,KAAK,CAACW,IAAI,CAACC,SAAS,CAAC,EAA4B;EAC5EZ,KAAK;EACLG,SAAS;EACTC,UAAU;EACVC,UAAU;EACVC,OAAO;EACPO,GAAG,EAAEb,KAAK,CAACa;AACb,CAAC,CAAC","ignoreList":[]}
|
||||
Reference in New Issue
Block a user