oxlint-plugin-eslint 1.60.0 → 1.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/ast-utils.cjs +6 -6
- package/common/chunk.cjs +1 -1
- package/common/regexpp.cjs +3 -2
- package/package.json +1 -1
- package/rules/arrow-parens.cjs +1 -1
- package/rules/function-paren-newline.cjs +1 -1
- package/rules/indent.cjs +12 -2
- package/rules/no-extra-boolean-cast.cjs +1 -0
- package/rules/no-return-await.cjs +1 -1
- package/rules/no-unmodified-loop-condition.cjs +1 -1
- package/rules/no-useless-computed-key.cjs +1 -0
- package/rules/no-whitespace-before-property.cjs +1 -1
- package/rules/object-shorthand.cjs +1 -1
- package/rules/padded-blocks.cjs +1 -0
- package/rules/prefer-arrow-callback.cjs +1 -1
package/common/ast-utils.cjs
CHANGED
|
@@ -2739,27 +2739,27 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
2739
2739
|
for (var prop in node) newNode[prop] = node[prop];
|
|
2740
2740
|
return newNode;
|
|
2741
2741
|
};
|
|
2742
|
-
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz", ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic", ecma11BinaryProperties = ecma10BinaryProperties, ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict", ecma13BinaryProperties = ecma12BinaryProperties,
|
|
2742
|
+
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz", ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic", ecma11BinaryProperties = ecma10BinaryProperties, ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict", ecma13BinaryProperties = ecma12BinaryProperties, unicodeBinaryProperties = {
|
|
2743
2743
|
9: ecma9BinaryProperties,
|
|
2744
2744
|
10: ecma10BinaryProperties,
|
|
2745
2745
|
11: ecma11BinaryProperties,
|
|
2746
2746
|
12: ecma12BinaryProperties,
|
|
2747
2747
|
13: ecma13BinaryProperties,
|
|
2748
|
-
14:
|
|
2749
|
-
},
|
|
2748
|
+
14: ecma13BinaryProperties
|
|
2749
|
+
}, unicodeBinaryPropertiesOfStrings = {
|
|
2750
2750
|
9: "",
|
|
2751
2751
|
10: "",
|
|
2752
2752
|
11: "",
|
|
2753
2753
|
12: "",
|
|
2754
2754
|
13: "",
|
|
2755
|
-
14:
|
|
2756
|
-
}, unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",
|
|
2755
|
+
14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
|
|
2756
|
+
}, unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", unicodeScriptValues = {
|
|
2757
2757
|
9: ecma9ScriptValues,
|
|
2758
2758
|
10: ecma10ScriptValues,
|
|
2759
2759
|
11: ecma11ScriptValues,
|
|
2760
2760
|
12: ecma12ScriptValues,
|
|
2761
2761
|
13: ecma13ScriptValues,
|
|
2762
|
-
14:
|
|
2762
|
+
14: ecma13ScriptValues + " " + scriptValuesAddedInUnicode
|
|
2763
2763
|
}, data = {};
|
|
2764
2764
|
function buildUnicodeData(ecmaVersion) {
|
|
2765
2765
|
var d = data[ecmaVersion] = {
|
package/common/chunk.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
2
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
3
3
|
//#endregion
|
|
4
4
|
Object.defineProperty(exports, "t", {
|
|
5
5
|
enumerable: !0,
|
package/common/regexpp.cjs
CHANGED
|
@@ -1193,7 +1193,7 @@ var require_regexpp = /* @__PURE__ */ require("./chunk.cjs").t(((exports) => {
|
|
|
1193
1193
|
onGroupEnter(start) {
|
|
1194
1194
|
let parent = this._node;
|
|
1195
1195
|
if (parent.type !== "Alternative") throw Error("UnknownError");
|
|
1196
|
-
|
|
1196
|
+
let group = {
|
|
1197
1197
|
type: "Group",
|
|
1198
1198
|
parent,
|
|
1199
1199
|
start,
|
|
@@ -1201,7 +1201,8 @@ var require_regexpp = /* @__PURE__ */ require("./chunk.cjs").t(((exports) => {
|
|
|
1201
1201
|
raw: "",
|
|
1202
1202
|
modifiers: null,
|
|
1203
1203
|
alternatives: []
|
|
1204
|
-
}
|
|
1204
|
+
};
|
|
1205
|
+
this._node = group, parent.elements.push(this._node);
|
|
1205
1206
|
}
|
|
1206
1207
|
onGroupLeave(start, end) {
|
|
1207
1208
|
let node = this._node;
|
package/package.json
CHANGED
package/rules/arrow-parens.cjs
CHANGED
|
@@ -99,7 +99,7 @@ var require_arrow_parens = /* @__PURE__ */ require_chunk.t(((exports, module) =>
|
|
|
99
99
|
* @returns {boolean} `true` if the function has at least one unexpected token.
|
|
100
100
|
*/
|
|
101
101
|
function hasUnexpectedTokensBeforeOpeningParen(node, openingParen) {
|
|
102
|
-
let expectedCount = node.async
|
|
102
|
+
let expectedCount = +!!node.async;
|
|
103
103
|
return sourceCode.getFirstToken(node, { skip: expectedCount }) !== openingParen;
|
|
104
104
|
}
|
|
105
105
|
return { "ArrowFunctionExpression[params.length=1]"(node) {
|
|
@@ -140,7 +140,7 @@ var require_function_paren_newline = /* @__PURE__ */ require_chunk.t(((exports,
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
case "ArrowFunctionExpression": {
|
|
143
|
-
let firstToken = sourceCode.getFirstToken(node, { skip: node.async
|
|
143
|
+
let firstToken = sourceCode.getFirstToken(node, { skip: +!!node.async });
|
|
144
144
|
return astUtils.isOpeningParenToken(firstToken) ? {
|
|
145
145
|
leftParen: firstToken,
|
|
146
146
|
rightParen: node.params.length ? sourceCode.getTokenAfter(node.params.at(-1), astUtils.isClosingParenToken) : sourceCode.getTokenAfter(firstToken)
|
package/rules/indent.cjs
CHANGED
|
@@ -606,7 +606,7 @@ var require_indent = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
|
606
606
|
addElementListIndent(node.properties, openingCurly, closingCurly, options.ObjectExpression);
|
|
607
607
|
},
|
|
608
608
|
ArrowFunctionExpression(node) {
|
|
609
|
-
let maybeOpeningParen = sourceCode.getFirstToken(node, { skip: node.async
|
|
609
|
+
let maybeOpeningParen = sourceCode.getFirstToken(node, { skip: +!!node.async });
|
|
610
610
|
if (astUtils.isOpeningParenToken(maybeOpeningParen)) {
|
|
611
611
|
let openingParen = maybeOpeningParen, closingParen = sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken);
|
|
612
612
|
parameterParens.add(openingParen), parameterParens.add(closingParen), addElementListIndent(node.params, openingParen, closingParen, options.FunctionExpression.parameters);
|
|
@@ -634,7 +634,17 @@ var require_indent = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
|
634
634
|
let firstToken = sourceCode.getFirstToken(node);
|
|
635
635
|
if (!options.flatTernaryExpressions || !astUtils.isTokenOnSameLine(node.test, node.consequent) || isOnFirstLineOfStatement(firstToken, node)) {
|
|
636
636
|
let questionMarkToken = sourceCode.getFirstTokenBetween(node.test, node.consequent, (token) => token.type === "Punctuator" && token.value === "?"), colonToken = sourceCode.getFirstTokenBetween(node.consequent, node.alternate, (token) => token.type === "Punctuator" && token.value === ":"), firstConsequentToken = sourceCode.getTokenAfter(questionMarkToken), lastConsequentToken = sourceCode.getTokenBefore(colonToken), firstAlternateToken = sourceCode.getTokenAfter(colonToken);
|
|
637
|
-
offsets.setDesiredOffset(questionMarkToken, firstToken, 1), offsets.setDesiredOffset(colonToken, firstToken, 1), offsets.setDesiredOffset(firstConsequentToken, firstToken, firstConsequentToken.type === "Punctuator" && options.offsetTernaryExpressions ? 2 : 1), lastConsequentToken.loc.end.line === firstAlternateToken.loc.start.line ? offsets.setDesiredOffset(firstAlternateToken, firstConsequentToken, 0) :
|
|
637
|
+
offsets.setDesiredOffset(questionMarkToken, firstToken, 1), offsets.setDesiredOffset(colonToken, firstToken, 1), offsets.setDesiredOffset(firstConsequentToken, firstToken, firstConsequentToken.type === "Punctuator" && options.offsetTernaryExpressions ? 2 : 1), lastConsequentToken.loc.end.line === firstAlternateToken.loc.start.line ? offsets.setDesiredOffset(firstAlternateToken, firstConsequentToken, 0) :
|
|
638
|
+
/**
|
|
639
|
+
* If the alternate and consequent do not share part of a line, offset the alternate from the first
|
|
640
|
+
* token of the conditional expression. For example:
|
|
641
|
+
* foo ? bar
|
|
642
|
+
* : baz
|
|
643
|
+
*
|
|
644
|
+
* If `baz` were aligned with `bar` rather than being offset by 1 from `foo`, `baz` would end up
|
|
645
|
+
* having no expected indentation.
|
|
646
|
+
*/
|
|
647
|
+
offsets.setDesiredOffset(firstAlternateToken, firstToken, firstAlternateToken.type === "Punctuator" && options.offsetTernaryExpressions ? 2 : 1);
|
|
638
648
|
}
|
|
639
649
|
},
|
|
640
650
|
"DoWhileStatement, WhileStatement, ForInStatement, ForOfStatement, WithStatement": (node) => addBlocklessNodeIndent(node.body),
|
|
@@ -110,6 +110,7 @@ var require_no_extra_boolean_cast = /* @__PURE__ */ require_chunk.t(((exports, m
|
|
|
110
110
|
throw Error("Ternary child must be test, consequent, or alternate.");
|
|
111
111
|
case "UnaryExpression": return precedence(node) < precedence(parent);
|
|
112
112
|
case "LogicalExpression": return astUtils.isMixedLogicalAndCoalesceExpressions(node, parent) ? !0 : previousNode === parent.left ? precedence(node) < precedence(parent) : precedence(node) <= precedence(parent);
|
|
113
|
+
/* c8 ignore next */
|
|
113
114
|
default: throw Error(`Unexpected parent type: ${parent.type}`);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
@@ -46,7 +46,7 @@ var require_no_return_await = /* @__PURE__ */ require_chunk.t(((exports, module)
|
|
|
46
46
|
fix(fixer) {
|
|
47
47
|
let sourceCode = context.sourceCode, [awaitToken, tokenAfterAwait] = sourceCode.getFirstTokens(node, 2);
|
|
48
48
|
if (awaitToken.loc.start.line !== tokenAfterAwait.loc.start.line) return null;
|
|
49
|
-
let [startOfAwait, endOfAwait] = awaitToken.range, range = [startOfAwait, endOfAwait + (sourceCode.text[endOfAwait] === " "
|
|
49
|
+
let [startOfAwait, endOfAwait] = awaitToken.range, range = [startOfAwait, endOfAwait + +(sourceCode.text[endOfAwait] === " ")];
|
|
50
50
|
return fixer.removeRange(range);
|
|
51
51
|
}
|
|
52
52
|
}]
|
|
@@ -369,7 +369,7 @@ var require_ms = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
|
369
369
|
"GITHUB_ACTIONS",
|
|
370
370
|
"BUILDKITE"
|
|
371
371
|
].some((sign) => sign in env) || env.CI_NAME === "codeship" ? 1 : min;
|
|
372
|
-
if ("TEAMCITY_VERSION" in env) return
|
|
372
|
+
if ("TEAMCITY_VERSION" in env) return +!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION);
|
|
373
373
|
if (env.COLORTERM === "truecolor") return 3;
|
|
374
374
|
if ("TERM_PROGRAM" in env) {
|
|
375
375
|
let version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
@@ -41,6 +41,7 @@ var require_no_useless_computed_key = /* @__PURE__ */ require_chunk.t(((exports,
|
|
|
41
41
|
case "Property": return node.parent.type === "ObjectExpression" ? value !== "__proto__" : !0;
|
|
42
42
|
case "PropertyDefinition": return node.static ? value !== "constructor" && value !== "prototype" : value !== "constructor";
|
|
43
43
|
case "MethodDefinition": return node.static ? value !== "prototype" : value !== "constructor";
|
|
44
|
+
/* c8 ignore next */
|
|
44
45
|
default: throw Error(`Unexpected node type: ${node.type}`);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -61,7 +61,7 @@ var require_no_whitespace_before_property = /* @__PURE__ */ require_chunk.t(((ex
|
|
|
61
61
|
}
|
|
62
62
|
return { MemberExpression(node) {
|
|
63
63
|
let rightToken, leftToken;
|
|
64
|
-
astUtils.isTokenOnSameLine(node.object, node.property) && (node.computed ? (rightToken = sourceCode.getTokenBefore(node.property, astUtils.isOpeningBracketToken), leftToken = sourceCode.getTokenBefore(rightToken, node.optional
|
|
64
|
+
astUtils.isTokenOnSameLine(node.object, node.property) && (node.computed ? (rightToken = sourceCode.getTokenBefore(node.property, astUtils.isOpeningBracketToken), leftToken = sourceCode.getTokenBefore(rightToken, +!!node.optional)) : (rightToken = sourceCode.getFirstToken(node.property), leftToken = sourceCode.getTokenBefore(rightToken, 1)), sourceCode.isSpaceBetweenTokens(leftToken, rightToken) && reportError(node, leftToken, rightToken));
|
|
65
65
|
} };
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -162,7 +162,7 @@ var require_object_shorthand = /* @__PURE__ */ require_chunk.t(((exports, module
|
|
|
162
162
|
let functionToken = sourceCode.getTokens(node.value).find((token) => token.type === "Keyword" && token.value === "function"), tokenBeforeParams = node.value.generator ? sourceCode.getTokenAfter(functionToken) : functionToken;
|
|
163
163
|
return fixer.replaceTextRange(fixRange, methodPrefix + sourceCode.text.slice(tokenBeforeParams.range[1], node.value.range[1]));
|
|
164
164
|
}
|
|
165
|
-
let arrowToken = sourceCode.getTokenBefore(node.value.body, astUtils.isArrowToken), fnBody = sourceCode.text.slice(arrowToken.range[1], node.value.range[1]), sliceStart = sourceCode.getFirstToken(node.value, { skip: node.value.async
|
|
165
|
+
let arrowToken = sourceCode.getTokenBefore(node.value.body, astUtils.isArrowToken), fnBody = sourceCode.text.slice(arrowToken.range[1], node.value.range[1]), sliceStart = sourceCode.getFirstToken(node.value, { skip: +!!node.value.async }).range[0], sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1], shouldAddParens = node.value.params.length === 1 && node.value.params[0].range[0] === sliceStart, oldParamText = sourceCode.text.slice(sliceStart, sliceEnd), newParamText = shouldAddParens ? `(${oldParamText})` : oldParamText;
|
|
166
166
|
return fixer.replaceTextRange(fixRange, methodPrefix + newParamText + fnBody);
|
|
167
167
|
}
|
|
168
168
|
/**
|
package/rules/padded-blocks.cjs
CHANGED
|
@@ -123,6 +123,7 @@ var require_padded_blocks = /* @__PURE__ */ require_chunk.t(((exports, module) =
|
|
|
123
123
|
case "StaticBlock": return options.blocks;
|
|
124
124
|
case "SwitchStatement": return options.switches;
|
|
125
125
|
case "ClassBody": return options.classes;
|
|
126
|
+
/* c8 ignore next */
|
|
126
127
|
default: throw Error("unreachable");
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -168,7 +168,7 @@ var require_prefer_arrow_callback = /* @__PURE__ */ require_chunk.t(((exports, m
|
|
|
168
168
|
if (astUtils.isParenthesised(sourceCode, memberNode) || sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) return;
|
|
169
169
|
yield fixer.removeRange([firstTokenToRemove.range[0], lastTokenToRemove.range[1]]);
|
|
170
170
|
}
|
|
171
|
-
let functionToken = sourceCode.getFirstToken(node, node.async
|
|
171
|
+
let functionToken = sourceCode.getFirstToken(node, +!!node.async), leftParenToken = sourceCode.getTokenAfter(functionToken, astUtils.isOpeningParenToken), tokenBeforeBody = sourceCode.getTokenBefore(node.body);
|
|
172
172
|
sourceCode.commentsExistBetween(functionToken, leftParenToken) ? (yield fixer.remove(functionToken), node.id && (yield fixer.remove(node.id))) : yield fixer.removeRange([functionToken.range[0], leftParenToken.range[0]]), yield fixer.insertTextAfter(tokenBeforeBody, " =>");
|
|
173
173
|
let replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node;
|
|
174
174
|
replacedNode.type === "ChainExpression" && (replacedNode = replacedNode.parent), replacedNode.parent.type !== "CallExpression" && replacedNode.parent.type !== "ConditionalExpression" && !astUtils.isParenthesised(sourceCode, replacedNode) && !astUtils.isParenthesised(sourceCode, node) && (yield fixer.insertTextBefore(replacedNode, "("), yield fixer.insertTextAfter(replacedNode, ")"));
|