Skip to content

Commit

Permalink
Merge pull request #1836 from GW2Treasures/feature/upgrade-eslint-9
Browse files Browse the repository at this point in the history
Upgrade eslint to 9.16.0
  • Loading branch information
darthmaim authored Dec 6, 2024
2 parents d8cd86e + c206782 commit 30b83f2
Show file tree
Hide file tree
Showing 40 changed files with 423 additions and 287 deletions.
5 changes: 0 additions & 5 deletions apps/legacy-importer/.eslintrc.json

This file was deleted.

13 changes: 13 additions & 0 deletions apps/legacy-importer/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...compat.extends('@gw2treasures/eslint-config')];
4 changes: 3 additions & 1 deletion apps/legacy-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"gw2-api-types": "0.0.8"
},
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/tsconfig": "workspace:*",
"@types/node": "22.10.1",
"eslint": "8.57.1",
"eslint": "9.16.0",
"prisma": "6.0.1",
"typescript": "5.7.2"
}
Expand Down
19 changes: 0 additions & 19 deletions apps/web/.eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/app/[language]/achievement/[id]/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/no-array-index-key */
import type { Language } from '@gw2treasures/database';
import DetailLayout from '@/components/Layout/DetailLayout';
import { db } from '@/lib/prisma';
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/[language]/homestead/decorations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @next/next/no-img-element */
import { Trans } from '@/components/I18n/Trans';
import { createDataTable } from '@gw2treasures/ui/components/Table/DataTable';
import { db } from '@/lib/prisma';
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/[language]/item/[id]/_edit-content/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { db } from '@/lib/prisma';
import { ContentChance, Prisma, ReviewState } from '@gw2treasures/database';
import { revalidateTag } from 'next/cache';

// eslint-disable-next-line require-await
export async function submitToReview({ itemId, removedItems, addedItems, removedCurrencies, addedCurrencies }: { itemId: number } & EditContentOrder): Promise<EditContentSubmitError | true> {
if(removedItems.length === 0 && addedItems.length === 0 && removedCurrencies.length === 0 && addedCurrencies.length === 0) {
console.log('No changes');
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/[language]/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
};
}

