Skip to content
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

add a more strict linter #433

Closed
dasilvacontin opened this issue Mar 22, 2015 · 9 comments · Fixed by #440
Closed

add a more strict linter #433

dasilvacontin opened this issue Mar 22, 2015 · 9 comments · Fixed by #440
Labels

Comments

@dasilvacontin
Copy link
Collaborator

We have strings with both " and '. I'd like the repo to have a more uniform coding style, tbh.
Thoughts, @phillipj?

@phillipj
Copy link
Collaborator

Sure, I'm also a '-fan 👍

JSCS has gotten a lot of traction lately. In fact the codestyle rules in JSHint is being deprecated these days in favor of JSCS, so the quotmark option in JSHint will dissapear sometime soon..

@bobthecow
Copy link

check out eslint. after trying all of 'em, that's where several projects i work on have ended up.

@phillipj
Copy link
Collaborator

Yeah eslint also does the trick.. Anything other than quotes you had in mind @dasilvacontin?

Although I feel most linters do the basic stuff equally well, some are more suiteable for specific things and custom styles.

@dasilvacontin
Copy link
Collaborator Author

Glad you guys mentioned eslint, it's the one I had in mind. :)

More things:

Writer.prototype._rawValue = function(token) {
vs
mustache.parse = function (template, tags) {

What are your thoughts about standard?

@phillipj
Copy link
Collaborator

My thoughts about the differences:

I like hinting about how "public" my functions are. Therefore I often tend to add an _ for "private" and usually very specific functions, e.g. function _somewhatPrivate(){}

I dont have a strong preference about spaces in function declarations. Looking at the source atm, there's mostly spaces function () {}, which means I have to fix my wrongly formatted Writer functions 😃

My two main reason for choosing the prototype-style today: better stack traces and memory profiling. Prototypes also helps raw performance, but that is usually not a big concern before running hot code which executes a lot.

@dasilvacontin
Copy link
Collaborator Author

I dont have a strong preference about spaces in function declarations.

I don't have a preference about either style, but I like them to look the same. Will merge PR for those changes. :)

@dasilvacontin
Copy link
Collaborator Author

I like hinting about how "public" my functions are. Therefore I often tend to add an _ for "private" and usually very specific functions, e.g. function _somewhatPrivate(){}

I usually just note it in the function's documentation and that's all.

Also, I like to name anonymous functions. Better stacktraces, as you mentioned, and more contribution-friendly code. :)

@phillipj
Copy link
Collaborator

Btw, #412 has fixed alot of mixed styles.. Personally havent had any experience with google closure compiler though, ref my question about the benefits compared to jshint (or eslint for that matter)

@dasilvacontin
Copy link
Collaborator Author

I agree, and I would merge it if it didn't have conflicts.We could try adding eslint after I merge my v2.0 PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants