style(guide): 🎨 Add ESLint rules for unused variables and type safety enforcement
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
927e46b864
commit
5ce778a17c
1 changed files with 46 additions and 0 deletions
46
games/age-of-dwarves/guide/eslint.config.js
Normal file
46
games/age-of-dwarves/guide/eslint.config.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import tseslint from 'typescript-eslint'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import unusedImports from 'eslint-plugin-unused-imports'
|
||||
import fileLength from '@lilith/eslint-plugin-file-length'
|
||||
import importAlias from '@lilith/eslint-plugin-import-alias'
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist/', '.vite/'] },
|
||||
tseslint.configs.recommended,
|
||||
{
|
||||
plugins: {
|
||||
'react-hooks': reactHooks,
|
||||
'unused-imports': unusedImports,
|
||||
'@lilith/file-length': fileLength,
|
||||
'import-alias': importAlias,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
|
||||
// Unused imports — autofix on lint:fix
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
'unused-imports/no-unused-vars': ['error', {
|
||||
vars: 'all', varsIgnorePattern: '^_',
|
||||
args: 'after-used', argsIgnorePattern: '^_',
|
||||
}],
|
||||
|
||||
// Type discipline (align with typescript-code-standards.md)
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': ['error', {
|
||||
prefer: 'type-imports', fixStyle: 'separate-type-imports',
|
||||
}],
|
||||
|
||||
// File length — project max 500 lines (CLAUDE.md)
|
||||
'@lilith/file-length/file-length': ['error', { warnThreshold: 400, errorThreshold: 500 }],
|
||||
|
||||
// Import alias enforcement — prefer @/ over relative src/ paths
|
||||
'import-alias/prefer-alias': 'error',
|
||||
|
||||
// Guide pages are lazy-loaded default exports (vite code-splitting)
|
||||
'no-console': 'error',
|
||||
'prefer-const': 'error',
|
||||
'no-var': 'error',
|
||||
},
|
||||
},
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue