https://bz.apache.org/bugzilla/show_bug.cgi?id=70137

            Bug ID: 70137
           Summary: StripJavaComments - a little too eager for JavaScript
           Product: Ant
           Version: 1.10.14
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

While StripJavaComments is not called StripJavaScriptComments, it has been
doing a wonderful job on JavaScript files for years. Until a linter suggested
replacing a `new regexp()` expression with a regex constant.

const re = new RegExp( '://', 'g' );

became:

const re = /:\/\//g;

Which works fine, until StripJavaComments considered //g; a comment and
truncated this to:

const re = /:\/\

May I suggest that:

- // at the start of a line (with optional prefixed whitespace) is always a
comment;
- // in the middle of a line should only be considered a comment /if/ it has
whitespace before it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to