The project shipped no linting or formatting; add both ahead of the first npm publish. ESLint (flat config, typescript-eslint) + Prettier enforce a consistent style, and a cognitive-complexity gate (ccts, threshold 25) keeps any function from regressing into the unreadable. Both run in CI and in a pre-commit hook (.githooks, enabled via core.hooksPath + the `prepare` script). Cyclomatic complexity stays advisory-only — its ??-chain false positives make it a poor gate. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import stylistic from '@stylistic/eslint-plugin';
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['dist', 'node_modules', 'bench', 'coverage'] },
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
plugins: { '@stylistic': stylistic },
|
|
rules: {
|
|
// The request pipeline accumulates a dynamic context object by design;
|
|
// `any` there is load-bearing, not laziness. Flag it as a warning so new
|
|
// uses are visible without failing the build.
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
// Breathing room around multi-line blocks (for/while/if/function/class) so
|
|
// consecutive blocks don't read as one wall of code. Auto-fixable.
|
|
'@stylistic/padding-line-between-statements': [
|
|
'error',
|
|
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
|
|
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
|
|
],
|
|
},
|
|
},
|
|
);
|