0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

chore: upgrade eslint (#18186)

This commit is contained in:
David Newell 2023-10-25 17:13:59 +01:00 committed by GitHub
parent 8b8cedf052
commit 4fc05e34c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 890 additions and 439 deletions

View File

@ -33,6 +33,7 @@ export function LemonCalendarRangeInline({
// How many months fit on the screen, capped between 1..2
function getMonthCount(): number {
const width =
// eslint-disable-next-line valid-typeof
typeof window === undefined ? WIDTH_OF_ONE_CALENDAR_MONTH * CALENDARS_IF_NO_WINDOW : window.innerWidth
return Math.min(Math.max(1, Math.floor(width / WIDTH_OF_ONE_CALENDAR_MONTH)), 2)
}

View File

@ -25,12 +25,14 @@ export const BillingLimitInput = ({ product }: { product: BillingProductV2Type }
if (value === undefined) {
return actuallyUpdateLimit()
}
const productAndAddonTiers: BillingV2TierType[][] = [
product.tiers,
...product.addons
?.filter((addon: BillingProductV2AddonType) => addon.subscribed)
?.map((addon: BillingProductV2AddonType) => addon.tiers),
].filter(Boolean) as BillingV2TierType[][]
const addonTiers = product.addons
?.filter((addon: BillingProductV2AddonType) => addon.subscribed)
?.map((addon: BillingProductV2AddonType) => addon.tiers)
const productAndAddonTiers: BillingV2TierType[][] = [product.tiers, ...addonTiers].filter(
Boolean
) as BillingV2TierType[][]
const newAmountAsUsage = product.tiers
? convertAmountToUsage(`${value}`, productAndAddonTiers, billing?.discount_percent)

View File

@ -101,12 +101,12 @@ export const billingProductLogic = kea<billingProductLogicType>([
(billing, product, isEditingBillingLimit, billingLimitInput, customLimitUsd) => {
// cast the product as a product, not an addon, to avoid TS errors. This is fine since we're just getting the tiers.
product = product as BillingProductV2Type
const productAndAddonTiers: BillingV2TierType[][] = [
product.tiers,
...product.addons
?.filter((addon: BillingProductV2AddonType) => addon.subscribed)
?.map((addon: BillingProductV2AddonType) => addon.tiers),
].filter(Boolean) as BillingV2TierType[][]
const addonTiers = product.addons
?.filter((addon: BillingProductV2AddonType) => addon.subscribed)
?.map((addon: BillingProductV2AddonType) => addon.tiers)
const productAndAddonTiers: BillingV2TierType[][] = [product.tiers, ...addonTiers].filter(
Boolean
) as BillingV2TierType[][]
return product.tiers
? isEditingBillingLimit
? convertAmountToUsage(`${billingLimitInput}`, productAndAddonTiers, billing?.discount_percent)

View File

@ -802,7 +802,7 @@ export const experimentLogic = kea<experimentLogicType>([
let index = -1
if (insightType === InsightType.FUNNELS) {
// Funnel Insight is displayed in order of decreasing count
index = ([...experimentResults?.insight] as FunnelStep[][])
index = ([...experimentResults.insight] as FunnelStep[][])
.sort((a, b) => b[0]?.count - a[0]?.count)
.findIndex(
(variantFunnel: FunnelStep[]) => variantFunnel[0]?.breakdown_value?.[0] === variant

View File

@ -266,7 +266,10 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
if (!state) {
return state
}
const groups = [...state?.filters.groups, { properties: [], rollout_percentage: 0, variant: null }]
const groups = [
...(state?.filters?.groups || []),
{ properties: [], rollout_percentage: 0, variant: null },
]
return { ...state, filters: { ...state.filters, groups } }
},
addRollbackCondition: (state) => {
@ -291,7 +294,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
return state
}
const groups = [...state?.filters.groups]
const groups = [...(state?.filters?.groups || [])]
if (newRolloutPercentage !== undefined) {
groups[index] = { ...groups[index], rollout_percentage: newRolloutPercentage }
}

View File

@ -143,7 +143,7 @@ export const trendsDataLogic = kea<trendsDataLogicType>([
actions.setInsightData({
...values.insightData,
result: [...values.insightData?.result, ...(response.result ? response.result : [])],
result: [...values.insightData.result, ...(response.result ? response.result : [])],
next: response.next,
})

View File

@ -229,8 +229,8 @@
"@types/react-virtualized": "^9.21.14",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/zxcvbn": "^4.4.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"autoprefixer": "^10.4.7",
"axe-core": "^4.4.3",
"babel-loader": "^8.0.6",
@ -241,15 +241,15 @@
"cypress": "^13.3.0",
"cypress-axe": "^1.5.0",
"cypress-terminal-report": "^5.3.7",
"eslint": "^7.8.0",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-compat": "^4.2.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-no-only-tests": "^3.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-jest": "^27.4.3",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-storybook": "^0.6.15",
"file-loader": "^6.1.0",
"givens": "^1.3.6",

File diff suppressed because it is too large Load Diff