lint: Recognize more JavaScript file extensions.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-11-09 22:02:11 -08:00 committed by Anders Kaseorg
parent b020d5e2e8
commit efd7c06e30
4 changed files with 355 additions and 353 deletions

View File

@ -1,352 +1,350 @@
import { defineConfig } from 'astro/config'; import starlight from "@astrojs/starlight";
import starlight from '@astrojs/starlight'; import {defineConfig} from "astro/config";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
base: 'help-beta', base: "help-beta",
integrations: [ integrations: [
starlight({ starlight({
title: 'Zulip help center', title: "Zulip help center",
pagination: false, pagination: false,
customCss: [ customCss: ["./src/styles/main.css"],
'./src/styles/main.css' sidebar: [
], {
sidebar: [ label: "Zulip homepage",
{ link: "https://zulip.com",
label: 'Zulip homepage', },
link: 'https://zulip.com' {
}, label: "Help center home",
{ slug: "index",
label: 'Help center home', },
slug: 'index' {
}, label: "Guides",
{ items: [
label: 'Guides', "getting-started-with-zulip",
items: [ "trying-out-zulip",
'getting-started-with-zulip', "zulip-cloud-or-self-hosting",
'trying-out-zulip', "moving-to-zulip",
'zulip-cloud-or-self-hosting', "moderating-open-organizations",
'moving-to-zulip', "setting-up-zulip-for-a-class",
'moderating-open-organizations', "using-zulip-for-a-class",
'setting-up-zulip-for-a-class', "using-zulip-via-email",
'using-zulip-for-a-class', ],
'using-zulip-via-email' },
] {
}, label: "Getting started",
{ items: [
label: 'Getting started', "join-a-zulip-organization",
items: [ "set-up-your-account",
'join-a-zulip-organization', "introduction-to-topics",
'set-up-your-account', {
'introduction-to-topics', label: "Starting a new topic",
{ link: "/introduction-to-topics#how-to-start-a-new-topic",
label: 'Starting a new topic', },
link: '/introduction-to-topics#how-to-start-a-new-topic' "finding-a-conversation-to-read",
}, "reading-conversations",
'finding-a-conversation-to-read', "starting-a-new-direct-message",
'reading-conversations', "replying-to-messages",
'starting-a-new-direct-message', "messaging-tips",
'replying-to-messages', "keyboard-shortcuts",
'messaging-tips', ],
'keyboard-shortcuts' },
] {
}, label: "Setting up your organization",
{ items: [
label: 'Setting up your organization', "migrating-from-other-chat-tools",
items: [ "create-your-organization-profile",
'migrating-from-other-chat-tools', "customize-organization-settings",
'create-your-organization-profile', "create-channels",
'customize-organization-settings', "customize-settings-for-new-users",
'create-channels', "invite-users-to-join",
'customize-settings-for-new-users', "create-user-groups",
'invite-users-to-join', "set-up-integrations",
'create-user-groups', ],
'set-up-integrations' },
] {
}, label: "Account basics",
{ items: [
label: 'Account basics', "edit-your-profile",
items: [ "change-your-name",
'edit-your-profile', "change-your-email-address",
'change-your-name', "change-your-profile-picture",
'change-your-email-address', "change-your-password",
'change-your-profile-picture', "configure-email-visibility",
'change-your-password', "logging-in",
'configure-email-visibility', "logging-out",
'logging-in', "switching-between-organizations",
'logging-out', "import-your-settings",
'switching-between-organizations', "review-your-settings",
'import-your-settings', "deactivate-your-account",
'review-your-settings', ],
'deactivate-your-account' },
] {
}, label: "Preferences",
{ items: [
label: 'Preferences', "dark-theme",
items: [ "font-size",
'dark-theme', "change-your-language",
'font-size', "change-your-timezone",
'change-your-language', "change-the-time-format",
'change-your-timezone', "configure-emoticon-translations",
'change-the-time-format', "configure-home-view",
'configure-emoticon-translations', "enable-full-width-display",
'configure-home-view', "manage-your-uploaded-files",
'enable-full-width-display', ],
'manage-your-uploaded-files' },
] {
}, label: "Writing messages",
{ items: [
label: 'Writing messages', "format-your-message-using-markdown",
items: [ "mention-a-user-or-group",
'format-your-message-using-markdown', "link-to-a-message-or-conversation",
'mention-a-user-or-group', "format-a-quote",
'link-to-a-message-or-conversation', "quote-and-reply",
'format-a-quote', "emoji-and-emoticons",
'quote-and-reply', "insert-a-link",
'emoji-and-emoticons', "share-and-upload-files",
'insert-a-link', "animated-gifs-from-giphy",
'share-and-upload-files', "text-emphasis",
'animated-gifs-from-giphy', "paragraph-and-section-formatting",
'text-emphasis', "bulleted-lists",
'paragraph-and-section-formatting', "numbered-lists",
'bulleted-lists', "tables",
'numbered-lists', "code-blocks",
'tables', "latex",
'code-blocks', "spoilers",
'latex', "me-action-messages",
'spoilers', "create-a-poll",
'me-action-messages', "collaborative-to-do-lists",
'create-a-poll', "global-times",
'collaborative-to-do-lists', "start-a-call",
'global-times', ],
'start-a-call' },
] {
}, label: "Sending messages",
{ items: [
label: 'Sending messages', "open-the-compose-box",
items: [ "mastering-the-compose-box",
'open-the-compose-box', "resize-the-compose-box",
'mastering-the-compose-box', "typing-notifications",
'resize-the-compose-box', "preview-your-message-before-sending",
'typing-notifications', "verify-your-message-was-successfully-sent",
'preview-your-message-before-sending', "edit-a-message",
'verify-your-message-was-successfully-sent', "delete-a-message",
'edit-a-message', "view-and-edit-your-message-drafts",
'delete-a-message', "schedule-a-message",
'view-and-edit-your-message-drafts', "message-a-channel-by-email",
'schedule-a-message', ],
'message-a-channel-by-email' },
] {
}, label: "Reading messages",
{ items: [
label: 'Reading messages', "reading-strategies",
items: [ "inbox",
'reading-strategies', "recent-conversations",
'inbox', "combined-feed",
'recent-conversations', "channel-feed",
'combined-feed', "left-sidebar",
'channel-feed', "message-actions",
'left-sidebar', "marking-messages-as-read",
'message-actions', "marking-messages-as-unread",
'marking-messages-as-read', "configure-unread-message-counters",
'marking-messages-as-unread', "emoji-reactions",
'configure-unread-message-counters', "view-your-mentions",
'emoji-reactions', "star-a-message",
'view-your-mentions', "view-images-and-videos",
'star-a-message', "view-messages-sent-by-a-user",
'view-images-and-videos', "link-to-a-message-or-conversation",
'view-messages-sent-by-a-user', "search-for-messages",
'link-to-a-message-or-conversation', "printing-messages",
'search-for-messages', "view-the-markdown-source-of-a-message",
'printing-messages', "view-the-exact-time-a-message-was-sent",
'view-the-markdown-source-of-a-message', "view-a-messages-edit-history",
'view-the-exact-time-a-message-was-sent', "collapse-a-message",
'view-a-messages-edit-history', "read-receipts",
'collapse-a-message', ],
'read-receipts' },
] {
}, label: "People",
{ items: [
label: 'People', "user-list",
items: [ "status-and-availability",
'user-list', "user-cards",
'status-and-availability', "view-someones-profile",
'user-cards', "direct-messages",
'view-someones-profile', "user-groups",
'direct-messages', "find-administrators",
'user-groups', ],
'find-administrators', },
] {
}, label: "Channels",
{ items: [
label: 'Channels', "introduction-to-channels",
items: [ "create-a-channel",
'introduction-to-channels', "pin-a-channel",
'create-a-channel', "change-the-color-of-a-channel",
'pin-a-channel', "unsubscribe-from-a-channel",
'change-the-color-of-a-channel', "manage-inactive-channels",
'unsubscribe-from-a-channel', "move-content-to-another-channel",
'manage-inactive-channels', "view-channel-subscribers",
'move-content-to-another-channel', ],
'view-channel-subscribers', },
] {
}, label: "Topics",
{ items: [
label: 'Topics', "introduction-to-topics",
items: [ "rename-a-topic",
'introduction-to-topics', "resolve-a-topic",
'rename-a-topic', "move-content-to-another-topic",
'resolve-a-topic', "delete-a-topic",
'move-content-to-another-topic', ],
'delete-a-topic', },
] {
}, label: "Notifications",
{ items: [
label: 'Notifications', "channel-notifications",
items: [ "topic-notifications",
'channel-notifications', "follow-a-topic",
'topic-notifications', "dm-mention-alert-notifications",
'follow-a-topic', "mute-a-channel",
'dm-mention-alert-notifications', "mute-a-topic",
'mute-a-channel', "mute-a-user",
'mute-a-topic', "email-notifications",
'mute-a-user', "desktop-notifications",
'email-notifications', "mobile-notifications",
'desktop-notifications', "do-not-disturb",
'mobile-notifications', ],
'do-not-disturb', },
] {
}, label: "Apps",
{ items: [
label: 'Apps', {
items: [ label: "Download apps for every platform",
{ link: "https://zulip.com/apps/",
'label': 'Download apps for every platform', },
link: 'https://zulip.com/apps/' "desktop-app-install-guide",
}, "supported-browsers",
'desktop-app-install-guide', "configure-how-links-open",
'supported-browsers', "connect-through-a-proxy",
'configure-how-links-open', "custom-certificates",
'connect-through-a-proxy', ],
'custom-certificates', },
] {
}, label: "Zulip Administration",
{ link: "#",
label: 'Zulip Administration', attrs: {
link: '#', class: "non-clickable-sidebar-heading",
attrs: { },
class: 'non-clickable-sidebar-heading' },
} {
}, label: "Organization basics",
{ items: [
label: 'Organization basics', "review-your-organization-settings",
items: [ "organization-type",
'review-your-organization-settings', "communities-directory",
'organization-type', "import-from-mattermost",
'communities-directory', "import-from-slack",
'import-from-mattermost', "import-from-rocketchat",
'import-from-slack', "configure-authentication-methods",
'import-from-rocketchat', "saml-authentication",
'configure-authentication-methods', "scim",
'saml-authentication', "export-your-organization",
'scim', "change-organization-url",
'export-your-organization', "deactivate-your-organization",
'change-organization-url', "analytics",
'deactivate-your-organization', "linking-to-zulip",
'analytics', "gdpr-compliance",
'linking-to-zulip', ],
'gdpr-compliance', },
] {
}, label: "Users",
{ items: [
label: 'Users', "roles-and-permissions",
items: [ "invite-new-users",
'roles-and-permissions', "restrict-account-creation",
'invite-new-users', "guest-users",
'restrict-account-creation', "manage-a-user",
'guest-users', "deactivate-or-reactivate-a-user",
'manage-a-user', "custom-profile-fields",
'deactivate-or-reactivate-a-user', "configure-default-new-user-settings",
'custom-profile-fields', "configure-organization-language",
'configure-default-new-user-settings', "manage-user-groups",
'configure-organization-language', "change-a-users-role",
'manage-user-groups', "change-a-users-name",
'change-a-users-role', "manage-user-channel-subscriptions",
'change-a-users-name', "restrict-name-and-email-changes",
'manage-user-channel-subscriptions', "restrict-profile-picture-changes",
'restrict-name-and-email-changes', "restrict-permissions-of-new-members",
'restrict-profile-picture-changes', ],
'restrict-permissions-of-new-members', },
] {
}, label: "Channel Management",
{ items: [
label: 'Channel Management', "create-a-channel",
items: [ "channel-permissions",
'create-a-channel', "public-access-option",
'channel-permissions', "channel-posting-policy",
'public-access-option', "configure-who-can-create-channels",
'channel-posting-policy', "configure-who-can-invite-to-channels",
'configure-who-can-create-channels', "add-or-remove-users-from-a-channel",
'configure-who-can-invite-to-channels', "set-default-channels-for-new-users",
'add-or-remove-users-from-a-channel', "rename-a-channel",
'set-default-channels-for-new-users', "change-the-channel-description",
'rename-a-channel', "change-the-privacy-of-a-channel",
'change-the-channel-description', "archive-a-channel",
'change-the-privacy-of-a-channel', ],
'archive-a-channel', },
] {
}, label: "Organization Settings",
{ items: [
label: 'Organization Settings', "custom-emoji",
items: [ "add-a-custom-linkifier",
'custom-emoji', "require-topics",
'add-a-custom-linkifier', "restrict-direct-messages",
'require-topics', "restrict-wildcard-mentions",
'restrict-direct-messages', "restrict-moving-messages",
'restrict-wildcard-mentions', "restrict-message-editing-and-deletion",
'restrict-moving-messages', "disable-message-edit-history",
'restrict-message-editing-and-deletion', "allow-image-link-previews",
'disable-message-edit-history', "hide-message-content-in-emails",
'allow-image-link-previews', "message-retention-policy",
'hide-message-content-in-emails', "digest-emails",
'message-retention-policy', "disable-welcome-emails",
'digest-emails', "configure-automated-notices",
'disable-welcome-emails', "configure-multi-language-search",
'configure-automated-notices', ],
'configure-multi-language-search', },
] {
}, label: "Bots & Integrations",
{ items: [
label: 'Bots & Integrations', "bots-overview",
items: [ "integrations-overview",
'bots-overview', "add-a-bot-or-integration",
'integrations-overview', "generate-integration-url",
'add-a-bot-or-integration', "edit-a-bot",
'generate-integration-url', "deactivate-or-reactivate-a-bot",
'edit-a-bot', "request-an-integration",
'deactivate-or-reactivate-a-bot', "restrict-bot-creation",
'request-an-integration', "view-your-bots",
'restrict-bot-creation', "view-all-bots-in-your-organization",
'view-your-bots', ],
'view-all-bots-in-your-organization', },
] {
}, label: "Support",
{ items: [
label: 'Support', "view-zulip-version",
items: [ "zulip-cloud-billing",
'view-zulip-version', "self-hosted-billing",
'zulip-cloud-billing', "support-zulip-project",
'self-hosted-billing', "linking-to-zulip-website",
'support-zulip-project', "contact-support",
'linking-to-zulip-website', ],
'contact-support', },
] {
}, label: "◀ Back to Zulip",
{ link: "../",
label: '◀ Back to Zulip', },
link: '../', ],
} }),
] ],
}),
],
}); });

