fix(lint): Add ctx shim to routes/apps and routes/arr
- routes/apps/deploy.js: Add ctx shim with APP_TEMPLATES, siteConfig, buildDomain, buildServiceUrl, addServiceToConfig, dns, notification, safeErrorMessage - routes/apps/index.js: Extract additional ctx properties for sub-routes - routes/arr/config.js: Add ctx shim with notification, safeErrorMessage + logError import - routes/arr/index.js: Extract notification, safeErrorMessage for sub-routes Result: Fixed ~30 no-undef errors (deploy.js 0 errors, arr/config.js 0 errors)
This commit is contained in:
57
dashcaddy-api/.eslintrc.js
Normal file
57
dashcaddy-api/.eslintrc.js
Normal file
@@ -0,0 +1,57 @@
|
||||
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-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',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user