Page MenuHomePhabricator

Diff on `arc lint` misleading when the replacement has newlines
Closed, ResolvedPublic

Description

I don't even know if it's supported to have a lint replacement-text have a newline in it, but it seems to work fine. The only problem is the reporting is off:

% arc lint javascript/typeahead-package/search-results-popup.jsx
>>> Lint for javascript/typeahead-package/search-results-popup.jsx:


   Error  (S&RX) Ereact/jsx-closing-bracket-location
    The closing bracket must be aligned with the line containing the opening
    tag (expected column 17 on the next line)

              30         if (this.props.totalResults != null) {
              31             resultsText =
              32                 <$_ totalFound={this.props.totalResults}
    >>> -     33                     query={this.props.query}>
        +                            query={this.props.query}>
        +                        
              34                         Show all %(totalFound)s results for %(query)s
              35                 </$_>;
              36         } else {

(If you mouse over the second added line, you can see it's a bunch of spaces.)

The actual replacement we are doing is '' -> '\n ', right before the closing >. And indeed when we actually apply the fix, it shows this:

--- /home/csilvers/khan/webapp/javascript/typeahead-package/search-results-popup.jsx    2015-11-24 14:21:46.486953917 -0800
+++ /tmp/6j9pk1zr31oo4gws/19167-zotkwH  2015-11-24 14:25:00.447741309 -0800
@@ -30,7 +30,8 @@
         if (this.props.totalResults != null) {
             resultsText =
                 <$_ totalFound={this.props.totalResults}
-                    query={this.props.query}>
+                    query={this.props.query}
+                >
                         Show all %(totalFound)s results for %(query)s
                 </$_>;

But in the initial lint error display, it shows the closing > on the first + line, when it should be at the end of the second.

Event Timeline

csilvers updated the task description. (Show Details)
csilvers added projects: Lint, Arcanist.
csilvers added a subscriber: csilvers.
eadler added a project: Restricted Project.Jan 11 2016, 9:39 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jan 11 2016, 9:42 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 4 2016, 9:10 PM