@hansevision/eslint9-config
v1.0.1
Published
Shareable ESLint 9 flat config for SPFx SharePoint Online and modern web projects
Maintainers
Readme
@hansevision/eslint9-config
Shareable, opinionated ESLint 9 flat config for TypeScript projects, optimised for SPFx SharePoint Online and other modern web projects.
Features
- ESLint 9 flat config format
- TypeScript support via
typescript-eslintv8 - Strict code-quality rules (complexity, max-lines, magic-numbers, …)
- Static analysis via
eslint-plugin-sonarjsv4
Requirements
| Peer dependency | Version |
| ----------------------- | --------- |
| eslint | ^9.0.0 |
| @eslint/js | ^9.0.0 |
| typescript-eslint | ^8.0.0 |
| eslint-plugin-sonarjs | ^4.0.0 |
| globals | ^15.0.0 |
Node.js ≥ 18.18 is required (ESLint 9 minimum).
Installation
npm install -D @hansevision/eslint9-config \
eslint@^9 \
@eslint/js@^9 \
typescript-eslint@^8 \
eslint-plugin-sonarjs@^4 \
globals@^15Usage
Create an eslint.config.js (or eslint.config.mjs) in your project root:
import config from '@hansevision/eslint9-config';
export default [...config];Extending / overriding rules
import config from '@hansevision/eslint9-config';
export default [
...config,
{
rules: {
'no-console': 'off',
'max-params': ['error', { max: 5 }],
},
},
];SPFx — additional ignores
SPFx projects contain auto-generated files that should be excluded from linting:
import config from '@hansevision/eslint9-config';
export default [
...config,
{
ignores: [
'lib/**',
'release/**',
'temp/**',
'sharepoint/**',
'*.js', // root-level config stubs generated by SPFx
],
},
];Development
# Install dependencies
npm install
# Build (ESM + CJS)
npm run build
# Watch (ESM only)
npm run dev
# Lint the source (requires a prior build)
npm run lintThe build produces three artefacts in dist/:
| File | Format |
| ------------ | ---------------- |
| index.js | ESM |
| index.cjs | CommonJS |
| index.d.ts | TypeScript types |
