Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`spaced-comment` should allow line ending after markers #12036

Closed
tiansh opened this issue Jul 29, 2019 · 7 comments · May be fixed by rsumner868/librealsense2.1#1, rsumner868/librealsense#4, O330oei/node#4 or O330oei/node#11

Comments

@tiansh
Copy link

@tiansh tiansh commented Jul 29, 2019

What rule do you want to change?
spaced-comment

Does this change cause the rule to produce more or fewer warnings?
fewer

How will the change be implemented? (New option, new default behavior, etc.)?
default behavior

Please provide some example code that this change will affect:

/* eslint spaced-comment: ["error", "always", { "line": { "markers": ["/", "#region", "#endregion"] } }] */
/* eslint no-trailing-spaces: ["error"] */

//#region blah
const answer = 42;
//#endregion

console.log(answer);

What does the rule currently do for this code?

6:1 error Expected space or tab after '//#endregion' in comment spaced-comment

using --fix cannot fix it (since there are no possible auto fix)

What will the rule do after it's changed?

pass without tip an error

Are you willing to submit a pull request to implement this change?

Maybe no


spaced-comment does allow line ending after // without using markers. And this behavior should be applied to markers too imo.

@platinumazure
Copy link
Member

@platinumazure platinumazure commented Jul 29, 2019

Hi @tiansh, thanks for the issue.

This feels like a bug to me. I think it shouldn't matter if a comment has markers after the content or not.

I'm going to relabel this as a bug, but team members can feel free to correct that if needed.

@platinumazure
Copy link
Member

@platinumazure platinumazure commented Jul 29, 2019

Reproduction here, so marking as accepted.

@g-plane
Copy link
Member

@g-plane g-plane commented Jul 29, 2019

@platinumazure Repro link is broken.

@platinumazure
Copy link
Member

@platinumazure platinumazure commented Jul 29, 2019

@g-plane Sorry, bad paste. It's fixed now.

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Aug 18, 2019

I'm working on this, but have a question. Should the rule also allow these:

/* eslint spaced-comment: ["error", "always", { "block": { "markers": ["foo"] } }] */

/*foo*/
/* eslint spaced-comment: ["error", "always", { "block": { "markers": ["foo"], balanced: true } }] */

/*foo*/

I.e. ignore a comment that contains only a marker like it already ignores an empty /**/

The issue with //#endregion is that the rule requires a \s after the marker, but there is nothing. Linebreak is not included in comment's value.

// immediately followed by the line ending is allowed simply because it's an empty comment.

@eslint eslint bot closed this Oct 28, 2019
@eslint eslint bot added the auto closed label Oct 28, 2019
@eslint
Copy link
Contributor

@eslint eslint bot commented Oct 28, 2019

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that accepted issues failing to be implemented after 90 days tend to
never be implemented, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@kaicataldo kaicataldo reopened this Oct 29, 2019
@kaicataldo kaicataldo removed the auto closed label Oct 29, 2019
@DmytroLapshyn
Copy link

@DmytroLapshyn DmytroLapshyn commented Oct 31, 2019

If anyone cares for a workaround, this worked for me:

"markers": ["#region"],
"exceptions": ["#endregion"]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.