SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

End of hash (`}`) force-enables linting #385

Open jkrems opened 7 years ago

jkrems commented 7 years ago

Example:

@css {
  body {
  }

  // linting is enabled, no matter what
}

I think this is caused by the following code:

var hashEnd = function( line ) {
    if ( !this.state.hashOrCSS ) { return }

    // ex }, but only if we've already establish that we're in a hash'
    if ( line.indexOf( '}' ) !== -1 ) {
        this.state.hashOrCSS = false
        this.state.testsEnabled = true // !
    }

    return this.state.hashOrCSS
}

It looks like it doesn't handle nesting (more interesting example would be nested media queries).

SimenB commented 7 years ago

Thanks for the issue, @jkrems!

We're currently working on 2.0, and won't get to bugs before after that's done, unless you're able to provide a PR for this yourself.

Will fix this (along with other bug reports), as soon as possible after release of 2.0 😄

See the project for progress on it, and #269 for discussions.