MM-69003 Switch to using @stylistic/eslint-plugin for deprecated ESLint rules (#36770)

* MM-69003 Switch to using @stylistic/eslint-plugin for deprecated ESLint rules

* Run --fix on all web app packages

These changes are mostly around TypeScript linting where the @stylistic
versions are more accurate and therefore stricter about spacing and
semicolons in TS types.

* Run --fix on Cypress tests
This commit is contained in:
Harrison Healey
2026-06-11 17:31:15 -04:00
committed by GitHub
parent 2db07164df
commit 5cbbb76b7b
1002 changed files with 2111 additions and 1847 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ export default [
'cypress/unsafe-to-chain-command': 0,
'func-names': 0,
'global-require': 0,
'lines-around-comment': 0,
'@stylistic/lines-around-comment': 0,
'max-nested-callbacks': 0,
'no-await-in-loop': 0,
'no-loop-func': 0,
@@ -77,8 +77,8 @@ export default [
],
'import/no-unresolved': 'off',
'max-lines': ['warn', {max: 800, skipBlankLines: true, skipComments: true}],
'eol-last': ['error', 'always'],
'no-trailing-spaces': 'error',
'@stylistic/eol-last': ['error', 'always'],
'@stylistic/no-trailing-spaces': 'error',
},
},
];
@@ -8,7 +8,7 @@ type ClickCategoryMenuItemProps = {
menuItemText: string;
categoryMenuButtonName?: string;
isSubMenu?: boolean;
}
};
export function clickCategoryMenuItem({categoryDisplayName, menuItemText, categoryMenuButtonName = categoryDisplayName, isSubMenu = false}: ClickCategoryMenuItemProps) {
cy.get('#SidebarContainer').should('be.visible').within(() => {
@@ -15,7 +15,7 @@ import {newTestPassword} from '@/utils';
const admin = getAdminAccount();
interface Subscription{
interface Subscription {
id: string;
product_id: string;
is_free_trial: string;
@@ -23,9 +23,9 @@ interface Subscription{
}
interface Limits {
messages?: { history: number };
teams?: { active: number; teamsLoaded: boolean };
files?: { total_storage: number };
messages?: {history: number};
teams?: {active: number; teamsLoaded: boolean};
files?: {total_storage: number};
}
function simulateFilesLimitReached(fileStorageUsageBytes: number) {
@@ -85,7 +85,7 @@ function simulateSubscription(subscription: Partial<Subscription>, withLimits =
}
}
function createUsersProcess(team: { id: string }, channel: { id: string }, times: number) {
function createUsersProcess(team: {id: string}, channel: {id: string}, times: number) {
const users: Cypress.UserProfile[] = [];
for (let i = 0; i < times; i++) {
cy.apiCreateUser({prefix: 'other'}).then(({user}) => {
@@ -67,8 +67,8 @@ describe('Elasticsearch system console', () => {
return cy.get('@firstRow').then((el) => {
return el.find('.status-icon-success').length > 0;
});
}
, {
},
{
timeout: TIMEOUTS.FIVE_MIN,
interval: TIMEOUTS.TWO_SEC,
errorMsg: 'Reindex did not succeed in time',
@@ -271,12 +271,12 @@ function demoteUserToGuest(user: Record<string, unknown>) {
});
}
function removeUserFromAllTeams(user: { id: string }) {
function removeUserFromAllTeams(user: {id: string}) {
// # Get all teams of a user
cy.apiGetTeamsForUser(user.id).then((teams) => {
// # Remove user from all the teams
if (teams.length > 0) {
teams.forEach((team: { id: string }) => {
teams.forEach((team: {id: string}) => {
cy.apiDeleteUserFromTeam(team.id, user.id);
});
}
@@ -6,7 +6,7 @@ import axios from 'axios';
import * as timeouts from '../fixtures/timeouts';
export interface ExternalRequestUser{
export interface ExternalRequestUser {
username: string;
password: string;
}
@@ -17,7 +17,7 @@ interface ExternalRequestArg {
path: string;
data: any;
}
type ExternalRequestResult = { status: number; statusText: string; data: any; isError?: boolean } | { data: { id: string; isTimeout: boolean }; status?: undefined; statusText?: undefined; isError?: undefined };
type ExternalRequestResult = {status: number; statusText: string; data: any; isError?: boolean} | {data: {id: string; isTimeout: boolean}; status?: undefined; statusText?: undefined; isError?: undefined};
export default async function externalRequest(arg: ExternalRequestArg): Promise<ExternalRequestResult> {
const {baseUrl, user, method = 'get', path, data = {}} = arg;
const loginUrl = `${baseUrl}/api/v4/users/login`;
@@ -17,7 +17,7 @@ import type {ChainableT, ResponseT} from '@/types';
// https://api.mattermost.com/#tag/commands
// *****************************************************************************
type CypressResponseBody = Cypress.Response<unknown>
type CypressResponseBody = Cypress.Response<unknown>;
function apiCreateCommand(command: Record<string, unknown> = {}): Cypress.Chainable<{data: CypressResponseBody['body']; status: CypressResponseBody['status']}> {
const options = {
url: '/api/v4/commands',
@@ -543,8 +543,8 @@ function checkRunLDAPSync() {
return cy.get('@firstRow').then((el) => {
return el.find('.status-icon-success').length > 0;
});
}
, {
},
{
timeout: TIMEOUTS.FIVE_MIN,
interval: TIMEOUTS.TWO_SEC,
errorMsg: 'AD/LDAP Sync Job did not finish',
+8 -8
View File
@@ -26,24 +26,24 @@ export default [
},
},
rules: {
'@stylistic/dot-location': 'off', // Covered by Prettier
'@stylistic/indent': 'off', // Covered by Prettier
'@stylistic/lines-around-comment': 'off', // Covered by Prettier
'@stylistic/multiline-ternary': 'off', // Covered by Prettier
'@stylistic/no-mixed-operators': 'off',
'@stylistic/operator-linebreak': 'off', // Covered by Prettier
'@stylistic/space-before-function-paren': 'off', // Covered by Prettier
'@stylistic/wrap-regex': 'off', // Covered by Prettier
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': 'off', // Covered by Prettier
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'func-names': 'off',
'dot-location': 'off', // Covered by Prettier
'lines-around-comment': 'off', // Covered by Prettier
'max-lines': ['warn', {max: 800, skipBlankLines: true, skipComments: true}],
'multiline-ternary': 'off', // Covered by Prettier
'no-await-in-loop': 'off',
'no-console': 'error',
'no-loop-func': 0,
'no-mixed-operators': 'off',
'no-process-env': 0,
'no-process-exit': 0,
'operator-linebreak': 'off', // Covered by Prettier
'space-before-function-paren': 'off', // Covered by Prettier
'wrap-regex': 'off', // Covered by Prettier
'headers/header-format': [
'error',
{
+1 -1
View File
@@ -43,7 +43,7 @@ export type ExecuteCommandReturnType = {
silentFailureReason?: Error;
commandResponse?: CommandResponse;
appResponse?: AppCallResponse;
}
};
export function executeCommand(message: string, args: CommandArgs): ActionFuncAsync<ExecuteCommandReturnType> {
return async (dispatch, getState) => {
@@ -45,7 +45,7 @@ type NotificationResult = {
status: string;
reason?: string;
data?: string;
}
};
type NotificationHooksArgs = {
title: string;
@@ -54,7 +54,7 @@ type NotificationHooksArgs = {
soundName: string;
url: string;
notify: boolean;
}
};
/**
* This function is used to determine if the desktop sound is enabled.
+1 -1
View File
@@ -64,7 +64,7 @@ import type {OnSubmitOptions, SubmitPostReturnType} from './views/create_comment
export type CreatePostOptions = {
keepDraft?: boolean;
ignorePostError?: boolean;
}
};
export function handleNewPost(post: Post, msg?: WebSocketMessages.Posted | WebSocketMessages.EphemeralPost): ActionFuncAsync<boolean> {
return async (dispatch, getState) => {
+1 -1
View File
@@ -369,7 +369,7 @@ export interface LoadPostsReturnValue {
moreToLoad: boolean;
}
export type CanLoadMorePosts = typeof PostRequestTypes[keyof typeof PostRequestTypes] | undefined
export type CanLoadMorePosts = typeof PostRequestTypes[keyof typeof PostRequestTypes] | undefined;
export interface LoadPostsParameters {
channelId: string;
@@ -172,7 +172,7 @@ export type OnSubmitOptions = {
afterSubmit?: (response: SubmitPostReturnType) => void;
afterOptimisticSubmit?: () => void;
keepDraft?: boolean;
}
};
export function onSubmit(
draft: PostDraft,
+4 -4
View File
@@ -26,7 +26,7 @@ type Draft = {
key: keyof GlobalState['storage']['storage'];
value: PostDraft;
timestamp: Date;
}
};
/**
* Gets drafts stored on the server and reconciles them with any locally stored drafts.
@@ -87,10 +87,10 @@ export function removeDraft(key: string, channelId: string, rootId = ''): Action
};
}
export function updateDraft(key: string, value: PostDraft|null, rootId = '', save = false): ActionFuncAsync<boolean> {
export function updateDraft(key: string, value: PostDraft | null, rootId = '', save = false): ActionFuncAsync<boolean> {
return async (dispatch, getState) => {
const state = getState();
let updatedValue: PostDraft|null = null;
let updatedValue: PostDraft | null = null;
if (value) {
const timestamp = new Date().getTime();
const data = getGlobalItem<Partial<PostDraft>>(state, key, {});
@@ -135,7 +135,7 @@ function upsertDraft(draft: PostDraft, userId: UserProfile['id'], rootId = '', c
return Client4.upsertDraft(newDraft, connectionId);
}
export function setGlobalDraft(key: string, value: PostDraft|null, isRemote: boolean): ActionFunc {
export function setGlobalDraft(key: string, value: PostDraft | null, isRemote: boolean): ActionFunc {
return (dispatch) => {
dispatch(setGlobalItem(key, value));
dispatch(setGlobalDraftSource(key, isRemote));
+1 -1
View File
@@ -70,7 +70,7 @@ export function loginById(id: string, password: string): ActionFuncAsync {
};
}
export function getUserLoginType(loginId: string): ActionFuncAsync<{auth_service: 'magic_link' | ''; is_deactivated: boolean }> {
export function getUserLoginType(loginId: string): ActionFuncAsync<{auth_service: 'magic_link' | ''; is_deactivated: boolean}> {
return async (dispatch) => {
try {
const response = await Client4.getUserLoginType(loginId);
+1 -1
View File
@@ -17,7 +17,7 @@ export function openModal<P>(modalData: ModalData<P>) {
export type CloseModalType = {
type: string;
modalId: string;
}
};
export function closeModal(modalId: string) {
return {
+1 -1
View File
@@ -13,7 +13,7 @@ import type {Translations} from 'types/store/i18n';
const pluginTranslationSources: Record<string, TranslationPluginFunction> = {};
export type TranslationPluginFunction = (locale: string) => Translations
export type TranslationPluginFunction = (locale: string) => Translations;
export function registerPluginTranslationsSource(pluginId: string, sourceFunction: TranslationPluginFunction): ThunkActionFunc<void> {
pluginTranslationSources[pluginId] = sourceFunction;
@@ -23,7 +23,7 @@ import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cl
type SocketStatus = {
connected: boolean;
serverHostname: string | undefined;
}
};
type Props = {
@@ -19,7 +19,7 @@ type Props = {
};
userAudits: Audit[];
currentUserId: string;
}
};
const AccessHistoryModal = ({
actions: {
@@ -79,12 +79,12 @@ export type Props = {
fetchBindings: (channelId: string, teamId: string) => Promise<ActionResult<AppBinding[]>>;
}; // TechDebt: Made non-mandatory while converting to typescript
}
};
type State = {
openUp: boolean;
appBindings?: AppBinding[];
}
};
export class ActionMenuClass extends React.PureComponent<Props, State> {
public static defaultProps: Partial<Props> = {
@@ -18,7 +18,7 @@ type Props = {
onOpenMarketplace: () => void;
onToggle: (open: boolean) => void;
isOpen: boolean;
}
};
export default function ActionsMenuEmptyPopover({
anchorElement,
@@ -6,7 +6,7 @@ import React from 'react';
type Props = {
name: string;
dangerous?: boolean;
}
};
export function ActionsMenuIcon({name, dangerous}: Props) {
const colorClass = dangerous ? 'MenuItem__compass-icon-dangerous' : 'MenuItem__compass-icon';
@@ -13,7 +13,7 @@ type Props = {
handleOpen: (e: React.MouseEvent) => void;
handleDismiss: () => void;
showTip: boolean;
}
};
const title = (
<FormattedMessage
@@ -23,7 +23,7 @@ export type PopoverProps = {
anchorOrigin?: PopoverOrigin;
transformOrigin?: PopoverOrigin;
}
};
const OPEN_ANIMATION_DURATION = 150;
const CLOSE_ANIMATION_DURATION = 100;
@@ -47,7 +47,7 @@ export type Props = {
*/
revokeSession: (userId: string, sessionId: string) => Promise<ActionResult>;
};
}
};
const ActivityLogModal = ({
currentUserId,
@@ -10,7 +10,7 @@ import {formatAsString} from 'utils/i18n';
type Props = {
devicePicture?: string;
deviceTitle: MessageDescriptor | string;
}
};
export default function DeviceIcon(props: Props) {
const intl = useIntl();
@@ -44,7 +44,7 @@ export type Props = {
getTeam: (teamId: string) => Promise<ActionResult>;
getAllGroupsAssociatedToTeam: (teamID: string, filterAllowReference: boolean, includeMemberCount: boolean) => Promise<ActionResult>;
};
}
};
type State = {
values: GroupValue[];
@@ -53,7 +53,7 @@ type State = {
saving: boolean;
addError: string | null;
loadingGroups: boolean;
}
};
export class AddGroupsToChannelModal extends React.PureComponent<Props, State> {
private searchTimeoutId: number;
@@ -227,7 +227,7 @@ export class AddGroupsToChannelModal extends React.PureComponent<Props, State> {
);
};
renderValue(props: { data: Partial<Value> }) {
renderValue(props: {data: Partial<Value>}) {
return props.data.display_name;
}
@@ -24,7 +24,7 @@ type OwnProps = {
skipCommit: boolean;
onAddCallback: (groupIDs: string[]) => void;
excludeGroups: Group[];
}
};
function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
const searchTerm = state.views.search.modalSearch;
@@ -40,7 +40,7 @@ type Props = {
skipCommit?: boolean;
onAddCallback?: (groupIDs: string[]) => void;
actions: Actions;
}
};
export type Actions = {
getGroupsNotAssociatedToTeam: (teamID: string, q?: string, page?: number, perPage?: number, source?: GroupSource | string, onlySyncableSources?: boolean) => Promise<ActionResult>;
@@ -56,7 +56,7 @@ type State = {
saving: boolean;
addError: null | string;
loadingGroups: boolean;
}
};
export class AddGroupsToTeamModal extends React.PureComponent<Props, State> {
private searchTimeoutId: number;
@@ -240,7 +240,7 @@ export class AddGroupsToTeamModal extends React.PureComponent<Props, State> {
};
// public for tests
public renderValue = (props: { data: Value }): string | undefined => props.data.display_name;
public renderValue = (props: {data: Value}): string | undefined => props.data.display_name;
public render(): JSX.Element {
const numRemainingText = (
@@ -23,7 +23,7 @@ type Props = {
skipCommit?: boolean;
onAddCallback?: (groupIDs: string[]) => void;
excludeGroups?: Group[];
}
};
function mapStateToProps(state: GlobalState, ownProps: Props) {
const searchTerm = state.views.search.modalSearch;
@@ -60,7 +60,7 @@ export type Props = {
autocompleteChannelsForSearch: (teamId: string, term: string) => Promise<ActionResult<Channel[]>>;
};
}
};
type State = {
@@ -94,7 +94,7 @@ type State = {
* An error to display when the add request fails
*/
submitError: string;
}
};
export default class AddUserToChannelModal extends React.PureComponent<Props, State> {
private suggestionProviders: SearchChannelWithPermissionsProvider[];
@@ -60,13 +60,13 @@ export type Props = {
loadStatusesForProfilesList: (users: UserProfile[]) => void;
searchProfiles: (term: string, options: any) => Promise<ActionResult>;
};
}
};
type State = {
values: UserProfileValue[];
term: string;
loadingUsers: boolean;
}
};
export class AddUserToGroupMultiSelect extends React.PureComponent<Props, State> {
private searchTimeoutId = 0;
@@ -22,7 +22,7 @@ type UserProfileValue = Value & UserProfile;
type OwnProps = {
groupId?: string;
}
};
function mapStateToProps(state: GlobalState, props: OwnProps) {
let profiles: UserProfileValue[];
@@ -25,7 +25,7 @@ type Props = {
onMouseMove: (user: UserProfileValue) => void;
userStatuses: RelationOneToOne<UserProfile, string>;
isSelected: boolean;
}
};
const MultiSelectOption = React.forwardRef(({
option,
@@ -26,7 +26,7 @@ export type Props = {
addUsersToGroup: (groupId: string, userIds: string[]) => Promise<ActionResult>;
openModal: <P>(modalData: ModalData<P>) => void;
};
}
};
const AddUsersToGroupModal = (props: Props) => {
const [show, setShow] = useState(true);
@@ -16,7 +16,7 @@ import AddUsersToGroupModal from './add_users_to_group_modal';
type OwnProps = {
groupId: string;
}
};
function mapStateToProps(state: GlobalState, props: OwnProps) {
const group = getGroup(state, props.groupId);
@@ -31,8 +31,8 @@ type Props = {
users: UserProfile[];
intl: IntlShape;
filterExcludeGuests?: boolean;
excludeUsers: { [userId: string]: UserProfile };
includeUsers: { [userId: string]: UserProfile };
excludeUsers: {[userId: string]: UserProfile};
includeUsers: {[userId: string]: UserProfile};
onAddCallback: (users: UserProfile[]) => void;
onExited?: () => void;
@@ -40,7 +40,7 @@ type Props = {
getProfilesNotInTeam: (teamId: string, groupConstrained: boolean, page: number, perPage?: number, options?: Record<string, any>) => Promise<ActionResult<UserProfile[]>>;
searchProfiles: (term: string, options?: Record<string, any>) => Promise<ActionResult<UserProfile[]>>;
};
}
};
type State = {
searchResults: UserProfile[];
@@ -51,7 +51,7 @@ type State = {
addError: null;
loading: boolean;
filterOptions: {[key: string]: any};
}
};
export class AddUsersToTeamModal extends React.PureComponent<Props, State> {
selectedItemRef: React.RefObject<HTMLDivElement>;
@@ -148,7 +148,7 @@ export class AddUsersToTeamModal extends React.PureComponent<Props, State> {
);
};
private renderValue = (value: { data: UserProfileValue }): string => {
private renderValue = (value: {data: UserProfileValue}): string => {
return value.data?.username || '';
};
@@ -40,7 +40,7 @@ const AttributeLabel = ({displayName, name}: AttributeLabelProps) => (
);
// Define AttributeIcon outside the main component
const AttributeIcon = (props: IconProps & { attribute?: UserPropertyField }) => {
const AttributeIcon = (props: IconProps & {attribute?: UserPropertyField}) => {
const {attribute, ...iconProps} = props;
if (attribute) {
const valueType = attribute.attrs?.value_type;
@@ -15,7 +15,7 @@ type Props = {
channelsAffected: number;
publicChannelsAffected?: number;
privateChannelsAffected?: number;
}
};
export default function PolicyConfirmationModal({active, onExited, onConfirm, channelsAffected, publicChannelsAffected = 0, privateChannelsAffected = 0}: Props) {
const {formatMessage} = useIntl();
@@ -28,7 +28,7 @@ type Props = {
searchUsers: (term: string, after: string, limit: number) => ActionFuncAsync<AccessControlTestResult>;
openModal?: <P>(modalData: ModalData<P>) => void;
};
}
};
function TestResultsModal({
onExited,
@@ -25,7 +25,7 @@ import './channel_list.scss';
type PolicyActiveStatus = {
id: string;
active: boolean;
}
};
type Props = WrappedComponentProps & {
channels: ChannelWithTeamData[];
@@ -45,14 +45,14 @@ type Props = WrappedComponentProps & {
setChannelListSearch: (term: string) => void;
setChannelListFilters: (filters: ChannelSearchOpts) => void;
};
}
};
type State = {
loading: boolean;
page: number;
after: string;
cursorHistory: string[];
}
};
const PAGE_SIZE = 10;
@@ -23,7 +23,7 @@ type OwnProps = {
policyId?: string;
channelsToAdd: Record<string, ChannelWithTeamData>;
teamId?: string;
}
};
const EMPTY_FILTERS: ChannelSearchOpts = {};
const EMPTY_SEARCH_TERM = '';
@@ -21,7 +21,7 @@ type OwnProps = {
policy_id: string;
};
};
}
};
function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
const policyId = ownProps.match.params.policy_id;
@@ -46,7 +46,7 @@ interface PolicyActions {
setNavigationBlocked: (blocked: boolean) => void;
assignChannelsToAccessControlPolicy: (policyId: string, channelIds: string[]) => Promise<ActionResult>;
unassignChannelsFromAccessControlPolicy: (policyId: string, channelIds: string[]) => Promise<ActionResult>;
createJob: (job: JobTypeBase & { data: any }) => Promise<ActionResult>;
createJob: (job: JobTypeBase & {data: any}) => Promise<ActionResult>;
updateAccessControlPoliciesActive: (states: AccessControlPolicyActiveUpdate[]) => Promise<ActionResult>;
}
@@ -44,7 +44,7 @@ type ExtraProps = {
patchConfig: (config: DeepPartial<AdminConfig>) => Promise<ActionResult>;
cloud: CloudState;
isCurrentUserSystemAdmin: boolean;
}
};
/**
* Focus or scroll to a provided hash for the given {@link Location}.
@@ -5006,7 +5006,7 @@ const AdminDefinition: AdminDefinitionType = {
id: 'OAuthSettings',
name: defineMessage({id: 'admin.authentication.oauth', defaultMessage: 'OAuth 2.0'}),
onConfigLoad: (config) => {
const newState: { oauthType?: string; 'GitLabSettings.Url'?: string } = {};
const newState: {oauthType?: string; 'GitLabSettings.Url'?: string} = {};
if (config.GitLabSettings?.Enable) {
newState.oauthType = Constants.GITLAB_SERVICE;
}
@@ -5330,7 +5330,7 @@ const AdminDefinition: AdminDefinitionType = {
id: 'OpenIdSettings',
name: defineMessage({id: 'admin.authentication.openid', defaultMessage: 'OpenID Connect'}),
onConfigLoad: (config) => {
const newState: { openidType?: string; 'GitLabSettings.Url'?: string } = {};
const newState: {openidType?: string; 'GitLabSettings.Url'?: string} = {};
if (config.Office365Settings?.Enable) {
newState.openidType = Constants.OFFICE365_SERVICE;
}
@@ -65,7 +65,7 @@ export const it = {
return cloud?.subscription?.is_free_trial === 'true';
},
userHasReadPermissionOnResource: (key: string) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.read as any)?.[key],
userHasReadPermissionOnSomeResources: (key: { [key: string]: string }) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => Object.values(key).some((resource) => (consoleAccess?.read as any)?.[resource]),
userHasReadPermissionOnSomeResources: (key: {[key: string]: string}) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => Object.values(key).some((resource) => (consoleAccess?.read as any)?.[resource]),
userHasWritePermissionOnResource: (key: string) => (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess) => (consoleAccess?.write as any)?.[key],
isSystemAdmin: (config: Partial<AdminConfig>, state: any, license?: ClientLicense, enterpriseReady?: boolean, consoleAccess?: ConsoleAccess, cloud?: CloudState, isSystemAdmin?: boolean) => Boolean(isSystemAdmin),
};
@@ -20,7 +20,7 @@ type Props = {
saving: boolean;
saveNeeded: boolean;
serverError?: React.ReactNode;
}
};
const AdminSettings = ({
doSubmit,
@@ -33,7 +33,7 @@ export interface Props extends PropsFromRedux {
type State = {
sections: string[] | null;
filter: string;
}
};
class AdminSidebar extends React.PureComponent<Props, State> {
searchRef: React.RefObject<HTMLInputElement>;
@@ -14,7 +14,7 @@ type Props = {
name?: string;
parentLink?: string;
sectionClass?: string;
}
};
const AdminSidebarCategory = ({icon, title, action, children, definitionKey, name, parentLink = '', sectionClass}: Props) => {
let link = parentLink;
@@ -19,7 +19,7 @@ type Props = {
subsection?: boolean;
tag?: string | JSX.Element;
restrictedIndicator?: string | JSX.Element;
}
};
const AdminSidebarSection = ({name, title, action, children = [], definitionKey, type, parentLink = '', subsection = false, tag, restrictedIndicator}: Props) => {
const getLink = () => parentLink + '/' + name;
@@ -15,7 +15,7 @@ import Avatar from 'components/widgets/users/avatar';
type Props = {
currentUser: UserProfile;
}
};
const SidebarHeader = ({currentUser: me}: Props) => {
const intl = useIntl();
@@ -15,14 +15,14 @@ import './admin_user_card.scss';
type BulletProps = {
user: UserProfile;
}
};
export type Props = {
user?: UserProfile;
isLoading?: boolean;
body?: React.ReactNode;
footer?: React.ReactNode;
}
};
const AdminUserCard = ({isLoading = false, ...props}: Props) => {
if (!props.user || isLoading) {
@@ -7,7 +7,7 @@ import {FormattedMessage} from 'react-intl';
type Props = {
title?: JSX.Element;
description: JSX.Element;
}
};
const Banner: React.FC<Props> = (props: Props) => {
let title = (
@@ -23,7 +23,7 @@ import './billing_history.scss';
type BillingHistoryModalProps = {
invoices: Invoice[] | undefined;
onHide?: () => void;
}
};
const invoiceListToRecordList = (invoices: Invoice[]) => {
const records = {} as Record<string, Invoice>;
@@ -17,7 +17,7 @@ type Props = {
isFreeTrial: boolean;
subscriptionPlan: string | undefined;
onUpgradeMattermostCloud: () => void;
}
};
const ContactSalesCard = (props: Props) => {
const [openSalesLink, contactSalesLink] = useOpenSalesLink();
@@ -67,7 +67,7 @@ export const noBillingHistory = (
type FreeTrialProps = {
daysLeftOnTrial: number;
}
};
export const FreeTrial = ({daysLeftOnTrial}: FreeTrialProps) => {
const [openSalesLink] = useOpenSalesLink();
@@ -147,7 +147,7 @@ type InvoiceInfoProps = {
fullCharges: InvoiceLineItem[];
partialCharges: InvoiceLineItem[];
hasMore?: number;
}
};
export const InvoiceInfo = ({invoice, product, fullCharges, partialCharges, hasMore}: InvoiceInfoProps) => {
const dispatch = useDispatch();
@@ -13,7 +13,7 @@ import './billing_summary.scss';
type BillingSummaryProps = {
isFreeTrial: boolean;
daysLeftOnTrial: number;
}
};
export default function BillingSummary({isFreeTrial, daysLeftOnTrial}: BillingSummaryProps) {
let body = noBillingHistory;
@@ -23,7 +23,7 @@ import './plan_details.scss';
type Props = {
isFreeTrial: boolean;
subscriptionPlan: string | undefined;
}
};
const PlanDetails = ({isFreeTrial, subscriptionPlan}: Props) => {
const subscription = useSelector(getCloudSubscription);
const product = useSelector(getSubscriptionProduct);
@@ -78,7 +78,7 @@ type Props = {
setByEnv: boolean;
disabledText?: React.ReactNode;
helpText: React.ReactNode;
}
};
const BooleanSetting = ({
id,
@@ -12,7 +12,7 @@ type Props = {
onChange: (id: string, foo: boolean) => void;
disabled?: boolean;
setByEnv: boolean;
}
};
const CheckboxSetting = ({
disabled = false,
@@ -15,11 +15,11 @@ type Props = {
onChange: (id: string, valueAsArray: string[]) => void;
disabled: boolean;
setByEnv: boolean;
}
};
type State = {
value: string;
}
};
export default class ClientSideUserIdsSetting extends PureComponent<Props, State> {
constructor(props: Props) {
@@ -22,13 +22,13 @@ type Props = {
schema_version: string;
}>;
reload: (e: MouseEvent<HTMLButtonElement>) => void;
}
};
type Style = {
clusterTable: CSSProperties;
clusterCell: CSSProperties;
warning: CSSProperties;
}
};
export default class ClusterTable extends PureComponent<Props> {
render() {
@@ -14,7 +14,7 @@ type Props = {
value: string;
onChange?: (id: string, color: string) => void;
disabled?: boolean;
}
};
const ColorSetting = (props: Props) => {
const handleChange = useCallback((color: string) => {
@@ -52,12 +52,12 @@ type Props = {
*/
createComplianceReport: (job: Partial<Compliance>) => Promise<ActionResult<Compliance>>;
};
}
};
type State = {
loadingReports: boolean;
runningReport?: boolean;
}
};
export default class ComplianceReports extends React.PureComponent<Props, State> {
private descInput: React.RefObject<HTMLInputElement>;
@@ -28,12 +28,12 @@ type Props = {
onChange: SystemConsoleCustomSettingChangeHandler;
value: ContentFlaggingAdditionalSettings;
disabled?: boolean;
}
};
export default function ContentFlaggingAdditionalSettingsSection({id, onChange, value, disabled = false}: Props) {
const [additionalSettings, setAdditionalSettings] = React.useState<ContentFlaggingAdditionalSettings>(value as ContentFlaggingAdditionalSettings);
const handleReasonsChange = useCallback((newValues: OnChangeValue<{ value: string }, true>) => {
const handleReasonsChange = useCallback((newValues: OnChangeValue<{value: string}, true>) => {
const updatedSettings: ContentFlaggingAdditionalSettings = {
...additionalSettings,
Reasons: newValues.map((v) => v.value),
@@ -26,7 +26,7 @@ type Props = {
onChange: SystemConsoleCustomSettingChangeHandler;
value: ContentFlaggingReviewerSetting;
disabled?: boolean;
}
};
export default function ContentFlaggingContentReviewers({id, onChange, value, disabled = false}: Props) {
const [reviewerSetting, setReviewerSetting] = useState<ContentFlaggingReviewerSetting>(value as ContentFlaggingReviewerSetting);
@@ -26,7 +26,7 @@ type Props = {
teamReviewersSetting: Record<string, TeamReviewerSetting>;
onChange: (updatedTeamSettings: Record<string, TeamReviewerSetting>) => void;
disabled?: boolean;
}
};
export default function TeamReviewers({teamReviewersSetting, onChange, disabled}: Props): JSX.Element {
const intl = useIntl();
@@ -22,7 +22,7 @@ type Props = {
onChange: SystemConsoleCustomSettingChangeHandler;
value: ContentFlaggingNotificationSettings;
disabled?: boolean;
}
};
export default function ContentFlaggingNotificationSettingsSection({id, value, onChange, disabled}: Props) {
const [notificationSettings, setNotificationSettings] = useState<ContentFlaggingNotificationSettings>(value as ContentFlaggingNotificationSettings);
@@ -13,7 +13,7 @@ type GroupTeamDisplayProps = {
item: Group | Team;
variant: 'group' | 'team';
displayMode?: 'list' | 'chip';
}
};
// Helper function to check if an option is a team
const isTeam = (option: Group | Team): option is Team => {
@@ -39,7 +39,7 @@ export type AutocompleteOptionType<T> = {
label: string | ReactElement;
value: string;
raw?: T;
}
};
const BASE_SELECT_COMPONENTS = {
LoadingIndicator,
@@ -50,12 +50,12 @@ const BASE_SELECT_COMPONENTS = {
type MultiSelectProps = {
multiSelectOnChange?: (selectedUserIds: string[]) => void;
multiSelectInitialValue?: string[];
}
};
type SingleSelectProps = {
singleSelectOnChange?: (selectedUserId: string) => void;
singleSelectInitialValue?: string;
}
};
type Props = MultiSelectProps & SingleSelectProps & {
id: string;
@@ -76,7 +76,7 @@ type Props = {
innerProps: JSX.IntrinsicElements['div'];
selectProps: unknown;
removeProps?: JSX.IntrinsicElements['div'];
}
};
function BaseUserProfilePill({data, innerProps, selectProps, removeProps}: Props) {
const item = data.raw;
@@ -19,7 +19,7 @@ type Props = {
setByEnv: boolean;
showConfirm: boolean;
config: AdminConfig;
}
};
const messages = defineMessages({
enableGuestMagicLinkTitle: {id: 'admin.guest_access.enableGuestMagicLinkTitle', defaultMessage: 'Enable passwordless authentication for guests using magic links via email: '},
@@ -17,7 +17,7 @@ type Props = {
disabled?: boolean;
setByEnv: boolean;
showConfirm: boolean;
}
};
const CustomEnableDisableGuestAccountsSetting = ({
id,
@@ -39,7 +39,7 @@ describe('custom plugin sections and settings', () => {
editRole: jest.fn(),
isCurrentUserSystemAdmin: false,
enterpriseReady: false,
match: {params: {plugin_id: 'testplugin'}} as match<{ plugin_id: string }>,
match: {params: {plugin_id: 'testplugin'}} as match<{plugin_id: string}>,
config: {
PluginSettings: {
Plugins: {
@@ -87,8 +87,8 @@ describe('custom plugin sections and settings', () => {
<CustomPluginSettings
{...baseProps}
patchConfig={jest.fn()}
/>
, {...baseState});
/>,
{...baseState});
expect(screen.getByText('testplugin')).toBeInTheDocument();
expect(screen.getByTestId('PluginSettings.PluginStates.testplugin.Enable')).toBeInTheDocument();
@@ -157,8 +157,8 @@ describe('custom plugin sections and settings', () => {
<CustomPluginSettings
{...props}
patchConfig={jest.fn()}
/>
, {...state});
/>,
{...state});
expect(screen.getByText('testplugin')).toBeInTheDocument();
expect(screen.getByTestId('PluginSettings.PluginStates.testplugin.Enable')).toBeInTheDocument();
@@ -236,8 +236,8 @@ describe('custom plugin sections and settings', () => {
<CustomPluginSettings
{...props}
patchConfig={jest.fn()}
/>
, {...state});
/>,
{...state});
expect(screen.getByText('testplugin')).toBeInTheDocument();
expect(screen.getByTestId('PluginSettings.PluginStates.testplugin.Enable')).toBeInTheDocument();
@@ -339,8 +339,8 @@ describe('custom plugin sections and settings', () => {
<CustomPluginSettings
{...props}
patchConfig={jest.fn()}
/>
, {...state});
/>,
{...state});
expect(screen.getByText('testplugin')).toBeInTheDocument();
expect(screen.getByTestId('PluginSettings.PluginStates.testplugin.Enable')).toBeInTheDocument();
@@ -27,7 +27,7 @@ import {it} from '../admin_definition_helpers';
import {escapePathPart} from '../schema_admin_settings';
import type {AdminDefinitionSetting, AdminDefinitionSubSectionSchema, AdminDefinitionConfigSchemaSection} from '../types';
type OwnProps = { match: { params: { plugin_id: string } } }
type OwnProps = {match: {params: {plugin_id: string}}};
function makeGetPluginSchema() {
return createSelector(
@@ -86,7 +86,7 @@ type Props = {
registerSaveAction: (saveAction: () => Promise<unknown>) => void;
unRegisterSaveAction: (saveAction: () => Promise<unknown>) => void;
id?: string;
}
};
type SaveActionResult = {
error?: Error;
@@ -44,7 +44,7 @@ type State = BaseState & {
saving: boolean;
serverError: JSX.Element | string | null;
errorTooltip: boolean;
}
};
export const messages = defineMessages({
termsOfServiceTitle: {id: 'admin.support.termsOfServiceTitle', defaultMessage: 'Custom Terms of Service'},
@@ -15,11 +15,11 @@ type Props = {
onChange: (id: string, valueAsArray: string[]) => void;
disabled: boolean;
setByEnv: boolean;
}
};
type State = {
value: string;
}
};
export default class CustomURLSchemesSetting extends PureComponent<Props, State> {
constructor(props: Props) {
@@ -27,14 +27,14 @@ export type Column = {
width?: number;
textAlign?: '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset' | 'center' | 'end' | 'justify' | 'left' | 'match-parent' | 'right' | 'start' | undefined;
overflow?: string;
}
};
export type Row = {
cells: {
[key: string]: JSX.Element | string | null;
};
onClick?: () => void;
}
};
type Props = {
rows: Row[];
@@ -10,7 +10,7 @@ import './data_grid.scss';
type HeaderElementProps = {
col: Column;
}
};
const HeaderElement = ({col}: HeaderElementProps) => {
const style: CSSProperties = {};
@@ -30,7 +30,7 @@ const HeaderElement = ({col}: HeaderElementProps) => {
export type Props = {
columns: Column[];
}
};
const DataGridHeader = ({columns}: Props) => {
return (
@@ -12,12 +12,12 @@ import './data_grid.scss';
type DataGridRowProps = {
columns: Column[];
row: Row;
}
};
type DataGridCellProps = {
column: Column;
row: Row;
}
};
const DataGridCell = ({row, column}: DataGridCellProps) => {
const style: CSSProperties = {};
@@ -22,7 +22,7 @@ type Props = {
keys: string[];
onFilter: (options: FilterOptions) => void;
};
}
};
const DataGridSearch = ({
term: termFromProps = '',
@@ -38,12 +38,12 @@ type Props = {
setChannelListSearch: (term: string) => void;
setChannelListFilters: (filters: ChannelSearchOpts) => void;
};
}
};
type State = {
loading: boolean;
page: number;
}
};
const PAGE_SIZE = 10;
export default class ChannelList extends React.PureComponent<Props, State> {
private pageLoaded = 0;
@@ -22,7 +22,7 @@ import ChannelList from './channel_list';
type OwnProps = {
policyId?: string;
channelsToAdd: Record<string, ChannelWithTeamData>;
}
};
function searchChannelsToAdd(channels: Record<string, Channel>, term: string, filters: ChannelSearchOpts): Record<string, Channel> {
let filteredTeams = filterChannelsMatchingTerm(Object.keys(channels).map((key) => channels[key]), term);
@@ -68,7 +68,7 @@ type State = {
serverError: boolean;
inputErrorText: React.ReactNode;
formErrorText: React.ReactNode;
}
};
export default class CustomPolicyForm extends React.PureComponent<Props, State> {
constructor(props: Props) {
@@ -30,7 +30,7 @@ type OwnProps = {
policy_id: string;
};
};
}
};
function mapStateToProps() {
const getPolicyTeams = getTeamsInPolicy();
@@ -32,7 +32,7 @@ import './data_retention_settings.scss';
type OptionType = {
label: string | JSX.Element;
value: string;
}
};
type Props = {
config: DeepPartial<AdminConfig>;
@@ -54,7 +54,7 @@ type State = {
page: number;
loading: boolean;
showEditJobTime: boolean;
}
};
const PAGE_SIZE = 10;
const messages = defineMessages({
@@ -25,7 +25,7 @@ import './global_policy_form.scss';
type ValueType = {
label: string | JSX.Element;
value: string;
}
};
type Props = {
config: DeepPartial<AdminConfig>;
messageRetentionHours: string | undefined;
@@ -45,7 +45,7 @@ type State = {
saving: boolean;
serverError: React.ReactNode;
formErrorText: React.ReactNode;
}
};
export default class GlobalPolicyForm extends React.PureComponent<Props, State> {
constructor(props: Props) {
@@ -22,7 +22,7 @@ import TeamList from './team_list';
type OwnProps = {
policyId?: string;
teamsToAdd: Record<string, Team>;
}
};
function searchTeamsToAdd(teams: Record<string, Team>, term: string): Record<string, Team> {
const filteredTeams = filterTeamsStartingWithTerm(Object.keys(teams).map((key) => teams[key]), term);
@@ -34,12 +34,12 @@ type Props = {
getDataRetentionCustomPolicyTeams: (id: string, page: number, perPage: number) => Promise<ActionResult>;
setTeamListSearch: (term: string) => ActionResult;
};
}
};
type State = {
loading: boolean;
page: number;
}
};
const PAGE_SIZE = 10;
export default class TeamList extends React.PureComponent<Props, State> {
private pageLoaded = 0;
@@ -17,7 +17,7 @@ type Props = {
actions: {
getAppliedSchemaMigrations: () => Promise<ActionResult>;
};
}
};
const MigrationsTable = ({
createHelpText,
@@ -75,7 +75,7 @@ const messages = defineMessages({
traceDescription: {id: 'admin.sql.traceDescription', defaultMessage: '(Development Mode) When true, executing SQL statements are written to the log.'},
});
export const searchableStrings: Array<string|MessageDescriptor|[MessageDescriptor, {[key: string]: any}]> = [
export const searchableStrings: Array<string | MessageDescriptor | [MessageDescriptor, {[key: string]: any}]> = [
messages.title,
[messages.recycleDescription, {featureName: '', reloadConfiguration: ''}],
messages.featureName,
@@ -17,7 +17,7 @@ type Props = {
disabled?: boolean;
setByEnv: boolean;
helpText?: ReactNode;
}
};
const DropdownSetting = ({
id,
@@ -77,7 +77,7 @@ export const messages = defineMessages({
enableSearchingDescription: {id: 'admin.elasticsearch.enableSearchingDescription', defaultMessage: 'Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used.'},
});
export const searchableStrings: Array<string|MessageDescriptor|[MessageDescriptor, {[key: string]: any}]> = [
export const searchableStrings: Array<string | MessageDescriptor | [MessageDescriptor, {[key: string]: any}]> = [
[messages.connectionUrlDescription, {link: (msg: string) => msg}],
[messages.enableIndexingDescription, {link: (msg: string) => msg}],
messages.title,
@@ -52,13 +52,13 @@ type Props = {
isPaidSubscription: boolean;
customer?: CloudCustomer;
showSkuTag?: boolean;
}
};
type State = {
gettingTrial: boolean;
gettingTrialError: string | null;
gettingTrialResponseCode: number | null;
}
};
export default class FeatureDiscovery extends React.PureComponent<Props, State> {
constructor(props: Props) {
@@ -6,7 +6,7 @@ import React from 'react';
type SvgProps = {
width?: number;
height?: number;
}
};
const AnnouncementBannerSVG = (props: SvgProps) => (
<svg
@@ -6,7 +6,7 @@ import * as React from 'react';
type SvgProps = {
width?: number;
height?: number;
}
};
const AutoTranslationSVG = (props: SvgProps) => (
<svg
@@ -6,7 +6,7 @@ import React from 'react';
type SvgProps = {
width?: number;
height?: number;
}
};
const BurnOnReadSVG = (props: SvgProps) => (
<svg

Some files were not shown because too many files have changed in this diff Show More