Skip to content

Commit

Permalink
chore: npm run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
scagood committed Jul 24, 2024
1 parent 7e63f21 commit d108a58
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | 💼 | ⚠️ | 🚫 | 🔧 |
| :------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | :-- | :-- | :-- |
Expand Down
2 changes: 1 addition & 1 deletion __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
2 changes: 1 addition & 1 deletion rules/always-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}

Expand Down
16 changes: 8 additions & 8 deletions rules/no-multiple-resolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down Expand Up @@ -288,7 +288,7 @@ class CodePathInfo {

const alreadyResolvedData = this._getAlreadyResolvedData(
segment,
promiseCodePathContext
promiseCodePathContext,
)
if (alreadyResolvedData) {
if (alreadyResolvedData.kind === 'certain') {
Expand Down Expand Up @@ -385,7 +385,7 @@ module.exports = {
*/
function verifyMultipleResolvedPath(codePathInfo, promiseCodePathContext) {
for (const { node, resolved, kind } of codePathInfo.iterateReports(
promiseCodePathContext
promiseCodePathContext,
)) {
report(node, resolved, kind)
}
Expand All @@ -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)
Expand Down Expand Up @@ -440,7 +440,7 @@ module.exports = {
},
/** @param {ThrowableExpression} node */
'CallExpression, MemberExpression, NewExpression, ImportExpression, YieldExpression:exit'(
node
node,
) {
lastThrowableExpression = node
},
Expand Down
4 changes: 2 additions & 2 deletions rules/no-nesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion rules/no-new-statics.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
fix(fixer) {
return fixer.replaceTextRange(
[node.range[0], node.range[0] + 'new '.length],
''
'',
)
},
})
Expand Down
2 changes: 1 addition & 1 deletion rules/param-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit d108a58

Please sign in to comment.