3 ms·
This can only be good news. Normally I, like anyone else experienced with the JS ecosystem, despair when new tools come out like this. However, consider: - set
by lloydatkinson 3y ago
This can only be good news. Normally I, like anyone else experienced with the JS ecosystem, despair when new tools come out like this. However, consider:
- setting up eslint isn't actually that simple
- if you're using typescript you need eslint-typescript too
- there are sets of rules in both eslint and eslint-typescript that conflict with each other, so I have countless rules in my config like this:
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
- then if you're doing React there's another set of JS and TS rules to apply, I still never figured out how to correctly apply airbnb rules
- this is a pretty garbage developer experience
- you can quite literally spend hours or days getting a "good" linting/formatting configuration setup, and you often can only use pieces of the configs you wrote for other repos because over time the rules and settings seem to change
- I hope this will eventually support things such as .astro files which is actually a combination of TypeScript and TSX blocks
> At this stage, oxlint is not intended to fully replace ESLint; it serves as an enhancement when ESLint's slowness becomes a bottleneck in your workflow.
I also hope that eventually it does become a full replacement. I like eslint, but holy shit, I cannot bring myself to create a new config from scratch that wrestles all the required extras and the frequently changing dependencies.
Also, wanted to give a sort of shout out to Deno here. Deno comes with a linter/formatter built in that is barely configurable (just double vs single quote, 2 or 4 space indentation, minor things) and it too is very fast and simply "just works".
---
Update: I just gave it a quick try and I am immediately impressed by it. Not only was it incredibly fast like it claims, it appears to already have all of the rules I was complaining about built in.
eslint-plugin-react(jsx-no-useless-fragment): Fragments should contain more than one child.
╭─[src/design/site/preact/MobileNavigationMenu.tsx:18:1]
18 │ return (
19 │ <>
· ──
20 │ <MenuButton isOpen={isOpen} onChange={setIsOpen} />
Finished in 17ms on 90 files with 70 rules using 16 threads.
Found 13 warnings and 0 errors.
- ahuth 3y agoI am defending eslint/JS's honor in other replies, but you're right... setting up eslint is too complicated (and more complicated in TS).
- c-hendricks 3y agoYou're right that initially setting up the rules takes time, that won't go away with any linter though. But once I set up my company's rules 4 years ago, it's just been adding the odd rule every year or so, and upgrading various dependencies, then publish. I use it across work and personal projects, never really noticed "only use pieces of the configs you wrote for other repos because over time the rules and settings seem to change" > Fragments should contain more than one child. What an annoying rule
- namtab00 3y agoI don't do JS/TS, but I have no idea why all this hasn't converged on editorconfig rules. I write C# and do "linting" via editorconfig + ReSharper file layout formatting at dev time and via precommit hook with their CLI tool I'm surely missing something crucial in that ecosystem that editorconfig can't handle...
- leipert 3y agoeditorconfig is mostly about formatting. Parts of the JavaScript ecosystem have converged on prettier for that. These linters do checks on the abstract syntax tree, and so they can statically analyze that e.g. you don’t use certain unsafe APIs or do things that might introduce performance issues or bugs.
- lloydatkinson 3y agoI also write C# and well... good question. Much of it is linting though, not just formatting.
- lakpan 3y agoAnyone who picks and chooses from the entire list of rules is doing it wrong. Pick a config that roughly matches your ideals and just use it. On older projects you’ll have to customize it a bit, on new ones you’ll probably just adapt to it. I’ve been using eslint-config-xo-typescript for several years, plus some plugins with their “recommended” presets.