View File

@ -56,11 +56,15 @@ def run() -> None:
"yml", "yml",
], ],
"frontend": [ "frontend": [
"cjs",
"css", "css",
"cts",
"flow", "flow",
"hbs", "hbs",
"html", "html",
"js", "js",
"mjs",
"mts",
"ts", "ts",
], ],
}, },
@ -76,8 +80,8 @@ def run() -> None:
) )
linter_config.external_linter( linter_config.external_linter(
"eslint", "eslint",
["node_modules/.bin/eslint", "--max-warnings=0", "--cache", "--ext", ".js,.ts"], ["node_modules/.bin/eslint", "--max-warnings=0", "--cache"],
["js", "ts"], ["cjs", "cts", "js", "mjs", "mts", "ts"],
fix_arg="--fix", fix_arg="--fix",
description="Standard JavaScript style and formatting linter (config: .eslintrc).", description="Standard JavaScript style and formatting linter (config: .eslintrc).",
) )
@ -162,7 +166,7 @@ def run() -> None:
linter_config.external_linter( linter_config.external_linter(
"prettier", "prettier",
["node_modules/.bin/prettier", "--cache", "--check", "--log-level=warn"], ["node_modules/.bin/prettier", "--cache", "--check", "--log-level=warn"],
["css", "flow", "js", "json", "md", "ts", "yaml", "yml"], ["cjs", "css", "cts", "flow", "js", "json", "md", "mjs", "mts", "ts", "yaml", "yml"],
fix_arg=["--write"], fix_arg=["--write"],
description="Formats CSS, JavaScript, YAML", description="Formats CSS, JavaScript, YAML",
) )

View File

@ -32,7 +32,7 @@ Object.defineProperty(global, "navigator", {
}); });
require("@babel/register")({ require("@babel/register")({
extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"], extensions: [".cjs", ".cts", ".js", ".mjs", ".mts", ".ts"],
only: [ only: [
new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../shared/src") + path.sep)), new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../shared/src") + path.sep)),
new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../src") + path.sep)), new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../src") + path.sep)),

View File

@ -117,7 +117,7 @@ const config = (
}, },
// Transpile .js and .ts files with Babel // Transpile .js and .ts files with Babel
{ {
test: /\.(js|ts)$/, test: /\.[cm]?[jt]s$/,
include: [ include: [
path.resolve(__dirname, "shared/src"), path.resolve(__dirname, "shared/src"),
path.resolve(__dirname, "src"), path.resolve(__dirname, "src"),