eslint-plugin-ajel-go
v0.0.4
Published
Eslint rules for ajel-go, the library which encourages handling errors similarly to Golang
Downloads
12
Maintainers
Readme
DEPRECATED
Personally - I recommend using ajel instead. Follow this link to see the new api.
ajel-go
Installation
yarn add ajel-go eslint-plugin-ajel-go
pnpm add ajel-go eslint-plugin-ajel-go
Basic eslintrc
{
plugins: ['ajel-go'],
extends: [
'plugin:ajel/recommended',
],
}
Advanced eslintrc
{
plugins: ['ajel-go'],
extends: [
'plugin:ajel/recommended',
],
rules: {
'ajel-go/ajel-const-tuples': [
'error',
{
ajelAlias: "blimpy",
sjelAlias: "limpyb",
},
],
'ajel-go/ajel-require-tuple-declaration': [
'error',
{
ajelAlias: 'blimpy',
sjelAlias: "limpyb",
},
],
'ajel-go/ajel-disable-try-catch': [
'error',
{
ajelAlias: 'blimpy',
sjelAlias: "limpyb",
},
'ajel/sjel-require-currying': [
'error',
{
sjelAlias: "limpyb",
},
//Use one of the two following rules
'ajel-go/ajel-require-error-handling': [
'error',
{
ajelAlias: 'blimpy',
sjelAlias: "limpyb",
},
],
//'ajel-go/ajel-strict-error-instanceof': [
// 'off',
// {
// ajelAlias: 'blimpy',
// sjelAlias: "limpyb",
// },
//],
},
}
ajel
and sjel
are a set of functions that return a tuple representing a potential result and a potential error.
On success, the result item has value. On error, the error item has value. It's that simple.
More interestingly, it comes with a series of linting tools to help enforce the paradigm available in the package eslint-plugin-ajel