WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 12 days ago

#31823 new enhancement

Add ESLint integration

Reported by: westonruter Owned by:
Milestone: Awaiting Review Priority: lowest
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": [
                "**/vendor/**",
                "**.min.js",
                "**/node_modules/**"
        ]
}

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

Change History (6)

#1 @westonruter
2 years ago

  • Description modified (diff)

#2 @netweb
2 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
2 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
12 months ago

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

#5 @westonruter
12 months ago

  • Description modified (diff)
  • Summary changed from Add JSCS integration to Add ESLint integration

This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.


12 days ago

Note: See TracTickets for help on using tickets.