Skip to content

Commit c51750b

Browse files
PAMulliganclaude
andcommitted
chore: Add ESLint configuration and fix lint errors
- Add ESLint 9 with TypeScript and React plugins - Add lint and lint:fix scripts to package.json - Configure separate rules for test files and config files - Fix unused imports and eslint-disable directives - Update git remote to new repository Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent eb617bc commit c51750b

6 files changed

Lines changed: 1891 additions & 5 deletions

File tree

app/eslint.config.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import js from "@eslint/js";
2+
import tseslint from "@typescript-eslint/eslint-plugin";
3+
import tsparser from "@typescript-eslint/parser";
4+
import react from "eslint-plugin-react";
5+
import reactHooks from "eslint-plugin-react-hooks";
6+
import globals from "globals";
7+
8+
export default [
9+
js.configs.recommended,
10+
{
11+
// Test files - add vitest globals
12+
files: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}", "**/test/**/*.{ts,tsx}"],
13+
languageOptions: {
14+
parser: tsparser,
15+
parserOptions: {
16+
ecmaVersion: "latest",
17+
sourceType: "module",
18+
ecmaFeatures: {
19+
jsx: true,
20+
},
21+
},
22+
globals: {
23+
...globals.browser,
24+
...globals.node,
25+
// Vitest globals
26+
describe: "readonly",
27+
it: "readonly",
28+
test: "readonly",
29+
expect: "readonly",
30+
vi: "readonly",
31+
beforeEach: "readonly",
32+
afterEach: "readonly",
33+
beforeAll: "readonly",
34+
afterAll: "readonly",
35+
// Chrome extension
36+
chrome: "readonly",
37+
},
38+
},
39+
plugins: {
40+
"@typescript-eslint": tseslint,
41+
react: react,
42+
"react-hooks": reactHooks,
43+
},
44+
rules: {
45+
"@typescript-eslint/no-unused-vars": [
46+
"warn",
47+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
48+
],
49+
"@typescript-eslint/no-explicit-any": "off",
50+
"no-unused-vars": "off",
51+
"no-empty": "off",
52+
},
53+
},
54+
{
55+
// Regular source files
56+
files: ["**/*.{ts,tsx}"],
57+
ignores: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}", "**/test/**/*.{ts,tsx}", "*.config.ts", "*.config.js", "vite.config.*.ts", "vitest.config.*.ts"],
58+
languageOptions: {
59+
parser: tsparser,
60+
parserOptions: {
61+
ecmaVersion: "latest",
62+
sourceType: "module",
63+
ecmaFeatures: {
64+
jsx: true,
65+
},
66+
},
67+
globals: {
68+
...globals.browser,
69+
// Chrome extension
70+
chrome: "readonly",
71+
// React 17+ JSX transform
72+
React: "readonly",
73+
},
74+
},
75+
plugins: {
76+
"@typescript-eslint": tseslint,
77+
react: react,
78+
"react-hooks": reactHooks,
79+
},
80+
rules: {
81+
// TypeScript rules
82+
"@typescript-eslint/no-unused-vars": [
83+
"warn",
84+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
85+
],
86+
"@typescript-eslint/no-explicit-any": "warn",
87+
88+
// React rules
89+
"react/react-in-jsx-scope": "off",
90+
"react/prop-types": "off",
91+
"react/jsx-uses-react": "off",
92+
"react/jsx-uses-vars": "error",
93+
94+
// React Hooks rules
95+
"react-hooks/rules-of-hooks": "error",
96+
"react-hooks/exhaustive-deps": "warn",
97+
98+
// General rules
99+
"no-unused-vars": "off",
100+
"no-console": "off",
101+
"no-empty": "off",
102+
},
103+
settings: {
104+
react: {
105+
version: "detect",
106+
},
107+
},
108+
},
109+
{
110+
// Config files (vite, vitest, tailwind, etc.) - Node.js environment
111+
files: ["*.config.ts", "*.config.js", "vite.config.*.ts", "vitest.config.*.ts"],
112+
languageOptions: {
113+
parser: tsparser,
114+
parserOptions: {
115+
ecmaVersion: "latest",
116+
sourceType: "module",
117+
},
118+
globals: {
119+
...globals.node,
120+
},
121+
},
122+
plugins: {
123+
"@typescript-eslint": tseslint,
124+
},
125+
rules: {
126+
"@typescript-eslint/no-unused-vars": "off",
127+
"no-unused-vars": "off",
128+
},
129+
},
130+
{
131+
ignores: [
132+
"node_modules/**",
133+
"dist/**",
134+
"coverage/**",
135+
"postcss.config.js",
136+
],
137+
},
138+
];

app/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"preview": "vite preview",
1111
"test": "vitest run",
1212
"test:watch": "vitest",
13+
"lint": "eslint .",
14+
"lint:fix": "eslint . --fix",
1315
"release": "standard-version",
1416
"release:minor": "standard-version --release-as minor",
1517
"release:major": "standard-version --release-as major",
@@ -28,16 +30,23 @@
2830
},
2931
"devDependencies": {
3032
"@crxjs/vite-plugin": "^2.0.0-beta.33",
33+
"@eslint/js": "^9.39.4",
3134
"@testing-library/jest-dom": "^6.6.3",
3235
"@testing-library/react": "^16.3.0",
3336
"@testing-library/user-event": "^14.6.1",
3437
"@types/canvas-confetti": "^1.9.0",
3538
"@types/chrome": "^0.0.318",
3639
"@types/react": "^19.1.4",
3740
"@types/react-dom": "^19.1.5",
41+
"@typescript-eslint/eslint-plugin": "^8.57.1",
42+
"@typescript-eslint/parser": "^8.57.1",
3843
"@vitejs/plugin-react": "^4.5.2",
3944
"@vitest/coverage-v8": "^3.2.4",
4045
"autoprefixer": "^10.4.21",
46+
"eslint": "^9.39.4",
47+
"eslint-plugin-react": "^7.37.5",
48+
"eslint-plugin-react-hooks": "^7.0.1",
49+
"globals": "^17.4.0",
4150
"jsdom": "^26.1.0",
4251
"postcss": "^8.5.4",
4352
"standard-version": "^9.5.0",

0 commit comments

Comments
 (0)