Skip to content

[MOB-10141] make lint rules stricter #604

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2ce56ae
Add ESLint configuration file and remove inline config from package.json
lposen Nov 7, 2024
1d73a8d
Enhance ESLint configuration for TypeScript support: add TypeScript p…
lposen Nov 7, 2024
b6797da
Enhance ESLint configuration: add jest plugin and update lint command…
lposen Nov 7, 2024
0bd3f0c
Fixed autofixabe lint issues
lposen Nov 7, 2024
46c5710
Fixed linting issues for IterableInboxMessageCell
lposen Nov 7, 2024
bc32769
eslint fixes
lposen Nov 7, 2024
6f87314
Add IterableEdgeInsetDetails type and update related classes for bett…
lposen Nov 7, 2024
61d143d
Refactor IterableConfig and IterableInAppMessage for improved type sa…
lposen Nov 7, 2024
888ee75
Enhance type safety by refining types in IterableCommerceItem, Iterab…
lposen Nov 7, 2024
a8ac6a1
Refactor fromDict methods in IterableAction and IterableActionContext…
lposen Nov 7, 2024
7b0104a
Refactor Iterable class methods to enhance type safety; replace 'any'…
lposen Nov 7, 2024
ad2cf2d
Allow `requires` for package.json and in tests
lposen Nov 7, 2024
9cbfc82
Refactor ESLint configuration for improved TypeScript support; update…
lposen Nov 8, 2024
4b20c6e
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' into 2.0.0…
lposen Nov 14, 2024
6ebc953
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' into 2.0.0…
lposen Nov 15, 2024
d76e662
Refactor ESLint configuration and improve type definitions. Excluded…
lposen Nov 16, 2024
5d96ec5
Refactor ESLint configuration and move Prettier settings to a separat…
lposen Nov 16, 2024
cc96da8
Update ESLint configuration and ignore settings; remove node_modules …
lposen Nov 16, 2024
d029374
Enhance ESLint configuration and improve component styles for better …
lposen Nov 16, 2024
c556a9f
Refactor IterableInboxMessageDisplay to use color constants for impro…
lposen Nov 16, 2024
835786f
Refactor IterableInboxMessageCell to use color constants for improved…
lposen Nov 16, 2024
52a6422
Refactor IterableInboxEmptyState to use color constants for improved …
lposen Nov 16, 2024
e2ebcf1
Refactor IterableInbox to use color constants and improve style consi…
lposen Nov 16, 2024
241c5f6
Refactor Commerce and Login components to use shadow constants for im…
lposen Nov 16, 2024
15add53
Update ESLint configuration to use the full plugin path for better cl…
lposen Nov 16, 2024
575cfbf
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' into 2.0.0…
lposen Nov 25, 2024
989dead
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' into 2.0.0…
lposen Nov 26, 2024
e5ade24
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' into 2.0.0…
lposen Nov 27, 2024
89ac82b
Merge branch '2.0.0-alpha/master' into 2.0.0-alpha/MOB-10141-make-lin…
evantk91 Dec 7, 2024
cbc3418
Merge branch '2.0.0-alpha/master' into 2.0.0-alpha/MOB-10141-make-lin…
lposen Dec 9, 2024
f2f5122
refactor: added constants instead of values as per PR review
lposen Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/classes/IterableCommerceItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class IterableCommerceItem {
description?: string;
url?: string;
imageUrl?: string;
categories?: Array<string>;
dataFields?: any;
categories?: string[];
dataFields?: unknown;

constructor(
id: string,
Expand All @@ -22,8 +22,8 @@ export class IterableCommerceItem {
description?: string,
url?: string,
imageUrl?: string,
categories?: Array<string>,
dataFields?: any | undefined
categories?: string[],
dataFields?: unknown | undefined
) {
this.id = id;
this.name = name;
Expand Down
12 changes: 6 additions & 6 deletions src/inApp/classes/IterableHtmlInAppContent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { IterableEdgeInsets, type IterableEdgeInsetDetails } from '../../core';
import { IterableEdgeInsets } from '../../core';

import { IterableInAppContentType } from '../enums';
import type { IterableInAppContent } from '../types';
import type {
IterableHtmlInAppContentRaw,
IterableInAppContent,
} from '../types';

// TODO: Add description
export class IterableHtmlInAppContent implements IterableInAppContent {
Expand All @@ -14,10 +17,7 @@ export class IterableHtmlInAppContent implements IterableInAppContent {
this.html = html;
}

static fromDict(dict: {
edgeInsets: IterableEdgeInsetDetails;
html: string;
}): IterableHtmlInAppContent {
static fromDict(dict: IterableHtmlInAppContentRaw): IterableHtmlInAppContent {
return new IterableHtmlInAppContent(
IterableEdgeInsets.fromDict(dict.edgeInsets),
dict.html as string
Expand Down
22 changes: 21 additions & 1 deletion src/inApp/classes/IterableInAppMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,26 @@ export class IterableInAppMessage {
);
}

static fromDict(dict: any): IterableInAppMessage {
static fromDict(dict: {
messageId: string;
campaignId: number;
trigger: IterableInAppTrigger;
createdAt: number;
expiresAt: number;
saveToInbox: boolean;
inboxMetadata: {
title: string | undefined;
subtitle: string | undefined;
icon: string | undefined;
};
customPayload: unknown;
read: boolean;
priorityLevel: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should have a type like was done for IterableHtmlInAppContentRaw.

}): IterableInAppMessage {
const messageId = dict.messageId as string;
const campaignId = dict.campaignId as number;
const trigger = IterableInAppTrigger.fromDict(dict.trigger);

let createdAt = dict.createdAt;
if (createdAt) {
const dateObject = new Date(0);
Expand Down Expand Up @@ -139,6 +155,10 @@ export class IterableInAppMessage {
messageId,
campaignId,
trigger,
// TODO: Speak to the team about `IterableInAppMessage` requiring a date
// object, but being passed a number in this case
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
createdAt,
expiresAt,
saveToInbox,
Expand Down
7 changes: 7 additions & 0 deletions src/inApp/types/IterableHtmlInAppContentRaw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { IterableEdgeInsetDetails } from '../../core';

/** The raw in-App content details returned from the server */
export interface IterableHtmlInAppContentRaw {
edgeInsets: IterableEdgeInsetDetails;
html: string;
}
1 change: 1 addition & 0 deletions src/inApp/types/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './IterableInAppContent';
export * from './IterableHtmlInAppContentRaw';
3 changes: 2 additions & 1 deletion src/inbox/classes/IterableInboxDataModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
IterableInAppDeleteSource,
IterableInAppLocation,
IterableInAppMessage,
type IterableHtmlInAppContentRaw,
} from '../../inApp';
import type {
IterableInboxImpressionRowInfo,
Expand Down Expand Up @@ -54,7 +55,7 @@ export class IterableInboxDataModel {
);

return RNIterableAPI.getHtmlInAppContentForMessage(id).then(
(content: any) => {
(content: IterableHtmlInAppContentRaw) => {
return IterableHtmlInAppContent.fromDict(content);
}
);
Expand Down
5 changes: 3 additions & 2 deletions src/inbox/components/IterableInboxMessageCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {
Text,
TouchableOpacity,
View,
type PanResponderGestureState,
type TextStyle,
type ViewStyle,
} from 'react-native';

import { IterableInboxDataModel } from '../classes';
import type {
IterableInboxRowViewModel,
IterableInboxCustomizations,
IterableInboxRowViewModel,
} from '../types';

// TODO: Change to component
Expand Down Expand Up @@ -251,7 +252,7 @@ export const IterableInboxMessageCell = ({
const FORCING_DURATION = 350;

//If user swipes, either complete swipe or reset
function userSwipedLeft(gesture: any) {
function userSwipedLeft(gesture: PanResponderGestureState) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

if (gesture.dx < -0.6 * contentWidth) {
completeSwipe();
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/inbox/components/IterableInboxMessageDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
View,
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import { WebView } from 'react-native-webview';
import { WebView, type WebViewMessageEvent } from 'react-native-webview';

import {
Iterable,
Expand Down Expand Up @@ -163,7 +163,7 @@ export const IterableInboxMessageDisplay = ({
};
});

function handleInAppLinkAction(event: any) {
function handleInAppLinkAction(event: WebViewMessageEvent) {
const URL = event.nativeEvent.data;

const action = new IterableAction('openUrl', URL, '');
Expand Down