Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint & fix #1808

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/paidAction/zap.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export async function onPaid ({ invoice, actIds }, { tx }) {
}
})
acts = await tx.itemAct.findMany({ where: { invoiceId: invoice.id }, include: { item: true } })
actIds = acts.map(act => act.id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code?

} else if (actIds) {
acts = await tx.itemAct.findMany({ where: { id: { in: actIds } }, include: { item: true } })
} else {
Expand Down
2 changes: 1 addition & 1 deletion components/file-upload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, useCallback, forwardRef, useRef } from 'react'
import { useCallback, forwardRef, useRef } from 'react'
import { UPLOAD_TYPES_ALLOW, MEDIA_URL } from '@/lib/constants'
import { useToast } from './toast'
import gql from 'graphql-tag'
Expand Down
2 changes: 1 addition & 1 deletion components/hidden-wallet-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function HiddenWalletSummary ({ abbreviate, fixedWidth }) {

return (
<span
className='text-monospace' style={{ whiteSpace: 'pre-wrap' }} align='right' onPointerEnter={() => setHover(true)} onPointerLeave={() => setHover(false)}
className='text-monospace' style={{ whiteSpace: 'pre-wrap', textAlign: 'right' }} onPointerEnter={() => setHover(true)} onPointerLeave={() => setHover(false)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably how it was intended, but this entire file looks like it is not being used anymore

>
{hover ? (abbreviate ? fixedWidthAbbrSats : numWithUnits(me.privates?.sats, { abbreviate: false, format: true })) : '******'}
</span>
Expand Down
4 changes: 2 additions & 2 deletions components/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export default function Invoice ({
return <QrSkeleton {...props} />
}

let variant = 'default'
let status = 'waiting for you'
let variant
let status
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other defaults are set in the else block

let sats = invoice.satsRequested
if (invoice.forwardedSats) {
if (invoice.actionType === 'RECEIVE') {
Expand Down
2 changes: 1 addition & 1 deletion components/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Item, { ItemSkeleton } from './item'
import ItemJob from './item-job'
import styles from './items.module.css'
import MoreFooter from './more-footer'
import { Fragment, useCallback, useMemo } from 'react'
import { useCallback, useMemo } from 'react'
import { CommentFlat } from './comment'
import { SUB_ITEMS } from '@/fragments/subs'
import { LIMIT } from '@/lib/cursor'
Expand Down
2 changes: 1 addition & 1 deletion components/log-message.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { timeSince } from '@/lib/time'
import styles from '@/styles/log.module.css'
import { Fragment, useState } from 'react'
import { useState } from 'react'

export default function LogMessage ({ showWallet, wallet, level, message, context, ts }) {
const [show, setShow] = useState(false)
Expand Down
12 changes: 6 additions & 6 deletions components/price.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export default function Price ({ className }) {
if (selection === 'yep') {
if (!price || price < 0) return null
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
{fixedDecimal(100000000 / price, 0) + ` sats/${fiatSymbol}`}
</div>
)
}

if (selection === '1btc') {
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
1sat=1sat
</div>
)
Expand All @@ -73,7 +73,7 @@ export default function Price ({ className }) {
if (selection === 'blockHeight') {
if (blockHeight <= 0) return null
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
{blockHeight}
</div>
)
Expand All @@ -82,7 +82,7 @@ export default function Price ({ className }) {
if (selection === 'halving') {
if (!halving) return null
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
<CompactLongCountdown date={halving} />
</div>
)
Expand All @@ -91,7 +91,7 @@ export default function Price ({ className }) {
if (selection === 'chainFee') {
if (chainFee <= 0) return null
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
{chainFee} sat/vB
</div>
)
Expand All @@ -100,7 +100,7 @@ export default function Price ({ className }) {
if (selection === 'fiat') {
if (!price || price < 0) return null
return (
<div className={compClassName} onClick={handleClick} variant='link'>
<div className={compClassName} onClick={handleClick}>
{fiatSymbol + fixedDecimal(price, 0)}
</div>
)
Expand Down
1 change: 0 additions & 1 deletion components/use-crossposter.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ export default function useCrossposter () {
const result = await nostr.crosspost(event, { relays: failedRelays || relays })

if (result.error) {
failedRelays = []
throw new Error(result.error)
}

Expand Down
66 changes: 66 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import pluginReact from 'eslint-plugin-react'
import sonarjs from 'eslint-plugin-sonarjs'
import pluginPromise from 'eslint-plugin-promise'

export default [
{
files: ['**/*.{js,mjs,cjs,jsx}']
},
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
sonarjs.configs.recommended,
pluginPromise.configs['flat/recommended'],
{
rules: {
'no-unused-vars': 'off',
'no-console': 'off',
eqeqeq: 'error',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'no-empty': 'off',
'react/no-unescaped-entities': 'off',
'react/display-name': 'off',
'sonarjs/cognitive-complexity': 'off',
'sonarjs/no-ignored-exceptions': 'off',
'sonarjs/todo-tag': 'warn',
'sonarjs/no-nested-conditional': 'off',
'sonarjs/no-nested-template-literals': 'off',
'sonarjs/no-small-switch': 'off',
'sonarjs/regex-complexity': 'off',
'sonarjs/no-clear-text-protocols': 'off',
'sonarjs/x-powered-by': 'off',
'sonarjs/no-inverted-boolean-check': 'off',
'sonarjs/pseudo-random': 'warn',
'sonarjs/public-static-readonly': 'off',
'sonarjs/table-header': 'off',
'sonarjs/no-invariant-returns': 'off',
'sonarjs/no-os-command-from-path': 'off',
'sonarjs/concise-regex': 'off',
'sonarjs/duplicates-in-character-class': 'off',
'sonarjs/updated-loop-counter': 'off',
'sonarjs/no-nested-functions': 'off',
'sonarjs/single-character-alternation': 'off',
'sonarjs/no-nested-assignment': 'off',
'sonarjs/no-redundant-assignments': 'off',
'sonarjs/single-char-in-character-classes': 'off',
'sonarjs/slow-regex': 'off',
'sonarjs/anchor-precedence': 'off',
'promise/always-return': 'off',
'promise/no-nesting': 'off',
'promise/catch-or-return': 'off',
'sonarjs/no-identical-functions': 'warn'
}
},
{
ignores: ['.next/*', '**/*.spec.js', 'node_modules/*', 'sw/**', 'public']
},
{
linterOptions: {
reportUnusedDisableDirectives: 'off'
}
}

]
Loading
Loading