Skip to content

Commit ea089f0

Browse files
committed
chore: add ESLint configs, lint scripts and pre-commit hook
Add root and per-package .eslintrc.cjs (apps/web, packages/{ai,core,mcp,shared}), add Husky pre-commit hook to run lint-staged, and enable lint / lint:fix scripts across root, apps/web and packages. Update lint-staged to run eslint --fix for TS packages/apps and prettier for other files. Add @codervisor/eslint-config and eslint to devDependencies (and pnpm-lock updates). Also expand turbo task outputs in turbo.json.
1 parent b464da0 commit ea089f0

File tree

14 files changed

+107
-9
lines changed

14 files changed

+107
-9
lines changed

.eslintrc.cjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
extends: ['@codervisor/eslint-config/base'],
5+
parserOptions: {
6+
ecmaVersion: 'latest',
7+
sourceType: 'module',
8+
},
9+
ignorePatterns: [
10+
'node_modules/',
11+
'dist/',
12+
'build/',
13+
'bin/',
14+
'.next/',
15+
'coverage/',
16+
'*.config.js',
17+
'*.config.ts',
18+
],
19+
};

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run lint-staged to lint and format staged files
5+
pnpm lint-staged

apps/web/.eslintrc.cjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
extends: ['@codervisor/eslint-config/react'],
4+
parserOptions: {
5+
project: './tsconfig.json',
6+
tsconfigRootDir: __dirname,
7+
},
8+
rules: {
9+
// Allow console.error for error logging
10+
'no-console': ['warn', { allow: ['error'] }],
11+
},
12+
};

apps/web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"build": "next build",
99
"start": "pnpm run build && next start --port 3010",
1010
"preview": "next start --port 3010",
11+
"lint": "eslint . --ext .ts,.tsx",
12+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
1113
"clean": "rimraf .next out *.tsbuildinfo",
1214
"clean:dev": "rimraf .next",
1315
"test": "vitest run",

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "Monorepo for development logging tools and MCP server",
55
"scripts": {
66
"build": "turbo build",
7+
"lint": "turbo lint",
8+
"lint:fix": "turbo lint -- --fix",
79
"test": "vitest run",
810
"test:watch": "vitest",
911
"test:ui": "vitest --ui",
@@ -18,6 +20,7 @@
1820
"start:web": "pnpm --filter @codervisor/devlog-web start",
1921
"preview:web": "pnpm --filter @codervisor/devlog-web preview",
2022
"format": "prettier --write packages/**/*.{ts,tsx,js,jsx,json,md}",
23+
"prepare": "husky",
2124
"spec": "node scripts/specs/spec.js",
2225
"spec:create": "node scripts/specs/spec.js create",
2326
"spec:list": "node scripts/specs/spec.js list",
@@ -37,10 +40,12 @@
3740
},
3841
"license": "Apache-2.0",
3942
"devDependencies": {
43+
"@codervisor/eslint-config": "workspace:^",
4044
"@types/node": "^20.0.0",
4145
"@types/semver": "^7.5.8",
4246
"@vitest/coverage-v8": "2.1.9",
4347
"concurrently": "9.2.0",
48+
"eslint": "9.39.0",
4449
"husky": "9.1.7",
4550
"lint-staged": "16.1.2",
4651
"prettier": "3.6.1",
@@ -55,9 +60,14 @@
5560
},
5661
"lint-staged": {
5762
"packages/**/*.{ts,tsx}": [
63+
"eslint --fix",
5864
"prettier --write"
5965
],
60-
"packages/**/*.{js,jsx,json,md}": [
66+
"apps/**/*.{ts,tsx}": [
67+
"eslint --fix",
68+
"prettier --write"
69+
],
70+
"**/*.{js,jsx,json,md}": [
6171
"prettier --write"
6272
]
6373
},

packages/ai/.eslintrc.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
extends: ['@codervisor/eslint-config/node'],
4+
parserOptions: {
5+
project: './tsconfig.json',
6+
tsconfigRootDir: __dirname,
7+
},
8+
};

packages/ai/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"build": "tsc",
1919
"clean": "rimraf build",
2020
"dev": "tsc --watch",
21+
"lint": "eslint src --ext .ts",
22+
"lint:fix": "eslint src --ext .ts --fix",
2123
"test": "vitest run",
2224
"test:ui": "vitest --ui",
2325
"test:watch": "vitest --watch"

packages/core/.eslintrc.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
extends: ['@codervisor/eslint-config/node'],
4+
parserOptions: {
5+
project: './tsconfig.json',
6+
tsconfigRootDir: __dirname,
7+
},
8+
};

packages/core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
"scripts": {
4545
"build": "tsc",
4646
"dev": "tsc --watch",
47+
"lint": "eslint src --ext .ts",
48+
"lint:fix": "eslint src --ext .ts --fix",
4749
"test": "vitest run",
4850
"test:watch": "vitest",
4951
"test:ui": "vitest --ui",

packages/mcp/.eslintrc.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
extends: ['@codervisor/eslint-config/node'],
4+
parserOptions: {
5+
project: './tsconfig.json',
6+
tsconfigRootDir: __dirname,
7+
},
8+
};

0 commit comments

Comments
 (0)