Deploy Production Code for Commit 2323e0195f 🚀

This commit is contained in:
James Ives
2024-09-02 15:50:16 +00:00
parent 2323e0195f
commit 920cbb300d
113 changed files with 1644 additions and 631 deletions

View File

@@ -28,7 +28,9 @@ const core_1 = require("@actions/core");
const github = __importStar(require("@actions/github"));
const util_1 = require("./util");
const { pusher, repository } = github.context.payload;
/* Flags to signal different scenarios to test cases */
/*
* Flags to signal different scenarios to test cases
*/
var TestFlag;
(function (TestFlag) {
TestFlag[TestFlag["NONE"] = 0] = "NONE";

7
lib/lib.d.ts vendored
View File

@@ -1,6 +1,5 @@
import { ActionInterface, NodeActionInterface } from './constants';
/** Initializes and runs the action.
*
* @param {object} configuration - The action configuration.
/**
* Initializes and runs the action.
*/
export default function run(configuration: ActionInterface | NodeActionInterface): Promise<void>;
export default function run(configuration?: ActionInterface | NodeActionInterface): Promise<void>;

View File

@@ -15,9 +15,8 @@ const constants_1 = require("./constants");
const git_1 = require("./git");
const ssh_1 = require("./ssh");
const util_1 = require("./util");
/** Initializes and runs the action.
*
* @param {object} configuration - The action configuration.
/**
* Initializes and runs the action.
*/
function run(configuration) {
return __awaiter(this, void 0, void 0, function* () {
@@ -49,11 +48,11 @@ function run(configuration) {
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues`);
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
const settings = Object.assign(Object.assign({}, configuration), {
// Set the default branch for Node configurations
branch: !(0, util_1.isNullOrUndefined)(configuration.branch)
? configuration.branch
: 'gh-pages' });
const settings = Object.assign(Object.assign({}, constants_1.action), configuration);
// Sets the branch to the default value if it's not defined
settings.branch = !(0, util_1.isNullOrUndefined)(settings.branch)
? settings.branch
: 'gh-pages';
// Defines the repository/folder paths and token types.
// Also verifies that the action has all of the required parameters.
settings.folderPath = (0, util_1.generateFolderPath)(settings);

View File

@@ -3,7 +3,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("./constants");
const lib_1 = __importDefault(require("./lib"));
// Runs the action within the GitHub actions environment.
(0, lib_1.default)(constants_1.action);
(0, lib_1.default)();

View File

@@ -430,10 +430,21 @@ declare module "@eslint-community/regexpp/ast" {
* The backreference.
* E.g. `\1`, `\k<name>`
*/
export interface Backreference extends NodeBase {
export type Backreference = AmbiguousBackreference | UnambiguousBackreference;
interface BaseBackreference extends NodeBase {
type: "Backreference";
parent: Alternative | Quantifier;
ref: number | string;
ambiguous: boolean;
resolved: CapturingGroup | CapturingGroup[];
}
export interface AmbiguousBackreference extends BaseBackreference {
ref: string;
ambiguous: true;
resolved: CapturingGroup[];
}
export interface UnambiguousBackreference extends BaseBackreference {
ambiguous: false;
resolved: CapturingGroup;
}
/**
@@ -471,7 +482,7 @@ declare module "@eslint-community/regexpp/parser" {
*/
strict?: boolean;
/**
* ECMAScript version. Default is `2024`.
* ECMAScript version. Default is `2025`.
* - `2015` added `u` and `y` flags.
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
* and Unicode Property Escape.
@@ -479,6 +490,7 @@ declare module "@eslint-community/regexpp/parser" {
* - `2022` added `d` flag.
* - `2023` added more valid Unicode Property Escapes.
* - `2024` added `v` flag.
* - `2025` added duplicate named capturing groups.
*/
ecmaVersion?: EcmaVersion;
}
@@ -559,7 +571,7 @@ declare module "@eslint-community/regexpp/validator" {
*/
strict?: boolean;
/**
* ECMAScript version. Default is `2024`.
* ECMAScript version. Default is `2025`.
* - `2015` added `u` and `y` flags.
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
* and Unicode Property Escape.
@@ -567,6 +579,7 @@ declare module "@eslint-community/regexpp/validator" {
* - `2022` added `d` flag.
* - `2023` added more valid Unicode Property Escapes.
* - `2024` added `v` flag.
* - `2025` added duplicate named capturing groups.
*/
ecmaVersion?: EcmaVersion;
/**
@@ -1060,6 +1073,7 @@ declare module "@eslint-community/regexpp/ecma-versions" {
| 2021
| 2022
| 2023
| 2024;
export const latestEcmaVersion = 2024;
| 2024
| 2025;
export const latestEcmaVersion = 2025;
}

View File

@@ -6,7 +6,7 @@ var ast = /*#__PURE__*/Object.freeze({
__proto__: null
});
const latestEcmaVersion = 2024;
const latestEcmaVersion = 2025;
let largeIdStartRanges = undefined;
let largeIdContinueRanges = undefined;
@@ -74,7 +74,7 @@ function restoreRanges(data) {
}
class DataSet {
constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024) {
constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024, raw2025) {
this._raw2018 = raw2018;
this._raw2019 = raw2019;
this._raw2020 = raw2020;
@@ -82,6 +82,7 @@ class DataSet {
this._raw2022 = raw2022;
this._raw2023 = raw2023;
this._raw2024 = raw2024;
this._raw2025 = raw2025;
}
get es2018() {
var _a;
@@ -111,13 +112,17 @@ class DataSet {
var _a;
return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" "))));
}
get es2025() {
var _a;
return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.split(" "))));
}
}
const gcNameSet = new Set(["General_Category", "gc"]);
const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "");
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz", "");
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "");
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence");
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "");
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz", "", "");
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "");
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "");
function isValidUnicodeProperty(version, name, value) {
if (gcNameSet.has(name)) {
return version >= 2018 && gcValueSets.es2018.has(value);
@@ -259,6 +264,103 @@ function combineSurrogatePair(lead, trail) {
return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000;
}
class GroupSpecifiersAsES2018 {
constructor() {
this.groupName = new Set();
}
clear() {
this.groupName.clear();
}
isEmpty() {
return !this.groupName.size;
}
hasInPattern(name) {
return this.groupName.has(name);
}
hasInScope(name) {
return this.hasInPattern(name);
}
addToScope(name) {
this.groupName.add(name);
}
enterDisjunction() {
}
enterAlternative() {
}
leaveDisjunction() {
}
}
class BranchID {
constructor(parent, base) {
this.parent = parent;
this.base = base !== null && base !== void 0 ? base : this;
}
separatedFrom(other) {
var _a, _b;
if (this.base === other.base && this !== other) {
return true;
}
if (other.parent && this.separatedFrom(other.parent)) {
return true;
}
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false;
}
child() {
return new BranchID(this, null);
}
sibling() {
return new BranchID(this.parent, this.base);
}
}
class GroupSpecifiersAsES2025 {
constructor() {
this.branchID = new BranchID(null, null);
this.groupNames = new Map();
}
clear() {
this.branchID = new BranchID(null, null);
this.groupNames.clear();
}
isEmpty() {
return !this.groupNames.size;
}
enterDisjunction() {
this.branchID = this.branchID.child();
}
enterAlternative(index) {
if (index === 0) {
return;
}
this.branchID = this.branchID.sibling();
}
leaveDisjunction() {
this.branchID = this.branchID.parent;
}
hasInPattern(name) {
return this.groupNames.has(name);
}
hasInScope(name) {
const branches = this.groupNames.get(name);
if (!branches) {
return false;
}
for (const branch of branches) {
if (!branch.separatedFrom(this.branchID)) {
return true;
}
}
return false;
}
addToScope(name) {
const branches = this.groupNames.get(name);
if (branches) {
branches.push(this.branchID);
return;
}
this.groupNames.set(name, [this.branchID]);
}
}
const legacyImpl = {
at(s, end, i) {
return i < end ? s.charCodeAt(i) : -1;
@@ -491,10 +593,13 @@ class RegExpValidator {
this._lastStrValue = "";
this._lastAssertionIsQuantifiable = false;
this._numCapturingParens = 0;
this._groupNames = new Set();
this._backreferenceNames = new Set();
this._srcCtx = null;
this._options = options !== null && options !== void 0 ? options : {};
this._groupSpecifiers =
this.ecmaVersion >= 2025
? new GroupSpecifiersAsES2025()
: new GroupSpecifiersAsES2018();
}
validateLiteral(source, start = 0, end = source.length) {
this._srcCtx = { source, start, end, kind: "literal" };
@@ -537,7 +642,7 @@ class RegExpValidator {
this.consumePattern();
if (!this._nFlag &&
this.ecmaVersion >= 2018 &&
this._groupNames.size > 0) {
!this._groupSpecifiers.isEmpty()) {
this._nFlag = true;
this.rewind(start);
this.consumePattern();
@@ -874,7 +979,7 @@ class RegExpValidator {
consumePattern() {
const start = this.index;
this._numCapturingParens = this.countCapturingParens();
this._groupNames.clear();
this._groupSpecifiers.clear();
this._backreferenceNames.clear();
this.onPatternEnter(start);
this.consumeDisjunction();
@@ -893,7 +998,7 @@ class RegExpValidator {
this.raise(`Unexpected character '${c}'`);
}
for (const name of this._backreferenceNames) {
if (!this._groupNames.has(name)) {
if (!this._groupSpecifiers.hasInPattern(name)) {
this.raise("Invalid named capture referenced");
}
}
@@ -934,6 +1039,7 @@ class RegExpValidator {
consumeDisjunction() {
const start = this.index;
let i = 0;
this._groupSpecifiers.enterDisjunction();
this.onDisjunctionEnter(start);
do {
this.consumeAlternative(i++);
@@ -945,9 +1051,11 @@ class RegExpValidator {
this.raise("Lone quantifier brackets");
}
this.onDisjunctionLeave(start, this.index);
this._groupSpecifiers.leaveDisjunction();
}
consumeAlternative(i) {
const start = this.index;
this._groupSpecifiers.enterAlternative(i);
this.onAlternativeEnter(start, i);
while (this.currentCodePoint !== -1 && this.consumeTerm()) {
}
@@ -1181,8 +1289,8 @@ class RegExpValidator {
consumeGroupSpecifier() {
if (this.eat(QUESTION_MARK)) {
if (this.eatGroupName()) {
if (!this._groupNames.has(this._lastStrValue)) {
this._groupNames.add(this._lastStrValue);
if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) {
this._groupSpecifiers.addToScope(this._lastStrValue);
return true;
}
this.raise("Duplicate capture group name");
@@ -2005,11 +2113,21 @@ class RegExpParserState {
this._node.raw = this.source.slice(start, end);
for (const reference of this._backreferences) {
const ref = reference.ref;
const group = typeof ref === "number"
? this._capturingGroups[ref - 1]
: this._capturingGroups.find((g) => g.name === ref);
reference.resolved = group;
group.references.push(reference);
const groups = typeof ref === "number"
? [this._capturingGroups[ref - 1]]
: this._capturingGroups.filter((g) => g.name === ref);
if (groups.length === 1) {
const group = groups[0];
reference.ambiguous = false;
reference.resolved = group;
}
else {
reference.ambiguous = true;
reference.resolved = groups;
}
for (const group of groups) {
group.references.push(reference);
}
}
}
onAlternativeEnter(start) {
@@ -2207,10 +2325,12 @@ class RegExpParserState {
}
const base = {
type: "CharacterSet",
parent: null,
start,
end,
raw: this.source.slice(start, end),
kind,
strings: null,
key,
};
if (strings) {
@@ -2253,6 +2373,7 @@ class RegExpParserState {
end,
raw: this.source.slice(start, end),
ref,
ambiguous: false,
resolved: DUMMY_CAPTURING_GROUP,
};
parent.elements.push(node);

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@ var ast = /*#__PURE__*/Object.freeze({
__proto__: null
});
const latestEcmaVersion = 2024;
const latestEcmaVersion = 2025;
let largeIdStartRanges = undefined;
let largeIdContinueRanges = undefined;
@@ -70,7 +70,7 @@ function restoreRanges(data) {
}
class DataSet {
constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024) {
constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024, raw2025) {
this._raw2018 = raw2018;
this._raw2019 = raw2019;
this._raw2020 = raw2020;
@@ -78,6 +78,7 @@ class DataSet {
this._raw2022 = raw2022;
this._raw2023 = raw2023;
this._raw2024 = raw2024;
this._raw2025 = raw2025;
}
get es2018() {
var _a;
@@ -107,13 +108,17 @@ class DataSet {
var _a;
return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" "))));
}
get es2025() {
var _a;
return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.split(" "))));
}
}
const gcNameSet = new Set(["General_Category", "gc"]);
const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "");
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz", "");
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "");
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence");
const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "");
const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz", "", "");
const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "");
const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "");
function isValidUnicodeProperty(version, name, value) {
if (gcNameSet.has(name)) {
return version >= 2018 && gcValueSets.es2018.has(value);
@@ -255,6 +260,103 @@ function combineSurrogatePair(lead, trail) {
return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000;
}
class GroupSpecifiersAsES2018 {
constructor() {
this.groupName = new Set();
}
clear() {
this.groupName.clear();
}
isEmpty() {
return !this.groupName.size;
}
hasInPattern(name) {
return this.groupName.has(name);
}
hasInScope(name) {
return this.hasInPattern(name);
}
addToScope(name) {
this.groupName.add(name);
}
enterDisjunction() {
}
enterAlternative() {
}
leaveDisjunction() {
}
}
class BranchID {
constructor(parent, base) {
this.parent = parent;
this.base = base !== null && base !== void 0 ? base : this;
}
separatedFrom(other) {
var _a, _b;
if (this.base === other.base && this !== other) {
return true;
}
if (other.parent && this.separatedFrom(other.parent)) {
return true;
}
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false;
}
child() {
return new BranchID(this, null);
}
sibling() {
return new BranchID(this.parent, this.base);
}
}
class GroupSpecifiersAsES2025 {
constructor() {
this.branchID = new BranchID(null, null);
this.groupNames = new Map();
}
clear() {
this.branchID = new BranchID(null, null);
this.groupNames.clear();
}
isEmpty() {
return !this.groupNames.size;
}
enterDisjunction() {
this.branchID = this.branchID.child();
}
enterAlternative(index) {
if (index === 0) {
return;
}
this.branchID = this.branchID.sibling();
}
leaveDisjunction() {
this.branchID = this.branchID.parent;
}
hasInPattern(name) {
return this.groupNames.has(name);
}
hasInScope(name) {
const branches = this.groupNames.get(name);
if (!branches) {
return false;
}
for (const branch of branches) {
if (!branch.separatedFrom(this.branchID)) {
return true;
}
}
return false;
}
addToScope(name) {
const branches = this.groupNames.get(name);
if (branches) {
branches.push(this.branchID);
return;
}
this.groupNames.set(name, [this.branchID]);
}
}
const legacyImpl = {
at(s, end, i) {
return i < end ? s.charCodeAt(i) : -1;
@@ -487,10 +589,13 @@ class RegExpValidator {
this._lastStrValue = "";
this._lastAssertionIsQuantifiable = false;
this._numCapturingParens = 0;
this._groupNames = new Set();
this._backreferenceNames = new Set();
this._srcCtx = null;
this._options = options !== null && options !== void 0 ? options : {};
this._groupSpecifiers =
this.ecmaVersion >= 2025
? new GroupSpecifiersAsES2025()
: new GroupSpecifiersAsES2018();
}
validateLiteral(source, start = 0, end = source.length) {
this._srcCtx = { source, start, end, kind: "literal" };
@@ -533,7 +638,7 @@ class RegExpValidator {
this.consumePattern();
if (!this._nFlag &&
this.ecmaVersion >= 2018 &&
this._groupNames.size > 0) {
!this._groupSpecifiers.isEmpty()) {
this._nFlag = true;
this.rewind(start);
this.consumePattern();
@@ -870,7 +975,7 @@ class RegExpValidator {
consumePattern() {
const start = this.index;
this._numCapturingParens = this.countCapturingParens();
this._groupNames.clear();
this._groupSpecifiers.clear();
this._backreferenceNames.clear();
this.onPatternEnter(start);
this.consumeDisjunction();
@@ -889,7 +994,7 @@ class RegExpValidator {
this.raise(`Unexpected character '${c}'`);
}
for (const name of this._backreferenceNames) {
if (!this._groupNames.has(name)) {
if (!this._groupSpecifiers.hasInPattern(name)) {
this.raise("Invalid named capture referenced");
}
}
@@ -930,6 +1035,7 @@ class RegExpValidator {
consumeDisjunction() {
const start = this.index;
let i = 0;
this._groupSpecifiers.enterDisjunction();
this.onDisjunctionEnter(start);
do {
this.consumeAlternative(i++);
@@ -941,9 +1047,11 @@ class RegExpValidator {
this.raise("Lone quantifier brackets");
}
this.onDisjunctionLeave(start, this.index);
this._groupSpecifiers.leaveDisjunction();
}
consumeAlternative(i) {
const start = this.index;
this._groupSpecifiers.enterAlternative(i);
this.onAlternativeEnter(start, i);
while (this.currentCodePoint !== -1 && this.consumeTerm()) {
}
@@ -1177,8 +1285,8 @@ class RegExpValidator {
consumeGroupSpecifier() {
if (this.eat(QUESTION_MARK)) {
if (this.eatGroupName()) {
if (!this._groupNames.has(this._lastStrValue)) {
this._groupNames.add(this._lastStrValue);
if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) {
this._groupSpecifiers.addToScope(this._lastStrValue);
return true;
}
this.raise("Duplicate capture group name");
@@ -2001,11 +2109,21 @@ class RegExpParserState {
this._node.raw = this.source.slice(start, end);
for (const reference of this._backreferences) {
const ref = reference.ref;
const group = typeof ref === "number"
? this._capturingGroups[ref - 1]
: this._capturingGroups.find((g) => g.name === ref);
reference.resolved = group;
group.references.push(reference);
const groups = typeof ref === "number"
? [this._capturingGroups[ref - 1]]
: this._capturingGroups.filter((g) => g.name === ref);
if (groups.length === 1) {
const group = groups[0];
reference.ambiguous = false;
reference.resolved = group;
}
else {
reference.ambiguous = true;
reference.resolved = groups;
}
for (const group of groups) {
group.references.push(reference);
}
}
}
onAlternativeEnter(start) {
@@ -2203,10 +2321,12 @@ class RegExpParserState {
}
const base = {
type: "CharacterSet",
parent: null,
start,
end,
raw: this.source.slice(start, end),
kind,
strings: null,
key,
};
if (strings) {
@@ -2249,6 +2369,7 @@ class RegExpParserState {
end,
raw: this.source.slice(start, end),
ref,
ambiguous: false,
resolved: DUMMY_CAPTURING_GROUP,
};
parent.elements.push(node);

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint-community/regexpp",
"version": "4.10.0",
"version": "4.11.0",
"description": "Regular expression parser for ECMAScript.",
"keywords": [
"regexp",
@@ -82,8 +82,6 @@
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"test262": "git+https://github.com/tc39/test262.git",
"test262-stream": "^1.4.0",
"ts-node": "^10.9.1",
"typescript": "~5.0.2"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint/js",
"version": "9.6.0",
"version": "9.7.0",
"description": "ESLint JavaScript language implementation",
"main": "./src/index.js",
"scripts": {},

View File

@@ -91,11 +91,13 @@ module.exports = {
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-template-expression': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',

View File

@@ -1 +1 @@
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../src/configs/all.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,+BAA+B,EAAE,OAAO;QACxC,mCAAmC,EAAE,OAAO;QAC5C,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,8BAA8B,EAAE,OAAO;QACvC,iDAAiD,EAAE,OAAO;QAC1D,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,oDAAoD,EAAE,OAAO;QAC7D,oDAAoD,EAAE,OAAO;QAC7D,mBAAmB,EAAE,KAAK;QAC1B,sCAAsC,EAAE,OAAO;QAC/C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO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tB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE,OAAO;QAC1C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,2CAA2C,EAAE,OAAO;QACpD,4BAA4B,EAAE,OAAO;QACrC,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}

View File

@@ -35,6 +35,7 @@ module.exports = {
'@typescript-eslint/no-unnecessary-template-expression': 'off',
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',

View File

@@ -1 +1 @@
{"version":3,"file":"disable-type-checked.js","sourceRoot":"","sources":["../../src/configs/disable-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,aAAa,EAAE;QACb,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,IAAI;QACb,8BAA8B,EAAE,KAAK;KACtC;IACD,KAAK,EAAE;QACL,mCAAmC,EAAE,KAAK;QAC1C,sCAAsC,EAAE,KAAK;QAC7C,4CAA4C,EAAE,KAAK;QACnD,iCAAiC,EAAE,KAAK;QACxC,sCAAsC,EAAE,KAAK;QAC7C,oCAAoC,EAAE,KAAK;QAC3C,sCAAsC,EAAE,KAAK;QAC7C,iDAAiD,EAAE,KAAK;QACxD,mDAAmD,EAAE,KAAK;QAC1D,yCAAyC,EAAE,KAAK;QAChD,oCAAoC,EAAE,KAAK;QAC3C,oCAAoC,EAAE,KAAK;QAC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C3C,8CAA8C,EAAE,KAAK;QACrD,0CAA0C,EAAE,KAAK;QACjD,iDAAiD,EAAE,KAAK;QACxD,oCAAoC,EAAE,KAAK;QAC3C,oDAAoD,EAAE,KAAK;QAC3D,iDAAiD,EAAE,KAAK;QACxD,uCAAuC,EAAE,KAAK;QAC9C,4CAA4C,EAAE,KAAK;QACnD,mDAAmD,EAAE,KAAK;QAC1D,2CAA2C,EAAE,KAAK;QAClD,+CAA+C,EAAE,KAAK;QACtD,kCAAkC,EAAE,KAAK;QACzC,2CAA2C,EAAE,KAAK;QAClD,kDAAkD,EAAE,KAAK;QACzD,iCAAiC,EAAE,KAAK;QACxC,+CAA+C,EAAE,KAAK;QACtD,gDAAgD,EAAE,KAAK;QACvD,mCAAmC,EAAE,KAAK;QAC1C,2DAA2D,EAAE,KAAK;KACnE;CAC6B,CAAC"}

View File

@@ -84,11 +84,13 @@ const no_throw_literal_1 = __importDefault(require("./no-throw-literal"));
const no_type_alias_1 = __importDefault(require("./no-type-alias"));
const no_unnecessary_boolean_literal_compare_1 = __importDefault(require("./no-unnecessary-boolean-literal-compare"));
const no_unnecessary_condition_1 = __importDefault(require("./no-unnecessary-condition"));
const no_unnecessary_parameter_property_assignment_1 = __importDefault(require("./no-unnecessary-parameter-property-assignment"));
const no_unnecessary_qualifier_1 = __importDefault(require("./no-unnecessary-qualifier"));
const no_unnecessary_template_expression_1 = __importDefault(require("./no-unnecessary-template-expression"));
const no_unnecessary_type_arguments_1 = __importDefault(require("./no-unnecessary-type-arguments"));
const no_unnecessary_type_assertion_1 = __importDefault(require("./no-unnecessary-type-assertion"));
const no_unnecessary_type_constraint_1 = __importDefault(require("./no-unnecessary-type-constraint"));
const no_unnecessary_type_parameters_1 = __importDefault(require("./no-unnecessary-type-parameters"));
const no_unsafe_argument_1 = __importDefault(require("./no-unsafe-argument"));
const no_unsafe_assignment_1 = __importDefault(require("./no-unsafe-assignment"));
const no_unsafe_call_1 = __importDefault(require("./no-unsafe-call"));
@@ -230,11 +232,13 @@ exports.default = {
'no-type-alias': no_type_alias_1.default,
'no-unnecessary-boolean-literal-compare': no_unnecessary_boolean_literal_compare_1.default,
'no-unnecessary-condition': no_unnecessary_condition_1.default,
'no-unnecessary-parameter-property-assignment': no_unnecessary_parameter_property_assignment_1.default,
'no-unnecessary-qualifier': no_unnecessary_qualifier_1.default,
'no-unnecessary-template-expression': no_unnecessary_template_expression_1.default,
'no-unnecessary-type-arguments': no_unnecessary_type_arguments_1.default,
'no-unnecessary-type-assertion': no_unnecessary_type_assertion_1.default,
'no-unnecessary-type-constraint': no_unnecessary_type_constraint_1.default,
'no-unnecessary-type-parameters': no_unnecessary_type_parameters_1.default,
'no-unsafe-argument': no_unsafe_argument_1.default,
'no-unsafe-assignment': no_unsafe_assignment_1.default,
'no-unsafe-call': no_unsafe_call_1.default,

File diff suppressed because one or more lines are too long

View File

@@ -57,6 +57,11 @@ exports.default = (0, util_1.createRule)({
{
type: 'object',
properties: {
allowForKnownSafePromises: util_1.readonlynessOptionsSchema.properties.allow,
checkThenables: {
description: 'Whether to check all "Thenable"s, not just the built-in Promise type.',
type: 'boolean',
},
ignoreVoid: {
description: 'Whether to ignore `void` expressions.',
type: 'boolean',
@@ -65,7 +70,6 @@ exports.default = (0, util_1.createRule)({
description: 'Whether to ignore async IIFEs (Immediately Invoked Function Expressions).',
type: 'boolean',
},
allowForKnownSafePromises: util_1.readonlynessOptionsSchema.properties.allow,
},
additionalProperties: false,
},
@@ -74,14 +78,16 @@ exports.default = (0, util_1.createRule)({
},
defaultOptions: [
{
allowForKnownSafePromises: util_1.readonlynessOptionsDefaults.allow,
checkThenables: true,
ignoreVoid: true,
ignoreIIFE: false,
allowForKnownSafePromises: util_1.readonlynessOptionsDefaults.allow,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const { checkThenables } = options;
// TODO: #5439
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const allowForKnownSafePromises = options.allowForKnownSafePromises;
@@ -283,17 +289,26 @@ exports.default = (0, util_1.createRule)({
}
return false;
}
// Modified from tsutils.isThenable() to only consider thenables which can be
// rejected/caught via a second parameter. Original source (MIT licensed):
//
// https://github.com/ajafff/tsutils/blob/49d0d31050b44b81e918eae4fbaf1dfe7b7286af/util/type.ts#L95-L125
function isPromiseLike(node, type) {
type ??= checker.getTypeAtLocation(node);
// Ignore anything specified by `allowForKnownSafePromises` option.
// The highest priority is to allow anything allowlisted
if (allowForKnownSafePromises.some(allowedType => (0, util_1.typeMatchesSpecifier)(type, allowedType, services.program))) {
return false;
}
for (const ty of tsutils.unionTypeParts(checker.getApparentType(type))) {
// Otherwise, we always consider the built-in Promise to be Promise-like...
const typeParts = tsutils.unionTypeParts(checker.getApparentType(type));
if (typeParts.some(typePart => (0, util_1.isBuiltinSymbolLike)(services.program, typePart, 'Promise'))) {
return true;
}
// ...and only check all Thenables if explicitly told to
if (!checkThenables) {
return false;
}
// Modified from tsutils.isThenable() to only consider thenables which can be
// rejected/caught via a second parameter. Original source (MIT licensed):
//
// https://github.com/ajafff/tsutils/blob/49d0d31050b44b81e918eae4fbaf1dfe7b7286af/util/type.ts#L95-L125
for (const ty of typeParts) {
const then = ty.getProperty('then');
if (then === undefined) {
continue;

File diff suppressed because one or more lines are too long

View File

@@ -79,15 +79,8 @@ exports.default = (0, util_1.createRule)({
tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Function | ts.SymbolFlags.Method)) {
return true;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
if (symbol && symbol.escapedName === FUNCTION_CONSTRUCTOR) {
const declarations = symbol.getDeclarations() ?? [];
for (const declaration of declarations) {
const sourceFile = declaration.getSourceFile();
if (services.program.isSourceFileDefaultLibrary(sourceFile)) {
return true;
}
}
if ((0, util_1.isBuiltinSymbolLike)(services.program, type, FUNCTION_CONSTRUCTOR)) {
return true;
}
const signatures = checker.getSignaturesOfType(type, ts.SignatureKind.Call);
return signatures.length > 0;
@@ -128,13 +121,9 @@ exports.default = (0, util_1.createRule)({
const type = services.getTypeAtLocation(node.callee);
const symbol = type.getSymbol();
if (symbol) {
const declarations = symbol.getDeclarations() ?? [];
for (const declaration of declarations) {
const sourceFile = declaration.getSourceFile();
if (services.program.isSourceFileDefaultLibrary(sourceFile)) {
context.report({ node, messageId: 'noFunctionConstructor' });
return;
}
if ((0, util_1.isBuiltinSymbolLike)(services.program, type, 'FunctionConstructor')) {
context.report({ node, messageId: 'noFunctionConstructor' });
return;
}
}
else {

View File

@@ -1 +1 @@
{"version":3,"file":"no-implied-eval.js","sourceRoot":"","sources":["../../src/rules/no-implied-eval.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,sDAAwC;AACxC,+CAAiC;AAEjC,kCAAwD;AAExD,MAAM,oBAAoB,GAAG,UAAU,CAAC;AACxC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,cAAc;IACd,aAAa;IACb,YAAY;IACZ,YAAY;CACb,CAAC,CAAC;AAEH,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,WAAW,EAAE,aAAa;YAC1B,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,kBAAkB,EAAE,4CAA4C;YAChE,qBAAqB,EACnB,wEAAwE;SAC3E;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,YAAY;KACnB;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAA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AAC;gBACpB,2BAA2B,CAAC,UAAU,EAAE,IAAI,CAAC,EAC7C,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QAED,OAAO;YACL,aAAa,EAAE,gBAAgB;YAC/B,cAAc,EAAE,gBAAgB;SACjC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View File

@@ -0,0 +1,151 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const scope_manager_1 = require("@typescript-eslint/scope-manager");
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const UNNECESSARY_OPERATORS = new Set(['=', '&&=', '||=', '??=']);
exports.default = (0, util_1.createRule)({
name: 'no-unnecessary-parameter-property-assignment',
meta: {
docs: {
description: 'Disallow unnecessary assignment of constructor property parameter',
},
messages: {
unnecessaryAssign: 'This assignment is unnecessary since it is already assigned by a parameter property.',
},
schema: [],
type: 'suggestion',
},
defaultOptions: [],
create(context) {
const reportInfoStack = [];
function isThisMemberExpression(node) {
return (node.type === utils_1.AST_NODE_TYPES.MemberExpression &&
node.object.type === utils_1.AST_NODE_TYPES.ThisExpression);
}
function getPropertyName(node) {
if (!isThisMemberExpression(node)) {
return null;
}
if (node.property.type === utils_1.AST_NODE_TYPES.Identifier) {
return node.property.name;
}
if (node.computed) {
return (0, util_1.getStaticStringValue)(node.property);
}
return null;
}
function findParentFunction(node) {
if (!node ||
node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration ||
node.type === utils_1.AST_NODE_TYPES.FunctionExpression ||
node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression) {
return node;
}
return findParentFunction(node.parent);
}
function findParentPropertyDefinition(node) {
if (!node || node.type === utils_1.AST_NODE_TYPES.PropertyDefinition) {
return node;
}
return findParentPropertyDefinition(node.parent);
}
function isConstructorFunctionExpression(node) {
return (node?.type === utils_1.AST_NODE_TYPES.FunctionExpression &&
utils_1.ASTUtils.isConstructor(node.parent));
}
function isReferenceFromParameter(node) {
const scope = context.sourceCode.getScope(node);
const rightRef = scope.references.find(ref => ref.identifier.name === node.name);
return rightRef?.resolved?.defs.at(0)?.type === scope_manager_1.DefinitionType.Parameter;
}
function isParameterPropertyWithName(node, name) {
return (node.type === utils_1.AST_NODE_TYPES.TSParameterProperty &&
((node.parameter.type === utils_1.AST_NODE_TYPES.Identifier && // constructor (public foo) {}
node.parameter.name === name) ||
(node.parameter.type === utils_1.AST_NODE_TYPES.AssignmentPattern && // constructor (public foo = 1) {}
node.parameter.left.type === utils_1.AST_NODE_TYPES.Identifier &&
node.parameter.left.name === name)));
}
function getIdentifier(node) {
if (node.type === utils_1.AST_NODE_TYPES.Identifier) {
return node;
}
if (node.type === utils_1.AST_NODE_TYPES.TSAsExpression ||
node.type === utils_1.AST_NODE_TYPES.TSNonNullExpression) {
return getIdentifier(node.expression);
}
return null;
}
function isArrowIIFE(node) {
return (node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
node.parent.type === utils_1.AST_NODE_TYPES.CallExpression);
}
return {
ClassBody() {
reportInfoStack.push({
unnecessaryAssignments: [],
assignedBeforeUnnecessary: new Set(),
assignedBeforeConstructor: new Set(),
});
},
'ClassBody:exit'() {
const { unnecessaryAssignments, assignedBeforeConstructor } = (0, util_1.nullThrows)(reportInfoStack.pop(), 'The top stack should exist');
unnecessaryAssignments.forEach(({ name, node }) => {
if (assignedBeforeConstructor.has(name)) {
return;
}
context.report({
node,
messageId: 'unnecessaryAssign',
});
});
},
'PropertyDefinition AssignmentExpression'(node) {
const name = getPropertyName(node.left);
if (!name) {
return;
}
const functionNode = findParentFunction(node);
if (functionNode) {
if (!(isArrowIIFE(functionNode) &&
findParentPropertyDefinition(node)?.value === functionNode.parent)) {
return;
}
}
const { assignedBeforeConstructor } = (0, util_1.nullThrows)(reportInfoStack.at(-1), 'The top stack should exist');
assignedBeforeConstructor.add(name);
},
"MethodDefinition[kind='constructor'] > FunctionExpression AssignmentExpression"(node) {
const leftName = getPropertyName(node.left);
if (!leftName) {
return;
}
let functionNode = findParentFunction(node);
if (functionNode && isArrowIIFE(functionNode)) {
functionNode = findParentFunction(functionNode.parent);
}
if (!isConstructorFunctionExpression(functionNode)) {
return;
}
const { assignedBeforeUnnecessary, unnecessaryAssignments } = (0, util_1.nullThrows)(reportInfoStack.at(reportInfoStack.length - 1), 'The top of stack should exist');
if (!UNNECESSARY_OPERATORS.has(node.operator)) {
assignedBeforeUnnecessary.add(leftName);
return;
}
const rightId = getIdentifier(node.right);
if (leftName !== rightId?.name || !isReferenceFromParameter(rightId)) {
return;
}
const hasParameterProperty = functionNode.params.some(param => isParameterPropertyWithName(param, rightId.name));
if (hasParameterProperty && !assignedBeforeUnnecessary.has(leftName)) {
unnecessaryAssignments.push({
name: leftName,
node,
});
}
},
};
},
});
//# sourceMappingURL=no-unnecessary-parameter-property-assignment.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,308 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
defaultOptions: [],
meta: {
docs: {
description: 'Disallow type parameters that only appear once',
requiresTypeChecking: true,
},
messages: {
sole: 'Type parameter {{name}} is used only once.',
},
schema: [],
type: 'problem',
},
name: 'no-unnecessary-type-parameters',
create(context) {
const parserServices = (0, util_1.getParserServices)(context);
return {
[[
'ArrowFunctionExpression[typeParameters]',
'ClassDeclaration[typeParameters]',
'ClassExpression[typeParameters]',
'FunctionDeclaration[typeParameters]',
'FunctionExpression[typeParameters]',
'TSCallSignatureDeclaration[typeParameters]',
'TSConstructorType[typeParameters]',
'TSDeclareFunction[typeParameters]',
'TSEmptyBodyFunctionExpression[typeParameters]',
'TSFunctionType[typeParameters]',
'TSMethodSignature[typeParameters]',
].join(', ')](node) {
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
const checker = parserServices.program.getTypeChecker();
let counts;
for (const typeParameter of tsNode.typeParameters) {
const esTypeParameter = parserServices.tsNodeToESTreeNodeMap.get(typeParameter);
const scope = context.sourceCode.getScope(esTypeParameter);
// Quick path: if the type parameter is used multiple times in the AST,
// we don't need to dip into types to know it's repeated.
if (isTypeParameterRepeatedInAST(esTypeParameter, scope.references)) {
continue;
}
// For any inferred types, we have to dip into type checking.
counts ??= countTypeParameterUsage(checker, tsNode);
const identifierCounts = counts.get(typeParameter.name);
if (!identifierCounts || identifierCounts > 2) {
continue;
}
context.report({
data: {
name: typeParameter.name.text,
},
node: esTypeParameter,
messageId: 'sole',
});
}
},
};
},
});
function isTypeParameterRepeatedInAST(node, references) {
let total = 0;
for (const reference of references) {
// References inside the type parameter's definition don't count.
if (reference.identifier.range[0] < node.range[1] &&
reference.identifier.range[1] > node.range[0]) {
continue;
}
// Neither do references that aren't to the same type parameter,
// namely value-land (non-type) identifiers of the type parameter's type,
// and references to different type parameters or values.
if (!reference.isTypeReference ||
reference.identifier.name !== node.name.name) {
continue;
}
// If the type parameter is being used as a type argument, then we
// know the type parameter is being reused and can't be reported.
if (reference.identifier.parent.type === utils_1.AST_NODE_TYPES.TSTypeReference) {
const grandparent = skipConstituentsUpward(reference.identifier.parent.parent);
if (grandparent.type === utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation &&
grandparent.params.includes(reference.identifier.parent)) {
return true;
}
}
total += 1;
if (total > 2) {
return true;
}
}
return false;
}
function skipConstituentsUpward(node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.TSIntersectionType:
case utils_1.AST_NODE_TYPES.TSUnionType:
return skipConstituentsUpward(node.parent);
default:
return node;
}
}
/**
* Count uses of type parameters in inferred return types.
* We need to resolve and analyze the inferred return type of a function
* to see whether it contains additional references to the type parameters.
* For classes, we need to do this for all their methods.
*/
function countTypeParameterUsage(checker, node) {
const counts = new Map();
if (ts.isClassLike(node)) {
for (const typeParameter of node.typeParameters) {
collectTypeParameterUsageCounts(checker, typeParameter, counts);
}
for (const member of node.members) {
collectTypeParameterUsageCounts(checker, member, counts);
}
}
else {
collectTypeParameterUsageCounts(checker, node, counts);
}
return counts;
}
/**
* Populates {@link foundIdentifierUsages} by the number of times each type parameter
* appears in the given type by checking its uses through its type references.
* This is essentially a limited subset of the scope manager, but for types.
*/
function collectTypeParameterUsageCounts(checker, node, foundIdentifierUsages) {
const visitedSymbolLists = new Set();
const type = checker.getTypeAtLocation(node);
const typeUsages = new Map();
const visitedConstraints = new Set();
let functionLikeType = false;
let visitedDefault = false;
if (ts.isCallSignatureDeclaration(node) ||
ts.isConstructorDeclaration(node)) {
functionLikeType = true;
visitSignature(checker.getSignatureFromDeclaration(node));
}
if (!functionLikeType) {
visitType(type, false);
}
function visitType(type, assumeMultipleUses) {
// Seeing the same type > (threshold=3 ** 2) times indicates a likely
// recursive type, like `type T = { [P in keyof T]: T }`.
// If it's not recursive, then heck, we've seen it enough times that any
// referenced types have been counted enough to qualify as used.
if (!type || incrementTypeUsages(type) > 9) {
return;
}
// https://github.com/JoshuaKGoldberg/ts-api-utils/issues/382
if (tsutils.isTypeParameter(type)) {
const declaration = type.getSymbol()?.getDeclarations()?.[0];
if (declaration) {
incrementIdentifierCount(declaration.name, assumeMultipleUses);
// Visiting the type of a constrained type parameter will recurse into
// the constraint. We avoid infinite loops by visiting each only once.
if (declaration.constraint &&
!visitedConstraints.has(declaration.constraint)) {
visitedConstraints.add(declaration.constraint);
visitType(checker.getTypeAtLocation(declaration.constraint), false);
}
if (declaration.default && !visitedDefault) {
visitedDefault = true;
visitType(checker.getTypeAtLocation(declaration.default), false);
}
}
}
// Intersections and unions like `0 | 1`
else if (tsutils.isUnionOrIntersectionType(type)) {
visitTypesList(type.types, assumeMultipleUses);
}
// Index access types like `T[K]`
else if (tsutils.isIndexedAccessType(type)) {
visitType(type.objectType, assumeMultipleUses);
visitType(type.indexType, assumeMultipleUses);
}
// Tuple types like `[K, V]`
// Generic type references like `Map<K, V>`
else if (tsutils.isTupleType(type) || tsutils.isTypeReference(type)) {
for (const typeArgument of type.typeArguments ?? []) {
visitType(typeArgument, true);
}
}
// Template literals like `a${T}b`
else if (tsutils.isTemplateLiteralType(type)) {
for (const subType of type.types) {
visitType(subType, assumeMultipleUses);
}
}
// Conditional types like `T extends string ? T : never`
else if (tsutils.isConditionalType(type)) {
visitType(type.checkType, assumeMultipleUses);
visitType(type.extendsType, assumeMultipleUses);
}
// Catch-all: inferred object types like `{ K: V }`.
// These catch-alls should be _after_ more specific checks like
// `isTypeReference` to avoid descending into all the properties of a
// generic interface/class, e.g. `Map<K, V>`.
else if (tsutils.isObjectType(type)) {
const properties = type.getProperties();
visitSymbolsListOnce(properties, false);
if (isMappedType(type)) {
visitType(type.typeParameter, false);
if (properties.length === 0) {
// TS treats mapped types like `{[k in "a"]: T}` like `{a: T}`.
// They have properties, so we need to avoid double-counting.
visitType(type.templateType, false);
}
}
for (const typeArgument of type.aliasTypeArguments ?? []) {
visitType(typeArgument, true);
}
visitType(type.getNumberIndexType(), true);
visitType(type.getStringIndexType(), true);
type.getCallSignatures().forEach(signature => {
functionLikeType = true;
visitSignature(signature);
});
type.getConstructSignatures().forEach(signature => {
functionLikeType = true;
visitSignature(signature);
});
}
// Catch-all: operator types like `keyof T`
else if (isOperatorType(type)) {
visitType(type.type, assumeMultipleUses);
}
// Catch-all: generic type references like `Exclude<T, null>`
else if (type.aliasTypeArguments) {
visitTypesList(type.aliasTypeArguments, true);
}
}
function incrementIdentifierCount(id, assumeMultipleUses) {
const identifierCount = foundIdentifierUsages.get(id) ?? 0;
const value = assumeMultipleUses ? 2 : 1;
foundIdentifierUsages.set(id, identifierCount + value);
}
function incrementTypeUsages(type) {
const count = (typeUsages.get(type) ?? 0) + 1;
typeUsages.set(type, count);
return count;
}
function visitSignature(signature) {
if (!signature) {
return;
}
if (signature.thisParameter) {
visitType(checker.getTypeOfSymbol(signature.thisParameter), false);
}
for (const parameter of signature.parameters) {
visitType(checker.getTypeOfSymbol(parameter), false);
}
for (const typeParameter of signature.getTypeParameters() ?? []) {
visitType(typeParameter, false);
}
visitType(checker.getTypePredicateOfSignature(signature)?.type ??
signature.getReturnType(), false);
}
function visitSymbolsListOnce(symbols, assumeMultipleUses) {
if (visitedSymbolLists.has(symbols)) {
return;
}
visitedSymbolLists.add(symbols);
for (const symbol of symbols) {
visitType(checker.getTypeOfSymbol(symbol), assumeMultipleUses);
}
}
function visitTypesList(types, assumeMultipleUses) {
for (const type of types) {
visitType(type, assumeMultipleUses);
}
}
}
function isMappedType(type) {
return 'typeParameter' in type;
}
function isOperatorType(type) {
return 'type' in type && !!type.type;
}
//# sourceMappingURL=no-unnecessary-type-parameters.js.map

File diff suppressed because one or more lines are too long

View File

@@ -95,8 +95,8 @@ exports.default = (0, util_1.createRule)({
return state;
}
return {
// ignore MemberExpression if it's parent is TSClassImplements or TSInterfaceHeritage
':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression': checkMemberExpression,
// ignore MemberExpressions with ancestors of type `TSClassImplements` or `TSInterfaceHeritage`
'MemberExpression:not(TSClassImplements MemberExpression, TSInterfaceHeritage MemberExpression)': checkMemberExpression,
'MemberExpression[computed = true] > *.property'(node) {
if (
// x[1]

View File

@@ -1 +1 @@
{"version":3,"file":"no-unsafe-member-access.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-member-access.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,sDAAwC;AAGxC,kCAMiB;AAOjB,SAAS,cAAc,CAAC,IAAa;IACnC,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC;AACjD,CAAC;AAED,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,mDAAmD;YAChE,WAAW,EAAE,aAAa;YAC1B,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,sBAAsB,EACpB,yDAAyD;YAC3D,0BAA0B,EAAE;gBAC1B,gFAAgF;gBAChF,2HAA2H;aAC5H,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,0BAA0B,EACxB,2DAA2D;SAC9D;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC9D,MAAM,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAC5D,eAAe,EACf,gBAAgB,CACjB,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;QAEnD,SAAS,qBAAqB,CAAC,IAA+B;YAC5D,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,C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,IAAI,KAAK,sBAAc,CAAC,OAAO;oBACpC,oBAAoB;oBACpB,+FAA+F;oBAC/F,uEAAuE;oBACvE,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB,EAC7C,CAAC;oBACD,6DAA6D;oBAC7D,OAAO;gBACT,CAAC;gBAED,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBAE9C,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,EAAE,CAAC;oBACxB,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACtD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,4BAA4B;wBACvC,IAAI,EAAE;4BACJ,QAAQ,EAAE,IAAI,YAAY,GAAG;4BAC7B,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;yBAC3B;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View File

@@ -8,7 +8,7 @@ const optionTesters = [
['Any', util_1.isTypeAnyType],
[
'Array',
(type, checker, recursivelyCheckType) => checker.isArrayType(type) &&
(type, checker, recursivelyCheckType) => (checker.isArrayType(type) || checker.isTupleType(type)) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
recursivelyCheckType(type.getNumberIndexType()),
],

View File

@@ -1 +1 @@
{"version":3,"file":"restrict-template-expressions.js","sourceRoot":"","sources":["../../src/rules/restrict-template-expressions.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,2CAAuC;AAEvC,kCAQiB;AAQjB,MAAM,YAAY,GAChB,CAAC,YAAuB,EAAgB,EAAE,CAC1C,IAAI,CAAC,EAAE,CACL,IAAA,oBAAa,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAEtC,MAAM,aAAa,GACjB;IACE,CAAC,KAAK,EAAE,oBAAa,CAAC;IACtB;QACE,OAA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SAAS,EAAE,aAAa;4BACxB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE;yBACrD,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;QAEF,SAAS,oBAAoB,CAAC,SAAe;YAC3C,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;gBACxB,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACrD,CAAC;YAED,IAAI,SAAS,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC/B,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,CACL,IAAA,oBAAa,EAAC,SAAS,EAAE,sBAAS,CAAC,UAAU,CAAC;gBAC9C,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACvC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,oBAAoB,CAAC,CACjD,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
{"version":3,"file":"restrict-template-expressions.js","sourceRoot":"","sources":["../../src/rules/restrict-template-expressions.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,2CAAuC;AAEvC,kCAQiB;AAQjB,MAAM,YAAY,GAChB,CAAC,YAAuB,EAAgB,EAAE,CAC1C,IAAI,CAAC,EAAE,CACL,IAAA,oBAAa,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAEtC,MAAM,aAAa,GACjB;IACE,CAAC,KAAK,EAAE,oBAAa,CAAC;IACtB;QACE,OAAO;QACP,CAAC,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAW,EAAE,CAC/C,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxD,oEAAoE;YACpE,oBAAoB,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BACH,CAAC;YACH,CAAC;SACF,CAAC;QAEF,SAAS,oBAAoB,CAAC,SAAe;YAC3C,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;gBACxB,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACrD,CAAC;YAED,IAAI,SAAS,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC/B,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,CACL,IAAA,oBAAa,EAAC,SAAS,EAAE,sBAAS,CAAC,UAAU,CAAC;gBAC9C,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACvC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,oBAAoB,CAAC,CACjD,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}

File diff suppressed because one or more lines are too long

View File

@@ -31,7 +31,7 @@ const defaultOptions: Options = {
### `ignoreOverrideMethods`
Makes the rule to ignores any class member explicitly marked with `override`.
Makes the rule ignore any class member explicitly marked with `override`.
Example of a correct code when `ignoreOverrideMethods` is set to `true`:

View File

@@ -84,6 +84,55 @@ await Promise.all([1, 2, 3].map(async x => x + 1));
## Options
### `checkThenables`
A ["Thenable"](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables) value is an object which has a `then` method, such as a `Promise`.
Other Thenables include TypeScript's built-in `PromiseLike` interface and any custom object that happens to have a `.then()`.
The `checkThenables` option triggers `no-floating-promises` to also consider all values that satisfy the Thenable shape (a `.then()` method that takes two callback parameters), not just Promises.
This can be useful if your code works with older `Promise` polyfills instead of the native `Promise` class.
<Tabs>
<TabItem value="❌ Incorrect">
```ts option='{"checkThenables": true}'
declare function createPromiseLike(): PromiseLike<string>;
createPromiseLike();
interface MyThenable {
then(onFulfilled: () => void, onRejected: () => void): MyThenable;
}
declare function createMyThenable(): MyThenable;
createMyThenable();
```
</TabItem>
<TabItem value="✅ Correct">
```ts option='{"checkThenables": true}'
declare function createPromiseLike(): PromiseLike<string>;
await createPromiseLike();
interface MyThenable {
then(onFulfilled: () => void, onRejected: () => void): MyThenable;
}
declare function createMyThenable(): MyThenable;
await createMyThenable();
```
</TabItem>
</Tabs>
:::info
This option is enabled by default in v7 but will be turned off by default in v8.
:::
### `ignoreVoid`
This option, which is `true` by default, allows you to stop the rule reporting promises consumed with void operator.

View File

@@ -0,0 +1,42 @@
---
description: 'Disallow unnecessary assignment of constructor property parameter.'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment** for documentation.
[TypeScript's parameter properties](https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties) allow creating and initializing a member in one place.
Therefore, in most cases, it is not necessary to assign parameter properties of the same name to members within a constructor.
## Examples
<Tabs>
<TabItem value="❌ Incorrect">
```ts
class Foo {
constructor(public bar: string) {
this.bar = bar;
}
}
```
</TabItem>
<TabItem value="✅ Correct">
```ts
class Foo {
constructor(public bar: string) {}
}
```
</TabItem>
</Tabs>
## When Not To Use It
If you don't use parameter properties, you can ignore this rule.

View File

@@ -0,0 +1,115 @@
---
description: 'Disallow type parameters that only appear once.'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-unnecessary-type-parameters** for documentation.
This rule forbids type parameters that only appear once in a function, method, or class definition.
Type parameters relate two types.
If a type parameter only appears once, then it is not relating anything.
It can usually be replaced with explicit types such as `unknown`.
At best unnecessary type parameters make code harder to read.
At worst they can be used to disguise unsafe type assertions.
:::warning Early Stage
This rule was recently added to typescript-eslint and still considered experimental.
It might change significantly between minor versions.
Please try it out and give us feedback!
:::
## Examples
<Tabs>
<TabItem value="❌ Incorrect">
```ts
function second<A, B>(a: A, b: B): B {
return b;
}
function parseJSON<T>(input: string): T {
return JSON.parse(input);
}
function printProperty<T, K extends keyof T>(obj: T, key: K) {
console.log(obj[key]);
}
```
</TabItem>
<TabItem value="✅ Correct">
```ts
function second<B>(a: unknown, b: B): B {
return b;
}
function parseJSON(input: string): unknown {
return JSON.parse(input);
}
function printProperty<T>(obj: T, key: keyof T) {
console.log(obj[key]);
}
// T appears twice: in the type of arg and as the return type
function identity<T>(arg: T): T {
return arg;
}
// T appears twice: "keyof T" and in the inferred return type (T[K]).
// K appears twice: "key: K" and in the inferred return type (T[K]).
function getProperty<T, K extends keyof T>(obj: T, key: K) {
return obj[key];
}
```
</TabItem>
</Tabs>
## Limitations
Note that this rule allows any type parameter that is used multiple times, even if those uses are via a type argument.
For example, the following `T` is used multiple times by virtue of being in an `Array`, even though its name only appears once after declaration:
```ts
declare function createStateHistory<T>(): T[];
```
This is because the type parameter `T` relates multiple methods in the `T[]` together, making it used more than once.
Therefore, this rule won't report on type parameters used as a type argument.
That includes type arguments given to global types such as `Array` (including the `T[]` shorthand and in tuples), `Map`, and `Set`.
## When Not To Use It
This rule will report on functions that use type parameters solely to test types, for example:
```ts
function assertType<T>(arg: T) {}
assertType<number>(123);
assertType<number>('abc');
// ~~~~~
// Argument of type 'string' is not assignable to parameter of type 'number'.
```
If you're using this pattern then you'll want to disable this rule on files that test types.
## Further Reading
- TypeScript handbook: [Type Parameters Should Appear Twice](https://microsoft.github.io/TypeScript-New-Handbook/everything/#type-parameters-should-appear-twice)
- Effective TypeScript: [The Golden Rule of Generics](https://effectivetypescript.com/2020/08/12/generics-golden-rule/)
## Related To
- eslint-plugin-etc's [`no-misused-generics`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-misused-generics.md)
- wotan's [`no-misused-generics`](https://github.com/fimbullinter/wotan/blob/master/packages/mimir/docs/no-misused-generics.md)
- DefinitelyTyped-tools' [`no-unnecessary-generics`](https://github.com/microsoft/DefinitelyTyped-tools/blob/main/packages/eslint-plugin/docs/rules/no-unnecessary-generics.md)

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "7.15.0",
"version": "7.16.1",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@@ -60,10 +60,10 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "7.15.0",
"@typescript-eslint/type-utils": "7.15.0",
"@typescript-eslint/utils": "7.15.0",
"@typescript-eslint/visitor-keys": "7.15.0",
"@typescript-eslint/scope-manager": "7.16.1",
"@typescript-eslint/type-utils": "7.16.1",
"@typescript-eslint/utils": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@@ -74,8 +74,8 @@
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "7.15.0",
"@typescript-eslint/rule-tester": "7.15.0",
"@typescript-eslint/rule-schema-to-typescript-types": "7.16.1",
"@typescript-eslint/rule-tester": "7.16.1",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "7.15.0",
"version": "7.16.1",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@@ -52,10 +52,10 @@
"eslint": "^8.56.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "7.15.0",
"@typescript-eslint/types": "7.15.0",
"@typescript-eslint/typescript-estree": "7.15.0",
"@typescript-eslint/visitor-keys": "7.15.0",
"@typescript-eslint/scope-manager": "7.16.1",
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/typescript-estree": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1",
"debug": "^4.3.4"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "7.15.0",
"version": "7.16.1",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "7.15.0",
"@typescript-eslint/visitor-keys": "7.15.0"
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "7.15.0",
"@typescript-eslint/typescript-estree": "7.16.1",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "7.15.0",
"version": "7.16.1",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@@ -46,14 +46,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "7.15.0",
"@typescript-eslint/utils": "7.15.0",
"@typescript-eslint/typescript-estree": "7.16.1",
"@typescript-eslint/utils": "7.16.1",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "7.15.0",
"@typescript-eslint/parser": "7.16.1",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",

View File

@@ -9,6 +9,12 @@ declare module './generated/ast-spec' {
*/
parent?: never;
}
interface AccessorPropertyComputedName {
parent: TSESTree.ClassBody;
}
interface AccessorPropertyNonComputedName {
parent: TSESTree.ClassBody;
}
}
export * as TSESTree from './generated/ast-spec';
//# sourceMappingURL=ts-estree.d.ts.map

View File

@@ -1 +1 @@
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;IAED,UAAU,4BAA4B;QACpC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IAED,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}

View File

@@ -1 +1 @@
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,iEAAiD"}
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,iEAAiD"}

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "7.15.0",
"version": "7.16.1",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View File

@@ -1 +1 @@
{"version":3,"file":"parser-options.d.ts","sourceRoot":"","sources":["../src/parser-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,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Q,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC;CACrD;AACD,MAAM,WAAW,oCACf,SAAQ,sBAAsB,EAC5B,kBAAkB;IACpB,OAAO,EAAE,IAAI,CAAC;CACf;AACD,MAAM,MAAM,cAAc,GACtB,oCAAoC,GACpC,iCAAiC,CAAC"}

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "7.15.0",
"version": "7.16.1",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "7.15.0",
"@typescript-eslint/visitor-keys": "7.15.0",
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",

View File

@@ -1 +1 @@
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/ast-utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAO9E,eAAO,MAAM,YAAY,GACtB,QAAQ,SAAS,cAAc,YAAY,QAAQ,YAE5C,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,KACrC,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAC3B,CAAC;AAE5B,eAAO,MAAM,aAAa,GACvB,SAAS,SAAS,SAAS,cAAc,EAAE,aAAa,SAAS,YAE1D,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,KACrC,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAE,CACpB,CAAC;AAE5C,eAAO,MAAM,0BAA0B,GACrC,QAAQ,SAAS,cAAc,EAC/B,a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A0B,CAAC,KAAK,KAAK,CAAC,CAAC;AAChF,CAAC,CAAC;AAjBW,QAAA,0BAA0B,8BAiBrC;AAEK,MAAM,2BAA2B,GAAG,CAOzC,SAAoB,EACpB,UAAsB,EAGmB,EAAE;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAkC,CAAC;IAE5E,OAAO,CACL,KAAwC,EACF,EAAE,CACxC,KAAK,EAAE,IAAI,KAAK,SAAS;QACzB,OAAO,CAAC,KAAK,CACX,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAA2B,CAAC,KAAK,KAAK,CAC/D,CAAC;AACN,CAAC,CAAC;AArBW,QAAA,2BAA2B,+BAqBtC;AAEK,MAAM,8BAA8B,GACzC,CAKE,SAAoB,EACpB,UAAsB,EAG4C,EAAE,CACtE,CAAC,KAAK,EAAiE,EAAE,CACvE,CAAC,IAAA,mCAA2B,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;AAZlD,QAAA,8BAA8B,kCAYoB"}

View File

@@ -3,7 +3,7 @@ type ObjectLike<T = unknown> = Record<string, T>;
* Check if the variable contains an object strictly rejecting arrays
* @returns `true` if obj is an object
*/
declare function isObjectNotArray<T extends ObjectLike>(obj: unknown): obj is T;
declare function isObjectNotArray(obj: unknown): obj is ObjectLike;
/**
* Pure function - doesn't mutate either parameter!
* Merges two objects together deeply, overwriting the properties in first with the properties in second

View File

@@ -1 +1 @@
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/deepMerge.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEjD;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,GAAE,UAAe,EACtB,MAAM,GAAE,UAAe,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0BzB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/deepMerge.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEjD;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,GAAE,UAAe,EACtB,MAAM,GAAE,UAAe,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0BzB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}

View File

@@ -1 +1 @@
{"version":3,"file":"deepMerge.js","sourceRoot":"","sources":["../../src/eslint-utils/deepMerge.ts"],"names":[],"mappings":";;AAiBA,8BA6BC;AAEQ,4CAAgB;AA9CzB;;;GAGG;AACH,SAAS,gBAAgB,CAAuB,GAAY;IAC1D,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,QAAoB,EAAE,EACtB,SAAqB,EAAE;IAEvB,iDAAiD;IACjD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAa,CAAC,GAAG,EAAE,G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CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACtD,MAAM,WAAW,GAAG,GAAG,IAAI,KAAK,CAAC;QACjC,MAAM,YAAY,GAAG,GAAG,IAAI,MAAM,CAAC;QACnC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,WAAW,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,gBAAgB,CAAC,UAAU,CAAC,IAAI,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,cAAc;gBACd,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,aAAa;gBACb,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;YACzB,CAAC;QACH,CAAC;aAAM,IAAI,WAAW,EAAE,CAAC;YACvB,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QACzB,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}

View File

@@ -1 +1 @@
{"version":3,"file":"getParserServices.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/getParserServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,cAAc,EACd,iCAAiC,EAClC,MAAM,cAAc,CAAC;AAUtB;;;GAGG;AACH,iBAAS,iBAAiB,CACxB,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,S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GAC3D,iCAAiC,CAAC;AACrC;;;GAGG;AACH,iBAAS,iBAAiB,CACxB,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,EAElC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAC5D,+BAA+B,EAAE,KAAK,GACrC,iCAAiC,CAAC;AACrC;;;GAGG;AACH,iBAAS,iBAAiB,CACxB,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,EAElC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAC5D,+BAA+B,EAAE,IAAI,GACpC,cAAc,CAAC;AAClB;;;GAGG;AACH,iBAAS,iBAAiB,CACxB,UAAU,SAAS,MAAM,EACzB,OAAO,SAAS,SAAS,OAAO,EAAE,EAElC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAC5D,+BAA+B,EAAE,OAAO,GACvC,cAAc,CAAC;AAiDlB,OAAO,EAAE,iBAAiB,EAAE,CAAC"}

View File

@@ -1,10 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParserServices = getParserServices;
const parserPathSeemsToBeTSESLint_1 = require("./parserPathSeemsToBeTSESLint");
const parserSeemsToBeTSESLint_1 = require("./parserSeemsToBeTSESLint");
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.';
const ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.';
function getParserServices(context, allowWithoutFullTypeInformation = false) {
const parser = context.parserPath || context.languageOptions.parser?.meta?.name;
// This check is unnecessary if the user is using the latest version of our parser.
//
// However the world isn't perfect:
@@ -17,25 +18,23 @@ function getParserServices(context, allowWithoutFullTypeInformation = false) {
// error message explaining the problem.
if (context.sourceCode.parserServices?.esTreeNodeToTSNodeMap == null ||
context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) {
throwError(context.parserPath);
throwError(parser);
}
// if a rule requires full type information, then hard fail if it doesn't exist
// this forces the user to supply parserOptions.project
if (context.sourceCode.parserServices.program == null &&
!allowWithoutFullTypeInformation) {
throwError(context.parserPath);
throwError(parser);
}
return context.sourceCode.parserServices;
}
/* eslint-enable @typescript-eslint/unified-signatures */
function throwError(parserPath) {
function throwError(parser) {
const messages = [
ERROR_MESSAGE_REQUIRES_PARSER_SERVICES,
`Parser: ${parserPath}`,
];
if (!(0, parserPathSeemsToBeTSESLint_1.parserPathSeemsToBeTSESLint)(parserPath)) {
messages.push(ERROR_MESSAGE_UNKNOWN_PARSER);
}
`Parser: ${parser || '(unknown)'}`,
!(0, parserSeemsToBeTSESLint_1.parserSeemsToBeTSESLint)(parser) && ERROR_MESSAGE_UNKNOWN_PARSER,
].filter(Boolean);
throw new Error(messages.join('\n'));
}
//# sourceMappingURL=getParserServices.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"getParserServices.js","sourceRoot":"","sources":["../../src/eslint-utils/getParserServices.ts"],"names":[],"mappings":";;AAuGS,8CAAiB;AAlG1B,+EAA4E;AAE5E,MAAM,sCAAsC,GAC1C,gLAAgL,CAAC;AAEnL,MAAM,4BAA4B,GAChC,mKAAmK,CAAC;AA+CtK,SAAS,iBAAiB,CACxB,OAA0D,EAC1D,+BAA+B,GAAG,KAAK;IAEvC,mFAAmF;IACnF,EAAE;IACF,mCAAmC;IACnC,yCAAyC;IACzC,yGAAyG;IACzG,sEAAsE;IACtE,0FAA0F;IAC1F,EAAE;IACF,qFAAqF;IACrF,wCAAwC;IACxC,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,IAAI,IAAI;QAChE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,IAAI,IAAI,EAC/D,CAAC;QACD,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED,+EAA+E;IAC/E,uDAAuD;IACvD,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,IAAI,IAAI;QACjD,CAAC,+BAA+B,EAChC,CAAC;QACD,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,cAAgC,CAAC;AAC7D,CAAC;AACD,yDAAyD;AAEzD,SAAS,UAAU,CAAC,UAAkB;IACpC,MAAM,QAAQ,GAAG;QACf,sCAAsC;QACtC,WAAW,UAAU,EAAE;KACxB,CAAC;IACF,IAAI,CAAC,IAAA,yDAA2B,EAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
{"version":3,"file":"getParserServices.js","sourceRoot":"","sources":["../../src/eslint-utils/getParserServices.ts"],"names":[],"mappings":";;AAyGS,8CAAiB;AApG1B,uEAAoE;AAEpE,MAAM,sCAAsC,GAC1C,gLAAgL,CAAC;AAEnL,MAAM,4BAA4B,GAChC,mKAAmK,CAAC;AA+CtK,SAAS,iBAAiB,CACxB,OAA0D,EAC1D,+BAA+B,GAAG,KAAK;IAEvC,MAAM,MAAM,GACV,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;IAEnE,mFAAmF;IACnF,EAAE;IACF,mCAAmC;IACnC,yCAAyC;IACzC,yGAAyG;IACzG,sEAAsE;IACtE,0FAA0F;IAC1F,EAAE;IACF,qFAAqF;IACrF,wCAAwC;IACxC,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,qBAAqB,IAAI,IAAI;QAChE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,qBAAqB,IAAI,IAAI,EAC/D,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,+EAA+E;IAC/E,uDAAuD;IACvD,IACE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,IAAI,IAAI;QACjD,CAAC,+BAA+B,EAChC,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,cAAgC,CAAC;AAC7D,CAAC;AACD,yDAAyD;AAEzD,SAAS,UAAU,CAAC,MAA0B;IAC5C,MAAM,QAAQ,GAAG;QACf,sCAAsC;QACtC,WAAW,MAAM,IAAI,WAAW,EAAE;QAClC,CAAC,IAAA,iDAAuB,EAAC,MAAM,CAAC,IAAI,4BAA4B;KACjE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}

View File

@@ -1,2 +0,0 @@
export declare function parserPathSeemsToBeTSESLint(parserPath: string): boolean;
//# sourceMappingURL=parserPathSeemsToBeTSESLint.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"parserPathSeemsToBeTSESLint.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/parserPathSeemsToBeTSESLint.ts"],"names":[],"mappings":"AAAA,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvE"}

View File

@@ -1,7 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parserPathSeemsToBeTSESLint = parserPathSeemsToBeTSESLint;
function parserPathSeemsToBeTSESLint(parserPath) {
return /(?:typescript-eslint|\.\.)[\w/\\]*parser/.test(parserPath);
}
//# sourceMappingURL=parserPathSeemsToBeTSESLint.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"parserPathSeemsToBeTSESLint.js","sourceRoot":"","sources":["../../src/eslint-utils/parserPathSeemsToBeTSESLint.ts"],"names":[],"mappings":";;AAAA,kEAEC;AAFD,SAAgB,2BAA2B,CAAC,UAAkB;IAC5D,OAAO,0CAA0C,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACrE,CAAC"}

View File

@@ -0,0 +1,2 @@
export declare function parserSeemsToBeTSESLint(parser: string | undefined): boolean;
//# sourceMappingURL=parserSeemsToBeTSESLint.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parserSeemsToBeTSESLint.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/parserSeemsToBeTSESLint.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE3E"}

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;
function parserSeemsToBeTSESLint(parser) {
return !!parser && /(?:typescript-eslint|\.\.)[\w/\\]*parser/.test(parser);
}
//# sourceMappingURL=parserSeemsToBeTSESLint.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parserSeemsToBeTSESLint.js","sourceRoot":"","sources":["../../src/eslint-utils/parserSeemsToBeTSESLint.ts"],"names":[],"mappings":";;AAAA,0DAEC;AAFD,SAAgB,uBAAuB,CAAC,MAA0B;IAChE,OAAO,CAAC,CAAC,MAAM,IAAI,0CAA0C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC"}

View File

@@ -151,9 +151,9 @@ export interface RuleContext<MessageIds extends string, Options extends readonly
*/
options: Options;
/**
* The name of the parser from configuration.
* The name of the parser from configuration, if in eslintrc (legacy) config.
*/
parserPath: string;
parserPath: string | undefined;
/**
* The language options configured for this run
*/

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "7.15.0",
"version": "7.16.1",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "7.15.0",
"@typescript-eslint/types": "7.15.0",
"@typescript-eslint/typescript-estree": "7.15.0"
"@typescript-eslint/scope-manager": "7.16.1",
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/typescript-estree": "7.16.1"
},
"peerDependencies": {
"eslint": "^8.56.0"

View File

@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "7.15.0",
"version": "7.16.1",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "7.15.0",
"@typescript-eslint/types": "7.16.1",
"eslint-visitor-keys": "^3.4.3"
},
"devDependencies": {

View File

@@ -104,6 +104,12 @@ This module is proudly supported by my [Sponsors](https://github.com/juliangrube
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
## 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)

176
node_modules/brace-expansion/index.js generated vendored
View File

@@ -1,4 +1,3 @@
var concatMap = require('concat-map');
var balanced = require('balanced-match');
module.exports = expandTop;
@@ -79,10 +78,6 @@ function expandTop(str) {
return expand(escapeBraces(str), true).map(unescapeBraces);
}
function identity(e) {
return e;
}
function embrace(str) {
return '{' + str + '}';
}
@@ -101,42 +96,7 @@ function expand(str, isTop) {
var expansions = [];
var m = balanced('{', '}', str);
if (!m || /\$$/.test(m.pre)) return [str];
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(',') >= 0;
if (!isSequence && !isOptions) {
// {a},b}
if (m.post.match(/,.*\}/)) {
str = m.pre + '{' + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
// x{{a,b}}y ==> x{a}y x{b}y
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
var post = m.post.length
? expand(m.post, false)
: [''];
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
// at this point, n is the parts, and we know it's not a comma set
// with a single entry.
if (!m) return [str];
// no need to expand pre, since it is guaranteed to be free of brace-sets
var pre = m.pre;
@@ -144,55 +104,97 @@ function expand(str, isTop) {
? expand(m.post, false)
: [''];
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length)
var incr = n.length == 3
? Math.abs(numeric(n[2]))
: 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === '\\')
c = '';
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join('0');
if (i < 0)
c = '-' + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
if (/\$$/.test(m.pre)) {
for (var k = 0; k < post.length; k++) {
var expansion = pre+ '{' + m.body + '}' + post[k];
expansions.push(expansion);
}
} else {
N = concatMap(n, function(el) { return expand(el, false) });
}
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(',') >= 0;
if (!isSequence && !isOptions) {
// {a},b}
if (m.post.match(/,.*\}/)) {
str = m.pre + '{' + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
// x{{a,b}}y ==> x{a}y x{b}y
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
// at this point, n is the parts, and we know it's not a comma set
// with a single entry.
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length)
var incr = n.length == 3
? Math.abs(numeric(n[2]))
: 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === '\\')
c = '';
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join('0');
if (i < 0)
c = '-' + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = [];
for (var j = 0; j < n.length; j++) {
N.push.apply(N, expand(n[j], false));
}
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "brace-expansion",
"description": "Brace expansion as known from sh/bash",
"version": "1.1.11",
"version": "2.0.1",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/brace-expansion.git"
@@ -14,11 +14,10 @@
"bench": "matcha test/perf/bench.js"
},
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
"balanced-match": "^1.0.0"
},
"devDependencies": {
"matcha": "^0.7.0",
"@c4312/matcha": "^1.3.1",
"tape": "^4.6.0"
},
"keywords": [],

7
node_modules/chalk/index.d.ts generated vendored
View File

@@ -137,6 +137,13 @@ declare namespace chalk {
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
```
@example
```
import chalk = require('chalk');
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
```
*/
(text: TemplateStringsArray, ...placeholders: unknown[]): string;

2
node_modules/chalk/package.json generated vendored
View File

@@ -1,6 +1,6 @@
{
"name": "chalk",
"version": "4.0.0",
"version": "4.1.2",
"description": "Terminal string styling done right",
"license": "MIT",
"repository": "chalk/chalk",

55
node_modules/chalk/readme.md generated vendored
View File

@@ -9,10 +9,58 @@
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](http://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
<br>
---
<div align="center">
<p>
<p>
<sup>
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
</sup>
</p>
<sup>Special thanks to:</sup>
<br>
<br>
<a href="https://standardresume.co/tech">
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
</a>
<br>
<br>
<a href="https://retool.com/?utm_campaign=sindresorhus">
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
</a>
<br>
<br>
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
<div>
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
</div>
<b>All your environment variables, in one place</b>
<div>
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
<br>
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
</div>
</a>
<br>
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
<div>
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
</div>
</a>
</p>
</div>
---
<br>
## Highlights
- Expressive API
@@ -199,7 +247,7 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
## Tagged template literal
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
```js
const chalk = require('chalk');
@@ -215,10 +263,11 @@ console.log(chalk`
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
```js
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
```

9
node_modules/chalk/source/index.js generated vendored
View File

@@ -6,6 +6,8 @@ const {
stringEncaseCRLFWithFirstIndex
} = require('./util');
const {isArray} = Array;
// `supportsColor.level` → `ansiStyles.color[name]` mapping
const levelMapping = [
'ansi',
@@ -135,6 +137,11 @@ const createStyler = (open, close, parent) => {
const createBuilder = (self, _styler, _isEmpty) => {
const builder = (...arguments_) => {
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
return applyStyle(builder, chalkTag(builder, ...arguments_));
}
// Single argument is hot path, implicit coercion is faster than anything
// eslint-disable-next-line no-implicit-coercion
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
@@ -189,7 +196,7 @@ let template;
const chalkTag = (chalk, ...strings) => {
const [firstString] = strings;
if (!Array.isArray(firstString)) {
if (!isArray(firstString) || !isArray(firstString.raw)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
return strings.join(' ');

View File

@@ -1884,7 +1884,7 @@ class Referencer extends esrecurse__default["default"].Visitor {
this.currentScope().__define(pattern,
new Definition(
Variable.CatchClause,
node.param,
pattern,
node,
null,
null,
@@ -2142,7 +2142,7 @@ class Referencer extends esrecurse__default["default"].Visitor {
/* vim: set sw=4 ts=4 et tw=80 : */
const version = "8.0.1";
const version = "8.0.2";
/*
Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>

View File

@@ -395,7 +395,7 @@ class Referencer extends esrecurse.Visitor {
this.currentScope().__define(pattern,
new Definition(
Variable.CatchClause,
node.param,
pattern,
node,
null,
null,

View File

@@ -1,3 +1,3 @@
const version = "8.0.1";
const version = "8.0.2";
export default version;

View File

@@ -11,7 +11,7 @@
},
"./package.json": "./package.json"
},
"version": "8.0.1",
"version": "8.0.2",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
@@ -59,7 +59,7 @@
"mocha": "^9.0.1",
"npm-license": "^0.3.3",
"rollup": "^2.52.7",
"shelljs": "^0.8.4",
"shelljs": "^0.8.5",
"typescript": "^5.4.2"
}
}

13
node_modules/eslint/README.md generated vendored
View File

@@ -39,7 +39,7 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
10. [License](#license)
11. [Team](#team)
12. [Sponsors](#sponsors)
13. [Technology Sponsors](#technology-sponsors)
13. [Technology Sponsors](#technology-sponsors) <!-- markdownlint-disable-line MD051 -->
## Installation and Usage
@@ -294,14 +294,13 @@ The following companies, organizations, and individuals support ESLint's ongoing
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--sponsorsstart-->
<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a> <a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://www.notion.so"><img src="https://images.opencollective.com/notion/bf3b117/logo.png" alt="notion" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>
<!--sponsorsend-->
## Technology Sponsors
* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
* Hosting for ([eslint.org](https://eslint.org)) is sponsored by [Netlify](https://www.netlify.com)
* Password management is sponsored by [1Password](https://www.1password.com)
<!--techsponsorsstart-->
<h2>Technology Sponsors</h2>
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
<!--techsponsorsend-->

View File

@@ -20,7 +20,9 @@ const { validateLanguageOptions } = require("./validate-language-options");
// Type Definitions
//-----------------------------------------------------------------------------
/** @typedef {import("../../linter/vfile").VFile} VFile */
/** @typedef {import("@eslint/core").File} File */
/** @typedef {import("@eslint/core").Language} Language */
/** @typedef {import("@eslint/core").OkParseResult} OkParseResult */
//-----------------------------------------------------------------------------
// Helpers
@@ -56,6 +58,9 @@ function analyzeScope(ast, languageOptions, visitorKeys) {
// Exports
//-----------------------------------------------------------------------------
/**
* @type {Language}
*/
module.exports = {
fileType: "text",
@@ -143,7 +148,7 @@ module.exports = {
/**
* Parses the given file into an AST.
* @param {VFile} file The virtual file to parse.
* @param {File} file The virtual file to parse.
* @param {Object} options Additional options passed from ESLint.
* @param {LanguageOptions} options.languageOptions The language options.
* @returns {Object} The result of parsing.
@@ -200,7 +205,7 @@ module.exports = {
} catch (ex) {
// If the message includes a leading line number, strip it:
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
const message = ex.message.replace(/^line \d+:/iu, "").trim();
debug("%s\n%s", message, ex.stack);
@@ -218,8 +223,8 @@ module.exports = {
/**
* Creates a new `SourceCode` object from the given information.
* @param {VFile} file The virtual file to create a `SourceCode` object from.
* @param {Object} parseResult The result returned from `parse()`.
* @param {File} file The virtual file to create a `SourceCode` object from.
* @param {OkParseResult} parseResult The result returned from `parse()`.
* @param {Object} options Additional options passed from ESLint.
* @param {LanguageOptions} options.languageOptions The language options.
* @returns {SourceCode} The new `SourceCode` object.

View File

@@ -29,6 +29,10 @@ const
//------------------------------------------------------------------------------
/** @typedef {import("eslint-scope").Variable} Variable */
/** @typedef {import("eslint-scope").Scope} Scope */
/** @typedef {import("@eslint/core").SourceCode} ISourceCode */
/** @typedef {import("@eslint/core").Directive} IDirective */
/** @typedef {import("@eslint/core").TraversalStep} ITraversalStep */
//------------------------------------------------------------------------------
// Private
@@ -373,6 +377,7 @@ class TraversalStep {
/**
* A class to represent a directive comment.
* @implements {IDirective}
*/
class Directive {
@@ -429,12 +434,13 @@ const caches = Symbol("caches");
/**
* Represents parsed source code.
* @implements {ISourceCode}
*/
class SourceCode extends TokenStore {
/**
* The cache of steps that were taken while traversing the source code.
* @type {Array<TraversalStep>}
* @type {Array<ITraversalStep>}
*/
#steps;
@@ -838,7 +844,7 @@ class SourceCode extends TokenStore {
/**
* Gets the scope for the given node
* @param {ASTNode} currentNode The node to get the scope of
* @returns {eslint-scope.Scope} The scope information for this node
* @returns {Scope} The scope information for this node
* @throws {TypeError} If the `currentNode` argument is missing.
*/
getScope(currentNode) {

View File

@@ -10,6 +10,9 @@
//------------------------------------------------------------------------------
/** @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
@@ -24,8 +27,8 @@ const {
/**
* Compares the locations of two objects in a source file
* @param {{line: number, column: number}} itemA The first object
* @param {{line: number, column: number}} itemB The second object
* @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.
*/
@@ -418,7 +421,7 @@ function applyDirectives(options) {
* @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 {Object} options.configuredRules The rules configuration.
* @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}}[]}

View File

@@ -72,6 +72,10 @@ const STEP_KIND_CALL = 2;
/** @typedef {import("../shared/types").Processor} Processor */
/** @typedef {import("../shared/types").Rule} Rule */
/** @typedef {import("../shared/types").Times} Times */
/** @typedef {import("@eslint/core").Language} Language */
/** @typedef {import("@eslint/core").RuleSeverity} RuleSeverity */
/** @typedef {import("@eslint/core").RuleConfig} RuleConfig */
/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */
/**
@@ -276,7 +280,7 @@ function updateLocationInformation({ line, column, endLine, endColumn }, languag
* @param {string} [options.ruleId] the ruleId to report
* @param {Object} [options.loc] the loc to report
* @param {string} [options.message] the error message to report
* @param {string} [options.severity] the error message to report
* @param {RuleSeverity} [options.severity] the error message to report
* @param {Language} [options.language] the language to use to adjust the location information
* @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId.
* @private
@@ -877,7 +881,7 @@ function storeTime(time, timeOpts, slots) {
/**
* Get the options for a rule (not including severity), if any
* @param {Array|number} ruleConfig rule configuration
* @param {RuleConfig} ruleConfig rule configuration
* @returns {Array} of rule options, empty Array if none
*/
function getRuleOptions(ruleConfig) {
@@ -941,7 +945,7 @@ function parse(file, language, languageOptions) {
nodeType: null,
fatal: true,
severity: 2,
message: error.message,
message: `Parsing error: ${error.message}`,
line: error.line,
column: error.column
}))

View File

@@ -334,10 +334,8 @@ class NodeEventGenerator {
* @returns {void}
*/
enterNode(node) {
if (node.parent) {
this.currentAncestry.unshift(node.parent);
}
this.applySelectors(node, false);
this.currentAncestry.unshift(node);
}
/**
@@ -346,8 +344,8 @@ class NodeEventGenerator {
* @returns {void}
*/
leaveNode(node) {
this.applySelectors(node, true);
this.currentAncestry.shift();
this.applySelectors(node, true);
}
}

View File

@@ -5,6 +5,12 @@
"use strict";
//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------
/** @typedef {import("@eslint/core").File} File */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
@@ -54,6 +60,7 @@ function stripUnicodeBOM(value) {
/**
* Represents a virtual file inside of ESLint.
* @implements {File}
*/
class VFile {

View File

@@ -89,6 +89,9 @@ const arrayOfStringsOrObjectPatterns = {
minItems: 1,
uniqueItems: true
},
regex: {
type: "string"
},
importNamePattern: {
type: "string"
},
@@ -104,7 +107,6 @@ const arrayOfStringsOrObjectPatterns = {
}
},
additionalProperties: false,
required: ["group"],
not: {
anyOf: [
{ required: ["importNames", "allowImportNames"] },
@@ -113,7 +115,11 @@ const arrayOfStringsOrObjectPatterns = {
{ required: ["importNamePattern", "allowImportNames"] },
{ required: ["allowImportNames", "allowImportNamePattern"] }
]
}
},
oneOf: [
{ required: ["group"] },
{ required: ["regex"] }
]
},
uniqueItems: true
}
@@ -235,9 +241,10 @@ module.exports = {
// relative paths are supported for this rule
const restrictedPatternGroups = restrictedPatterns.map(
({ group, message, caseSensitive, importNames, importNamePattern, allowImportNames, allowImportNamePattern }) => (
({ group, regex, message, caseSensitive, importNames, importNamePattern, allowImportNames, allowImportNamePattern }) => (
{
matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group),
...(group ? { matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group) } : {}),
...(typeof regex === "string" ? { regexMatcher: new RegExp(regex, caseSensitive ? "u" : "iu") } : {}),
customMessage: message,
importNames,
importNamePattern,
@@ -493,7 +500,7 @@ module.exports = {
* @private
*/
function isRestrictedPattern(importSource, group) {
return group.matcher.ignores(importSource);
return group.regexMatcher ? group.regexMatcher.test(importSource) : group.matcher.ignores(importSource);
}
/**

View File

@@ -340,7 +340,7 @@ module.exports = {
/**
* Determines if a variable has a sibling rest property
* @param {Variable} variable eslint-scope variable object.
* @returns {boolean} True if the variable is exported, false if not.
* @returns {boolean} True if the variable has a sibling rest property, false if not.
* @private
*/
function hasRestSpreadSibling(variable) {

View File

@@ -72,11 +72,11 @@ module.exports = {
schema: [],
messages: {
nested: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' from within that group.",
forward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears later in the pattern.",
backward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which appears before in the same lookbehind.",
disjunctive: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in another alternative.",
intoNegativeLookaround: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}' which is in a negative lookaround."
nested: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} from within that group.",
forward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which appears later in the pattern.",
backward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which appears before in the same lookbehind.",
disjunctive: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which is in another alternative.",
intoNegativeLookaround: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which is in a negative lookaround."
}
},
@@ -104,16 +104,21 @@ module.exports = {
visitRegExpAST(regExpAST, {
onBackreferenceEnter(bref) {
const group = bref.resolved,
brefPath = getPathToRoot(bref),
groupPath = getPathToRoot(group);
let messageId = null;
const groups = [bref.resolved].flat(),
brefPath = getPathToRoot(bref);
if (brefPath.includes(group)) {
const problems = groups.map(group => {
const groupPath = getPathToRoot(group);
if (brefPath.includes(group)) {
// group is bref's ancestor => bref is nested ('nested reference') => group hasn't matched yet when bref starts to match.
return {
messageId: "nested",
group
};
}
// group is bref's ancestor => bref is nested ('nested reference') => group hasn't matched yet when bref starts to match.
messageId = "nested";
} else {
// Start from the root to find the lowest common ancestor.
let i = brefPath.length - 1,
@@ -130,35 +135,80 @@ module.exports = {
lowestCommonLookaround = commonPath.find(isLookaround),
isMatchingBackward = lowestCommonLookaround && lowestCommonLookaround.kind === "lookbehind";
if (groupCut.at(-1).type === "Alternative") {
// group's and bref's ancestor nodes below the lowest common ancestor are sibling alternatives => they're disjunctive.
return {
messageId: "disjunctive",
group
};
}
if (!isMatchingBackward && bref.end <= group.start) {
// bref is left, group is right ('forward reference') => group hasn't matched yet when bref starts to match.
messageId = "forward";
} else if (isMatchingBackward && group.end <= bref.start) {
return {
messageId: "forward",
group
};
}
if (isMatchingBackward && group.end <= bref.start) {
// the opposite of the previous when the regex is matching backward in a lookbehind context.
messageId = "backward";
} else if (groupCut.at(-1).type === "Alternative") {
// group's and bref's ancestor nodes below the lowest common ancestor are sibling alternatives => they're disjunctive.
messageId = "disjunctive";
} else if (groupCut.some(isNegativeLookaround)) {
return {
messageId: "backward",
group
};
}
if (groupCut.some(isNegativeLookaround)) {
// group is in a negative lookaround which isn't bref's ancestor => group has already failed when bref starts to match.
messageId = "intoNegativeLookaround";
return {
messageId: "intoNegativeLookaround",
group
};
}
return null;
});
if (problems.length === 0 || problems.some(problem => !problem)) {
// If there are no problems or no problems with any group then do not report it.
return;
}
if (messageId) {
context.report({
node,
messageId,
data: {
bref: bref.raw,
group: group.raw
}
});
let problemsToReport;
// Gets problems that appear in the same disjunction.
const problemsInSameDisjunction = problems.filter(problem => problem.messageId !== "disjunctive");
if (problemsInSameDisjunction.length) {
// Only report problems that appear in the same disjunction.
problemsToReport = problemsInSameDisjunction;
} else {
// If all groups appear in different disjunctions, report it.
problemsToReport = problems;
}
const [{ messageId, group }, ...other] = problemsToReport;
let otherGroups = "";
if (other.length === 1) {
otherGroups = " and another group";
} else if (other.length > 1) {
otherGroups = ` and other ${other.length} groups`;
}
context.report({
node,
messageId,
data: {
bref: bref.raw,
group: group.raw,
otherGroups
}
});
}
});
}

View File

@@ -8,7 +8,7 @@
const { RegExpValidator } = require("@eslint-community/regexpp");
const REGEXPP_LATEST_ECMA_VERSION = 2024;
const REGEXPP_LATEST_ECMA_VERSION = 2025;
/**
* Checks if the given regular expression pattern would be valid with the `u` flag.

9
node_modules/eslint/package.json generated vendored
View File

@@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "9.6.0",
"version": "9.7.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"description": "An AST-based pattern checker for JavaScript.",
"bin": {
@@ -67,10 +67,10 @@
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint-community/regexpp": "^4.11.0",
"@eslint/config-array": "^0.17.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "9.6.0",
"@eslint/js": "9.7.0",
"@humanwhocodes/module-importer": "^1.0.1",
"@humanwhocodes/retry": "^0.3.0",
"@nodelib/fs.walk": "^1.2.8",
@@ -79,7 +79,7 @@
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^8.0.1",
"eslint-scope": "^8.0.2",
"eslint-visitor-keys": "^4.0.0",
"espree": "^10.1.0",
"esquery": "^1.5.0",
@@ -104,6 +104,7 @@
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@eslint/core": "^0.1.0",
"@types/estree": "^1.0.5",
"@types/node": "^20.11.5",
"@wdio/browser-runner": "^8.38.3",

109
node_modules/micromatch/CHANGELOG.md generated vendored
View File

@@ -1,109 +0,0 @@
# Release history
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
<details>
<summary><strong>Guiding Principles</strong></summary>
- Changelogs are for humans, not machines.
- There should be an entry for every single version.
- The same types of changes should be grouped.
- Versions and sections should be linkable.
- The latest version comes first.
- The release date of each versions is displayed.
- Mention whether you follow Semantic Versioning.
</details>
<details>
<summary><strong>Types of changes</strong></summary>
Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
- `Added` for new features.
- `Changed` for changes in existing functionality.
- `Deprecated` for soon-to-be removed features.
- `Removed` for now removed features.
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.
</details>
## [4.0.0] - 2019-03-20
### Added
- Adds support for `options.onMatch`. See the readme for details
- Adds support for `options.onIgnore`. See the readme for details
- Adds support for `options.onResult`. See the readme for details
### Breaking changes
- Require Node.js >= 8.6
- Removed support for passing an array of brace patterns to `micromatch.braces()`.
- To strictly enforce closing brackets (for `{`, `[`, and `(`), you must now use `strictBrackets=true` instead of `strictErrors`.
- `cache` - caching and all related options and methods have been removed
- `options.unixify` was renamed to `options.windows`
- `options.nodupes` Was removed. Duplicates are always removed by default. You can override this with custom behavior by using the `onMatch`, `onResult` and `onIgnore` functions.
- `options.snapdragon` was removed, as snapdragon is no longer used.
- `options.sourcemap` was removed, as snapdragon is no longer used, which provided sourcemap support.
## [3.0.0] - 2017-04-11
Complete overhaul, with 36,000+ new unit tests validated against actual output generated by Bash and minimatch. More specifically, 35,000+ of the tests:
- micromatch results are directly compared to bash results
- in rare cases, when micromatch and bash disagree, micromatch's results are compared to minimatch's results
- micromatch is much more accurate than minimatch, so there were cases where I had to make assumptions. I'll try to document these.
This refactor introduces a parser and compiler that are supersets of more granular parsers and compilers from other sub-modules. Each of these sub-modules has a singular responsibility and focuses on a certain type of matching that aligns with a specific part of the Bash "expansion" API.
These sub-modules work like plugins to seamlessly create the micromatch parser/compiler, so that strings are parsed in one pass, an [AST is created](https://gist.github.com/jonschlinkert/099c8914f56529f75bc757cc9e5e8e2a), then a new string is generated by the compiler.
Here are those sub-modules with links to related prs on those modules if you want to see how they contribute to this code:
[nanomatch](https://github.com/jonschlinkert/nanomatch) (new library) - glob expansion (`*`, `**`, `?` and `[...]`))
[braces](https://github.com/jonschlinkert/braces/pull/10) - brace expansion (`{1..10}`, `{a,b,c}`, etc)
[extglob](https://github.com/jonschlinkert/extglob/pull/5) - extended globs (`!(a|b)`, `@(!(foo|bar))`, etc)
[expand-brackets](https://github.com/jonschlinkert/expand-brackets/pull/5) - POSIX character classes `[[:alpha:][:digit:]]`
**Added**
- source map support (optionally created when using parse or compile - I have no idea what the use case is yet, but they come for free) (note that source maps are not generated for brace expansion at present, since the braces compiler uses a different strategy. I'll update if/when this changes).
- parser is exposed, so that implementors can customize or override specific micromatch parsers if necessary
- compiler is exposed, so that implementors can customize or override specific micromatch compilers if necessary
**Fixed**
- more accurate matching (passes 100% of Bash 4.3 of the brace expansion and extglob unit tests, as well as all Bash glob tests that are relevant to node.js usage, all minimatch tests, all brace-expansion tests, and also passes a couple of tests that bash fails)
- even safer - micromatch has always generated optimized patterns so it's not subject to DoS exploits like minimatch (completely different than the regex DoS issue, minimatch and multimatch are still openly exposed to being used for DoS attacks), but more safeguards were built into this refactor
**Changed**
- the public API of this library did not change in this version and should be safe to upgrade without changing implentor code. However, we have released this as a major version for the following reasons:
- out of an abundance of caution due to the large amount of code changed in this release
- we have improved parser accuracy to such a degree that some implementors using invalid globs have noted change in behavior. If this is the case for you, please check that you are using a valid glob expression before logging a bug with this library
## [1.0.1] - 2016-12-12
**Added**
- Support for windows path edge cases where backslashes are used in brackets or other unusual combinations.
## [1.0.0] - 2016-12-12
Stable release.
## [0.1.0] - 2016-10-08
First release.
[Unreleased]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...HEAD
[0.2.0]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...0.2.0
[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog

172
node_modules/micromatch/README.md generated vendored
View File

@@ -1,4 +1,4 @@
# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Linux Build Status](https://img.shields.io/travis/micromatch/micromatch.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/micromatch)
# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Tests](https://github.com/micromatch/micromatch/actions/workflows/test.yml/badge.svg)](https://github.com/micromatch/micromatch/actions/workflows/test.yml)
> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.
@@ -9,46 +9,48 @@ Please consider following this project's author, [Jon Schlinkert](https://github
<details>
<summary><strong>Details</strong></summary>
- [Install](#install)
- [Quickstart](#quickstart)
- [Why use micromatch?](#why-use-micromatch)
* [Matching features](#matching-features)
- [Switching to micromatch](#switching-to-micromatch)
* [From minimatch](#from-minimatch)
* [From multimatch](#from-multimatch)
- [API](#api)
- [Options](#options)
- [Options Examples](#options-examples)
* [options.basename](#optionsbasename)
* [options.bash](#optionsbash)
* [options.expandRange](#optionsexpandrange)
* [options.format](#optionsformat)
* [options.ignore](#optionsignore)
* [options.matchBase](#optionsmatchbase)
* [options.noextglob](#optionsnoextglob)
* [options.nonegate](#optionsnonegate)
* [options.noglobstar](#optionsnoglobstar)
* [options.nonull](#optionsnonull)
* [options.nullglob](#optionsnullglob)
* [options.onIgnore](#optionsonignore)
* [options.onMatch](#optionsonmatch)
* [options.onResult](#optionsonresult)
* [options.posixSlashes](#optionsposixslashes)
* [options.unescape](#optionsunescape)
- [Extended globbing](#extended-globbing)
* [Extglobs](#extglobs)
* [Braces](#braces)
* [Regex character classes](#regex-character-classes)
* [Regex groups](#regex-groups)
* [POSIX bracket expressions](#posix-bracket-expressions)
- [Notes](#notes)
* [Bash 4.3 parity](#bash-43-parity)
* [Backslashes](#backslashes)
- [Benchmarks](#benchmarks)
* [Running benchmarks](#running-benchmarks)
* [Latest results](#latest-results)
- [Contributing](#contributing)
- [About](#about)
* [Install](#install)
- [Sponsors](#sponsors)
* [Gold Sponsors](#gold-sponsors)
* [Quickstart](#quickstart)
* [Why use micromatch?](#why-use-micromatch)
+ [Matching features](#matching-features)
* [Switching to micromatch](#switching-to-micromatch)
+ [From minimatch](#from-minimatch)
+ [From multimatch](#from-multimatch)
* [API](#api)
* [Options](#options)
* [Options Examples](#options-examples)
+ [options.basename](#optionsbasename)
+ [options.bash](#optionsbash)
+ [options.expandRange](#optionsexpandrange)
+ [options.format](#optionsformat)
+ [options.ignore](#optionsignore)
+ [options.matchBase](#optionsmatchbase)
+ [options.noextglob](#optionsnoextglob)
+ [options.nonegate](#optionsnonegate)
+ [options.noglobstar](#optionsnoglobstar)
+ [options.nonull](#optionsnonull)
+ [options.nullglob](#optionsnullglob)
+ [options.onIgnore](#optionsonignore)
+ [options.onMatch](#optionsonmatch)
+ [options.onResult](#optionsonresult)
+ [options.posixSlashes](#optionsposixslashes)
+ [options.unescape](#optionsunescape)
* [Extended globbing](#extended-globbing)
+ [Extglobs](#extglobs)
+ [Braces](#braces)
+ [Regex character classes](#regex-character-classes)
+ [Regex groups](#regex-groups)
+ [POSIX bracket expressions](#posix-bracket-expressions)
* [Notes](#notes)
+ [Bash 4.3 parity](#bash-43-parity)
+ [Backslashes](#backslashes)
* [Benchmarks](#benchmarks)
+ [Running benchmarks](#running-benchmarks)
+ [Latest results](#latest-results)
* [Contributing](#contributing)
* [About](#about)
</details>
@@ -60,6 +62,14 @@ Install with [npm](https://www.npmjs.com/):
$ npm install --save micromatch
```
<br />
# Sponsors
[Become a Sponsor](https://github.com/sponsors/jonschlinkert) to add your logo to this README, or any of [my other projects](https://github.com/jonschlinkert?tab=repositories&q=&type=&language=&sort=stargazers)
<br />
## Quickstart
```js
@@ -103,7 +113,7 @@ console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true
* Support for multiple glob patterns (no need for wrappers like multimatch)
* Wildcards (`**`, `*.js`)
* Negation (`'!a/*.js'`, `'*!(b).js']`)
* Negation (`'!a/*.js'`, `'*!(b).js'`)
* [extglobs](#extglobs) (`+(x|y)`, `!(a|b)`)
* [POSIX character classes](#posix-bracket-expressions) (`[[:alpha:][:digit:]]`)
* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`)
@@ -157,7 +167,7 @@ console.log(mm(['a.js', 'a.txt'], ['*.js']));
//=> [ 'a.js' ]
```
### [.matcher](index.js#L104)
### [.matcher](index.js#L109)
Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match.
@@ -178,7 +188,7 @@ console.log(isMatch('a.a')); //=> false
console.log(isMatch('a.b')); //=> true
```
### [.isMatch](index.js#L123)
### [.isMatch](index.js#L128)
Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -199,7 +209,7 @@ console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
console.log(mm.isMatch('a.a', 'b.*')); //=> false
```
### [.not](index.js#L148)
### [.not](index.js#L153)
Returns a list of strings that _**do not match any**_ of the given `patterns`.
@@ -220,7 +230,7 @@ console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
//=> ['b.b', 'c.c']
```
### [.contains](index.js#L188)
### [.contains](index.js#L193)
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
@@ -243,7 +253,7 @@ console.log(mm.contains('aa/bb/cc', '*d'));
//=> false
```
### [.matchKeys](index.js#L230)
### [.matchKeys](index.js#L235)
Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead.
@@ -265,7 +275,7 @@ console.log(mm.matchKeys(obj, '*b'));
//=> { ab: 'b' }
```
### [.some](index.js#L259)
### [.some](index.js#L264)
Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
@@ -288,7 +298,7 @@ console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
// false
```
### [.every](index.js#L295)
### [.every](index.js#L300)
Returns true if every string in the given `list` matches any of the given glob `patterns`.
@@ -315,7 +325,7 @@ console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
// false
```
### [.all](index.js#L334)
### [.all](index.js#L339)
Returns true if **all** of the given `patterns` match the specified string.
@@ -345,7 +355,7 @@ console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
// true
```
### [.capture](index.js#L361)
### [.capture](index.js#L366)
Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match.
@@ -368,7 +378,7 @@ console.log(mm.capture('test/*.js', 'foo/bar.css'));
//=> null
```
### [.makeRe](index.js#L387)
### [.makeRe](index.js#L392)
Create a regular expression from the given glob `pattern`.
@@ -388,7 +398,7 @@ console.log(mm.makeRe('*.js'));
//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
```
### [.scan](index.js#L403)
### [.scan](index.js#L408)
Scan a glob pattern to separate the pattern into segments. Used by the [split](#split) method.
@@ -405,7 +415,7 @@ const mm = require('micromatch');
const state = mm.scan(pattern[, options]);
```
### [.parse](index.js#L419)
### [.parse](index.js#L424)
Parse a glob pattern to create the source string for a regular expression.
@@ -419,10 +429,10 @@ Parse a glob pattern to create the source string for a regular expression.
```js
const mm = require('micromatch');
const state = mm(pattern[, options]);
const state = mm.parse(pattern[, options]);
```
### [.braces](index.js#L446)
### [.braces](index.js#L451)
Process the given brace `pattern`.
@@ -845,7 +855,7 @@ $ npm run bench
### Latest results
As of April 10, 2021 (longer bars are better):
As of August 23, 2024 (longer bars are better):
```sh
# .makeRe star
@@ -963,32 +973,38 @@ You might also be interested in these projects:
| **Commits** | **Contributor** |
| --- | --- |
| 508 | [jonschlinkert](https://github.com/jonschlinkert) |
| 523 | [jonschlinkert](https://github.com/jonschlinkert) |
| 12 | [es128](https://github.com/es128) |
| 9 | [danez](https://github.com/danez) |
| 8 | [doowb](https://github.com/doowb) |
| 6 | [paulmillr](https://github.com/paulmillr) |
| 5 | [mrmlnc](https://github.com/mrmlnc) |
| 4 | [danez](https://github.com/danez) |
| 3 | [DrPizza](https://github.com/DrPizza) |
| 2 | [TrySound](https://github.com/TrySound) |
| 2 | [mceIdo](https://github.com/mceIdo) |
| 2 | [Glazy](https://github.com/Glazy) |
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
| 2 | [Tvrqvoise](https://github.com/Tvrqvoise) |
| 1 | [amilajack](https://github.com/amilajack) |
| 1 | [Cslove](https://github.com/Cslove) |
| 1 | [devongovett](https://github.com/devongovett) |
| 1 | [DianeLooney](https://github.com/DianeLooney) |
| 1 | [UltCombo](https://github.com/UltCombo) |
| 1 | [frangio](https://github.com/frangio) |
| 1 | [juszczykjakub](https://github.com/juszczykjakub) |
| 1 | [muescha](https://github.com/muescha) |
| 1 | [sebdeckers](https://github.com/sebdeckers) |
| 1 | [tomByrer](https://github.com/tomByrer) |
| 1 | [fidian](https://github.com/fidian) |
| 1 | [simlu](https://github.com/simlu) |
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
| 2 | [antonyk](https://github.com/antonyk) |
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
| 2 | [Glazy](https://github.com/Glazy) |
| 2 | [mceIdo](https://github.com/mceIdo) |
| 2 | [TrySound](https://github.com/TrySound) |
| 1 | [yvele](https://github.com/yvele) |
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
| 1 | [simlu](https://github.com/simlu) |
| 1 | [curbengh](https://github.com/curbengh) |
| 1 | [fidian](https://github.com/fidian) |
| 1 | [tomByrer](https://github.com/tomByrer) |
| 1 | [ZoomerTedJackson](https://github.com/ZoomerTedJackson) |
| 1 | [styfle](https://github.com/styfle) |
| 1 | [sebdeckers](https://github.com/sebdeckers) |
| 1 | [muescha](https://github.com/muescha) |
| 1 | [juszczykjakub](https://github.com/juszczykjakub) |
| 1 | [joyceerhl](https://github.com/joyceerhl) |
| 1 | [donatj](https://github.com/donatj) |
| 1 | [frangio](https://github.com/frangio) |
| 1 | [UltCombo](https://github.com/UltCombo) |
| 1 | [DianeLooney](https://github.com/DianeLooney) |
| 1 | [devongovett](https://github.com/devongovett) |
| 1 | [Cslove](https://github.com/Cslove) |
| 1 | [amilajack](https://github.com/amilajack) |
### Author
@@ -1000,9 +1016,9 @@ You might also be interested in these projects:
### License
Copyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert).
Copyright © 2024, [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 April 10, 2021._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on August 23, 2024._

17
node_modules/micromatch/index.js generated vendored
View File

@@ -4,7 +4,12 @@ const util = require('util');
const braces = require('braces');
const picomatch = require('picomatch');
const utils = require('picomatch/lib/utils');
const isEmptyString = val => val === '' || val === './';
const isEmptyString = v => v === '' || v === './';
const hasBraces = v => {
const index = v.indexOf('{');
return index > -1 && v.indexOf('}', index) > -1;
};
/**
* Returns an array of strings that match one or more glob patterns.
@@ -155,10 +160,10 @@ micromatch.not = (list, patterns, options = {}) => {
items.push(state.output);
};
let matches = micromatch(list, patterns, { ...options, onResult });
let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
for (let item of items) {
if (!matches.includes(item)) {
if (!matches.has(item)) {
result.add(item);
}
}
@@ -408,7 +413,7 @@ micromatch.scan = (...args) => picomatch.scan(...args);
*
* ```js
* const mm = require('micromatch');
* const state = mm(pattern[, options]);
* const state = mm.parse(pattern[, options]);
* ```
* @param {String} `glob`
* @param {Object} `options`
@@ -445,7 +450,7 @@ micromatch.parse = (patterns, options) => {
micromatch.braces = (pattern, options) => {
if (typeof pattern !== 'string') throw new TypeError('Expected a string');
if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
if ((options && options.nobrace === true) || !hasBraces(pattern)) {
return [pattern];
}
return braces(pattern, options);
@@ -464,4 +469,6 @@ micromatch.braceExpand = (pattern, options) => {
* Expose micromatch
*/
// exposed for tests
micromatch.hasBraces = hasBraces;
module.exports = micromatch;

View File

@@ -32,6 +32,16 @@ Changelog entries are classified using the following labels _(from [keep-a-chang
</details>
## 2.3.1 (2022-01-02)
### Fixed
* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)).
### Changed
* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)).
## 2.3.0 (2021-05-21)
### Fixed

View File

@@ -312,12 +312,11 @@ The following options may be used with the main `picomatch()` function or any of
| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
| `flags` | `boolean` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
| `lookbehinds` | `boolean` | `true` | Support regex positive and negative lookbehinds. Note that you must be using Node 8.1.10 or higher to enable regex lookbehinds. |
| `matchBase` | `boolean` | `false` | Alias for `basename` |
| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
@@ -341,6 +340,8 @@ The following options may be used with the main `picomatch()` function or any of
| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error.
### Scan Options
In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
@@ -704,4 +705,4 @@ npm install -g verbose/verb#dev verb-generate-readme && verb
### License
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
Released under the [MIT License](LICENSE).

View File

@@ -250,7 +250,14 @@ const parse = (input, options) => {
}
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
output = token.close = `)${rest})${extglobStar})`;
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
// In this case, we need to parse the string and use it in the output of the original pattern.
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
//
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
const expression = parse(rest, { ...options, fastpaths: false }).output;
output = token.close = `)${expression})${extglobStar})`;
}
if (token.prev.type === 'bos') {

Some files were not shown because too many files have changed in this diff Show More