Page MenuHomePhabricator

Add some `.arclint` configuration options for `ArcanistJSHintLinter`.
ClosedPublic

Authored by joshuaspence on May 14 2014, 3:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 4:37 AM
Unknown Object (File)
Mon, Oct 28, 1:00 PM
Unknown Object (File)
Mon, Oct 28, 6:04 AM
Unknown Object (File)
Oct 14 2024, 1:34 AM
Unknown Object (File)
Oct 12 2024, 7:47 AM
Unknown Object (File)
Oct 3 2024, 9:33 AM
Unknown Object (File)
Oct 2 2024, 2:07 AM
Unknown Object (File)
Oct 1 2024, 11:34 PM

Details

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.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Add some `.arclint` configuration options for `ArcanistJSHintLinter`..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
src/lint/linter/ArcanistJSHintLinter.php
94

Don't we eventually use %Ls to print this? So special characters in these flags would be double-escaped, becuase we're using csprintf() here and then %Ls again later?

116–122

Maybe we should make a convenience method for this, since several linters either do something similar or should do something similar.

131

As above.

joshuaspence edited edge metadata.
joshuaspence added a subscriber: john.snow.
src/lint/linter/ArcanistJSHintLinter.php
94

I think that you are correct, but I'll double check.

116–122

I guess there are two possibilities here:

  1. Provide a function In ArcanistLinter for checking/retrieving a file from the working copy.
  2. Blindly pass the option to the external linter, regardless of whether the file exists.

The former is probably better, but the latter is simpler.

src/lint/linter/ArcanistJSHintLinter.php
116–122

I actually think (2) isn't too bad, as long as we can solve the CWD problem with setCWD($project_root) on the Future. Hopefully most/all linters raise sensible errors when you pass bad flags to them.

(They also often exit with a nonzero status, but usually we can figure out if that means "error" or not.)

Don't use csprintf.

@epriestley, you were correct about the double escaping:

  • Without csprintf: 'jshint' '--reporter=/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/reporter.js' '--config=/path/to/.jshintrc' '--exclude-path=/path/to/.jshintignore' -
  • With csprintf: 'jshint' '--reporter='\''/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/reporter.js'\''' '--config='\''/path/to/.jshintrc'\''' '--exclude-path='\''/path/to/.jshintignore'\''' -

Namespace the jshint configuration options.

Don't check if the .jshintrc and .jshintignore paths exist (let jshint determine this).

joshuaspence added a task: Restricted Maniphest Task.
epriestley edited edge metadata.
This revision is now accepted and ready to land.May 17 2014, 4:42 AM
epriestley updated this revision to Diff 21761.

Closed by commit rARC8cd9cb104798 (authored by @joshuaspence, committed by @epriestley).

pzinovkin added inline comments.
src/lint/linter/ArcanistJSHintLinter.php
113

It's useless because file passed via STDIN.