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 upRelease proposal: standard v5 #192
Comments
This comment has been minimized.
This comment has been minimized.
|
This might also be a good opportunity to make other breaking changes we want to make. In particular, the work in this PR: #189 Anything else we should think about? |
feross
added
the
question
label
Jul 17, 2015
This comment has been minimized.
This comment has been minimized.
|
Unnecessary var arr = [].concat.apply([], [[1], [2], [3]])
console.dir(arr) |
This comment has been minimized.
This comment has been minimized.
|
standard@5.0.1-0 === standard@latest? |
This comment has been minimized.
This comment has been minimized.
|
@Flet I believe that's expected behavior. The |
This comment has been minimized.
This comment has been minimized.
|
@jprichardson Good catch re: I also just learned that |
This comment has been minimized.
This comment has been minimized.
|
@feross thanks, I did not realize this! Doing this: Looking for some npm docs on this behavior, but not finding any :( Anyways, carry on. :) |
This comment has been minimized.
This comment has been minimized.
|
@Flet hm, actually, i think what's happening is that when you do a publish, npm updates the |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I found where npm iterates over the versions and picks the one to install... It looks like Fun stuff!
And of course there is code above this part that will use the tagged version if a tag is passed. Cool, I assumed that |
This comment has been minimized.
This comment has been minimized.
|
I get this version when I run the following, is that suppose to happen?
|
This comment has been minimized.
This comment has been minimized.
|
@jprichardson because it should?
|
This comment has been minimized.
This comment has been minimized.
No it's not. That outputs: [ 1, 2 ]What I was trying to demonstrate: var b = [[1], [2], [3]]
var arr = [].concat.apply([], b)
console.dir(arr)Which standard accepts. So maybe there isn't much of an issue here. |
This comment has been minimized.
This comment has been minimized.
> [].concat([1], [2], [3])
[ 1, 2, 3 ]@jprichardson, huh? I use this pattern all the time to flatten arrays, using edit: Just re-read your example, you meant in the case that |
This comment has been minimized.
This comment has been minimized.
Had a screw loose, you are correct.
As do I, that's why I brought up the issue as noted in my first comment.
Hence, why I said:
i.e. it looks like |
This comment has been minimized.
This comment has been minimized.
|
@LinusU When I run
Can you check your |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dmonad
commented
Jul 21, 2015
I agree that this is a neat rule in most cases. But what if a third party library expects a generator function as an argument, and my generator implementation doesn't actually need to |
This comment has been minimized.
This comment has been minimized.
|
@DadaMonad then use an inline comment to disable that rule in place? Since, it would seem, in that case, you know that it is OK. |
This comment has been minimized.
This comment has been minimized.
dmonad
commented
Jul 21, 2015
|
@dcousens I don't think that this is a good solution. I have plenty of generator definitions that do not yield. In my humble opinion, the linter should not get too much in my way. Furthermore, I don't really see a scenario where a rule like this could prevent me from doing something stupid. When you declare a generator function you probably have good reasons for it.. |
This comment has been minimized.
This comment has been minimized.
|
@DadaMonad well, beyond that, I haven't used |
This comment has been minimized.
This comment has been minimized.
|
Okay, I cleared up the version confusion by using tags.
To get the 5.0.0 beta versions, use |
This comment has been minimized.
This comment has been minimized.
|
@DadaMonad Can you link to some examples of generator functions you've written that do not yield? You may have a good point on this. |
This comment has been minimized.
This comment has been minimized.
dmonad
commented
Jul 22, 2015
|
@feross I want my framework to support different databases to store its state persistently. I use indexedDB in the browser, and redis in nodejs. When I yield, I request data from the database. You can also store non-persistently in memory. An in-memory database implementation naturally has no asynchronous behaviour - therefore, I do not need to yield. |
This comment has been minimized.
This comment has been minimized.
|
Thank you for 5.0! |
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Jul 24, 2015
This comment has been minimized.
This comment has been minimized.
|
@DadaMonad Thanks for the feedback. I just removed the |
This comment has been minimized.
This comment has been minimized.
dmonad
commented
Jul 24, 2015
|
Thanks a lot @feross ! |
This comment has been minimized.
This comment has been minimized.
|
Another case where you want a generator function that doesn't yield anything is with koa. I have a reasonable amount of those. Each middleware is a generator functions, and depending on how you setup your middleware, your final "controller action" middleware can end up looking like this: UsersController.current = function * current () {
this.body = this.state.user
}Along the same line, when using async functions you don't wanna force it to have an await. One example of this: you have an async function that'll return a cached value immediately if it's available, otherwise it will do a network request. Since an async function will always return a promise, it's always async (no zalgo, kthx) but you might not have anything that you need to actually await. async function getOrFetch (id) {
return id in cache
? cache[id]
: (await fetchThing(id))
} |
This comment has been minimized.
This comment has been minimized.
|
@cesarandreu Good to know! |
This comment has been minimized.
This comment has been minimized.
|
ESLint has one more breaking change we haven't discussed yet:
Before, ESLint would report errors with 0-based columns. The current 5.x pre-releases are just passing this change through, meaning that editor integrations are currently off-by-one with standard 5.x. It's not hugely disruptive, but plugin maintainers should update their packages. That's you @Flet, @ricardofbarros, @ishamf, @scrooloose. I'll release the stable 5.0.0 today. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@LinusU The current format is super easy to parse with a one-line regex https://github.com/Flet/SublimeLinter-contrib-standard/blob/master/linter.py#L25 But let's keep that discussion in #218. |
This comment has been minimized.
This comment has been minimized.
|
standard 5.0.0 is released! |
feross
closed this
Aug 3, 2015
This comment has been minimized.
This comment has been minimized.
|
Thank you @feross Will update as soon as possible |
This comment has been minimized.
This comment has been minimized.
|
@ricardofbarros nice! |
This comment has been minimized.
This comment has been minimized.
|
\o/ |
This comment has been minimized.
This comment has been minimized.
|
Hurrah! |
This comment has been minimized.
This comment has been minimized.
boennemann
commented
Aug 5, 2015
|
@feross Thanks so much for this new version! I just wanted to suggest adding these release notes (or at least a link) to the Releases page on GitHub or to a CHANGELOG.md file. For me I only notice that there is a new version of standard, because some dependency badges turn yellow or red. I then come to your repo page to check whether the changes actually affect me and how to update, but I just can't find any indication of what's breaking. Only because I know you and the project well enough I then turn over to Twitter where I find a link to this issue. I think using common places like GitHub Releases or CHANGELOG.md makes the update process way easier for everyone. Thank you |
This comment has been minimized.
This comment has been minimized.
|
+1 for keeping a changelog, it's a great way to keep up to date with the rule changes. |
This comment has been minimized.
This comment has been minimized.
|
@boennemann @LinusU Thanks for the changelog suggestion. I just added the release notes from this issue to the Releases page. |

feross commentedJul 17, 2015
eslint v1.0.0 will be released soon! eslint added some new rules that are nice, and lots of existing rules have subtle behavior changes designed to catch more errors.
Let's talk about the next version of standard! We'll bump the major version to standard v5.0.0 to pull in these improvements.
New rules:
generator functions should always have ayieldkeyword (standard/eslint-config-standard@63ab1c6)There were other new rules that I didn't add because they have too many false positives, require ES6-only codebases, or would be divisive: standard/eslint-config-standard@a211a1c
Changed rules:
no-extra-parensinstead of the deprecatedno-wrap-funcrule (standard/eslint-config-standard@fc8a076)indentgot stricter and catches errors in object literal indentation. 12/131 repos in the test suite started failing after this rule was improved.I'm posting this to get feedback. Please share your thoughts! I published a prerelease version (v5.0.0-1). Please give it a try on your code!