Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15534512
D12198.id32757.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12198.id32757.diff
View Options
diff --git a/src/lint/linter/ArcanistESLintLinter.php b/src/lint/linter/ArcanistESLintLinter.php
--- a/src/lint/linter/ArcanistESLintLinter.php
+++ b/src/lint/linter/ArcanistESLintLinter.php
@@ -2,6 +2,9 @@
final class ArcanistESLintLinter extends ArcanistExternalLinter {
+ private $eslintenv;
+ private $eslintconfig;
+
public function getInfoName() {
return 'ESLint';
}
@@ -14,8 +17,18 @@
return pht('ESLint is a linter for JavaScript source files.');
}
+ public function getVersion() {
+ $output = exec('eslint --version');
+
+ if (strpos($output, 'command not found') !== false) {
+ return false;
+ }
+
+ return $output;
+ }
+
public function getLinterName() {
- return 'ESLint';
+ return 'ESLINT';
}
public function getLinterConfigurationName() {
@@ -27,11 +40,51 @@
}
public function getInstallInstructions() {
- return pht('Install ESLint using `npm install -g eslint`.');
+ return pht('Install ESLint using `%s`.', 'npm install -g eslint');
+ }
+
+ public function getMandatoryFlags() {
+ $options = array();
+
+ $options[] = '--format=stylish';
+
+ if ($this->eslintenv) {
+ $options[] = '--env='.$this->eslintenv;
+ }
+
+ if ($this->eslintconfig) {
+ $options[] = '--config='.$this->eslintconfig;
+ }
+
+ return $options;
}
- protected function canCustomizeLintSeverities() {
- return true;
+ public function getLinterConfigurationOptions() {
+ $options = array(
+ 'eslint.eslintenv' => array(
+ 'type' => 'optional string',
+ 'help' => pht('enables specific environments.'),
+ ),
+ 'eslint.eslintconfig' => array(
+ 'type' => 'optional string',
+ 'help' => pht('config file to use the default is .eslint.'),
+ ),
+ );
+ return $options + parent::getLinterConfigurationOptions();
+ }
+
+ public function setLinterConfigurationValue($key, $value) {
+
+ switch ($key) {
+ case 'eslint.eslintenv':
+ $this->eslintenv = $value;
+ return;
+ case 'eslint.eslintconfig':
+ $this->eslintconfig = $value;
+ return;
+ }
+
+ return parent::setLinterConfigurationValue($key, $value);
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 25, 12:33 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7741010
Default Alt Text
D12198.id32757.diff (2 KB)
Attached To
Mode
D12198: Added ESLint Support
Attached
Detach File
Event Timeline
Log In to Comment