Merged in chore/eslint9 (pull request #2029)
chore: Update to ESLint 9 * wip: apply codemod and upgrade swc plugin * Update eslint to 9 in scandic-web apply code mod to config fix existing lint issues * Remove uneccessary fixupConfigRules * Update eslint to 9 in design-system * Add lint turbo dependency * Move redis-api to eslint and prettier instead of biome * Simplify eslint configs * Clean up * Apply linting Approved-by: Linus Flood
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
{
|
||||
"extends": ["next/core-web-vitals", "plugin:import/typescript"],
|
||||
"plugins": ["simple-import-sort", "@typescript-eslint", "formatjs"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"no-unused-vars": "off",
|
||||
"react/function-component-definition": "error",
|
||||
"simple-import-sort/imports": [
|
||||
"error",
|
||||
{
|
||||
"groups": [
|
||||
// Side effect imports.
|
||||
["^\\u0000"],
|
||||
// Node.js builtins.
|
||||
["^node:"],
|
||||
// NPM packages.
|
||||
["^@?\\w"],
|
||||
// Internal packages.
|
||||
["^@scandic-hotels/(?!.*\u0000$).*$"],
|
||||
// Local imports (lib, constants, etc.), excl. types.
|
||||
[
|
||||
"^@/constants/?(?!.*\u0000$).*$",
|
||||
"^@/env/?(?!.*\u0000$).*$",
|
||||
"^@/lib/?(?!.*\u0000$).*$",
|
||||
"^@/server/?(?!.*\u0000$).*$",
|
||||
"^@/stores/?(?!.*\u0000$).*$"
|
||||
],
|
||||
// Local imports (the rest), excl. types.
|
||||
["^@/(?!(types|.*\u0000$)).*$"],
|
||||
// Parent imports. Put `..` last.
|
||||
// Other relative imports. Put same-folder imports and `.` last.
|
||||
[
|
||||
"^\\.\\.(?!/?$)",
|
||||
"^\\.\\./?$",
|
||||
"^\\./(?=.*/)(?!/?$)",
|
||||
"^\\.(?!/?$)",
|
||||
"^\\./?$"
|
||||
],
|
||||
// Style imports.
|
||||
["^(?!\\u0000).+\\.s?css$"],
|
||||
// Node.js builtins and NPM packages type imports.
|
||||
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
|
||||
// Local type imports.
|
||||
[
|
||||
"^@scandichotels/.*\\u0000$",
|
||||
"^@/types/.*",
|
||||
"^@/.*\\u0000$",
|
||||
"^[^.].*\\u0000$",
|
||||
"^\\..*\\u0000$"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"simple-import-sort/exports": "error",
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
"import/no-duplicates": [
|
||||
"error",
|
||||
{
|
||||
"prefer-inline": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"args": "all",
|
||||
"argsIgnorePattern": "^_",
|
||||
"caughtErrors": "all",
|
||||
"caughtErrorsIgnorePattern": "^_",
|
||||
"destructuredArrayIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"ignoreRestSiblings": true
|
||||
}
|
||||
],
|
||||
// "formatjs/enforce-description": ["warn", "anything"],
|
||||
"formatjs/enforce-default-message": ["error", "literal"],
|
||||
"formatjs/enforce-placeholders": ["error"],
|
||||
"formatjs/enforce-plural-rules": ["error"],
|
||||
"formatjs/no-literal-string-in-jsx": ["error"],
|
||||
"formatjs/no-multiple-whitespaces": ["error"],
|
||||
"formatjs/no-multiple-plurals": ["error"],
|
||||
"formatjs/no-invalid-icu": ["error"],
|
||||
"formatjs/no-id": ["error"],
|
||||
"formatjs/no-complex-selectors": ["error"],
|
||||
"formatjs/no-useless-message": ["error"],
|
||||
"formatjs/prefer-pound-in-plural": ["error"]
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -15,7 +15,11 @@ import { getIntl } from "@/i18n"
|
||||
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
||||
import { parseSelectHotelSearchParams } from "@/utils/url"
|
||||
|
||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||
import {
|
||||
type LangParams,
|
||||
type NextSearchParams,
|
||||
type PageArgs,
|
||||
} from "@/types/params"
|
||||
|
||||
export default async function AlternativeHotelsPage(
|
||||
props: PageArgs<LangParams, NextSearchParams>
|
||||
|
||||
@@ -24,7 +24,6 @@ export default async function HotelReservationPage(
|
||||
}
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line formatjs/no-literal-string-in-jsx
|
||||
<div className={styles.page}>
|
||||
<TrackingSDK pageData={pageTrackingData} />
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import HotelMarkerByType from "@/components/Maps/Markers"
|
||||
|
||||
@@ -6,11 +6,10 @@ import type {
|
||||
NucleoIconProps,
|
||||
} from "@scandic-hotels/design-system/Icons"
|
||||
import type { MaterialIconSetIconProps } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import type { JSX } from "react"
|
||||
|
||||
import { FacilityEnum } from "@/types/enums/facilities"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
const facilityToIconMap: Record<FacilityEnum, IconName> = {
|
||||
[FacilityEnum.AccessibleBathingControls]: IconName.StarFilled,
|
||||
[FacilityEnum.AccessibleBathtubs]: IconName.StarFilled,
|
||||
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
|
||||
import { ChildBedTypeEnum } from "@/constants/booking"
|
||||
|
||||
import type { JSX } from "react"
|
||||
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import {
|
||||
RoomPackageCodeEnum,
|
||||
@@ -13,8 +15,6 @@ import {
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
interface IconForFeatureCodeProps {
|
||||
featureCode: RoomPackageCodes
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ import type {
|
||||
IconProps,
|
||||
NucleoIconProps,
|
||||
} from "@scandic-hotels/design-system/Icons"
|
||||
|
||||
import type { JSX } from "react";
|
||||
import type { JSX } from "react"
|
||||
|
||||
interface IconByIconNameProps {
|
||||
iconName: IconName | null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Dispatch, SetStateAction, JSX } from "react";
|
||||
import type { Dispatch, JSX, SetStateAction } from "react"
|
||||
|
||||
export enum AnimationStateEnum {
|
||||
unmounted = "unmounted",
|
||||
|
||||
@@ -36,7 +36,6 @@ import type {
|
||||
NucleoIconProps,
|
||||
} from "@scandic-hotels/design-system/Icons"
|
||||
import type { MaterialSymbolProps } from "@scandic-hotels/design-system/Icons/MaterialIcon/MaterialSymbol"
|
||||
|
||||
import type { JSX } from "react"
|
||||
|
||||
interface FacilityIconProps {
|
||||
|
||||
@@ -3,11 +3,11 @@ import {
|
||||
type MaterialIconSetIconProps,
|
||||
} from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
|
||||
import type { JSX } from "react"
|
||||
|
||||
import { AlertTypeEnum } from "@/types/enums/alert"
|
||||
import type { AlertProps } from "./alert"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
interface IconByAlertProps {
|
||||
alertType: AlertTypeEnum
|
||||
variant?: AlertProps["variant"]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { IconProps } from "@scandic-hotels/design-system/Icons"
|
||||
|
||||
import type { JSX } from "react";
|
||||
import type { JSX } from "react"
|
||||
|
||||
export interface RadioCardProps
|
||||
extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "title"> {
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
import { FlatCompat } from "@eslint/eslintrc"
|
||||
import js from "@eslint/js"
|
||||
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
||||
import tsParser from "@typescript-eslint/parser"
|
||||
import { defineConfig } from "eslint/config"
|
||||
import formatjs from "eslint-plugin-formatjs"
|
||||
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
||||
|
||||
const compat = new FlatCompat({
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
})
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"),
|
||||
plugins: {
|
||||
"simple-import-sort": simpleImportSort,
|
||||
"@typescript-eslint": typescriptEslint,
|
||||
formatjs,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
},
|
||||
|
||||
rules: {
|
||||
"no-unused-vars": "off",
|
||||
"react/function-component-definition": "error",
|
||||
|
||||
"simple-import-sort/imports": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
["^\\u0000"],
|
||||
["^node:"],
|
||||
["^@?\\w"],
|
||||
["^@scandic-hotels/(?!.*\u0000$).*$"],
|
||||
[
|
||||
"^@/constants/?(?!.*\u0000$).*$",
|
||||
"^@/env/?(?!.*\u0000$).*$",
|
||||
"^@/lib/?(?!.*\u0000$).*$",
|
||||
"^@/server/?(?!.*\u0000$).*$",
|
||||
"^@/stores/?(?!.*\u0000$).*$",
|
||||
],
|
||||
["^@/(?!(types|.*\u0000$)).*$"],
|
||||
[
|
||||
"^\\.\\.(?!/?$)",
|
||||
"^\\.\\./?$",
|
||||
"^\\./(?=.*/)(?!/?$)",
|
||||
"^\\.(?!/?$)",
|
||||
"^\\./?$",
|
||||
],
|
||||
["^(?!\\u0000).+\\.s?css$"],
|
||||
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
|
||||
[
|
||||
"^@scandichotels/.*\\u0000$",
|
||||
"^@/types/.*",
|
||||
"^@/.*\\u0000$",
|
||||
"^[^.].*\\u0000$",
|
||||
"^\\..*\\u0000$",
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
"simple-import-sort/exports": "error",
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
|
||||
"import/no-duplicates": [
|
||||
"error",
|
||||
{
|
||||
"prefer-inline": true,
|
||||
},
|
||||
],
|
||||
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "all",
|
||||
argsIgnorePattern: "^_",
|
||||
caughtErrors: "all",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
destructuredArrayIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
ignoreRestSiblings: true,
|
||||
},
|
||||
],
|
||||
|
||||
"formatjs/enforce-default-message": ["error", "literal"],
|
||||
"formatjs/enforce-placeholders": ["error"],
|
||||
"formatjs/enforce-plural-rules": ["error"],
|
||||
"formatjs/no-literal-string-in-jsx": ["error"],
|
||||
"formatjs/no-multiple-whitespaces": ["error"],
|
||||
"formatjs/no-multiple-plurals": ["error"],
|
||||
"formatjs/no-invalid-icu": ["error"],
|
||||
"formatjs/no-id": ["error"],
|
||||
"formatjs/no-complex-selectors": ["error"],
|
||||
"formatjs/no-useless-message": ["error"],
|
||||
"formatjs/prefer-pound-in-plural": ["error"],
|
||||
},
|
||||
},
|
||||
])
|
||||
@@ -114,6 +114,9 @@
|
||||
"zustand": "^4.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.9",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.26.0",
|
||||
"@formatjs/cli": "^6.7.1",
|
||||
"@lokalise/node-api": "^14.0.0",
|
||||
"@scandic-hotels/typescript-config": "workspace:*",
|
||||
@@ -134,7 +137,7 @@
|
||||
"adm-zip": "^0.5.16",
|
||||
"cypress": "^14.3.3",
|
||||
"dotenv": "^16.5.0",
|
||||
"eslint": "^8",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.3.2",
|
||||
"eslint-plugin-formatjs": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["@scandic-hotels/design-system#build"]
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": ["@scandic-hotels/design-system#build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { JSX } from "react"
|
||||
|
||||
import type { MembershipLevel } from "@/constants/membershipLevels"
|
||||
import type { LoyaltyLevel } from "@/server/routers/contentstack/loyaltyLevel/output"
|
||||
import type { CMSReward } from "../trpc/routers/contentstack/reward"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
export type OverviewTableClientProps = {
|
||||
activeMembership: MembershipLevel | null
|
||||
levels: ComparisonLevel[]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RTETypeEnum } from "./enums"
|
||||
import type { JSX } from "react"
|
||||
|
||||
import type { EmbedByUid } from "../components/deprecatedjsontohtml"
|
||||
import type {
|
||||
@@ -8,10 +8,9 @@ import type {
|
||||
RTEImageVaultAttrs,
|
||||
RTELinkAttrs,
|
||||
} from "./attrs"
|
||||
import type { RTETypeEnum } from "./enums"
|
||||
import type { RenderOptions } from "./option"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
export interface RTEDefaultNode {
|
||||
attrs: Attributes
|
||||
children: RTENode[]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { JSX } from "react"
|
||||
|
||||
import type { EmbedByUid } from "../jsontohtml"
|
||||
import type {
|
||||
Attributes,
|
||||
@@ -9,8 +11,6 @@ import type {
|
||||
import type { RTETypeEnum } from "./enums"
|
||||
import type { RenderOptions } from "./option"
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
export interface RTEDefaultNode {
|
||||
attrs: Attributes
|
||||
children: RTENode[]
|
||||
|
||||
Reference in New Issue
Block a user