Just tried to update all my project's dependencies. Eslint is now at 9.6.0 but several of my other dependencies do not yet work with even 9.0.0. Upgrading the config seems like an absolute nightmare - there's an autoupgrader, but a) it generated javascript with syntax errors and b) when I fixed the syntax errors, it still wouldn't work (the storybook plugin specifically) despite being wrapped in a `compat` call.
So... I'm usually v conservative about switching away from boring tools, but eslint is feeling tedious for the wrong reasons atm. I've seen a bunch of alternatives floating about - are any of them mature enough to make the switch (and are any reasonably painless to switch to?)
Videos
I have been watching the progress for a while and it looks pretty cool. Haven't really had the time yet to give it a try myself, so my question is for the people that did try it.
Is it a valid replacement for both, ESLint and Prettier?
Does it play nice with nextjs?
Happy to hear some first hand experiences and thoughts :)
In my experience, the best combination is all 3, and here's why:
EditorConfig: This helps your editor produce code that looks like your style guide as you go. While this isn't strictly necessary in order to achieve your goals, it's nice if you're always looking at code that follows the same coding styles. Otherwise if you don't have EditorConfig, as you're typing your editor will auto-format differently to the rest of the code base, which is confusing. Of course if you've set up prettier it'll fix it before it goes into your code base, but still, why would you want to look at it in one format while you're writing it and then have it switch when you go to commit? Might as well be consistent.
Prettier: Automatically formats your code. I like to set it up to do this when I stage my files for a commit, so that it's physically impossible for me to commit code that doesn't match my style guide.
ESLint: So why would you want a linter too? Because ESLint does more than just style. It picks up when you declare variables you don't use, or reference things that aren't defined, amongst a few other niceties. So while its role diminishes somewhat compared to the days before prettier, it's still useful to have in a project to catch the other errors.
Prettier
It removes all original styling and ensures that all outputted code conforms to a consistent style.
- It changes your code after writing your code.
- For example
- on save with the Visual Studio Code editor
- with a CLI like
prettier --write .
Editorconfig
EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
- It applies your rules before writing code
- For example
- When you press TAB, it leaves four spaces.
- For example
ESLint
ESLint statically analyzes your code to quickly find problems.
- ESLint finds problems in your code
To summarize:
- EditorConfig changes your editor settings.
- Prettier updates your code with your rules to reshape your code.
Finally:
- They have some common features in order to do the same things.
- I also agree with KevinBrownTech to use three of them. Especially if you are working with a team.
Useful sources for who want to dive into:
- Feross Aboukhadijeh: Write Perfect Code With Standard And ESLint - JSConf.Asia 2018
- JavaScript Standard Style
Also look at the React framework's repository:

Let's see why we are getting this error.
If you have installed the prettier extension in your VSCode then the default values are set as mentioned here which can be seen by searching prettier in the
settingsof VSCode as well.Now if you have enabled
formatOnSavein your VSCode the prettier formats your code based on configs from the VSCode.This error would occur when the configs from the VSCode conflicts from the configs mentioned in .prettierrc.json or .eslintrc.json.

Ex: Let's say your project is using a printWidth of 100 but the default printWidth is 80. ( Search prettier printwidth in VSCode settings )
In general the spacing errors will be autoCleared ( autoFormatted ) on save by prettier. But in this case that won't work.
Reason: Prettier is sticking to the config ( printWidth: 80 ) which is an error according to Repo's eslintrc/ prettierrc ( printWidth: 100 )
Fix here
Change default VSCode Prettier configs. -> This would be a bad idea as it will effect all your projects opened in VSCode.
Better way to fix this issue is by adding a
.vscode/settings.jsonin the root directory of the repo.Add these lines in the settings.json
{ "editor.codeActionsOnSave": { "source.fixAll": true }, "editor.formatOnSave": false, }Now go to files with errors and save the files to format. Files will be formatted according to the configs mentioned in project's eslintrc/ prettierrc
Instead of going to each file you can fix all autofixable problems from the command line as below.
Go to package.json and add this line to your scripts.
"lint-fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'",Now in the terminal run
npm run lint-fix.
I had the same issue, in the eslinrc.json file under "prettier/prettier", I removed printWidth.
Is there an alternative to prettier or is it possible to configure prettier itself to match my styling guidelines?
https://www.prettier.io/