CSSLint / csslint

Automated linting of Cascading Stylesheets
http://csslint.net
Other
4.76k stars 483 forks source link

Don't rely on `this` #711

Closed Aaronius closed 6 years ago

Aaronius commented 6 years ago

There's an assumption being made that format and verify will be called with api being the this context:

https://github.com/CSSLint/csslint/blob/master/src/core/CSSLint.js#L140 https://github.com/CSSLint/csslint/blob/master/src/core/CSSLint.js#L233

This isn't always the case though. In the case of htmlhint, it's calling without a this context:

https://github.com/yaniswang/HTMLHint/blob/master/src/rules/csslint.js#L26

Which causes issues when CSSLint access methods on this thinking it's the api.