-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making standard easier to use #1356
Comments
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. |
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. |
👍 Babel by default. #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. 👍 #1355. 👍 for #703 (I wrote it) but without the need for a CLI flag. Just having the extension package installed should activate it. |
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 |
How much larger will the install be with the babel stuff? |
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, |
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 Maybe also for ease of development you could move standard-engine to this repository? |
Also I woudn't complain about adding other packages in monorepo style:
Why? It's hard to coordinate changes in all repositories. For example to add some change in eslint-config-standard I'd need to make request to it, then update standard-engine, then update standard, very tedious. I'd like to help but the fragmentation of standard repositories makes me meh :) |
I guess it would be possible to add the |
Could we have
All modern browsers support it https://caniuse.com/#search=globalThis |
@catalin-luntraru that seems like a good move, would you mind opening a separate issue for that, and maybe a PR as well? |
@feross same issue, i want to. use standard with vue, but when i run command like |
Supporting |
The vision of
standard
is 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
--fix
functionality.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
standard
to 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-eslint
by default.babelrc
is recognized and used automaticallyRemove
--verbose
flag 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:
snazzy
so users can add dostandard --report=pretty
and get pretty outputstandard-json
so users can dostandard --report=json
to get JSON outputstandard-tap
so users can dostandard --report=tap
to 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
--pretty
or not, and especially not for--json
.Allow all non-confusing browser globals Consider allowing use of browser globals #1330
window.
prefix or a/* global Blah */
commentwindow.
is not usable in a service worker or in Node.jsglobalThis
is not pretty and not widely available yet anyway.top
andself
will still be treated as undefined by defaultBuild in
prettier
Adopt prettier for consistent formatting #811standard --format
.standard --fix
.Lint JavaScript in Markdown files and HTML files by default Lint all JavaScript in markdown files by default #1355
README.md
files 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
standard
working. 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 instandard
itself.Users also have to do this to get set up:
Followed by
standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin *.ts
Ugh. This looks like configuration to me. Here's a possible solution:
.ts
files and apply the necessary minimal rule changes so everything works.standard
If we support parsing Typescript and we default to the
babel-eslint
parser, then we can also:--plugin
and--parser
flags.(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 --react
orstandard --vue
and 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.env
or an ESLint environment with the--env
flag. Maybe this can piggyback on that concept?standard --env react --env mocha
if 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!
The text was updated successfully, but these errors were encountered: