diff --git a/templates/_template/eslint.config.mjs b/templates/_template/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/_template/eslint.config.mjs +++ b/templates/_template/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/blank/eslint.config.mjs b/templates/blank/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/blank/eslint.config.mjs +++ b/templates/blank/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/blank/pnpm-lock.yaml b/templates/blank/pnpm-lock.yaml index 60f82b43897..a3b80d6bfd7 100644 --- a/templates/blank/pnpm-lock.yaml +++ b/templates/blank/pnpm-lock.yaml @@ -42,6 +42,9 @@ importers: specifier: 0.32.6 version: 0.32.6 devDependencies: + '@eslint/eslintrc': + specifier: ^3.2.0 + version: 3.2.0 '@types/node': specifier: ^22.5.4 version: 22.10.0 diff --git a/templates/website/eslint.config.mjs b/templates/website/eslint.config.mjs index 46f02aef02f..37d29ea57d2 100644 --- a/templates/website/eslint.config.mjs +++ b/templates/website/eslint.config.mjs @@ -9,6 +9,27 @@ const compat = new FlatCompat({ baseDirectory: __dirname, }) -const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')] +const eslintConfig = [ + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] export default eslintConfig diff --git a/templates/website/src/utilities/generatePreviewPath.ts b/templates/website/src/utilities/generatePreviewPath.ts index 56a9e0ec4f2..80486ce6c82 100644 --- a/templates/website/src/utilities/generatePreviewPath.ts +++ b/templates/website/src/utilities/generatePreviewPath.ts @@ -30,7 +30,7 @@ export const generatePreviewPath = ({ collection, slug, req }: Props) => { process.env.NODE_ENV === 'production' || Boolean(process.env.VERCEL_PROJECT_PRODUCTION_URL) const protocol = isProduction ? 'https:' : req.protocol - let url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}` + const url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}` return url } diff --git a/templates/with-payload-cloud/eslint.config.mjs b/templates/with-payload-cloud/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/with-payload-cloud/eslint.config.mjs +++ b/templates/with-payload-cloud/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/with-postgres/eslint.config.mjs b/templates/with-postgres/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/with-postgres/eslint.config.mjs +++ b/templates/with-postgres/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/with-vercel-mongodb/eslint.config.mjs b/templates/with-vercel-mongodb/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/with-vercel-mongodb/eslint.config.mjs +++ b/templates/with-vercel-mongodb/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/with-vercel-postgres/eslint.config.mjs b/templates/with-vercel-postgres/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/with-vercel-postgres/eslint.config.mjs +++ b/templates/with-vercel-postgres/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/with-vercel-website/eslint.config.mjs b/templates/with-vercel-website/eslint.config.mjs index c85fb67c463..37d29ea57d2 100644 --- a/templates/with-vercel-website/eslint.config.mjs +++ b/templates/with-vercel-website/eslint.config.mjs @@ -1,16 +1,35 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/ban-ts-comment': 'warn', + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: false, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^(_|ignore)', + }, + ], + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/templates/with-vercel-website/src/utilities/generatePreviewPath.ts b/templates/with-vercel-website/src/utilities/generatePreviewPath.ts index 56a9e0ec4f2..80486ce6c82 100644 --- a/templates/with-vercel-website/src/utilities/generatePreviewPath.ts +++ b/templates/with-vercel-website/src/utilities/generatePreviewPath.ts @@ -30,7 +30,7 @@ export const generatePreviewPath = ({ collection, slug, req }: Props) => { process.env.NODE_ENV === 'production' || Boolean(process.env.VERCEL_PROJECT_PRODUCTION_URL) const protocol = isProduction ? 'https:' : req.protocol - let url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}` + const url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}` return url }