From d108a583045331cb21055950556354991b0ddbcb Mon Sep 17 00:00:00 2001 From: Sebastian Good <2230835+scagood@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:27:01 +0100 Subject: [PATCH] chore: npm run lint --- README.md | 3 ++- __tests__/index.js | 2 +- rules/always-return.js | 2 +- rules/no-multiple-resolved.js | 16 ++++++++-------- rules/no-nesting.js | 4 ++-- rules/no-new-statics.js | 2 +- rules/param-names.js | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 85d6f281..4397b24c 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,8 @@ or start with the recommended rule set: 🚫 Configurations disabled in.\ ✅ Set in the `flat/recommended` configuration.\ ✅ Set in the `recommended` configuration.\ -🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix). +🔧 Automatically fixable by the +[`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix). | Name                      | Description | 💼 | ⚠️ | 🚫 | 🔧 | | :------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | :-- | :-- | :-- | diff --git a/__tests__/index.js b/__tests__/index.js index 66198d9a..2107e886 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -7,7 +7,7 @@ test('can require index file', () => { test('rule set', () => { const plugin = require('../index') expect(plugin.configs.recommended.rules).toEqual( - plugin.configs['flat/recommended'].rules + plugin.configs['flat/recommended'].rules, ) expect(plugin.configs['flat/recommended'].plugins.promise).toBe(plugin) }) diff --git a/rules/always-return.js b/rules/always-return.js index be74b5c2..093ea33a 100644 --- a/rules/always-return.js +++ b/rules/always-return.js @@ -44,7 +44,7 @@ function isMemberCall(memberName, node) { /** @param {Node} node */ function isFirstArgument(node) { return Boolean( - node.parent && node.parent.arguments && node.parent.arguments[0] === node + node.parent && node.parent.arguments && node.parent.arguments[0] === node, ) } diff --git a/rules/no-multiple-resolved.js b/rules/no-multiple-resolved.js index 513290d5..37e1ab0a 100644 --- a/rules/no-multiple-resolved.js +++ b/rules/no-multiple-resolved.js @@ -177,12 +177,12 @@ class CodePathInfo { */ *iterateReports(promiseCodePathContext) { const targets = [...this.segmentInfos.values()].filter( - (info) => info.resolved + (info) => info.resolved, ) for (const segmentInfo of targets) { const result = this._getAlreadyResolvedData( segmentInfo.segment, - promiseCodePathContext + promiseCodePathContext, ) if (result) { yield { @@ -201,13 +201,13 @@ class CodePathInfo { */ _getAlreadyResolvedData(segment, promiseCodePathContext) { const prevSegments = segment.prevSegments.filter( - (prev) => !promiseCodePathContext.isResolvedTryBlockCodePathSegment(prev) + (prev) => !promiseCodePathContext.isResolvedTryBlockCodePathSegment(prev), ) if (prevSegments.length === 0) { return null } const prevSegmentInfos = prevSegments.map((prev) => - this._getProcessedSegmentInfo(prev, promiseCodePathContext) + this._getProcessedSegmentInfo(prev, promiseCodePathContext), ) if (prevSegmentInfos.every((info) => info.resolved)) { // If the previous paths are all resolved, the next path is also resolved. @@ -288,7 +288,7 @@ class CodePathInfo { const alreadyResolvedData = this._getAlreadyResolvedData( segment, - promiseCodePathContext + promiseCodePathContext, ) if (alreadyResolvedData) { if (alreadyResolvedData.kind === 'certain') { @@ -385,7 +385,7 @@ module.exports = { */ function verifyMultipleResolvedPath(codePathInfo, promiseCodePathContext) { for (const { node, resolved, kind } of codePathInfo.iterateReports( - promiseCodePathContext + promiseCodePathContext, )) { report(node, resolved, kind) } @@ -408,7 +408,7 @@ module.exports = { const resolverReferences = new Set() const resolvers = node.params.filter( /** @returns {node is Identifier} */ - (node) => node && node.type === 'Identifier' + (node) => node && node.type === 'Identifier', ) for (const resolver of resolvers) { const variable = getScope(context, node).set.get(resolver.name) @@ -440,7 +440,7 @@ module.exports = { }, /** @param {ThrowableExpression} node */ 'CallExpression, MemberExpression, NewExpression, ImportExpression, YieldExpression:exit'( - node + node, ) { lastThrowableExpression = node }, diff --git a/rules/no-nesting.js b/rules/no-nesting.js index ed9d08ae..2a95cdd7 100644 --- a/rules/no-nesting.js +++ b/rules/no-nesting.js @@ -99,13 +99,13 @@ module.exports = { // const closestCallbackScope = callbackScopes[0] for (const reference of iterateDefinedReferences( - closestCallbackScope + closestCallbackScope, )) { if ( node.arguments.some( (arg) => arg.range[0] <= reference.identifier.range[0] && - reference.identifier.range[1] <= arg.range[1] + reference.identifier.range[1] <= arg.range[1], ) ) { // Argument callbacks refer to variables defined in the callback function. diff --git a/rules/no-new-statics.js b/rules/no-new-statics.js index 890fab8f..c2483ce4 100644 --- a/rules/no-new-statics.js +++ b/rules/no-new-statics.js @@ -31,7 +31,7 @@ module.exports = { fix(fixer) { return fixer.replaceTextRange( [node.range[0], node.range[0] + 'new '.length], - '' + '', ) }, }) diff --git a/rules/param-names.js b/rules/param-names.js index c210d512..5d4500a6 100644 --- a/rules/param-names.js +++ b/rules/param-names.js @@ -34,7 +34,7 @@ module.exports = { const options = context.options[0] || {} const resolvePattern = new RegExp( options.resolvePattern || '^_?resolve$', - 'u' + 'u', ) const rejectPattern = new RegExp(options.rejectPattern || '^_?reject$', 'u')