An eslint config that catches problems in your code, without checking style. For use with prettier.
npm install eslint-config-problemseslint-config-problems is an ESLint config that doesn't regulate your code style. It only catches actual problems with your code.
It's designed for use with Prettier, the opinionated code formatter.
- Rules
- I disagree with rule X; you missed rule Y
- Installation & Usage
- License
Rules were chosen based on the following criteria:
- No stylistic rules; nothing that Prettier can fix
- Prevent guaranteed runtime errors (i.e. no undefined variables)
- Disallow "evil" things like eval
- Disallow archaic language features like with
- Disallow obvious bad practices like new Number(13)
- Force usage of ES2015+ features
- Point out places the code could be made shorter. For example:
``js`
if (someCondition) return someValue;
else {
// Do something else
}
else
The block is unneeded, since the if block contains a return statement. eslint-config-problems will point this out to you (or auto-fix with the --fix option).
If you disagree; feel free to open an issue. I'm open to changing rules if you have a good reason.
If I missed a rule that prevents an actual problem or is otherwise in keeping with the general guidelines above, please open an issue as well; I just might add it.
_eslint-config-problems is designed to work with ESLint v9+; if you're still using ESLint v8 or earlier, use eslint-config-problems v8.0.0._
---
npm install -D eslint eslint-config-problems
In your eslint.config.js:
`js
import problems from 'eslint-config-problems';
export default [
problems,
{
rules: {
// custom rules
},
},
];
``