Phase 1: Add ESLint/Prettier config + baseline auto-fixes
This commit is contained in:
56
dashcaddy-api/.eslintrc.js
Normal file
56
dashcaddy-api/.eslintrc.js
Normal file
@@ -0,0 +1,56 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
node: true,
|
||||
es2021: true,
|
||||
jest: true,
|
||||
},
|
||||
extends: 'eslint:recommended',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
},
|
||||
rules: {
|
||||
// Possible errors
|
||||
'no-await-in-loop': 'warn',
|
||||
'no-console': 'off', // We use console in server code
|
||||
'no-template-curly-in-string': 'error',
|
||||
|
||||
// Best practices
|
||||
'curly': ['error', 'multi-line'],
|
||||
'eqeqeq': ['error', 'always', { null: 'ignore' }],
|
||||
'no-eval': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-return-await': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'prefer-promise-reject-errors': 'error',
|
||||
'require-await': 'warn',
|
||||
|
||||
// Variables
|
||||
'no-unused-vars': ['error', {
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
}],
|
||||
'no-use-before-define': ['error', {
|
||||
functions: false,
|
||||
classes: true,
|
||||
}],
|
||||
|
||||
// Stylistic
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'quotes': ['error', 'single', { avoidEscape: true }],
|
||||
'semi': ['error', 'always'],
|
||||
'indent': ['error', 2, { SwitchCase: 1 }],
|
||||
'max-len': ['warn', {
|
||||
code: 120,
|
||||
ignoreUrls: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
}],
|
||||
|
||||
// ES6
|
||||
'arrow-spacing': 'error',
|
||||
'no-var': 'error',
|
||||
'prefer-const': 'error',
|
||||
'prefer-arrow-callback': 'warn',
|
||||
'prefer-template': 'warn',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user