Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistESLintLinter.php
| <?php | <?php | ||||
| final class ArcanistESLintLinter extends ArcanistExternalLinter { | final class ArcanistESLintLinter extends ArcanistExternalLinter { | ||||
| public function getInfoName() { | public function getInfoName() { | ||||
| return 'ESLint'; | return 'ESLint'; | ||||
| } | } | ||||
| public function getInfoURI() { | public function getInfoURI() { | ||||
| return 'https://www.eslint.org'; | return 'https://www.eslint.org'; | ||||
| } | } | ||||
| public function getInfoDescription() { | public function getInfoDescription() { | ||||
| return pht('ESLint is a linter for JavaScript source files.'); | 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() { | public function getLinterName() { | ||||
| return 'ESLint'; | return 'ESLINT'; | ||||
| } | } | ||||
| public function getLinterConfigurationName() { | public function getLinterConfigurationName() { | ||||
| return 'eslint'; | return 'eslint'; | ||||
| } | } | ||||
| public function getDefaultBinary() { | public function getDefaultBinary() { | ||||
| return 'eslint'; | return 'eslint'; | ||||
| } | } | ||||
| public function getInstallInstructions() { | public function getInstallInstructions() { | ||||
| return pht('Install ESLint using `npm install -g eslint`.'); | return pht('Install ESLint using `%s`.', 'npm install -g eslint'); | ||||
| } | |||||
| protected function canCustomizeLintSeverities() { | |||||
| return true; | |||||
| } | } | ||||
| protected function parseLinterOutput($path, $err, $stdout, $stderr) { | protected function parseLinterOutput($path, $err, $stdout, $stderr) { | ||||
| $lines = phutil_split_lines($stdout, false); | $lines = phutil_split_lines($stdout, false); | ||||
| $messages = array(); | $messages = array(); | ||||
| foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
| // Clean up nasty ESLint output | // Clean up nasty ESLint output | ||||
| Show All 23 Lines | |||||