Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMaking standard easier to use #1356
Comments
This comment has been minimized.
This comment has been minimized.
PandawanFr
commented
Aug 14, 2019
•
Or, if you decided not to add TypeScript support by default, you might want to consider supporting it as a plugin like you mentioned for react and vue instead? Note: This should still be an "alternative," it'd be much better if standard supported TypeScript by default with no extra config/installs. |
This comment has been minimized.
This comment has been minimized.
Yeah, that's a good point. It would fit easily into that model since it's just a plugin, parser, and a few rule tweaks. |
This comment has been minimized.
This comment has been minimized.
|
#1330 seems too large to be yes/no in the context of this issue. I have a feeling that bundling prettier is not a worthwhile investment. Perhaps making it officially supported and very easy to use along with standard would be wiser. I can imagine a future where ESLint fixes make prettier obsolete. You can say I'm a dreamer. I've never used prettier. |
This comment has been minimized.
This comment has been minimized.
Personally, this is one of the things I'm looking forward to the most! I've been in a lot of projects that used to use standard, but has switched to Prettier. It's always a hassle since Prettier is impossible to configure to 100% match standard, so in the end we'll end up adding a prettier config to match as closely as possible, and then either run eslint after (which preserves all the good "catch bug" linting) or just skip standard alltogheter. If all we needed to do was to add a |
This comment has been minimized.
This comment has been minimized.
|
How much larger will the install be with the babel stuff? |
This comment has been minimized.
This comment has been minimized.
ArmorDarks
commented
Aug 14, 2019
|
This mostly looks like a nice one!
Including That means that the user still has to install babel plugin, but doesn't need to configure it.
Adopting Prettier seems to be the right decision, as the war between eslint, standard and prettier preferences is getting quite annoying.
nice, but means even more default dependencies...
sounds nice, but isn't that more dependencies for non-TypeScript users? Plugins (extensions) still feels better. Just
oh no, that will sound like an end of the
The question is, will that list update frequently enough? If for some reason project will stagnate (as that happened a few times, because, well, we all lazy and rely on core maintainers...), it could quickly lose users. That partially happened because of the TypeScript, or Vue, which were unusable with Would allowing extension of the It feels to me that it would be much better if
That concept looks interesting. It also means that certain features can be invoked ad hoc, in some files, right? For instance, |
This comment has been minimized.
This comment has been minimized.
We'd go from 287 dependencies to 321. As for the performance of I ran
EDIT: I forgot to clear the cache between runs. The new times are 52.463 seconds with babel-eslint vs. 46.336 seconds with the built-in parser. So babel is actually a bit slower. |
feross commentedAug 13, 2019
•
edited
The vision of
standardis to save you time in three ways:I think we do a really good job on (3), enforcing style and catching errors. We do a pretty good job on (2) as well, thanks to ESLint's
--fixfunctionality.But we can do way better at Number 1.
We're pretty far away from the vision of "just do this and you're done" for lots of real-world projects.
In fact our readme promises "no configuration" and then goes on to do a bit too much explanation about packages to install and flags to pass to get
standardto work for your particular codebase. And it's not working so well right now.Here are some very rough ideas that that might improve the situation. Feedback very much welcome!
Include
babel-eslintby default.babelrcis recognized and used automaticallyRemove
--verboseflag and just always include the rule name in the error messageESList exposes features that we decided to remove/hide for simplicity. But then users sometimes need these features, so we created additional packages to install as an escape hatch to get those features back. I'm not sure that this is actually simpler than just adding a command line flag for these features. So here's a few ideas:
snazzyso users can add dostandard --report=prettyand get pretty outputstandard-jsonso users can dostandard --report=jsonto get JSON outputstandard-tapso users can dostandard --report=tapto get TAP outputESLint already supports these internally so it feels kind of strange to have to maintain these packages which just parse output and convert it back.
Note: these flags are not allowing arbitrary rules to be added or changed, so they're not the kind of "configuration" that we want to avoid. These are just command line flags that help users accomplish their goals. I can't see teammates bikeshedding about whether to use
--prettyor not, and especially not for--json.Allow all non-confusing browser globals #1330
window.prefix or a/* global Blah */commentwindow.is not usable in a service worker or in Node.jsglobalThisis not pretty and not widely available yet anyway.topandselfwill still be treated as undefined by defaultBuild in
prettier#811standard --format.standard --fix.Lint JavaScript in Markdown files and HTML files by default #1355
README.mdfiles anddocs/folders should be standard, but I never remember to installstandard-markdown. We can build this in by default.The TypeScript experience is completely broken right now. Typescript users need to install an ESLint plugin and configure some rules in order to get
standardworking. The problem is that you can't configure rules instandard. Indeed, that's the point. So they have to switch tostandardx, another escape hatch that we built to handle cases that we don't handle correctly instandarditself.Users also have to do this to get set up:
Followed by
standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin *.tsUgh. This looks like configuration to me. Here's a possible solution:
.tsfiles and apply the necessary minimal rule changes so everything works.standardIf we support parsing Typescript and we default to the
babel-eslintparser, then we can also:--pluginand--parserflags.(An alternative is to just drop support for Typescript entirely if we can't do a good job of it)
Here's an idea that might be going too far, but if it worked would be really cool.
standard --reactorstandard --vueand get additional rules for their specific framework. There can be a very small list of possible choices, maintained as shareable configs in the @standard org.envor an ESLint environment with the--envflag. Maybe this can piggyback on that concept?standard --env react --env mochaif they want additional rules for React and globals defined for Mocha tests, as one hypothetical example.If we make all the changes I've proposed here, we'd go from this help page:
to this:
If I had to summarize the main idea here I'd say it feels like we've let a lot of the complexity of ESLint leak through, and we can do better. Lots of the details of my proposed solutions might not be the best, but I hope this will re-energize us and get us thinking about solutions.
Eager for feedback!