Files
dashcaddy/dashcaddy-api/.eslintrc.js
T
Hermes 140aa5d4b1 [grade=A] P2-1 through P2-4: version sync, dead file cleanup, ESLint fixes
P2-1: VERSION file 1.14.9→1.15.0 (matches package.json), CLAUDE.md 1.13.4→1.15.0
P2-2: git rm dashcaddy-api/scripts/legacy/comprehensive-test.js + test-security-fixes.js
P2-3: .eslintrc.js add no-empty rule with allowEmptyCatch:true (3 errors→0)
P2-4: routes/auth/session-handlers.js:39 fix no-useless-escape (\- → .- in char class)

1539/1539 tests pass. ESLint errors eliminated.
2026-08-10 20:28:36 -07:00

84 lines
2.3 KiB
JavaScript

module.exports = {
env: {
node: true,
es2021: true,
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'commonjs',
},
rules: {
// Error Prevention
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-console': 'off', // We use structured logging, but console is okay for debug
'no-undef': 'error',
'no-unreachable': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
// Code Quality
'prefer-const': 'warn',
'no-var': 'warn',
'eqeqeq': ['warn', 'always', { null: 'ignore' }],
'curly': ['warn', 'multi-line'],
'no-throw-literal': 'error',
// Async/Await
'require-await': 'warn',
'no-async-promise-executor': 'error',
'no-await-in-loop': 'off', // Sometimes intentional for sequential operations
// Style (Prettier handles formatting, these are semantic)
'consistent-return': 'off', // Express routes don't always return
'no-nested-ternary': 'warn',
'max-depth': ['warn', 4],
'complexity': ['warn', 20],
// Prevent common pitfalls
'no-empty': ['error', { allowEmptyCatch: true }],
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-with': 'error',
'no-proto': 'error',
},
overrides: [
{
// Test files can be more lenient
files: ['**/__tests__/**/*.js', '**/*.test.js', '**/*.spec.js'],
env: {
jest: true,
},
rules: {
'no-unused-expressions': 'off',
'max-depth': 'off',
},
},
{
// Browser-side assets (client JS)
files: ['assets/**/*.js', 'frontend/**/*.js'],
env: {
browser: true,
es2021: true,
node: false,
},
globals: {
// Common dashboard globals from status/index.html context
apiUrl: 'readonly',
API_BASE_URL: 'readonly',
CONFIG: 'readonly',
// Client-side dashboard classes (loaded via script tags)
ErrorHandler: 'readonly',
ProgressTracker: 'readonly',
ThemeAdapter: 'readonly',
DnsTemplateSelector: 'readonly',
TourManager: 'readonly',
TooltipDefinitions: 'readonly',
},
rules: {
'no-undef': 'warn',
},
},
],
};