-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
"rules": {
// Our base eslint with airbnb
"comma-dangle": [
"error",
"never"
],
// Necessary to follow a clean code approach
"no-use-before-define": [
"error",
{
"functions": false,
"classes": false
}
],
// Code can have empty space to separe block of things
"no-trailing-spaces": [
"error",
{
"skipBlankLines": true
}
],
// In express applications is very comon to modify the response
// In general I think that is not a bad practice to update a property
"no-param-reassign": [
"error",
{
"props": false
}
],
// 80 is the default, Intellij allows 121
"max-len": [
"error",
121
],
// Don't allow ternary operator, why?
"no-unused-expressions": [
"error",
{
"allowTernary": true
}
],
// In express, error handlers are a special kind of middlewares with 4 arguments
// In the last error handler is unnecesary to call the last argument (next), but it must appear
"no-unused-vars": [
"error",
{
"args": "none"
}
],
// I prefer {color: 'blue'} than { color: blue }
"object-curly-spacing": [
"error",
"never"
],
// I prefer function() than function ()
"space-before-function-paren": [
"error",
"never"
]
}In test directory we should define another .eslintrc.json with this rule
"rules": {
"no-unused-expressions": 0
}
Specially if we are using chai.js, this kind of expect gives an error:
expect(null).to.be.null;
Let discuss about the rules I mentioned above, what do you think?
Metadata
Metadata
Assignees
Labels
No labels