.eslintrc.jsā¢9.59 kB
/**
* ESLint Configuration for HubSpot MCP Server
*
* Comprehensive linting configuration with security rules,
* Node.js best practices, and code quality standards.
*/
module.exports = {
// Environment configuration
env: {
node: true,
es2022: true,
jest: true
},
// Parser configuration
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module'
},
// Extended configurations
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:security/recommended',
'plugin:jest/recommended'
],
// Plugins
plugins: [
'node',
'security',
'jest',
'import'
],
// Rule configuration
rules: {
// Possible Errors
'no-console': 'warn',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-obj-calls': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-unreachable': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',
// Best Practices
'array-callback-return': 'error',
'block-scoped-var': 'error',
'complexity': ['warn', 10],
'consistent-return': 'error',
'curly': 'error',
'default-case': 'error',
'dot-notation': 'error',
'eqeqeq': 'error',
'guard-for-in': 'error',
'no-alert': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-div-regex': 'error',
'no-else-return': 'error',
'no-empty-function': 'error',
'no-empty-pattern': 'error',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-fallthrough': 'error',
'no-floating-decimal': 'error',
'no-global-assign': 'error',
'no-implicit-coercion': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-magic-numbers': ['warn', {
ignore: [-1, 0, 1, 2],
ignoreArrayIndexes: true,
enforceConst: true,
detectObjects: false
}],
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-param-reassign': 'error',
'no-proto': 'error',
'no-redeclare': 'error',
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-void': 'error',
'no-warning-comments': 'warn',
'no-with': 'error',
'prefer-promise-reject-errors': 'error',
'radix': 'error',
'vars-on-top': 'error',
'wrap-iife': 'error',
'yoda': 'error',
// Strict Mode
'strict': ['error', 'global'],
// Variables
'init-declarations': 'off',
'no-catch-shadow': 'error',
'no-delete-var': 'error',
'no-label-var': 'error',
'no-restricted-globals': 'error',
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-undefined': 'off',
'no-unused-vars': ['error', {
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false
}],
'no-use-before-define': 'error',
// Node.js and CommonJS
'callback-return': 'error',
'global-require': 'error',
'handle-callback-err': 'error',
'no-buffer-constructor': 'error',
'no-mixed-requires': 'error',
'no-new-require': 'error',
'no-path-concat': 'error',
'no-process-env': 'off',
'no-process-exit': 'warn',
'no-restricted-modules': 'off',
'no-sync': 'off',
// Stylistic Issues
'array-bracket-spacing': ['error', 'never'],
'block-spacing': 'error',
'brace-style': ['error', '1tbs'],
'camelcase': 'error',
'comma-dangle': ['error', 'never'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'consistent-this': 'error',
'eol-last': 'error',
'func-names': 'off',
'func-style': ['error', 'declaration'],
'id-length': 'off',
'indent': ['error', 2],
'key-spacing': 'error',
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'max-depth': ['warn', 4],
'max-len': ['warn', {
code: 100,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}],
'max-nested-callbacks': ['warn', 3],
'max-params': ['warn', 4],
'max-statements': ['warn', 20],
'new-cap': 'error',
'new-parens': 'error',
'newline-after-var': 'off',
'no-array-constructor': 'error',
'no-continue': 'off',
'no-inline-comments': 'off',
'no-lonely-if': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': 'error',
'no-negated-condition': 'off',
'no-nested-ternary': 'error',
'no-new-object': 'error',
'no-spaced-func': 'error',
'no-ternary': 'off',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-unneeded-ternary': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var': ['error', 'never'],
'operator-assignment': 'error',
'operator-linebreak': 'error',
'padded-blocks': ['error', 'never'],
'quote-props': ['error', 'as-needed'],
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'semi-spacing': 'error',
'sort-vars': 'off',
'space-before-blocks': 'error',
'space-before-function-paren': ['error', 'never'],
'space-in-parens': 'error',
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'spaced-comment': 'error',
'wrap-regex': 'off',
// ECMAScript 6
'arrow-body-style': 'error',
'arrow-parens': 'error',
'arrow-spacing': 'error',
'constructor-super': 'error',
'generator-star-spacing': 'error',
'no-class-assign': 'error',
'no-confusing-arrow': 'error',
'no-const-assign': 'error',
'no-dupe-class-members': 'error',
'no-duplicate-imports': 'error',
'no-new-symbol': 'error',
'no-restricted-imports': 'off',
'no-this-before-super': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-reflect': 'off',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'require-yield': 'error',
'rest-spread-spacing': 'error',
'sort-imports': 'off',
'template-curly-spacing': 'error',
'yield-star-spacing': 'error',
// Security rules
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'warn',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-new-buffer': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-non-literal-fs-filename': 'warn',
'security/detect-non-literal-regexp': 'warn',
'security/detect-non-literal-require': 'warn',
'security/detect-object-injection': 'warn',
'security/detect-possible-timing-attacks': 'warn',
'security/detect-pseudoRandomBytes': 'error',
'security/detect-unsafe-regex': 'error',
// Import rules
'import/no-unresolved': 'error',
'import/named': 'error',
'import/default': 'error',
'import/namespace': 'error',
'import/no-restricted-paths': 'off',
'import/no-absolute-path': 'error',
'import/no-dynamic-require': 'warn',
'import/no-internal-modules': 'off',
'import/no-webpack-loader-syntax': 'error',
'import/export': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error',
'import/no-deprecated': 'warn',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/unambiguous': 'off',
'import/no-commonjs': 'off',
'import/no-amd': 'error',
'import/no-nodejs-modules': 'off',
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-namespace': 'off',
'import/extensions': 'off',
'import/order': 'error',
'import/newline-after-import': 'error',
'import/prefer-default-export': 'off',
'import/max-dependencies': 'off',
'import/no-unassigned-import': 'off',
'import/no-named-default': 'error'
},
// Override rules for specific files
overrides: [
{
files: ['**/*.test.js', '**/*.spec.js'],
env: {
jest: true
},
rules: {
'no-magic-numbers': 'off',
'max-statements': 'off',
'max-len': 'off'
}
},
{
files: ['jest.config.js', '.eslintrc.js'],
rules: {
'no-magic-numbers': 'off'
}
}
],
// Global variables
globals: {
testUtils: 'readonly',
setupTestDatabase: 'readonly',
teardownTestDatabase: 'readonly'
},
// Report unused disable directives
reportUnusedDisableDirectives: true
};