Make WordPress Core

Opened 6 years ago

Last modified 7 months ago

#31823 accepted task (blessed)

Add ESLint integration — at Version 5

Reported by: westonruter Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: javascript Cc:

Description (last modified by westonruter)

Update: The JSCS project has merged into ESLint. So now an ESLint config is needed to be developed for core as opposed to a JSCS one.

The JSCS project has added a wordpress preset. This could be useful to be included in Core. All it needs is a .jscsrc file located in the root which contains:

        "preset": "wordpress",
        "excludeFiles": [

#30153 (PHP_CodeSniffer)
#25187 (JSHnt)
#28543 (Allow stricter JSHint checks for core files)

Change History (5)

#1 @westonruter
6 years ago

  • Description modified (diff)

#2 @netweb
6 years ago

Related: #28236

I have some large concerns in adding JSCS in any form to WordPress Core.

I looked into adding JSCS to WordPress Core to fix #28236 back in January. To get familiar with JSCS I looked at jQuery's implementation and upon looking found that jQuery needed some JSCS updates. I created two pull requests for jQuery, one was merged and the second was not (The JSCS maintainers maintain jQuery's implementation of JSCS.)

I walked away from the second and from JSCS in frustration of ideological differences of what I believe should've been merged vs what the JSCS maintainers believe should've been merged.

For reference these are the two jQuery issues:

As I noted in #29792

This is becoming an important issue for us, our tools need to be both functional and maintained and is one part of the reasoning for the change in #31332

I'll add to this by saying that I think any external libraries we use should also match WordPress Core development philosophies and based on my recent JSCS experience via jQuery at this time I don't believe JSCS align with WordPress'.

#3 @westonruter
6 years ago

Just got this update from @hzoo:

If you guys do add it to wordpress core (or even just run it on the codebase) - there will probably be a lot of changes needed to the preset (added and removed). Like #1187.

So you can create an issue/PR about it so we can get it in.

And if there's differences in rules because of jquery changes we could move the original jquery rules into wordpress so it doesn't depend on another preset (if needed).

Maybe it would be interesting to not have to depend on jscs itself for the preset definitions (but that's probably a different thing altogether and maybe already discussed?).

Disclaimer: I'm new to JSCS.

#4 @iseulde
5 years ago

This is now merged with ESLint, see http://jscs.info.

#5 @westonruter
5 years ago

  • Description modified (diff)
  • Summary changed from Add JSCS integration to Add ESLint integration
Note: See TracTickets for help on using tickets.