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

chore(deps): update dependency @antfu/eslint-config to ^2.19.0 #2726

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion components/common/CommonTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const tabs = computed(() => {
})

function toValidName(option: string) {
return option.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
return option.toLowerCase().replace(/[^a-z0-9]/gi, '-')
}

useCommands(() => command
Expand Down
4 changes: 2 additions & 2 deletions components/publish/PublishWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ const characterCount = computed(() => {
let length = stringLength(text)

// taken from https://github.com/mastodon/mastodon/blob/07f8b4d1b19f734d04e69daeb4c3421ef9767aac/app/lib/text_formatter.rb
const linkRegex = /(https?:\/\/(www\.)?|xmpp:)\S+/g
const linkRegex = /(https?:\/\/|xmpp:)\S+/g

// taken from https://github.com/mastodon/mastodon/blob/af578e/app/javascript/mastodon/features/compose/util/counter.js
const countableMentionRegex = /(^|[^/\w])@(([a-z0-9_]+)@[a-z0-9.-]+[a-z0-9]+)/ig
const countableMentionRegex = /(^|[^/\w])@((\w+)@[a-z0-9.-]+[a-z0-9])/gi

// maximum of 23 chars per link
// https://github.com/elk-zone/elk/issues/1651
Expand Down
2 changes: 1 addition & 1 deletion components/user/UserSignIn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function handleInput() {

if (
isValidUrl(`https://${input}`)
&& input.match(/^[a-z0-9-]+(\.[a-z0-9-]+)+(:[0-9]+)?$/i)
&& input.match(/^[a-z0-9-]+(\.[a-z0-9-]+)+(:\d+)?$/i)
// Do not hide the autocomplete if a result has an exact substring match on the input
&& !filteredServers.value.some(s => s.includes(input))
)
Expand Down
13 changes: 7 additions & 6 deletions composables/content-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ContentParseOptions {
inReplyToStatus?: mastodon.v1.Status
}

const sanitizerBasicClasses = filterClasses(/^(h-\S*|p-\S*|u-\S*|dt-\S*|e-\S*|mention|hashtag|ellipsis|invisible)$/u)
const sanitizerBasicClasses = filterClasses(/^h-\S*|p-\S*|u-\S*|dt-\S*|e-\S*|mention|hashtag|ellipsis|invisible$/u)
const sanitizer = sanitize({
// Allow basic elements as seen in https://github.com/mastodon/mastodon/blob/17f79082b098e05b68d6f0d38fabb3ac121879a9/lib/sanitize_ext/sanitize_config.rb
br: {},
Expand Down Expand Up @@ -93,6 +93,7 @@ export function parseMastodonHTML(
if (markdown) {
// Handle code blocks
html = html
/* eslint-disable regexp/no-super-linear-backtracking, regexp/no-misleading-capturing-group */
.replace(/>(```|~~~)(\w*)([\s\S]+?)\1/g, (_1, _2, lang: string, raw: string) => {
const code = htmlToText(raw)
.replace(/</g, '&lt;')
Expand Down Expand Up @@ -191,7 +192,7 @@ export function recursiveTreeToText(input: Node): string {
return treeToText(input)
}

const emojiIdNeedsWrappingRE = /^(\d|\w|-|_)+$/
const emojiIdNeedsWrappingRE = /^([\w\-])+$/

export function treeToText(input: Node): string {
let pre = ''
Expand Down Expand Up @@ -417,7 +418,7 @@ function removeCustomEmoji(customEmojis: Record<string, mastodon.v1.CustomEmoji>
if (node.type !== TEXT_NODE)
return node

const split = node.value.split(/\s?:([\w-]+?):/g)
const split = node.value.split(/\s?:([\w-]+):/g)
if (split.length === 1)
return node

Expand All @@ -439,7 +440,7 @@ function replaceCustomEmoji(customEmojis: Record<string, mastodon.v1.CustomEmoji
if (node.type !== TEXT_NODE)
return node

const split = node.value.split(/:([\w-]+?):/g)
const split = node.value.split(/:([\w-]+):/g)
if (split.length === 1)
return node

Expand Down Expand Up @@ -484,9 +485,9 @@ const _markdownReplacements: [RegExp, (c: (string | Node)[]) => Node][] = [
[/\*\*(.*?)\*\*/g, c => h('b', null, c)],
[/\*(.*?)\*/g, c => h('em', null, c)],
[/~~(.*?)~~/g, c => h('del', null, c)],
[/`([^`]+?)`/g, c => h('code', null, c)],
[/`([^`]+)`/g, c => h('code', null, c)],
// transform @username@twitter.com as links
[/\B@([a-zA-Z0-9_]+)@twitter\.com\b/gi, c => h('a', { href: `https://twitter.com/${c}`, target: '_blank', rel: 'nofollow noopener noreferrer', class: 'mention external' }, `@${c}@twitter.com`)],
[/\B@(\w+)@twitter\.com\b/gi, c => h('a', { href: `https://twitter.com/${c}`, target: '_blank', rel: 'nofollow noopener noreferrer', class: 'mention external' }, `@${c}@twitter.com`)],
]

function _markdownProcess(value: string) {
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function getDisplayName(account: mastodon.v1.Account, options?: { rich?:
const displayName = account.displayName || account.username || account.acct || ''
if (options?.rich)
return displayName
return displayName.replace(/:([\w-]+?):/g, '')
return displayName.replace(/:([\w-]+):/g, '')
}

export function accountToShortHandle(acct: string) {
Expand Down
2 changes: 1 addition & 1 deletion composables/tiptap/custom-emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare module '@tiptap/core' {
}
}

const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/
const inputRegex = /(?:^|\s)(!\[(.+|:?)\]\((\S+)(?:\s+["'](\S+)["'])?\))$/

export const TiptapPluginCustomEmoji = Node.create<EmojiOptions>({
name: 'custom-emoji',
Expand Down
2 changes: 1 addition & 1 deletion constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE = 'elk-last-accessed-n
export const STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE = 'elk-last-accessed-explore-route'
export const STORAGE_KEY_BOTTOM_NAV_BUTTONS = 'elk-bottom-nav-buttons'

export const HANDLED_MASTO_URLS = /^(https?:\/\/)?([\w\d-]+\.)+\w+\/(@[@\w\d-\.]+)(\/objects)?(\/\d+)?$/
export const HANDLED_MASTO_URLS = /^(https?:\/\/)?([\w\-]+\.)+\w+\/(@[@\w\-.]+)(\/objects)?(\/\d+)?$/

export const NOTIFICATION_FILTER_TYPES: mastodon.v1.NotificationType[] = ['status', 'reblog', 'follow', 'follow_request', 'favourite', 'poll', 'update', 'admin.sign_up', 'admin.report']

Expand Down
2 changes: 1 addition & 1 deletion modules/purge-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
return

const s = new MagicString(code)
s.replace(/<!--(?:.*?)-->/sg, '')
s.replace(/<!--.*?-->/gs, '')
github-advanced-security[bot] marked this conversation as resolved.
Dismissed
Show resolved Hide resolved

if (s.hasChanged()) {
return {
Expand Down
2 changes: 1 addition & 1 deletion modules/pwa/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function createManifestTransform(base: string, appManifestFolder?: string): impo
})

if (appManifestFolder) {
const regExp = /(\/)?[0-9a-f]{8}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{12}\.json$/i
const regExp = /\/?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.json$/i
// we need to remove the revision from the sw prechaing manifest, UUID is enough:
// we don't use dontCacheBustURLsMatching, single regex
entries.filter(e => e && e.url.startsWith(appManifestFolder) && regExp.test(e.url)).forEach((e) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"ws": "^8.15.1"
},
"devDependencies": {
"@antfu/eslint-config": "^2.9.0",
"@antfu/eslint-config": "^2.19.0",
"@antfu/ni": "^0.21.12",
"@types/chroma-js": "^2.4.4",
"@types/file-saver": "^2.0.7",
Expand Down
2 changes: 1 addition & 1 deletion plugins/setup-head-script.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineNuxtPlugin(() => {
if (settings.themeColors) {
Object.entries(settings.themeColors).map(i => html.style.setProperty(i[0], i[1]))
}
})()`.trim().replace(/\s*\n+\s*/g, ';'),
})()`.trim().replace(/\s*\n\s*/g, ';'),
},
],
})
Expand Down
Loading
Loading