fluid-project / fluid-lint-all

Consolidated linting logic free from any particular build technology
BSD 3-Clause "New" or "Revised" License
0 stars 5 forks source link

GH-26: Disabled indentation checks for JS comments (resolves #26). #34

Closed the-t-in-rtf closed 3 years ago

the-t-in-rtf commented 3 years ago

Ignore JS comments in lintspaces.newlines checks. See #26 for context.

the-t-in-rtf commented 3 years ago

It seems like lintspaces cannot be configured more finely than opting JS comments out of their checks altogether.

In my testing, there are side effects that we should be aware of. Indentation errors will now only be reported for the first line of a multi-line comment. So, things like these examples would be allowed:

/*
  * A little slanted.
    */

/*
        * A lot slanted.
                */

/*
* Oops, forgot a space.
*/

/*
                                          * Oops, cat slept on the spacebar while I was out.
*/

I was hoping ESLint would catch these for us, but it seems pretty agnostic about comment indentation, and accepts each of those as well. I'll see if I can find another library or ESLint plugin that does a better job.

the-t-in-rtf commented 3 years ago

There's a new ESLint rule to enforce a single comment style, and it has indentation checks. Sadly, it only allows you to use a single style, so it seems more appropriate to have people opt into that downstream, as I know we have a mix of "block" and "starred" commenters in the community.