Skip to content

Commit 2e7a9e9

Browse files
committed
migrate eslint, fix lint warnings
1 parent 1da95e6 commit 2e7a9e9

File tree

14 files changed

+117
-102
lines changed

14 files changed

+117
-102
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 57 deletions
This file was deleted.

eslint.config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
import { FlatCompat } from '@eslint/eslintrc';
4+
import js from '@eslint/js';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
recommendedConfig: js.configs.recommended,
11+
allConfig: js.configs.all,
12+
});
13+
14+
export default [
15+
{
16+
ignores: [
17+
'**/node_modules',
18+
'**/dist',
19+
'**/build',
20+
'**/generated',
21+
'packages/cli/tests/cli/init',
22+
'packages/cli/tests/cli/validation',
23+
'packages/ts/test/',
24+
'**/examples',
25+
'**/vitest.config.ts',
26+
],
27+
},
28+
...compat.extends('@theguild'),
29+
{
30+
rules: {
31+
'import/extensions': 'off',
32+
'unicorn/no-array-push-push': 'off',
33+
'import/no-default-export': 'off',
34+
'@typescript-eslint/no-explicit-any': 'off',
35+
'@typescript-eslint/ban-types': 'off',
36+
eqeqeq: 'off',
37+
'@typescript-eslint/no-unused-vars': 'off',
38+
},
39+
},
40+
{
41+
files: ['packages/ts/**'],
42+
43+
rules: {
44+
'@typescript-eslint/no-namespace': 'off',
45+
'sonarjs/no-inverted-boolean-check': 'off',
46+
'no-loss-of-precision': 'warn',
47+
},
48+
},
49+
{
50+
files: ['packages/cli/**'],
51+
52+
rules: {
53+
'no-restricted-imports': [
54+
'error',
55+
{
56+
patterns: [
57+
{
58+
group: ['@whatwg-node/fetch'],
59+
message: 'Please use `fetch` from `./packages/cli/src/fetch.ts`.',
60+
},
61+
],
62+
},
63+
],
64+
},
65+
},
66+
];

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "graphprotocol-tools-monorepo",
3+
"type": "module",
34
"repository": {
45
"type": "git",
56
"url": "git+https://github.com/graphprotocol/graph-cli"
@@ -17,8 +18,8 @@
1718
"scripts": {
1819
"build": "pnpm --filter=@graphprotocol/graph-* build",
1920
"lint": "pnpm lint:prettier && pnpm lint:eslint",
20-
"lint:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint .",
21-
"lint:eslint:fix": "ESLINT_USE_FLAT_CONFIG=false eslint . --fix",
21+
"lint:eslint": "eslint .",
22+
"lint:eslint:fix": "eslint . --fix",
2223
"lint:fix": "pnpm lint:prettier:fix && pnpm lint:eslint:fix",
2324
"lint:prettier": "prettier -c .",
2425
"lint:prettier:fix": "prettier . --write",
@@ -30,6 +31,7 @@
3031
"devDependencies": {
3132
"@changesets/changelog-github": "^0.5.0",
3233
"@changesets/cli": "^2.27.10",
34+
"@eslint/js": "^9.16.0",
3335
"@theguild/eslint-config": "0.13.1",
3436
"@theguild/prettier-config": "3.0.0",
3537
"@types/node": "^22.10.1",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "tsc && vite build",
88
"clean": "rimraf ./dist",
99
"dev": "vite",
10-
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --report-unused-disable-directives",
10+
"lint": "eslint . --report-unused-disable-directives",
1111
"prebuild": "tsr generate",
1212
"preview": "vite preview"
1313
},

website/src/components/Dropzone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const ACCEPTED_IMAGE_TYPES = {
1313
};
1414

1515
// Limit avatar images to 1mb
16-
const MAX_IMAGE_SIZE = 1000000;
16+
const MAX_IMAGE_SIZE = 1_000_000;
1717

1818
const BOX_SIZE = 152;
1919

website/src/components/ui/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const FormControl = React.forwardRef<
105105
<Slot
106106
ref={ref}
107107
id={formItemId}
108-
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
108+
aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}
109109
aria-invalid={!!error}
110110
{...props}
111111
/>

website/src/components/ui/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { cn } from '@/lib/utils';
33

4-
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
4+
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
55

66
const Input = React.forwardRef<HTMLInputElement, InputProps>(
77
({ className, type, ...props }, ref) => {

website/src/components/ui/textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { cn } from '@/lib/utils';
33

4-
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
4+
type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
55

66
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
77
({ className, ...props }, ref) => {

website/src/components/ui/toaster.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function Toaster() {
1313

1414
return (
1515
<ToastProvider>
16-
{toasts.map(function ({ id, title, description, action, ...props }) {
16+
{toasts.map(({ id, title, description, action, ...props }) => {
1717
return (
1818
<Toast key={id} {...props}>
1919
<div className="grid gap-1">

0 commit comments

Comments
 (0)