ESLint plugin that enforces patterns from @armadacore/essentials:
result-must-handle-err—IResult<T>values must have their error path handled.optional-must-have-default— Optional function/method parameters and return types must not leakundefined/null.
npm install -D @armadacore/eslint-plugin-essentialsPeer dependencies: eslint >=9, typescript >=5.
// eslint.config.js
import essentials from '@armadacore/eslint-plugin-essentials';
import tseslint from 'typescript-eslint';
export default [
...tseslint.configs.recommendedTypeChecked,
...essentials.configs.recommended,
{
languageOptions: {
parserOptions: {
project: './tsconfig.json',
},
},
},
];Both rules require parserServices (i.e. a TypeScript program). Without parserOptions.project, the rules will silently no-op.
Reports any IResult<T> value whose Err branch is never handled.
Accepted as handling: onErr, match, unwrapOr, unwrapOrElse, err, expectErr, orElse, ignoreErr.
Delegation also counts: return result, passing as argument, assignment to a container.
See the wiki page.
Reports function/method signatures that introduce undefined/null into the function body or its return value.
See the wiki page.
The example/ directory contains a real workspace using @armadacore/essentials with both valid and invalid code samples. Run:
npm install
npm run build
npm run example:lintMIT