-
Notifications
You must be signed in to change notification settings - Fork 515
Conversation
You have problems with indentation, could also update readme file? |
Fixed |
Looks much simpler for now. |
cc @markelog |
Any news? |
I think one example is enough for readme, rule is pretty much self-descriptive. How this corresponds with The opposite rule might be helpful though, but if JSCS would have |
jscs behave like JSHint with
maybe something else... |
Don't warn on every semicolon, just on ones that you described in the PR description, maybe we would need to change the name of the rule, but i fine with the current one, but perhaps explanation of it should be more verbose. |
That's not enough, for example: var foo = function(){}; // use semicolon
(123)
// foo -> [function]
var foo = function(){} // don't use semicolon
(123)
// foo -> undefined |
Opposite rule should do only opposite checks, this is why i noted – maybe we would need to change the name of the rule, but i fine with the current one, but perhaps explanation of it should be more verbose But this could go another way too, i'm just considering options here, since esprima AST is verbose enough to catch cases you mentioned above. But only way i see to land this is to create the opposite rule. |
Perhaps we could reconsider this, if the opposite rule would be presented |
Strange decision. |
I closed it because it's a duplicative rule of jshint The only way i can see to land this, is presented it with conjunction with opposite one, but i already said that. |
For now we don't duplicate jshint options. We will notify you in case if it will be changed. Thank you for you interest. I'm looking forward for new pull-requests from you covering other cases. |
jshint requires semicolon by default, asi is relaxing option. |
Good point. We will discuss it. Keep in touch. |
+1 for getting this into JSCS. JSHint version 3 is planning to remove all style warnings: They are planning the following: It's unclear to me whether JSHint will still require semicolons or not. Since there's automatic semicolon insertion, it isn't technically a bug. I'm probably a typical user of JSHint and/or JSCS and/or Closure... we just want one tool and one config file to maintain. The goal is to get a good code quality tool to enforce quality code. It doesn't matter whether it is a bug or bad style, what matters is code quality, which is inclusive of both. |
Whether or not ASI is style or not is debatable, however, JSCS has no current plans to implement gotcha checks (like accidental globals, unused vars, typos...). If you're looking for one tool, JSCS isn't it currently. Our focus is an unopinionated, composable, configurable style guide enforcer. JSHint does a great job finding REAL bugs. JSCS is currently here to make your code pretty. We believe a focus or style will enable us to do it well. |
I get that it's your decision (and JSHint's) to focus on different topics. It's just going to less useful than a combined project would be. For instance, is a missing semicolon bad style, a bug, both, or neither? There's almost definitely going to be cases where JSCS says something's a bug and out of scope, and JSHint says something's a style and out of scope, and as a result neither will cover it. In any case, the real issue for this PR is whether or not to include semicolons. I hope you guys do. |
As JSHint removed Style-Checking, our team (and we're not the only ones I suppose) are looking for an alternative because "All code in any code-base should look like a single person typed it, no matter how many people contributed." (https://github.com/rwaldron/idiomatic.js/) |
@edwardsmit @pickhardt if JSHint removes the ASI checks, we'll gladly implement it. I'm sure they havent' yet, and don't believe they are as per https://github.com/jshint/jshint/blob/2.x/dist/jshint.js#L52823 |
+1. Totally support @pickhardt on this topic. I think |
@adius, what makes you think JSHint is dropping semicolon detection? |
Please refer to JSHint's docs, and the source code: https://github.com/jshint/jshint/blob/4ec82974b08808a976b4a263a52bb1bcc86debff/src/options.js#L5 I assure you JSHint is still doing semicolons, unless I missed an announcement somewhere. |
JSHint only supports "automatic semicolon insertion should be tolerated" but I want "disallowSemicolon" which translates to "semicolons must not be used unless they are absolutely necessary". |
Neither tool ever supported it. This is true. I think it's safe for us to tackle this one unless Anton would consider a "don't use semicolons unless necessary rule". He has more of the machinery in place. If not, I think it's safe for us to handle it. @valueof could you weigh in on this:
Thoughts? |
I am evaluating node-jscs to use in my development processes. Although I prefer using semicolons, let's pretend that I hate them. It seems like it can be a code-style issue. In twbs/bootstrap#3057, for example, there are many reasons against using semicolons (mainly for stylistic reasons) and other reasons for using semicolons. If the following is parsed with jshint:
There is one warning: "4: missing semicolon". But if I don't like semicolons, and I want my code style to have them as little as possible, I can tell jshint that I would like some ASI:
That's all fine and dandy, but I don't want any unnecessary semicolons. I want something to tell me that there is an unnecessary semicolon on line 3. This desire of mine is a stylistic desire. But we need to be careful. Because, let's say that I want to also say hello to a couple of awesome JS projects:
jshint now correctly tells me that this is wrong with the following:
It would also be nice if I were to have a tool that told me that I also had an unnecessary semicolon on line 3. I however prefer to use semicolons, though, so I personally will never run into this problem. |
JSHint—as of 2.5.0—now warns when semicolon is omitted but may cause problems even when |
@valueof, that makes sense, but still leaves the following question unanswered: is JSHint planning a "disallow semicolons except when required" option? |
@mikesherov No. |
You better should. There are a lot of projects which have this style. They should be able to check documents for conformity as well! |
As |
Yep, would you like to rebase this or open a new PR? |
Sorry for delay. |
Boolean rule that requires semicolon after:
Valid:
Invalid: