Skip to content

Commit

Permalink
chore: upgrade eslint-plugin-lingui (#1405)
Browse files Browse the repository at this point in the history
Which has a number of breaking changes, see
https://github.com/lingui/eslint-plugin/releases/tag/0.8.0

This is the change that is breaking #1403.
  • Loading branch information
tackley authored Dec 3, 2024
1 parent 4dcec1c commit 47c3617
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 22 deletions.
35 changes: 21 additions & 14 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,26 @@ export default tseslint.config(
"lingui/no-unlocalized-strings": [
"error",
{
ignoreAttribute: [
ignore: [
// Ignore strings which are a single "word" (no spaces)
// and doesn't start with an uppercase letter
"^(?![A-Z])\\S+$",
// Ignore UPPERCASE literals
// Example: const test = "FOO"
"^[A-Z0-9_-]+$",
],
ignoreFunctions: [
"createSvgIcon",
"log",
"useTrackMatomoPageView",
"useTrackWithMatomo",
"formatInTimeZone",
"zonedTimeToUtc",
"utcToZonedTime",
"graphql",
"getGenericMultiSelect",
],
ignoreNames: [
"style",
"sx",
"fontFamily",
Expand All @@ -74,19 +93,6 @@ export default tseslint.config(
"gridTemplateRows",
"gridTemplateAreas",
"rel",
],
ignoreFunction: [
"createSvgIcon",
"log",
"useTrackMatomoPageView",
"useTrackWithMatomo",
"formatInTimeZone",
"zonedTimeToUtc",
"utcToZonedTime",
"graphql",
"getGenericMultiSelect",
],
ignoreProperty: [
"documentTitle",
"color",
"border",
Expand Down Expand Up @@ -118,6 +124,7 @@ export default tseslint.config(
"**/*.test.ts",
"src/components/TimeZonePicker/useTimeZoneList.ts",
"codegen.ts",
"eslint.config.js",
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"babel-plugin-macros": "3.1.0",
"eslint": "8.57.1",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-lingui": "0.7.0",
"eslint-plugin-lingui": "0.8.1",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.0.0",
"husky": "9.1.6",
Expand Down
117 changes: 111 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export class ErrorBoundary extends Component<

static getDerivedStateFromError(error: unknown): State {
// Update state so the next render will show the fallback UI.
console.log("getDerivedStateFromError called", error);
return { error };
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Datagrid/renderers.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable lingui/no-unlocalized-strings */
import { Box, Tooltip } from "@mui/material";
import _ from "lodash";
import { ReactElement, ReactNode, useContext } from "react";
Expand Down
1 change: 1 addition & 0 deletions src/components/Error/ErrorDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ErrorDetail = ({ error, additionalDetails }: Props) => {

const stringError = JSON.stringify(error, undefined, 2);

// eslint-disable-next-line lingui/no-unlocalized-strings
const errorDetails = `
URL: ${document.location}
VERSION: ${VERSION.shortHash}
Expand Down
1 change: 1 addition & 0 deletions src/form/DateFieldHelpers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dayjs, { Dayjs } from "dayjs";

// eslint-disable-next-line lingui/no-unlocalized-strings
const ADS_DEFAULT_TIMEZONE = "America/New_York";

export const defaultStartDate = (): string =>
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useEffect } from "react";
import { findLocale } from "./i18n";

console.log(
// eslint-disable-next-line lingui/no-unlocalized-strings
`https://github.com/brave/ads-ui rev ${VERSION.shortHash} built ${VERSION.buildTime}`,
);

Expand Down
1 change: 1 addition & 0 deletions src/user/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default function User() {
flex={1}
component="main"
marginTop="64px"
// eslint-disable-next-line lingui/no-unlocalized-strings
height="calc(100% - 64px)"
overflow="auto"
padding={1}
Expand Down
1 change: 1 addition & 0 deletions src/user/reporting/csv.library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ async function transformConversionEnvelope(blob: Blob): Promise<Blob> {
Papa.parse(text, {
header: true,
transform(value: string, field: string) {
// eslint-disable-next-line lingui/no-unlocalized-strings
if (field.includes("Conversion")) {
const { ciphertext, nonce, epk }: Envelope = JSON.parse(value);
const res = tweetnacl.box.open(
Expand Down
1 change: 1 addition & 0 deletions src/user/views/user/search/CreateSearchCampaign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function CreateSearchCampaign({ domain }: Props) {
<CardContainer
childSx={{
width: "800px",
// eslint-disable-next-line lingui/no-unlocalized-strings
height: "calc(100vh - 110px)",
}}
>
Expand Down
1 change: 1 addition & 0 deletions src/util/billingType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function uiLabelsForBillingType(
billingType: string | undefined | null,
): BillingTypeLabels {
if (!billingType) {
// eslint-disable-next-line lingui/no-unlocalized-strings
return { value: "N/A", shortLabel: "N/A", longLabel: t`Unknown` };
}

Expand Down

0 comments on commit 47c3617

Please sign in to comment.