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:
@@ -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",
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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",
|
||||
|
||||
1
apps/partner-sas/types/window.d.ts
vendored
1
apps/partner-sas/types/window.d.ts
vendored
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
interface Window {
|
||||
dataLayer: {
|
||||
[key: string]: any
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable import/no-anonymous-default-export */
|
||||
import type { Context } from "@netlify/functions"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable import/no-anonymous-default-export */
|
||||
import type { Config, Context } from "@netlify/functions"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import { performWarmup } from "./warmup-background.mjs"
|
||||
|
||||
import type { Config, Context } from "@netlify/functions"
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
|
||||
|
||||
import type { MeetingRooms } from "../meetingRooms"
|
||||
|
||||
export type MeetingsAndConferencesSidePeekProps = {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -5337,7 +5337,6 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@scandic-hotels/partner-sas@workspace:apps/partner-sas"
|
||||
dependencies:
|
||||
"@eslint/eslintrc": "npm:^3.3.1"
|
||||
"@eslint/js": "npm:^9.26.0"
|
||||
"@formatjs/intl": "npm:^3.1.6"
|
||||
"@netlify/plugin-nextjs": "npm:^5.14.4"
|
||||
@@ -5357,6 +5356,7 @@ __metadata:
|
||||
"@types/react-dom": "npm:^19.2.3"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.32.0"
|
||||
"@typescript-eslint/parser": "npm:^8.32.0"
|
||||
"@typescript/native-preview": "npm:^7.0.0-dev.20251104.1"
|
||||
babel-plugin-formatjs: "npm:^10.5.39"
|
||||
eslint: "npm:^9"
|
||||
eslint-config-next: "npm:15.3.2"
|
||||
@@ -5420,7 +5420,6 @@ __metadata:
|
||||
dependencies:
|
||||
"@contentstack/live-preview-utils": "npm:^3.2.1"
|
||||
"@eslint/compat": "npm:^1.2.9"
|
||||
"@eslint/eslintrc": "npm:^3.3.1"
|
||||
"@eslint/js": "npm:^9.26.0"
|
||||
"@formatjs/cli": "npm:^6.7.1"
|
||||
"@formatjs/intl": "npm:^3.1.6"
|
||||
@@ -5462,6 +5461,7 @@ __metadata:
|
||||
"@types/supercluster": "npm:^7.1.3"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.32.0"
|
||||
"@typescript-eslint/parser": "npm:^8.32.0"
|
||||
"@typescript/native-preview": "npm:^7.0.0-dev.20251104.1"
|
||||
"@vis.gl/react-google-maps": "npm:^1.5.2"
|
||||
"@vitejs/plugin-react": "npm:^5.0.0"
|
||||
adm-zip: "npm:^0.5.16"
|
||||
|
||||
Reference in New Issue
Block a user