Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint-config-bases updated to typescript-eslint v8 #6025

Merged
merged 9 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .ncurc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ reject:
[
'eslint',
'eslint-plugin-react-hooks',
'eslint-plugin-sonarjs',
'@pothos/plugin-prisma',
'@pothos/core',
'@pothos/plugin-errors',
'@typescript-eslint/parser',
'@typescript-eslint/eslint-plugin',
]
2 changes: 1 addition & 1 deletion apps/nextjs-app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NEXT_BUILD_ENV_SOURCEMAPS=false
#######################################################################################

# DATABASE_URL
# When deploying on serveless/lambdas "?connection_limit=" should be 1
# When deploying on serverless/lambdas "?connection_limit=" should be 1
# @see https://www.prisma.io/docs/concepts/components/prisma-client/deployment#recommended-connection-limit
PRISMA_DATABASE_URL=postgresql://nextjs:!ChangeMe!@localhost:5432/maindb?schema=public

Expand Down
5 changes: 3 additions & 2 deletions apps/nextjs-app/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
project: 'tsconfig.json',
},
ignorePatterns: [...getDefaultIgnorePatterns(), '.next', '.out'],
extends: [
'@your-org/eslint-config-bases/typescript',
'@your-org/eslint-config-bases/import-x',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/jest',
Expand Down Expand Up @@ -55,7 +56,7 @@ module.exports = {
},
},
{
files: ['src/pages/\\_*.{ts,tsx}'],
files: [String.raw`src/pages/\_*.{ts,tsx}`],
rules: {
'react/display-name': 'off',
},
Expand Down
1 change: 0 additions & 1 deletion apps/nextjs-app/config/tests/I18nextTestStubProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* Fully wrapped strategy for i18next, you can use stub/mocks as well
* @link {https://react.i18next.com/misc/testing}
*/
// eslint-disable-next-line import/no-named-as-default-member
void i18next.use(initReactI18next).init({

Check warning on line 10 in apps/nextjs-app/config/tests/I18nextTestStubProvider.tsx

View workflow job for this annotation

GitHub Actions / test (20.x)

Caution: `i18next` also has a named export `use`. Check if you meant to write `import {use} from 'i18next'` instead
lng: 'en',
fallbackLng: 'en',
ns: ['common'],
Expand Down
2 changes: 2 additions & 0 deletions apps/nextjs-app/config/tests/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ const customRender = (ui: ReactElement, options?: any) =>
});

// re-export everything
// eslint-disable-next-line import-x/export
export * from '@testing-library/react';
export { default as userEvent } from '@testing-library/user-event';

// override render method
// eslint-disable-next-line import-x/export
export { customRender as render };
2 changes: 1 addition & 1 deletion apps/nextjs-app/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { devices, type PlaywrightTestConfig } from '@playwright/test';
*/
const config: PlaywrightTestConfig = {
testDir: '.',
timeout: 6_000,
timeout: 6000,
/* Maximum time one test can run for. */
/* Opt out of parallel tests on CI. */
// workers: process.env.CI ? 1 : undefined,
Expand Down
18 changes: 12 additions & 6 deletions apps/nextjs-app/next-i18next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from 'path';

const debugI18n = ['true', 1].includes(
process?.env?.NEXTJS_DEBUG_I18N ?? 'false'
);
Expand All @@ -8,6 +6,17 @@ const localePublicFolder = undefined;

export const defaultLocale = 'en';

const getLocalesPath = async () => {
if ('window' in globalThis) {
return localePublicFolder;
}
// eslint-disable-next-line unicorn/prefer-node-protocol,unicorn/import-style
const path = await import('path').then((mod) => mod.default);
return path.resolve('../../packages/common-i18n/src/locales');
};

const localePath = await getLocalesPath();

/**
* @type {import('next-i18next').UserConfig}
*/
Expand All @@ -29,8 +38,5 @@ export default {
escapeValue: false,
},
*/
localePath:
typeof window === 'undefined'
? path.resolve('../../packages/common-i18n/src/locales')
: localePublicFolder,
localePath,
};
2 changes: 1 addition & 1 deletion apps/nextjs-app/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const workspaceRoot = path.resolve(
* @type {import('type-fest').PackageJson}
*/
const packageJson = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url)).toString('utf-8')
readFileSync(new URL('package.json', import.meta.url)).toString('utf8')
);

