Manual:Jsparse.php/fr

Category:MediaWiki code/fr#Jsparse.php

Détails

Le fichier jsparse.php est un script de maintenance qui teste les analyses de validité JavaScript en utilisant l'analyseur de JSMin+ . This is a useful feature to run parsing/syntax check on JavaScript files.

Options/Arguments

This script takes the filenames of the files to be validated as arguments, separated by spaces.

Usage

php maintenance/run.php jsparse filename
Dans la version MediaWiki 1.39.12 et antérieure, vous devez invoquer des scripts de maintenance à l'aide de php maintenance/scriptName.php au lieu de php maintenance/run.php scriptName.

Checking valid file

example.js
$( function () {
	var $longList = $("#longList").addClass("grid_row");
	var $leftDiv = $("<div>");
	var $rightDiv = $("<div>");
	
	$longList.append($leftDiv, $rightDiv);
});
Terminal

Checking invalid file

example.js
$( function () {
	var $longList = $("#longList").addClass("grid_row");
	var $leftDiv = $("<div>");
	var $rightDiv = $("<div>");
	
    // Intentionally removed `);` from the end for the jsparse.php demo
	$longList.append($leftDiv, $rightDiv
});
Terminal

Common error

$filename ERROR: could not read file

This error occurs when the file does not exist or the user running the script does not have permission to read the file.

If the file does exist, check the file permissions. If you are root user, then you can run the script with sudo.

See also

Category:Maintenance scripts/fr Category:Development maintenance scripts/fr
Category:Development maintenance scripts/fr Category:Maintenance scripts/fr Category:MediaWiki code/fr