Manual:Jsparse.php/ja

Category:MediaWiki code/ja#Jsparse.php

詳細

jsparse.php file is a maintenance script for testing JavaScript validity using JSMin+'s parser. This is a useful feature to run parsing/syntax check on JavaScript files.

オプション/引数

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

使用法

php maintenance/run.php jsparse filename
MediaWiki バージョン 1.39.12 以前では、メンテナンス スクリプトを php maintenance/run.php scriptName ではなく php maintenance/scriptName.php を使用して実行する必要があります。

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.

関連項目

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