question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sourceCode.isSpaceBetweenTokens() and multiline comments

See original GitHub issue

Noticed this while working on #12259

sourceCode.isSpaceBetweenTokens() sees newlines inside multiline block comments as spaces.

Observable:

/* eslint space-before-function-paren:["error", "never"]*/

function foo/*
*/(){}

Demo link

The above is an error because of the newline (function foo/* */(){} is not an error for the same rule.)

Is it intentional or a bug?

There is no such test for isSpaceBetweenTokens() in source-code tests.

Also, when I add the s flag to the /\/\*.*?\*\//gu regex in isSpaceBetweenTokens and run npm test everything still works.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
kaicataldocommented, Sep 12, 2019

Seems like a bug to me.

1reaction
mdjermanoviccommented, Sep 13, 2019

@kaicataldo Feel free to claim this 😃

The effects of this change can be also observed in the current version of template-tag-spacing, it will have more and fewer errors in some cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ single line comments followed by \ transforms in multiline ...
Each instance of a backslash character () immediately followed by a new-line character is deleted, splicing physical source lines to form logical source...
Read more >
2. Lexical analysis — Python 3.11.1 documentation
This chapter describes how the lexical analyzer breaks a file into tokens. Python reads program text as Unicode code points; the encoding of...
Read more >
Three Types of Comments in Java: Javadoc, Single-line and ...
Java's single line and multi-line comments are collectively called implementation comments, while Javadoc comments are called documentation comments.
Read more >
How whitespace is handled by HTML, CSS, and in the DOM
Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line...
Read more >
Lexical Structure - Python in a Nutshell, 2nd Edition [Book]
You may freely use whitespace between tokens to separate them. Some whitespace separation is necessary between logically adjacent identifiers or keywords; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found