Merged in chore/migrate-from-next-lint (pull request #3263)

chore: Migrate from next lint to eslint

* Migrate scandic-web

* Migrate partner-sas

* Enable any rule in partner-sas


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-12-02 10:08:56 +00:00
parent be28982e73
commit 5da3e457cb
18 changed files with 62 additions and 30 deletions

View File

@@ -12,6 +12,22 @@ const compat = new FlatCompat({
})
export default defineConfig([
{
ignores: [
".next/**",
"node_modules/**",
"dist/**",
"build/**",
"public/**",
"playwright-report/**",
"test-results/**",
"coverage/**",
"*.config.js",
"*.config.ts",
"*.config.mjs",
"next-env.d.ts",
],
},
{
extends: compat.extends(
"next/core-web-vitals",
@@ -80,6 +96,8 @@ export default defineConfig([
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": [
"error",

View File

@@ -2,13 +2,11 @@ import path from "node:path"
const WEB_ROOT = path.join(process.cwd(), "apps/partner-sas/")
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
const buildEslintCommand = (filenames) => {
const cmd = `next lint --fix --max-warnings 0 --file ${filenames
const files = filenames
.map((f) => `'${path.relative(WEB_ROOT, f)}'`)
.join(" --file ")}`
return cmd
.join(" ")
return `eslint --fix --no-warn-ignored --max-warnings 0 ${files}`
}
const config = {

View File

@@ -7,8 +7,8 @@
"dev": "NODE_OPTIONS=--openssl-legacy-provider PORT=3001 NEXT_PUBLIC_PORT=3001 next dev --turbo",
"build": "next build",
"start": "node .next/standalone/server.js",
"lint": "next lint --max-warnings 0 && tsgo --noEmit",
"lint:fix": "next lint --fix && tsgo --noEmit",
"lint": "eslint --max-warnings 0 . && tsgo --noEmit",
"lint:fix": "eslint --fix . && tsgo --noEmit",
"check-types": "tsgo --noEmit",
"typegen": "next typegen",
"clean": "rm -rf .next",
@@ -42,7 +42,6 @@
"usehooks-ts": "3.1.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.26.0",
"@playwright/test": "^1.53.1",
"@scandic-hotels/common": "workspace:*",
@@ -53,6 +52,7 @@
"@types/react-dom": "^19.2.3",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@typescript/native-preview": "^7.0.0-dev.20251104.1",
"babel-plugin-formatjs": "^10.5.39",
"eslint": "^9",
"eslint-config-next": "15.3.2",

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
interface Window {
dataLayer: {
[key: string]: any

View File

@@ -12,6 +12,23 @@ const compat = new FlatCompat({
})
export default defineConfig([
{
ignores: [
".next/**",
"node_modules/**",
"dist/**",
"build/**",
".netlify/**",
"public/**",
"playwright-report/**",
"test-results/**",
"coverage/**",
"*.config.js",
"*.config.ts",
"*.config.mjs",
"next-env.d.ts",
],
},
{
extends: compat.extends(
"next/core-web-vitals",
@@ -79,6 +96,8 @@ export default defineConfig([
],
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": [
"warn",

View File

@@ -2,13 +2,11 @@ import path from "node:path"
const WEB_ROOT = path.join(process.cwd(), "apps/scandic-web/")
// https://nextjs.org/docs/app/building-your-application/configuring/eslint#lint-staged
const buildEslintCommand = (filenames) => {
const cmd = `next lint --fix --max-warnings 0 --file ${filenames
const files = filenames
.map((f) => `'${path.relative(WEB_ROOT, f)}'`)
.join(" --file ")}`
return cmd
.join(" ")
return `eslint --fix --no-warn-ignored --max-warnings 0 ${files}`
}
const config = {

View File

@@ -1,9 +1,9 @@
import { type NextMiddleware, NextResponse } from "next/server"
import { getPublicNextURL } from "@/server/utils"
import { findLang } from "@scandic-hotels/common/utils/languages"
import { getPublicNextURL } from "@/server/utils"
import { getDefaultRequestHeaders } from "./utils"
import type { MiddlewareMatcher } from "@/types/middleware"

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
/* eslint-disable import/no-anonymous-default-export */
import type { Context } from "@netlify/functions"

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
/* eslint-disable import/no-anonymous-default-export */
import type { Config, Context } from "@netlify/functions"

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { performWarmup } from "./warmup-background.mjs"
import type { Config, Context } from "@netlify/functions"

View File

@@ -6,8 +6,8 @@
"scripts": {
"build": "next build",
"dev": "NODE_OPTIONS=--openssl-legacy-provider PORT=3000 NEXT_PUBLIC_PORT=3000 next dev --turbo",
"lint": "next typegen && next lint --max-warnings 0 && tsc",
"lint:fix": "next typegen && next lint --fix --max-warnings 0 && tsc",
"lint": "next typegen && eslint --max-warnings 0 . && tsgo --noEmit",
"lint:fix": "next typegen && eslint --fix --max-warnings 0 . && tsgo --noEmit",
"start": "node .next/standalone/server.js",
"test:setup": "yarn build && yarn start",
"preinstall": "/bin/sh -c \"export $(cat .env.local | grep -v '^#' | xargs)\"",
@@ -48,6 +48,7 @@
"@tsparticles/confetti": "^3.8.1",
"@types/geojson": "^7946.0.16",
"@types/supercluster": "^7.1.3",
"@typescript/native-preview": "^7.0.0-dev.20251104.1",
"@vis.gl/react-google-maps": "^1.5.2",
"class-variance-authority": "^0.7.1",
"client-only": "^0.0.1",
@@ -87,7 +88,6 @@
},
"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",

View File

@@ -1,5 +1,4 @@
import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/headers/dynamicContent"
import type { z } from "zod"
import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/headers/dynamicContent"
export type HeaderDynamicContentProps = z.infer<typeof dynamicContentSchema>

View File

@@ -1,4 +1,5 @@
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
import type { MeetingRooms } from "../meetingRooms"
export type MeetingsAndConferencesSidePeekProps = {

View File

@@ -1,5 +1,4 @@
import type { mapLocationSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/mapLocation"
import type { z } from "zod"
import type { mapLocationSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/mapLocation"
export type MapLocation = z.output<typeof mapLocationSchema>

View File

@@ -1,10 +1,9 @@
import type { z } from "zod"
import type {
validateLinkItem,
validateLinksWithType,
validateSecondaryLinks,
} from "@scandic-hotels/trpc/routers/contentstack/base/output"
import type { z } from "zod"
export type FooterLink = z.output<typeof validateLinkItem>
export type FooterSecondaryNavGroup = z.output<typeof validateSecondaryLinks>

View File

@@ -7,10 +7,6 @@ function base64ToUint8Array(base64String: string) {
return byteArray
}
function utf8ToUint8Array(utf8String: string) {
return new TextEncoder().encode(utf8String)
}
function uint8ArrayToUtf8(uint8Array: Uint8Array) {
return new TextDecoder().decode(uint8Array)
}

View File

@@ -10,6 +10,7 @@ import { cache as reactCache } from "react"
*
* @param fn - The function to memoize
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function cache<T extends (...args: any[]) => any>(fn: T) {
const cachedFunction = reactCache((stringifiedParams: string) => {
return fn(...JSON.parse(stringifiedParams))