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