From 95b1980c87ba1a35a1c9e3e45a3f68b170a30bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Thu, 18 Apr 2024 18:34:57 +0800 Subject: [PATCH] chore: upgrade a few dev deps to latest (#472) chore: re-apply prettier --- docs/rules/report-message-format.md | 2 +- eslint.config.js | 2 +- lib/index.js | 10 +- lib/rules/consistent-output.js | 4 +- lib/rules/fixer-return.js | 4 +- lib/rules/meta-property-ordering.js | 6 +- lib/rules/no-deprecated-context-methods.js | 8 +- lib/rules/no-deprecated-report-api.js | 6 +- lib/rules/no-identical-tests.js | 2 +- lib/rules/no-missing-message-ids.js | 4 +- lib/rules/no-missing-placeholders.js | 6 +- lib/rules/no-only-tests.js | 2 +- lib/rules/no-property-in-node.js | 4 +- lib/rules/no-unused-message-ids.js | 4 +- lib/rules/no-unused-placeholders.js | 6 +- lib/rules/no-useless-token-range.js | 10 +- lib/rules/prefer-message-ids.js | 4 +- lib/rules/prefer-object-rule.js | 4 +- lib/rules/prefer-output-null.js | 2 +- lib/rules/prefer-placeholders.js | 2 +- lib/rules/prefer-replace-text.js | 2 +- lib/rules/report-message-format.js | 8 +- lib/rules/require-meta-docs-description.js | 2 +- lib/rules/require-meta-docs-url.js | 14 +-- lib/rules/require-meta-has-suggestions.js | 6 +- lib/rules/require-meta-schema.js | 6 +- lib/rules/test-case-property-ordering.js | 4 +- lib/rules/test-case-shorthand-strings.js | 6 +- lib/utils.js | 72 +++++++------- package.json | 28 +++--- tests/lib/index.js | 2 +- tests/lib/rule-setup.js | 12 +-- tests/lib/rules/no-missing-placeholders.js | 6 +- tests/lib/rules/no-unused-placeholders.js | 2 +- tests/lib/rules/no-useless-token-range.js | 2 +- tests/lib/rules/report-message-format.js | 2 +- tests/lib/utils.js | 104 ++++++++++----------- 37 files changed, 185 insertions(+), 185 deletions(-) diff --git a/docs/rules/report-message-format.md b/docs/rules/report-message-format.md index aa324885..86381815 100644 --- a/docs/rules/report-message-format.md +++ b/docs/rules/report-message-format.md @@ -40,7 +40,7 @@ module.exports = { context.report( node, 'This will get reported, regardless of the value of the {{placeholder}}', - { placeholder: foo } + { placeholder: foo }, ); }, }; diff --git a/eslint.config.js b/eslint.config.js index de418956..ad269749 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -17,7 +17,7 @@ module.exports = [ 'not-an-aardvark/node', 'plugin:eslint-comments/recommended', 'plugin:prettier/recommended', - 'plugin:unicorn/recommended' + 'plugin:unicorn/recommended', ), pluginN.configs['flat/recommended'], { diff --git a/lib/index.js b/lib/index.js index 9f5d60f8..05dabb56 100644 --- a/lib/index.js +++ b/lib/index.js @@ -39,7 +39,7 @@ const allRules = Object.fromEntries( .map((ruleName) => [ ruleName, require(path.join(__dirname, 'rules', ruleName)), - ]) + ]), ); const plugin = { @@ -61,11 +61,11 @@ Object.assign( rules: Object.fromEntries( Object.keys(allRules) .filter((ruleName) => configFilters[configName](allRules[ruleName])) - .map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']) + .map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']), ), }, }); - }, {}) + }, {}), ); // flat configs @@ -79,11 +79,11 @@ Object.assign( rules: Object.fromEntries( Object.keys(allRules) .filter((ruleName) => configFilters[configName](allRules[ruleName])) - .map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']) + .map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']), ), }, }); - }, {}) + }, {}), ); module.exports = plugin; diff --git a/lib/rules/consistent-output.js b/lib/rules/consistent-output.js index d4520504..b62ab7a2 100644 --- a/lib/rules/consistent-output.js +++ b/lib/rules/consistent-output.js @@ -45,11 +45,11 @@ module.exports = { Program(ast) { utils.getTestInfo(context, ast).forEach((testRun) => { const readableCases = testRun.invalid.filter( - (testCase) => testCase.type === 'ObjectExpression' + (testCase) => testCase.type === 'ObjectExpression', ); const casesWithoutOutput = readableCases.filter( (testCase) => - !testCase.properties.map(utils.getKeyName).includes('output') + !testCase.properties.map(utils.getKeyName).includes('output'), ); if ( diff --git a/lib/rules/fixer-return.js b/lib/rules/fixer-return.js index ac231d8f..038556d7 100644 --- a/lib/rules/fixer-return.js +++ b/lib/rules/fixer-return.js @@ -54,7 +54,7 @@ module.exports = { */ function ensureFunctionReturnedFix( node, - loc = (node.id || node).loc.start + loc = (node.id || node).loc.start, ) { if ( (node.generator && !funcInfo.hasYieldWithFixer) || // Generator function never yielded a fix @@ -102,7 +102,7 @@ module.exports = { const sourceCode = context.sourceCode || context.getSourceCode(); // TODO: just use context.sourceCode when dropping eslint < v9 contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, - ast + ast, ); }, diff --git a/lib/rules/meta-property-ordering.js b/lib/rules/meta-property-ordering.js index 4c19e146..50fe30f7 100644 --- a/lib/rules/meta-property-ordering.js +++ b/lib/rules/meta-property-ordering.js @@ -78,10 +78,10 @@ module.exports = { const knownProps = props .filter((prop) => orderMap.has(getKeyName(prop))) .sort( - (a, b) => orderMap.get(getKeyName(a)) - orderMap.get(getKeyName(b)) + (a, b) => orderMap.get(getKeyName(a)) - orderMap.get(getKeyName(b)), ); const unknownProps = props.filter( - (prop) => !orderMap.has(getKeyName(prop)) + (prop) => !orderMap.has(getKeyName(prop)), ); for (const violatingProp of violatingProps) { @@ -96,7 +96,7 @@ module.exports = { return props.map((prop, k) => { return fixer.replaceText( prop, - sourceCode.getText(expectedProps[k]) + sourceCode.getText(expectedProps[k]), ); }); }, diff --git a/lib/rules/no-deprecated-context-methods.js b/lib/rules/no-deprecated-context-methods.js index 3d68edbb..e72580ca 100644 --- a/lib/rules/no-deprecated-context-methods.js +++ b/lib/rules/no-deprecated-context-methods.js @@ -70,8 +70,8 @@ module.exports = { contextId.parent.property.type === 'Identifier' && Object.prototype.hasOwnProperty.call( DEPRECATED_PASSTHROUGHS, - contextId.parent.property.name - ) + contextId.parent.property.name, + ), ) .forEach((contextId) => context.report({ @@ -87,10 +87,10 @@ module.exports = { fixer.insertTextAfter(contextId, '.getSourceCode()'), fixer.replaceText( contextId.parent.property, - DEPRECATED_PASSTHROUGHS[contextId.parent.property.name] + DEPRECATED_PASSTHROUGHS[contextId.parent.property.name], ), ], - }) + }), ); }, }; diff --git a/lib/rules/no-deprecated-report-api.js b/lib/rules/no-deprecated-report-api.js index 59ff825d..266cb71d 100644 --- a/lib/rules/no-deprecated-report-api.js +++ b/lib/rules/no-deprecated-report-api.js @@ -41,7 +41,7 @@ module.exports = { Program(ast) { contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, - ast + ast, ); }, CallExpression(node) { @@ -70,9 +70,9 @@ module.exports = { [openingParen.range[1], closingParen.range[0]], `{${Object.keys(reportInfo) .map( - (key) => `${key}: ${sourceCode.getText(reportInfo[key])}` + (key) => `${key}: ${sourceCode.getText(reportInfo[key])}`, ) - .join(', ')}}` + .join(', ')}}`, ); }, }); diff --git a/lib/rules/no-identical-tests.js b/lib/rules/no-identical-tests.js index 429eb626..c0744fad 100644 --- a/lib/rules/no-identical-tests.js +++ b/lib/rules/no-identical-tests.js @@ -71,7 +71,7 @@ module.exports = { [ start.range[1], end.value === ',' ? end.range[1] : test.range[1], - ] + ], ); }, }); diff --git a/lib/rules/no-missing-message-ids.js b/lib/rules/no-missing-message-ids.js index 73d12dd9..1066b855 100644 --- a/lib/rules/no-missing-message-ids.js +++ b/lib/rules/no-missing-message-ids.js @@ -64,7 +64,7 @@ module.exports = { const reportMessagesAndDataArray = utils.collectReportViolationAndSuggestionData(reportInfo); for (const { messageId } of reportMessagesAndDataArray.filter( - (obj) => obj.messageId + (obj) => obj.messageId, )) { const values = messageId.type === 'Literal' @@ -81,7 +81,7 @@ module.exports = { val.value, ruleInfo, scopeManager, - scope + scope, ) ) // Couldn't find this messageId in `meta.messages`. diff --git a/lib/rules/no-missing-placeholders.js b/lib/rules/no-missing-placeholders.js index f505d4f4..d3994428 100644 --- a/lib/rules/no-missing-placeholders.js +++ b/lib/rules/no-missing-placeholders.js @@ -76,7 +76,7 @@ module.exports = { obj.messageId.value, ruleInfo, scopeManager, - scope + scope, ); if (correspondingMessage) { obj.message = correspondingMessage.value; @@ -105,13 +105,13 @@ module.exports = { while ( (match = PLACEHOLDER_MATCHER.exec( - message.value || messageStaticValue.value + message.value || messageStaticValue.value, )) ) { const matchingProperty = data && data.properties.find( - (prop) => utils.getKeyName(prop) === match[1] + (prop) => utils.getKeyName(prop) === match[1], ); if (!matchingProperty) { diff --git a/lib/rules/no-only-tests.js b/lib/rules/no-only-tests.js index fc016cc8..974f2ff7 100644 --- a/lib/rules/no-only-tests.js +++ b/lib/rules/no-only-tests.js @@ -40,7 +40,7 @@ module.exports = { property.key.type === 'Identifier' && property.key.name === 'only' && property.value.type === 'Literal' && - property.value.value + property.value.value, ); if (onlyProperty) { diff --git a/lib/rules/no-property-in-node.js b/lib/rules/no-property-in-node.js index f3e2e0c8..bd974af1 100644 --- a/lib/rules/no-property-in-node.js +++ b/lib/rules/no-property-in-node.js @@ -32,7 +32,7 @@ function isAstNodeType(type) { return (type.types || [type]) .filter((typePart) => typePart.getProperty('type')) .flatMap( - (typePart) => (typePart.symbol && typePart.symbol.declarations) || [] + (typePart) => (typePart.symbol && typePart.symbol.declarations) || [], ) .some((declaration) => { const fileName = declaration.getSourceFile().fileName; @@ -69,7 +69,7 @@ module.exports = { const services = (context.sourceCode || context).parserServices; if (!services.program) { throw new Error( - '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.' + '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.', ); } diff --git a/lib/rules/no-unused-message-ids.js b/lib/rules/no-unused-message-ids.js index 86840d15..978fad10 100644 --- a/lib/rules/no-unused-message-ids.js +++ b/lib/rules/no-unused-message-ids.js @@ -60,7 +60,7 @@ module.exports = { const scope = sourceCode.getScope?.(ast) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < 9.0.0 const messageIdNodesUnused = messageIdNodes.filter( - (node) => !messageIdsUsed.has(utils.getKeyName(node, scope)) + (node) => !messageIdsUsed.has(utils.getKeyName(node, scope)), ); // Report any messageIds that were never used. @@ -93,7 +93,7 @@ module.exports = { const reportMessagesAndDataArray = utils.collectReportViolationAndSuggestionData(reportInfo); for (const { messageId } of reportMessagesAndDataArray.filter( - (obj) => obj.messageId + (obj) => obj.messageId, )) { const values = messageId.type === 'Literal' diff --git a/lib/rules/no-unused-placeholders.js b/lib/rules/no-unused-placeholders.js index da116ceb..d6e7dc93 100644 --- a/lib/rules/no-unused-placeholders.js +++ b/lib/rules/no-unused-placeholders.js @@ -75,7 +75,7 @@ module.exports = { obj.messageId.value, ruleInfo, scopeManager, - scope + scope, ); if (correspondingMessage) { obj.message = correspondingMessage.value; @@ -85,7 +85,7 @@ module.exports = { } for (const { message, data } of reportMessagesAndDataArray.filter( - (obj) => obj.message + (obj) => obj.message, )) { const messageStaticValue = getStaticValue(message, scope); if ( @@ -105,7 +105,7 @@ module.exports = { PLACEHOLDER_MATCHER, (fullMatch, term) => { placeholdersInMessage.add(term); - } + }, ); data.properties.forEach((prop) => { diff --git a/lib/rules/no-useless-token-range.js b/lib/rules/no-useless-token-range.js index ea488190..998c0059 100644 --- a/lib/rules/no-useless-token-range.js +++ b/lib/rules/no-useless-token-range.js @@ -138,23 +138,23 @@ module.exports = { ((isStartAccess(identifier.parent.parent.parent) && identifier.parent.property.name === 'getFirstToken') || (isEndAccess(identifier.parent.parent.parent) && - identifier.parent.property.name === 'getLastToken')) + identifier.parent.property.name === 'getLastToken')), ) .forEach((identifier) => { const fullRangeAccess = isRangeAccess( - identifier.parent.parent.parent + identifier.parent.parent.parent, ) ? identifier.parent.parent.parent.parent : identifier.parent.parent.parent; const replacementText = sourceCode.text.slice( fullRangeAccess.range[0], - identifier.parent.parent.range[0] + identifier.parent.parent.range[0], ) + sourceCode.getText(identifier.parent.parent.arguments[0]) + sourceCode.text.slice( identifier.parent.parent.range[1], - fullRangeAccess.range[1] + fullRangeAccess.range[1], ); context.report({ node: identifier.parent.parent, @@ -163,7 +163,7 @@ module.exports = { fix(fixer) { return fixer.replaceText( identifier.parent.parent, - sourceCode.getText(identifier.parent.parent.arguments[0]) + sourceCode.getText(identifier.parent.parent.arguments[0]), ); }, }); diff --git a/lib/rules/prefer-message-ids.js b/lib/rules/prefer-message-ids.js index 48bf348a..4ee51006 100644 --- a/lib/rules/prefer-message-ids.js +++ b/lib/rules/prefer-message-ids.js @@ -46,7 +46,7 @@ module.exports = { const scope = sourceCode.getScope?.(ast) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < v9.0.0 contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, - ast + ast, ); const metaNode = ruleInfo.meta; @@ -54,7 +54,7 @@ module.exports = { metaNode && metaNode.properties && metaNode.properties.find( - (p) => p.type === 'Property' && utils.getKeyName(p) === 'messages' + (p) => p.type === 'Property' && utils.getKeyName(p) === 'messages', ); if (!messagesNode) { diff --git a/lib/rules/prefer-object-rule.js b/lib/rules/prefer-object-rule.js index 4cb11fcd..4a9351bf 100644 --- a/lib/rules/prefer-object-rule.js +++ b/lib/rules/prefer-object-rule.js @@ -57,7 +57,7 @@ module.exports = { ) { const openParenToken = sourceCode.getFirstToken( ruleInfo.create, - (token) => token.type === 'Punctuator' && token.value === '(' + (token) => token.type === 'Punctuator' && token.value === '(', ); /* istanbul ignore if */ @@ -68,7 +68,7 @@ module.exports = { yield fixer.replaceTextRange( [ruleInfo.create.range[0], openParenToken.range[0]], - '{create' + '{create', ); yield fixer.insertTextAfter(ruleInfo.create, '}'); } else if (ruleInfo.create.type === 'ArrowFunctionExpression') { diff --git a/lib/rules/prefer-output-null.js b/lib/rules/prefer-output-null.js index d58e4307..d9be111b 100644 --- a/lib/rules/prefer-output-null.js +++ b/lib/rules/prefer-output-null.js @@ -49,7 +49,7 @@ module.exports = { function getTestInfo(key) { if (test.type === 'ObjectExpression') { return test.properties.find( - (item) => item.type === 'Property' && item.key.name === key + (item) => item.type === 'Property' && item.key.name === key, ); } return null; diff --git a/lib/rules/prefer-placeholders.js b/lib/rules/prefer-placeholders.js index bd3457c3..4a5a7dfc 100644 --- a/lib/rules/prefer-placeholders.js +++ b/lib/rules/prefer-placeholders.js @@ -66,7 +66,7 @@ module.exports = { const variable = findVariable( scopeManager.acquire(messageNode) || scopeManager.globalScope, - messageNode + messageNode, ); if ( diff --git a/lib/rules/prefer-replace-text.js b/lib/rules/prefer-replace-text.js index a9517ed2..100c618c 100644 --- a/lib/rules/prefer-replace-text.js +++ b/lib/rules/prefer-replace-text.js @@ -43,7 +43,7 @@ module.exports = { Program(ast) { contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, - ast + ast, ); }, diff --git a/lib/rules/report-message-format.js b/lib/rules/report-message-format.js index d22d9cfa..d7f17a21 100644 --- a/lib/rules/report-message-format.js +++ b/lib/rules/report-message-format.js @@ -72,7 +72,7 @@ module.exports = { const scope = sourceCode.getScope?.(ast) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < v9.0.0 contextIdentifiers = utils.getContextIdentifiers( sourceCode.scopeManager, - ast + ast, ); const messagesObject = @@ -81,7 +81,7 @@ module.exports = { ruleInfo.meta.type === 'ObjectExpression' && ruleInfo.meta.properties.find( (prop) => - prop.type === 'Property' && utils.getKeyName(prop) === 'messages' + prop.type === 'Property' && utils.getKeyName(prop) === 'messages', ); if ( @@ -115,13 +115,13 @@ module.exports = { if (suggest && suggest.type === 'ArrayExpression') { suggest.elements .flatMap((obj) => - obj.type === 'ObjectExpression' ? obj.properties : [] + obj.type === 'ObjectExpression' ? obj.properties : [], ) .filter( (prop) => prop.type === 'Property' && prop.key.type === 'Identifier' && - prop.key.name === 'message' + prop.key.name === 'message', ) .map((prop) => prop.value) .forEach((it) => processMessageNode(it, scope)); diff --git a/lib/rules/require-meta-docs-description.js b/lib/rules/require-meta-docs-description.js index 3afd6d8d..55e4c082 100644 --- a/lib/rules/require-meta-docs-description.js +++ b/lib/rules/require-meta-docs-description.js @@ -70,7 +70,7 @@ module.exports = { .evaluateObjectProperties(docsNode && docsNode.value, scopeManager) .find( (p) => - p.type === 'Property' && utils.getKeyName(p) === 'description' + p.type === 'Property' && utils.getKeyName(p) === 'description', ); if (!descriptionNode) { diff --git a/lib/rules/require-meta-docs-url.js b/lib/rules/require-meta-docs-url.js index 8b6f25ac..37d49077 100644 --- a/lib/rules/require-meta-docs-url.js +++ b/lib/rules/require-meta-docs-url.js @@ -72,7 +72,7 @@ module.exports = { function isExpectedUrl(url) { return Boolean( typeof url === 'string' && - (expectedUrl === undefined || url === expectedUrl) + (expectedUrl === undefined || url === expectedUrl), ); } @@ -94,7 +94,7 @@ module.exports = { const urlPropNode = util .evaluateObjectProperties( docsPropNode && docsPropNode.value, - scopeManager + scopeManager, ) .find((p) => p.type === 'Property' && util.getKeyName(p) === 'url'); @@ -121,9 +121,9 @@ module.exports = { messageId: !urlPropNode ? 'missing' : // eslint-disable-next-line unicorn/no-nested-ternary,unicorn/no-negated-condition -- this is fine for now - !expectedUrl - ? 'wrongType' - : /* otherwise */ 'mismatch', + !expectedUrl + ? 'wrongType' + : /* otherwise */ 'mismatch', data: { expectedUrl, @@ -151,7 +151,7 @@ module.exports = { fixer, docsPropNode.value, `url: ${urlString}`, - sourceCode + sourceCode, ); } else if ( !docsPropNode && @@ -162,7 +162,7 @@ module.exports = { fixer, metaNode, `docs: {\nurl: ${urlString}\n}`, - sourceCode + sourceCode, ); } diff --git a/lib/rules/require-meta-has-suggestions.js b/lib/rules/require-meta-has-suggestions.js index 3166841e..323e138c 100644 --- a/lib/rules/require-meta-has-suggestions.js +++ b/lib/rules/require-meta-has-suggestions.js @@ -117,13 +117,13 @@ module.exports = { // If object is empty, just replace entire object. return fixer.replaceText( metaNode, - '{ hasSuggestions: true }' + '{ hasSuggestions: true }', ); } // Add new property to start of property list. return fixer.insertTextBefore( metaNode.properties[0], - 'hasSuggestions: true, ' + 'hasSuggestions: true, ', ); } }, @@ -144,7 +144,7 @@ module.exports = { ) { return fixer.replaceText( hasSuggestionsProperty.value, - 'true' + 'true', ); } }, diff --git a/lib/rules/require-meta-schema.js b/lib/rules/require-meta-schema.js index 30d24109..bbb6e00a 100644 --- a/lib/rules/require-meta-schema.js +++ b/lib/rules/require-meta-schema.js @@ -69,7 +69,7 @@ module.exports = { schemaNode = utils .evaluateObjectProperties(metaNode, scopeManager) .find( - (p) => p.type === 'Property' && utils.getKeyName(p) === 'schema' + (p) => p.type === 'Property' && utils.getKeyName(p) === 'schema', ); if (!schemaNode) { @@ -80,7 +80,7 @@ module.exports = { if (value.type === 'Identifier' && value.name !== 'undefined') { const variable = findVariable( scopeManager.acquire(value) || scopeManager.globalScope, - value + value, ); // If we can't find the declarator, we have to assume it's in correct type @@ -131,7 +131,7 @@ module.exports = { fixer, metaNode, 'schema: []', - sourceCode + sourceCode, ); }, }, diff --git a/lib/rules/test-case-property-ordering.js b/lib/rules/test-case-property-ordering.js index 5b8542c5..e0e5b50a 100644 --- a/lib/rules/test-case-property-ordering.js +++ b/lib/rules/test-case-property-ordering.js @@ -71,7 +71,7 @@ module.exports = { (current < lastChecked || lastChecked === -1) ) { let orderMsg = order.filter((item) => - keyNames.includes(item) + keyNames.includes(item), ); orderMsg = [ ...orderMsg, @@ -90,7 +90,7 @@ module.exports = { properties[keyNames.indexOf(key)]; return fixer.replaceText( properties[index], - sourceCode.getText(propertyToInsert) + sourceCode.getText(propertyToInsert), ); }); }, diff --git a/lib/rules/test-case-shorthand-strings.js b/lib/rules/test-case-shorthand-strings.js index 84b16e20..7a4da747 100644 --- a/lib/rules/test-case-shorthand-strings.js +++ b/lib/rules/test-case-shorthand-strings.js @@ -71,7 +71,7 @@ module.exports = { const isConsistent = new Set(caseInfoList.map((caseInfo) => caseInfo.shorthand)).size <= 1; const hasCaseNeedingLongform = caseInfoList.some( - (caseInfo) => caseInfo.needsLongform + (caseInfo) => caseInfo.needsLongform, ); caseInfoList @@ -85,7 +85,7 @@ module.exports = { : (caseInfo) => caseInfo.shorthand, 'consistent-as-needed': (caseInfo) => caseInfo.shorthand === hasCaseNeedingLongform, - }[shorthandOption] + }[shorthandOption], ) .forEach((badCaseInfo) => { context.report({ @@ -100,7 +100,7 @@ module.exports = { badCaseInfo.node, badCaseInfo.shorthand ? `{code: ${sourceCode.getText(badCaseInfo.node)}}` - : sourceCode.getText(badCaseInfo.node.properties[0].value) + : sourceCode.getText(badCaseInfo.node.properties[0].value), ); }, }); diff --git a/lib/utils.js b/lib/utils.js index 9a409a5b..bae2b891 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -143,7 +143,7 @@ function getRuleExportsESM(ast, scopeManager) { const nodes = statement.declaration.type === 'VariableDeclaration' ? statement.declaration.declarations.map( - (declarator) => declarator.init + (declarator) => declarator.init, ) : [statement.declaration]; @@ -151,7 +151,7 @@ function getRuleExportsESM(ast, scopeManager) { // skip if it's function-style to avoid false positives // refs: https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/450 possibleNodes.push( - ...nodes.filter((node) => node && !functionTypes.has(node.type)) + ...nodes.filter((node) => node && !functionTypes.has(node.type)), ); } break; @@ -164,7 +164,7 @@ function getRuleExportsESM(ast, scopeManager) { // Check `export default { create() {}, meta: {} }` return collectInterestingProperties( node.properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } else if (isFunctionRule(node)) { // Check `export default function(context) { return { ... }; }` @@ -173,7 +173,7 @@ function getRuleExportsESM(ast, scopeManager) { // Check `export default someTypeScriptHelper({ create() {}, meta: {} }); return collectInterestingProperties( node.arguments[0].properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } else if (node.type === 'Identifier') { // Rule could be stored in a variable before being exported. @@ -183,7 +183,7 @@ function getRuleExportsESM(ast, scopeManager) { // Check `const possibleRule = { ... }; export default possibleRule; return collectInterestingProperties( possibleRule.properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } else if (isFunctionRule(possibleRule)) { // Check `const possibleRule = function(context) { return { ... } }; export default possibleRule;` @@ -192,7 +192,7 @@ function getRuleExportsESM(ast, scopeManager) { // Check `const possibleRule = someTypeScriptHelper({ ... }); export default possibleRule; return collectInterestingProperties( possibleRule.arguments[0].properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } } @@ -231,7 +231,7 @@ function getRuleExportsCJS(ast, scopeManager) { return collectInterestingProperties( node.right.properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } else if (node.right.type === 'Identifier') { // Rule could be stored in a variable before being exported. @@ -241,7 +241,7 @@ function getRuleExportsCJS(ast, scopeManager) { // Check `const possibleRule = { ... }; module.exports = possibleRule; return collectInterestingProperties( possibleRule.properties, - INTERESTING_RULE_KEYS + INTERESTING_RULE_KEYS, ); } else if (isFunctionRule(possibleRule)) { // Check `const possibleRule = function(context) { return { ... } }; module.exports = possibleRule;` @@ -286,7 +286,7 @@ function getRuleExportsCJS(ast, scopeManager) { */ function findObjectPropertyValueByKeyName(obj, keyName) { const property = obj.properties.find( - (prop) => prop.key.type === 'Identifier' && prop.key.name === keyName + (prop) => prop.key.type === 'Identifier' && prop.key.name === keyName, ); return property ? property.value : undefined; } @@ -300,7 +300,7 @@ function findObjectPropertyValueByKeyName(obj, keyName) { function findVariableValue(node, scopeManager) { const variable = findVariable( scopeManager.acquire(node) || scopeManager.globalScope, - node + node, ); if (variable && variable.defs && variable.defs[0] && variable.defs[0].node) { if ( @@ -357,7 +357,7 @@ module.exports = { const createExists = Object.prototype.hasOwnProperty.call( exportNodes, - 'create' + 'create', ); if (!createExists) { return null; @@ -403,7 +403,7 @@ module.exports = { scopeManager .getDeclaredVariables(ruleInfo.create) .find((variable) => variable.name === ruleInfo.create.params[0].name) - .references.map((ref) => ref.identifier) + .references.map((ref) => ref.identifier), ); }, @@ -474,7 +474,7 @@ module.exports = { checkStatementsForTestInfo( context, statements, - variableIdentifiers = new Set() + variableIdentifiers = new Set(), ) { const sourceCode = context.sourceCode || context.getSourceCode(); // TODO: just use context.sourceCode when dropping eslint < v9 const runCalls = []; @@ -492,8 +492,8 @@ module.exports = { ...module.exports.checkStatementsForTestInfo( context, extracted, - variableIdentifiers - ) + variableIdentifiers, + ), ); if ( @@ -517,8 +517,8 @@ module.exports = { ...module.exports.checkStatementsForTestInfo( context, statement.body.body, - variableIdentifiers - ) + variableIdentifiers, + ), ); } @@ -532,8 +532,8 @@ module.exports = { ...module.exports.checkStatementsForTestInfo( context, body, - variableIdentifiers - ) + variableIdentifiers, + ), ); continue; @@ -555,8 +555,8 @@ module.exports = { ...module.exports.checkStatementsForTestInfo( context, extracted, - variableIdentifiers - ) + variableIdentifiers, + ), ); } @@ -583,22 +583,22 @@ module.exports = { getTestInfo(context, ast) { const runCalls = module.exports.checkStatementsForTestInfo( context, - ast.body + ast.body, ); return runCalls .filter( (call) => call.arguments.length >= 3 && - call.arguments[2].type === 'ObjectExpression' + call.arguments[2].type === 'ObjectExpression', ) .map((call) => call.arguments[2]) .map((run) => { const validProperty = run.properties.find( - (prop) => module.exports.getKeyName(prop) === 'valid' + (prop) => module.exports.getKeyName(prop) === 'valid', ); const invalidProperty = run.properties.find( - (prop) => module.exports.getKeyName(prop) === 'invalid' + (prop) => module.exports.getKeyName(prop) === 'invalid', ); return { @@ -673,7 +673,7 @@ module.exports = { return Object.fromEntries( keys .slice(0, reportArgs.length) - .map((key, index) => [key, reportArgs[index]]) + .map((key, index) => [key, reportArgs[index]]), ); }, @@ -697,13 +697,13 @@ module.exports = { identifier.parent === identifier.parent.parent.callee && identifier.parent.parent.parent.type === 'VariableDeclarator' && identifier.parent.parent === identifier.parent.parent.parent.init && - identifier.parent.parent.parent.id.type === 'Identifier' + identifier.parent.parent.parent.id.type === 'Identifier', ) .flatMap((identifier) => - scopeManager.getDeclaredVariables(identifier.parent.parent.parent) + scopeManager.getDeclaredVariables(identifier.parent.parent.parent), ) .flatMap((variable) => variable.references) - .map((ref) => ref.identifier) + .map((ref) => ref.identifier), ); }, @@ -720,7 +720,7 @@ module.exports = { } return fixer.insertTextAfter( sourceCode.getLastToken(node.properties.at(-1)), - `,\n${propertyText}` + `,\n${propertyText}`, ); }, @@ -748,7 +748,7 @@ module.exports = { return { messageId: findObjectPropertyValueByKeyName( suggestObjNode, - 'messageId' + 'messageId', ), message: findObjectPropertyValueByKeyName(suggestObjNode, 'desc'), // Note: suggestion message named `desc` data: findObjectPropertyValueByKeyName(suggestObjNode, 'data'), @@ -799,7 +799,7 @@ module.exports = { parent.parent.parent.parent.parent.type === 'ObjectExpression' && parent.parent.parent.parent.parent.parent.type === 'CallExpression' && contextIdentifiers.has( - parent.parent.parent.parent.parent.parent.callee.object + parent.parent.parent.parent.parent.parent.callee.object, ) && parent.parent.parent.parent.parent.parent.callee.property.name === 'report' && @@ -848,7 +848,7 @@ module.exports = { .evaluateObjectProperties(metaNode, scopeManager) .find( (p) => - p.type === 'Property' && module.exports.getKeyName(p) === 'messages' + p.type === 'Property' && module.exports.getKeyName(p) === 'messages', ); if (messagesNode) { @@ -890,7 +890,7 @@ module.exports = { .find( (p) => p.type === 'Property' && - module.exports.getKeyName(p, scope) === messageId + module.exports.getKeyName(p, scope) === messageId, ); }, @@ -903,7 +903,7 @@ module.exports = { findPossibleVariableValues(node, scopeManager) { const variable = findVariable( scopeManager.acquire(node) || scopeManager.globalScope, - node + node, ); return ((variable && variable.references) || []).flatMap((ref) => { if ( @@ -928,7 +928,7 @@ module.exports = { isVariableFromParameter(node, scopeManager) { const variable = findVariable( scopeManager.acquire(node) || scopeManager.globalScope, - node + node, ); return variable?.defs[0]?.type === 'Parameter'; diff --git a/package.json b/package.json index c0d63faf..91aa9770 100644 --- a/package.json +++ b/package.json @@ -50,40 +50,40 @@ "statements": 99 }, "devDependencies": { - "@commitlint/cli": "^17.1.2", - "@commitlint/config-conventional": "^17.1.0", + "@commitlint/cli": "^19.2.2", + "@commitlint/config-conventional": "^19.2.2", "@eslint/eslintrc": "^3.0.2", "@eslint/js": "^9.0.0", - "@release-it/conventional-changelog": "^4.3.0", - "@types/eslint": "^8.56.7", + "@release-it/conventional-changelog": "^8.0.1", + "@types/eslint": "^8.56.9", "@types/estree": "^1.0.5", - "@typescript-eslint/parser": "^7.5.0", - "@typescript-eslint/utils": "^7.5.0", - "chai": "^4.3.6", + "@typescript-eslint/parser": "^7.7.0", + "@typescript-eslint/utils": "^7.7.0", + "chai": "^4.4.1", "dirty-chai": "^2.0.1", "eslint": "^9.0.0", "eslint-config-not-an-aardvark": "^2.1.0", - "eslint-config-prettier": "^8.5.0", + "eslint-config-prettier": "^9.1.0", "eslint-doc-generator": "^1.7.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "file:./", - "eslint-plugin-markdown": "^3.0.0", - "eslint-plugin-n": "^17.0.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-markdown": "^4.0.1", + "eslint-plugin-n": "^17.2.1", + "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-unicorn": "^52.0.0", "eslint-remote-tester": "^3.0.1", "eslint-scope": "^8.0.1", "espree": "^10.0.1", "globals": "^15.0.0", - "husky": "^8.0.1", + "husky": "^9.0.11", "lodash": "^4.17.21", "markdownlint-cli": "^0.39.0", "mocha": "^10.4.0", "npm-package-json-lint": "^7.1.0", "npm-run-all2": "^6.1.2", "nyc": "^15.1.0", - "prettier": "^2.7.1", - "release-it": "^14.14.3", + "prettier": "^3.2.5", + "release-it": "^17.2.0", "typescript": "^5.4.3" }, "peerDependencies": { diff --git a/tests/lib/index.js b/tests/lib/index.js index db72f464..794d0d57 100644 --- a/tests/lib/index.js +++ b/tests/lib/index.js @@ -11,7 +11,7 @@ describe('exported plugin', () => { it(ruleName, () => { assert.match( plugin.rules[ruleName].meta.docs.url, - /^https:\/\/github.com\/eslint-community\/eslint-plugin-eslint-plugin\/tree\/HEAD\/docs\/rules\/[\w-]+\.md$/ + /^https:\/\/github.com\/eslint-community\/eslint-plugin-eslint-plugin\/tree\/HEAD\/docs\/rules\/[\w-]+\.md$/, ); }); }); diff --git a/tests/lib/rule-setup.js b/tests/lib/rule-setup.js index f1486cae..a1c75e82 100644 --- a/tests/lib/rule-setup.js +++ b/tests/lib/rule-setup.js @@ -16,7 +16,7 @@ describe('rule setup is correct', () => { RULE_NAMES, files .filter((file) => !file.startsWith('.')) - .map((file) => file.replace('.js', '')) + .map((file) => file.replace('.js', '')), ); }); @@ -28,7 +28,7 @@ describe('rule setup is correct', () => { const ALLOWED_CATEGORIES = ['Rules', 'Tests']; assert.ok( ALLOWED_CATEGORIES.includes(rule.meta.docs.category), - 'has an allowed category' + 'has an allowed category', ); }); @@ -39,13 +39,13 @@ describe('rule setup is correct', () => { '..', 'lib', 'rules', - `${ruleName}.js` + `${ruleName}.js`, ); const file = readFileSync(filePath, 'utf8'); assert.ok( file.includes("/** @type {import('eslint').Rule.RuleModule} */"), - 'includes jsdoc comment for rule type' + 'includes jsdoc comment for rule type', ); }); }); @@ -60,7 +60,7 @@ describe('rule setup is correct', () => { RULE_NAMES, files .filter((file) => !file.startsWith('.')) - .map((file) => file.replace('.js', '')) + .map((file) => file.replace('.js', '')), ); }); @@ -72,7 +72,7 @@ describe('rule setup is correct', () => { RULE_NAMES, files .filter((file) => !file.startsWith('.')) - .map((file) => file.replace('.md', '')) + .map((file) => file.replace('.md', '')), ); }); }); diff --git a/tests/lib/rules/no-missing-placeholders.js b/tests/lib/rules/no-missing-placeholders.js index 56e4cf6e..43bb137b 100644 --- a/tests/lib/rules/no-missing-placeholders.js +++ b/tests/lib/rules/no-missing-placeholders.js @@ -249,7 +249,7 @@ ruleTester.run('no-missing-placeholders', rule, { endLine: 6, column: 24, endColumn: 37, - } + }, ), ], }, @@ -329,7 +329,7 @@ ruleTester.run('no-missing-placeholders', rule, { endLine: 7, column: 21, endColumn: 39, - } + }, ), ], }, @@ -429,7 +429,7 @@ ruleTester.run('no-missing-placeholders', rule, { endLine: 7, column: 26, endColumn: 39, - } + }, ), ], }, diff --git a/tests/lib/rules/no-unused-placeholders.js b/tests/lib/rules/no-unused-placeholders.js index d61fd030..fd93b777 100644 --- a/tests/lib/rules/no-unused-placeholders.js +++ b/tests/lib/rules/no-unused-placeholders.js @@ -224,7 +224,7 @@ ruleTester.run('no-unused-placeholders', rule, { endLine: 7, column: 23, endColumn: 26, - } + }, ), ], }, diff --git a/tests/lib/rules/no-useless-token-range.js b/tests/lib/rules/no-useless-token-range.js index 52d216a5..c4b13960 100644 --- a/tests/lib/rules/no-useless-token-range.js +++ b/tests/lib/rules/no-useless-token-range.js @@ -75,7 +75,7 @@ const INVALID_CASES = [ Object.assign(invalidCase, { code: wrapRule(invalidCase.code), output: wrapRule(invalidCase.output), - }) + }), ); const ruleTester = new RuleTester({ diff --git a/tests/lib/rules/report-message-format.js b/tests/lib/rules/report-message-format.js index 155f4c46..7ca4cf10 100644 --- a/tests/lib/rules/report-message-format.js +++ b/tests/lib/rules/report-message-format.js @@ -327,7 +327,7 @@ ruleTester.run('report-message-format', rule, { }, ], }, - invalidCase + invalidCase, ); }), }); diff --git a/tests/lib/utils.js b/tests/lib/utils.js index eaf7a285..d299abcc 100644 --- a/tests/lib/utils.js +++ b/tests/lib/utils.js @@ -62,7 +62,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); assert.isNull( utils.getRuleInfo({ ast, scopeManager }), - 'Expected no rule to be found' + 'Expected no rule to be found', ); }); }); @@ -112,7 +112,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); assert.isNull( utils.getRuleInfo({ ast, scopeManager }), - 'Expected no rule to be found' + 'Expected no rule to be found', ); }); }); @@ -143,7 +143,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); assert.isNull( utils.getRuleInfo({ ast, scopeManager }), - 'Expected no rule to be found' + 'Expected no rule to be found', ); }); }); @@ -164,7 +164,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); assert.isNull( utils.getRuleInfo({ ast, scopeManager }), - 'Expected no rule to be found' + 'Expected no rule to be found', ); }); }); @@ -342,8 +342,8 @@ describe('utils', () => { assert( lodash.isMatch(ruleInfo, CASES[ruleSource]), `Expected \n${inspect(ruleInfo)}\nto match\n${inspect( - CASES[ruleSource] - )}` + CASES[ruleSource], + )}`, ); }); }); @@ -475,8 +475,8 @@ describe('utils', () => { assert( lodash.isMatch(ruleInfo, CASES[ruleSource]), `Expected \n${inspect(ruleInfo)}\nto match\n${inspect( - CASES[ruleSource] - )}` + CASES[ruleSource], + )}`, ); }); }); @@ -564,8 +564,8 @@ describe('utils', () => { assert( lodash.isMatch(ruleInfo, CASES[ruleSource]), `Expected \n${inspect(ruleInfo)}\nto match\n${inspect( - CASES[ruleSource] - )}` + CASES[ruleSource], + )}`, ); }); }); @@ -588,7 +588,7 @@ describe('utils', () => { const meta = {}; module.exports = { create, meta }; `, - { ecmaVersion: 6, range: true } + { ecmaVersion: 6, range: true }, ); const expected = { create: { type: 'ArrowFunctionExpression' }, @@ -600,7 +600,7 @@ describe('utils', () => { const ruleInfo = utils.getRuleInfo({ ast, scopeManager }); assert( lodash.isMatch(ruleInfo, expected), - `Expected \n${inspect(ruleInfo)}\nto match\n${inspect(expected)}` + `Expected \n${inspect(ruleInfo)}\nto match\n${inspect(expected)}`, ); }); } @@ -634,15 +634,15 @@ describe('utils', () => { it('does not throw with node type PropertyDefinition which is not handled by estraverse (estraverse is used for detecting the object return statement in a function-style rule).', () => { const ast = typescriptEslintParser.parse( testCase.source, - testCase.options + testCase.options, ); const scopeManager = eslintScope.analyze(ast); const ruleInfo = utils.getRuleInfo({ ast, scopeManager }); assert( lodash.isMatch(ruleInfo, testCase.expected), `Expected \n${inspect(ruleInfo)}\nto match\n${inspect( - testCase.expected - )}` + testCase.expected, + )}`, ); }); }); @@ -653,7 +653,7 @@ describe('utils', () => { describe('getContextIdentifiers', () => { const CASES = { 'module.exports = context => { context; context; context; return {}; }'( - ast + ast, ) { return [ ast.body[0].expression.right.body.body[0].expression, @@ -667,7 +667,7 @@ describe('utils', () => { ]; }, 'module.exports = { meta: {}, create(notContext) { notContext; notContext; notContext; } }'( - ast + ast, ) { return [ ast.body[0].expression.right.properties[1].value.body.body[0] @@ -679,7 +679,7 @@ describe('utils', () => { ]; }, 'const create = function(context) { context }; module.exports = { meta: {}, create };'( - ast + ast, ) { return [ast.body[0].declarations[0].init.body.body[0].expression]; }, @@ -698,12 +698,12 @@ describe('utils', () => { assert( identifiers instanceof Set, - 'getContextIdentifiers should return a Set' + 'getContextIdentifiers should return a Set', ); assert.strictEqual( identifiers.size, CASES[ruleSource](ast).length, - 'has the correct number of results' + 'has the correct number of results', ); [...identifiers].forEach((identifier, index) => { assert.strictEqual(identifier, CASES[ruleSource](ast)[index]); @@ -751,7 +751,7 @@ describe('utils', () => { // Object-style test case used when we need to specify additional information for this test case. assert.strictEqual( utils.getKeyName(caseInfo.getNode(ast), scopeManager.globalScope), - caseInfo.result + caseInfo.result, ); if ( @@ -760,16 +760,16 @@ describe('utils', () => { // Ensure the behavior is correct when `scope` is omitted from the parameters. assert.strictEqual( utils.getKeyName(caseInfo.getNode(ast)), - caseInfo.resultWithoutScope + caseInfo.resultWithoutScope, ); } } else { assert.strictEqual( utils.getKeyName( ast.body[0].expression.properties[0], - scopeManager.globalScope + scopeManager.globalScope, ), - caseInfo + caseInfo, ); } }); @@ -784,7 +784,7 @@ describe('utils', () => { assert.strictEqual( utils.getKeyName(ast.body[0].expression.properties[0]), - CASES_ES9[objectSource] + CASES_ES9[objectSource], ); }); }); @@ -824,7 +824,7 @@ describe('utils', () => { assert.deepEqual( utils.getTestInfo(context, ast), [], - 'Expected no tests to be found' + 'Expected no tests to be found', ); }); }); @@ -898,19 +898,19 @@ describe('utils', () => { assert.strictEqual( testInfo.length, 1, - 'Expected to find one test run' + 'Expected to find one test run', ); assert.strictEqual( testInfo[0].valid.length, CASES[testSource].valid, - `Expected ${CASES[testSource].valid} valid cases but got ${testInfo[0].valid.length}` + `Expected ${CASES[testSource].valid} valid cases but got ${testInfo[0].valid.length}`, ); assert.strictEqual( testInfo[0].invalid.length, CASES[testSource].invalid, - `Expected ${CASES[testSource].invalid} invalid cases but got ${testInfo[0].invalid.length}` + `Expected ${CASES[testSource].invalid} invalid cases but got ${testInfo[0].invalid.length}`, ); }); }); @@ -1098,7 +1098,7 @@ describe('utils', () => { assert.strictEqual( testInfo.length, CASES[testSource].length, - `Expected to find ${CASES[testSource].length} test runs but got ${testInfo.length}` + `Expected to find ${CASES[testSource].length} test runs but got ${testInfo.length}`, ); CASES[testSource].forEach((testRun, index) => { @@ -1107,14 +1107,14 @@ describe('utils', () => { testInfo[index].valid.length, `On run ${index + 1}, expected ${ testRun.valid - } valid cases but got ${testInfo[index].valid.length}` + } valid cases but got ${testInfo[index].valid.length}`, ); assert.strictEqual( testRun.invalid, testInfo[index].invalid.length, `On run ${index + 1}, expected ${ testRun.invalid - } valid cases but got ${testInfo[index].invalid.length}` + } valid cases but got ${testInfo[index].invalid.length}`, ); }); }); @@ -1211,7 +1211,7 @@ describe('utils', () => { assert.strictEqual( utils.getSourceCodeIdentifiers(scopeManager, ast).size, - CASES[testSource] + CASES[testSource], ); }); }); @@ -1364,8 +1364,8 @@ describe('utils', () => { assert( lodash.isMatch(data, testCase.shouldMatch), `Expected \n${inspect(data)}\nto match\n${inspect( - testCase.shouldMatch - )}` + testCase.shouldMatch, + )}`, ); } }); @@ -1482,7 +1482,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); const result = utils.evaluateObjectProperties( ast.body[0].declarations[0].init, - scopeManager + scopeManager, ); assert.deepEqual(result, ast.body[0].declarations[0].init.properties); }); @@ -1497,17 +1497,17 @@ describe('utils', () => { { ecmaVersion: 9, range: true, - } + }, ); const scopeManager = eslintScope.analyze(ast); const result = utils.evaluateObjectProperties( ast.body[2].declarations[0].init, - scopeManager + scopeManager, ); assert.deepEqual(result, [ ...ast.body[0].declarations[0].init.properties, // First spread properties ...ast.body[2].declarations[0].init.properties.filter( - (property) => property.type !== 'SpreadElement' + (property) => property.type !== 'SpreadElement', ), // Non-spread properties ...ast.body[1].declarations[0].init.properties, // Second spread properties ]); @@ -1521,7 +1521,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); const result = utils.evaluateObjectProperties( ast.body[1].declarations[0].init, - scopeManager + scopeManager, ); assert.deepEqual(result, []); }); @@ -1534,7 +1534,7 @@ describe('utils', () => { const scopeManager = eslintScope.analyze(ast); const result = utils.evaluateObjectProperties( ast.body[0].declarations[0].init, - scopeManager + scopeManager, ); assert.deepEqual(result, []); }); @@ -1598,7 +1598,7 @@ describe('utils', () => { const ruleInfo = utils.getRuleInfo({ ast, scopeManager }); assert.strictEqual( utils.getMessagesNode(ruleInfo, scopeManager), - testCase.getResult(ast) + testCase.getResult(ast), ); }); }); @@ -1646,7 +1646,7 @@ describe('utils', () => { const ruleInfo = utils.getRuleInfo({ ast, scopeManager }); assert.deepEqual( utils.getMessageIdNodes(ruleInfo, scopeManager), - testCase.getResult(ast) + testCase.getResult(ast), ); }); }); @@ -1662,7 +1662,7 @@ describe('utils', () => { 'foo', ruleInfo, scopeManager, - scopeManager.globalScope + scopeManager.globalScope, ); }, getResult(ast) { @@ -1677,7 +1677,7 @@ describe('utils', () => { 'bar', ruleInfo, scopeManager, - scopeManager.globalScope + scopeManager.globalScope, ); }, getResult() {}, // returns undefined @@ -1693,7 +1693,7 @@ describe('utils', () => { const ruleInfo = utils.getRuleInfo({ ast, scopeManager }); assert.strictEqual( testCase.run(ruleInfo, scopeManager), - testCase.getResult(ast) + testCase.getResult(ast), ); }); }); @@ -1720,14 +1720,14 @@ describe('utils', () => { assert.deepEqual( utils.findPossibleVariableValues( ast.body[0].declarations[0].id, - scopeManager + scopeManager, ), [ ast.body[0].declarations[0].init, ast.body[1].expression.right, ast.body[2].expression.right, ast.body[3].consequent.body[0].expression.right, - ] + ], ); }); }); @@ -1745,8 +1745,8 @@ describe('utils', () => { assert.ok( utils.isVariableFromParameter( ast.body[0].body.body[1].expression.arguments[0], - scopeManager - ) + scopeManager, + ), ); }); @@ -1761,8 +1761,8 @@ describe('utils', () => { assert.notOk( utils.isVariableFromParameter( ast.body[1].expression.arguments[0], - scopeManager - ) + scopeManager, + ), ); }); });