// eslint-disable-next-line require-await
async function redirectToGw2Me(returnTo?: string, additionalScopes?: string) {
'use server';

Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Gw2Api/Gw2ApiProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const Gw2ApiProvider: FC<Gw2ApiProviderProps> = ({ children }) => {
const router = useRouter();
const [hiddenAccounts, setHiddenAccounts] = useLocalStorageState<string[]>('accounts.hidden', []);

// eslint-disable-next-line require-await
const getAccounts = useCallback(async (requiredScopes: Scope[], optionalScopes: Scope[] = [], { includeHidden = false }: GetAccountsOptions = {}) => {
// always return [] during SSR
if(typeof window === 'undefined') {
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Gw2Api/reauthorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Scope, type AuthorizationUrlParams } from '@gw2me/client';
import { redirect } from 'next/navigation';
import 'server-only';

// eslint-disable-next-line require-await
export async function reauthorize(requiredScopes: Scope[], prompt?: AuthorizationUrlParams['prompt']) {

// build redirect url
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Layout/DetailLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const DetailLayout: FC<DetailLayoutProps> = async ({ title, icon, breadcrumb, ch
<TableOfContentContext>
<main className={[styles.main, className].filter(Boolean).join(' ')} style={color ? { '--hero-color': color } : undefined}>
<div className={infobox ? styles.headline : styles.headlineWithoutInfobox}>
{/* eslint-disable-next-line @next/next/no-img-element */}
{icon && typeof icon === 'object' && (isValidElement(icon) ? cloneElement(icon, { className: styles.icon }) : <EntityIcon icon={icon} size={48} className={styles.icon} type={iconType}/>)}
<h1 className={styles.title}>{title}</h1>
{breadcrumb && <div className={styles.breadcrumb}>{breadcrumb}</div>}
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Skill/SkillTooltip.client.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @next/next/no-img-element */
import type { FC } from 'react';
import styles from './SkillTooltip.module.css';
import { Separator } from '@gw2treasures/ui/components/Layout/Separator';
Expand Down
32 changes: 32 additions & 0 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import nextJsPlugin from '@gw2treasures/eslint-plugin-nextjs';
import reactCompiler from 'eslint-plugin-react-compiler';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import { FlatCompat } from '@eslint/eslintrc';

const compat = new FlatCompat({
baseDirectory: import.meta.url,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default tseslint.config(
{ ignores: ['.next'] },
...compat.extends('next/core-web-vitals', '@gw2treasures/eslint-config/react'),
{
plugins: {
'@gw2treasures/nextjs': nextJsPlugin,
'react-compiler': reactCompiler,
},
},
{
files: ['**/page.tsx'],
rules: {
'@gw2treasures/nextjs/require-metadata': 'warn',
},
}, {
files: ['eslint.config.mjs'],
// eslint-disable-next-line import/no-named-as-default-member
extends: [tseslint.configs.disableTypeChecked],
}
);
7 changes: 5 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"sharp": "0.33.5"
},
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2api/types": "0.0.22",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/eslint-plugin-nextjs": "workspace:*",
Expand All @@ -69,14 +71,15 @@
"@types/react-dom": "19.0.1",
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
"csstype": "3.1.3",
"eslint": "8.57.1",
"eslint": "9.16.0",
"eslint-config-next": "15.0.4",
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
"gw2-api-types": "0.0.8",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-node": "10.9.2",
"tslib": "2.8.1",
"typescript": "5.7.2"
"typescript": "5.7.2",
"typescript-eslint": "8.17.0"
}
}
5 changes: 0 additions & 5 deletions apps/worker/.eslintrc.json

This file was deleted.

13 changes: 13 additions & 0 deletions apps/worker/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...compat.extends('@gw2treasures/eslint-config')];
4 changes: 3 additions & 1 deletion apps/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
"sharp": "0.33.5"
},
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2api/types": "0.0.22",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/tsconfig": "workspace:*",
"@types/jest": "29.5.14",
"@types/node": "22.10.1",
"@typescript-eslint/parser": "8.17.0",
"@vercel/ncc": "0.38.3",
"eslint": "8.57.1",
"eslint": "9.16.0",
"jest": "29.7.0",
"ts-jest": "29.2.5",
"typescript": "5.7.2"
Expand Down
1 change: 0 additions & 1 deletion apps/worker/src/jobs/recipes/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Prisma } from '@gw2treasures/database';
import { toId } from '../helper/toId';
import { db } from '../../db';
Expand Down
1 change: 0 additions & 1 deletion apps/worker/src/jobs/skills/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Prisma } from '@gw2treasures/database';
import { LocalizedObject } from '../helper/types';
import { Skill } from '@gw2api/types/data/skill';
Expand Down
1 change: 0 additions & 1 deletion apps/worker/src/jobs/skins/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ interface MigratedSkin {

// eslint-disable-next-line require-await
export async function createMigrator() {
// eslint-disable-next-line require-await
return async function migrate({ de, en, es, fr }: LocalizedObject<Skin>, currentVersion = -1) {
const update: MigratedSkin = {
version: CURRENT_VERSION
Expand Down
7 changes: 6 additions & 1 deletion packages/eslint-config/configs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,10 @@
{ "selector": "default", "format": null },
{ "selector": "typeLike", "format": ["PascalCase"] }
]
}
},

"overrides": [{
"files": ["**/eslint.config.mjs"],
"extends": "plugin:@typescript-eslint/disable-type-checked"
}]
}
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint-plugin-react": "7.37.2"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^9.16.0"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 0 additions & 7 deletions packages/eslint-plugin-nextjs/.eslintrc.json

This file was deleted.

17 changes: 17 additions & 0 deletions packages/eslint-plugin-nextjs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
{ ignores: ['dist/**/*'] },
...compat.extends('@gw2treasures/eslint-config')
];
6 changes: 4 additions & 2 deletions packages/eslint-plugin-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@
"@typescript-eslint/utils": "8.17.0"
},
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/tsconfig": "workspace:*",
"eslint": "8.57.1",
"eslint": "9.16.0",
"tsup": "8.3.5",
"typescript": "5.7.2"
},
"peerDependencies": {
"eslint": "^8.56.0"
"eslint": "^8.56.0 || ^9.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 0 additions & 5 deletions packages/helper/.eslintrc.json

This file was deleted.

13 changes: 13 additions & 0 deletions packages/helper/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...compat.extends('@gw2treasures/eslint-config')];
4 changes: 3 additions & 1 deletion packages/helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
},
"homepage": "https://github.com/GW2Treasures/gw2treasures.com#readme",
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/tsconfig": "workspace:*",
"eslint": "8.57.1",
"eslint": "9.16.0",
"typescript": "5.7.2"
},
"publishConfig": {
Expand Down
9 changes: 0 additions & 9 deletions packages/publish-package/.eslintrc.json

This file was deleted.

17 changes: 17 additions & 0 deletions packages/publish-package/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
{ ignores: ['**/bin/'] },
...compat.extends('@gw2treasures/eslint-config')
];
4 changes: 3 additions & 1 deletion packages/publish-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
},
"homepage": "https://github.com/GW2Treasures/gw2treasures.com#readme",
"devDependencies": {
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
"@gw2treasures/eslint-config": "workspace:*",
"@gw2treasures/tsconfig": "workspace:*",
"@types/node": "22.10.1",
"eslint": "8.57.1",
"eslint": "9.16.0",
"typescript": "5.7.2"
},
"publishConfig": {
Expand Down
13 changes: 0 additions & 13 deletions packages/ui/.eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/ui/components/Form/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export type SwitchControlProps = {
| { type: 'radio', href?: never, replace?: never, scroll?: never, name: string, value: string }
);

export const Switch: FC<SwitchProps> & { Control: FC<SwitchControlProps> } = ({ children }) => {
export const Switch: FC<SwitchProps> & { Control: FC<SwitchControlProps> } = ({ children }: SwitchProps) => {
return (
<Composite className={styles.wrapper}>
{children}
</Composite>
);
};

Switch.Control = ({ children, active, type = 'button', href, clickAction, name, value, icon, tip, replace, scroll }) => {
Switch.Control = ({ children, active, type = 'button', href, clickAction, name, value, icon, tip, replace, scroll }: SwitchControlProps) => {
const Element = type === 'link' ? Link : type === 'radio' ? 'label' : 'button';

const element = (
Expand Down
Loading

0 comments on commit 30b83f2

Please sign in to comment.