const isProd = process.env.NODE_ENV === 'production';
Expand Down
14 changes: 7 additions & 7 deletions apps/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dev": "next",
"fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
"flamegraph-home": "npx 0x --output-dir './.debug/flamegraph/{pid}.0x' --on-port 'autocannon http://localhost:$PORT --duration 20' -- node ../../node_modules/.bin/next start",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/nextjs-app.eslintcache",
"lint": "TIMING=1 eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/nextjs-app.eslintcache",
"start": "next start",
"test": "yarn test-unit",
"test-e2e": "cross-env E2E_WEBSERVER_MODE=BUILD_AND_START playwright test",
Expand Down Expand Up @@ -90,7 +90,7 @@
"graphql": "16.9.0",
"graphql-jit": "0.8.6",
"graphql-yoga": "5.7.0",
"i18next": "23.16.0",
"i18next": "23.16.2",
"jose": "5.9.4",
"ky": "1.7.2",
"next": "14.2.15",
Expand All @@ -103,7 +103,7 @@
"picocolors": "1.1.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form": "7.53.0",
"react-hook-form": "7.53.1",
"react-i18next": "15.0.3",
"rippleui": "1.12.1",
"rooks": "7.14.1",
Expand All @@ -116,7 +116,7 @@
"devDependencies": {
"@next/bundle-analyzer": "14.2.15",
"@next/env": "14.2.15",
"@playwright/test": "1.48.0",
"@playwright/test": "1.48.1",
"@prisma/nextjs-monorepo-workaround-plugin": "5.21.1",
"@size-limit/file": "11.1.6",
"@svgr/webpack": "8.1.0",
Expand All @@ -128,9 +128,9 @@
"@testing-library/user-event": "14.5.2",
"@types/cors": "2.8.17",
"@types/is-ci": "3.0.4",
"@types/node": "22.7.6",
"@types/node": "22.7.7",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"@types/react-dom": "18.3.1",
"@types/react-test-renderer": "18.3.0",
"@vitejs/plugin-react-swc": "3.7.1",
"@vitest/coverage-v8": "2.1.3",
Expand All @@ -141,7 +141,7 @@
"dotenv-flow-cli": "1.1.1",
"es-check": "7.2.1",
"eslint": "8.57.1",
"eslint-config-next": "14.2.15",
"eslint-config-next": "15.0.0-rc.1",
"eslint-plugin-tailwindcss": "3.17.5",
"is-ci": "3.0.1",
"jsdom": "25.0.1",
Expand Down
144 changes: 0 additions & 144 deletions apps/nextjs-app/playwright.config.old.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/nextjs-app/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { devices, type PlaywrightTestConfig } from '@playwright/test';

const isCI = ['true', '1'].includes(process.env?.CI ?? '');

const outputDir = new URL('./e2e/.out', import.meta.url).pathname;
const outputDir = new URL('e2e/.out', import.meta.url).pathname;
const testDir = new URL('e2e', import.meta.url).pathname;

// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
testDir: testDir,
timeout: 6_000,
timeout: 6000,
/* Maximum time one test can run for. */
/* Opt out of parallel tests on CI. */
// workers: process.env.CI ? 1 : undefined,
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs-app/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Sentry.init({
console.log('Sentry event', event);
console.log('Sentry hint', hint);
}
return Promise.resolve(event);
return event;
},
ignoreErrors: [
/**
Expand Down
6 changes: 1 addition & 5 deletions apps/nextjs-app/src/components/banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Speaker as SpeakerIcon, Close as XIcon } from '@mui/icons-material';
import type { FC } from 'react';

type Props = {
children?: never;
};

export const Banner: FC<Props> = () => {
export const Banner: FC = () => {
return (
<div className="bg-indigo-600">
<div className="mx-auto max-w-7xl p-3 sm:px-6 lg:px-8">
Expand Down

This file was deleted.

Loading
Loading