mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +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:
parent
35a26718d8
commit
8cd9cb1047
1 changed files with 44 additions and 2 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue