🔧 chore: add root ESLint config and enable lint in pre-commit

- Add eslint.config.mjs at root with TypeScript/JS rules
- Configure lint-staged to run ESLint --fix on JS/TS files
- Add ESLint dependencies to root package.json
- Set "type": "module" in package.json to fix module warning
- Ignore projects with their own ESLint configs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Wuesteon 2025-12-03 13:49:57 +01:00
parent 0086e33910
commit fd962c30b2
4 changed files with 371 additions and 331 deletions

67
eslint.config.mjs Normal file
View file

@ -0,0 +1,67 @@
// @ts-check
import eslint from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import tseslint from 'typescript-eslint';
/**
* Root ESLint config for the monorepo.
* Individual projects can override with their own eslint.config.* files.
*/
export default tseslint.config(
// Global ignores
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/.svelte-kit/**',
'**/.expo/**',
'**/.next/**',
'**/coverage/**',
'**/apps-archived/**',
// Ignore projects with their own ESLint configs
'apps/manadeck/apps/mobile/**',
'apps/picture/apps/mobile/**',
'apps/picture/apps/web/**',
'games/voxel-lava/apps/web/**',
],
},
// Base JavaScript rules
eslint.configs.recommended,
// TypeScript rules (without type-checking for speed)
...tseslint.configs.recommended,
// Prettier integration
eslintPluginPrettierRecommended,
// Global settings
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
...globals.es2022,
},
ecmaVersion: 2022,
sourceType: 'module',
},
},
// TypeScript-specific rules (relaxed for monorepo compatibility)
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-require-imports': 'off',
},
},
// JavaScript-specific rules
{
files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
}
);

View file

@ -1,3 +1,4 @@
export default { export default {
'*.{ts,tsx,js,jsx,json,md,svelte,astro}': ['prettier --config .prettierrc.json --write'], '*.{ts,tsx,js,jsx,mjs,cjs}': ['eslint --fix', 'prettier --config .prettierrc.json --write'],
'*.{json,md,svelte,astro}': ['prettier --config .prettierrc.json --write'],
}; };

View file

@ -2,6 +2,7 @@
"name": "manacore-monorepo", "name": "manacore-monorepo",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"type": "module",
"description": "Manacore Monorepo containing manacore, manadeck, picture, chat, zitare, and presi", "description": "Manacore Monorepo containing manacore, manadeck, picture, chat, zitare, and presi",
"scripts": { "scripts": {
"dev": "turbo run dev", "dev": "turbo run dev",
@ -116,7 +117,12 @@
"prepare": "husky" "prepare": "husky"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.39.1",
"concurrently": "^9.2.0", "concurrently": "^9.2.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"globals": "^16.5.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"lint-staged": "^16.2.7", "lint-staged": "^16.2.7",
"prettier": "^3.3.3", "prettier": "^3.3.3",
@ -124,6 +130,7 @@
"prettier-plugin-svelte": "^3.4.0", "prettier-plugin-svelte": "^3.4.0",
"turbo": "^2.3.0", "turbo": "^2.3.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.48.1",
"wrangler": "^4.51.0" "wrangler": "^4.51.0"
}, },
"engines": { "engines": {

625
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff