Skip to content

Commit

Permalink
Fix some linting warnings (bluesky-social#2532)
Browse files Browse the repository at this point in the history
fix some linting warnings
  • Loading branch information
dholms authored Jun 10, 2024
1 parent 6e323fb commit 71e3edc
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion packages/api/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
} from './types'
import { BSKY_LABELER_DID } from './const'

const MAX_MOD_AUTHORITIES = 3
const MAX_LABELERS = 10
const REFRESH_SESSION = 'com.atproto.server.refreshSession'

Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/rich-text/detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export function detectFacets(text: UnicodeString): Facet[] | undefined {
{
const re = TAG_REGEX
while ((match = re.exec(text.utf16))) {
let [, leading, tag] = match
const leading = match[1]
let tag = match[2]

if (!tag) continue

Expand Down
1 change: 1 addition & 0 deletions packages/api/src/rich-text/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export const TRAILING_PUNCTUATION_REGEX = /\p{P}+$/gu
* `\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2` zero-width spaces (likely incomplete)
*/
export const TAG_REGEX =
// eslint-disable-next-line no-misleading-character-class
/(^|\s)[##]((?!\ufe0f)[^\s\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]*[^\d\s\p{P}\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]+[^\s\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]*)?/gu
11 changes: 7 additions & 4 deletions packages/api/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { TID } from '@atproto/common-web'
import { AppBskyActorDefs } from './client'

export function sanitizeMutedWordValue(value: string) {
return value
.trim()
.replace(/^#(?!\ufe0f)/, '')
.replace(/[\r\n\u00AD\u2060\u200D\u200C\u200B]+/, '')
return (
value
.trim()
.replace(/^#(?!\ufe0f)/, '')
// eslint-disable-next-line no-misleading-character-class
.replace(/[\r\n\u00AD\u2060\u200D\u200C\u200B]+/, '')
)
}

export function savedFeedsToUriArrays(
Expand Down
1 change: 0 additions & 1 deletion packages/api/tests/moderation-quoteposts.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
moderateProfile,
moderatePost,
mock,
ModerationOpts,
Expand Down
2 changes: 0 additions & 2 deletions packages/bsky/tests/label-hydration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import axios from 'axios'

describe('label hydration', () => {
let network: TestNetwork
let agent: AtpAgent
let pdsAgent: AtpAgent
let sc: SeedClient

Expand All @@ -17,7 +16,6 @@ describe('label hydration', () => {
network = await TestNetwork.create({
dbPostgresSchema: 'bsky_label_hydration',
})
agent = network.bsky.getClient()
pdsAgent = network.pds.getClient()
sc = network.getSeedClient()
await basicSeed(sc)
Expand Down
3 changes: 0 additions & 3 deletions packages/bsky/tests/query-labels.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { AtpAgent } from '@atproto/api'
import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
import axios from 'axios'

describe('label hydration', () => {
let network: TestNetwork
let agent: AtpAgent
let pdsAgent: AtpAgent
let sc: SeedClient

Expand All @@ -17,7 +15,6 @@ describe('label hydration', () => {
network = await TestNetwork.create({
dbPostgresSchema: 'bsky_label_hydration',
})
agent = network.bsky.getClient()
pdsAgent = network.pds.getClient()
sc = network.getSeedClient()
await basicSeed(sc)
Expand Down
3 changes: 0 additions & 3 deletions packages/ozone/tests/lang.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import {
TestNetwork,
basicSeed,
} from '@atproto/dev-env'
import AtpAgent from '@atproto/api'
import { REASONSPAM } from '../src/lexicon/types/com/atproto/moderation/defs'

describe('moderation status language tagging', () => {
let network: TestNetwork
let agent: AtpAgent
let sc: SeedClient
let modClient: ModeratorClient

Expand All @@ -21,7 +19,6 @@ describe('moderation status language tagging', () => {
blobDivertAdminPassword: 'test-auth-token',
},
})
agent = network.pds.getClient()
sc = network.getSeedClient()
modClient = network.ozone.getModClient()
await basicSeed(sc)
Expand Down
2 changes: 1 addition & 1 deletion packages/pds/tests/handle-validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('handle validation', () => {
const expectThrow = (handle: string, err: string) => {
expect(() => ensureHandleServiceConstraints(handle, domains)).toThrow(err)
}
const expectNotThrow = (handle: string, memo: string) => {
const expectNotThrow = (handle: string, _memo: string) => {
expect(() =>
ensureHandleServiceConstraints(handle, domains),
).not.toThrow()
Expand Down

0 comments on commit 71e3edc

Please sign in to comment.