JS linting

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

JS linting

Post by callumacrae »

The JavaScript going in phpBB is a bit of a mess and looks like it was written by 20 different people (which it was).

I'd suggest we use JSHint and possibly JSCS, or ESLint.
Made by developers, for developers!
My blog

User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 185
Joined: Thu Sep 09, 2010 11:36 am
Location: Munich, Germany

Re: JS linting

Post by Marc »

I generally like the idea. As far as I can tell this will require node.js though?

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: JS linting

Post by callumacrae »

To run it on Travis or on the command line, yeah. They have plugins for most editors, though.
Made by developers, for developers!
My blog

User avatar
MattF
Extension Customisations
Extension Customisations
Posts: 675
Joined: Mon Mar 08, 2010 9:18 am

Re: JS linting

Post by MattF »

And every phpstorm user should install the jshint plugin too ;)
Has an irascible disposition.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: JS linting

Post by brunoais »

If using jsLint or JsHint, please also use FixMyJS. At least, it should be able to suggest copy & paste changes to help understanding the complaint when dealing with blanks.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: JS linting

Post by callumacrae »

If you can install that in your editor then sure. I'm not suggesting adding any dependencies.
Made by developers, for developers!
My blog

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: JS linting

Post by naderman »

All in favour, prepare a PR to enable them on travis?

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: JS linting

Post by callumacrae »

Both projects depend on Node. It looks like it might already be installed, though—even on the PHP instances.

http://www.lornajane.net/posts/2014/add ... is-project
Made by developers, for developers!
My blog

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: JS linting

Post by brunoais »

I won't vote in favor until I know the rule list you are thinking on using for phpBB.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: JS linting

Post by callumacrae »

It's a relaxed version of what I use at work and what I've always used for phpBB. Most code already conforms to it.

https://github.com/phpbb/phpbb/pull/3668/files

http://area51.phpbb.com/docs/31x/coding-guidelines.html (this has been like this for years)
Made by developers, for developers!
My blog

Post Reply