1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Add some .arclint configuration options for ArcanistJSHintLinter.

Summary:
Allow `.jshintrc` and `.jshintignore` paths to be passed to `jshint`.

Ref T2039.

Test Plan: Added the `jshintrc` and `jshintignore` keys to an `.arclint` file that was configured to use `ArcanistJSHintLinter`. Ran `arc lint --trace` and inspected the flags that were passed to `jshint`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: john.snow, epriestley, Korvin

Maniphest Tasks: T2039, T5085

Differential Revision: https://secure.phabricator.com/D9112
This commit is contained in:
Joshua Spence 2014-05-16 21:42:52 -07:00 committed by epriestley
parent 35a26718d8
commit 8cd9cb1047

View file

@ -5,6 +5,9 @@
*/
final class ArcanistJSHintLinter extends ArcanistExternalLinter {
private $jshintignore;
private $jshintrc;
public function getInfoName() {
return 'JSHint';
}
@ -74,9 +77,48 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
}
protected function getMandatoryFlags() {
return array(
'--reporter='.dirname(realpath(__FILE__)).'/reporter.js',
$options = array();
$options[] = '--reporter='.dirname(realpath(__FILE__)).'/reporter.js';
if ($this->jshintrc) {
$options[] = '--config='.$this->jshintrc;
}
if ($this->jshintignore) {
$options[] = '--exclude-path='.$this->jshintignore;
}
return $options;
}
public function getLinterConfigurationOptions() {
$options = array(
'jshint.jshintignore' => array(
'type' => 'optional string',
'help' => pht('Pass in a custom jshintignore file path.'),
),
'jshint.jshintrc' => array(
'type' => 'optional string',
'help' => pht('Custom configuration file.'),
),
);
return $options + parent::getLinterConfigurationOptions();
}
public function setLinterConfigurationValue($key, $value) {
switch ($key) {
case 'jshint.jshintignore':
$this->jshintignore = $value;
return;
case 'jshint.jshintrc':
$this->jshintrc = $value;
return;
}
return parent::setLinterConfigurationValue($key, $value);
}
protected function getDefaultFlags() {