Remove JSHint due to license compatibility

JSHint inherits a license from JSLint that includes the clause  "The Software shall be used for Good, not Evil." WordPress's license specifically allows grants the freedom to run the program, for any purpose. Please note, this is not an encouragement of evil. Rather than doing something evil, how about learning to love those around you. Instead of tweeting lies and saying people are "Not Good!", help your neighbor. In the words of Lin Manual Miranda, "Love is love is love is love is love is love is love is love, cannot be killed or swept aside." 

This replaces JSHint with esprima, a part of the larger jQuery project, and a custom wrapper for some basic error checking within codemirror.

The existing JSHint configuration is kept in place in case someone wants to use that, but they can only do so for Good.

Fixes #42850
Props netweb for a spelling fix on a comment.


Built from https://develop.svn.wordpress.org/trunk@42547


git-svn-id: http://core.svn.wordpress.org/trunk@42376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2018-01-23 01:29:32 +00:00
parent 2ec77391f6
commit 9efeb545c0
6 changed files with 6748 additions and 24548 deletions

View File

@ -779,6 +779,8 @@ $_old_files = array(
'wp-includes/js/mediaelement/renderers/soundcloud.min.js',
'wp-includes/js/mediaelement/renderers/twitch.js',
'wp-includes/js/mediaelement/renderers/twitch.min.js',
// 5.0
'wp-includes/js/codemirror/jshint.js',
);
/**

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,43 @@
// JSHINT has some GPL Compatability issues, so we are faking it out and using esprima for validation
// Based on https://github.com/jquery/esprima/blob/gh-pages/demo/validate.js which is MIT licensed
var fakeJSHINT = new function() {
var syntax, errors;
var that = this;
this.data = [];
this.convertError = function( error ){
return {
line: error.lineNumber,
character: error.column,
reason: error.description,
code: 'E'
};
};
this.parse = function( code ){
try {
syntax = window.esprima.parse(code, { tolerant: true, loc: true });
errors = syntax.errors;
if ( errors.length > 0 ) {
for ( var i = 0; i < errors.length; i++) {
var error = errors[i];
that.data.push( that.convertError( error ) );
}
} else {
that.data = [];
}
} catch (e) {
that.data.push( that.convertError( e ) );
}
};
};
window.JSHINT = function( text ){
fakeJSHINT.parse( text );
};
window.JSHINT.data = function(){
return {
errors: fakeJSHINT.data
};
};

File diff suppressed because one or more lines are too long

View File

@ -494,7 +494,8 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.js', array(), '5.29.1-alpha-ee20357' );
$scripts->add( 'csslint', '/wp-includes/js/codemirror/csslint.js', array(), '1.0.5' );
$scripts->add( 'jshint', '/wp-includes/js/codemirror/jshint.js', array(), '2.9.5' );
$scripts->add( 'jshint', '/wp-includes/js/codemirror/fakejshint.js', array( 'esprima' ), '2.9.5' );
$scripts->add( 'esprima', '/wp-includes/js/codemirror/esprima.js', array(), '4.0.0' );
$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
$scripts->add( 'htmlhint', '/wp-includes/js/codemirror/htmlhint.js', array(), '0.9.14-xwp' );
$scripts->add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42545';
$wp_version = '5.0-alpha-42547';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.