@@ -178,6 +178,7 @@ var CSSLint = (function() {
178178 reporter ,
179179 lines ,
180180 allow = { } ,
181+ ignore = [ ] ,
181182 report ,
182183 parser = new parserlib . css . Parser ( { starHack : true , ieFilters : true ,
183184 underscoreHack : true , strict : false } ) ;
@@ -201,6 +202,29 @@ var CSSLint = (function() {
201202 }
202203 } ) ;
203204
205+ var ignoreStart = null ,
206+ ignoreEnd = null ;
207+ CSSLint . Util . forEach ( lines , function ( line , lineno ) {
208+ // Keep oldest, "unclosest" ignore:start
209+ if ( null === ignoreStart && line . match ( / \/ \* [ \t ] * c s s l i n t [ \t ] + i g n o r e : s t a r t [ \t ] * \* \/ / i) ) {
210+ ignoreStart = lineno ;
211+ }
212+
213+ if ( line . match ( / \/ \* [ \t ] * c s s l i n t [ \t ] + i g n o r e : e n d [ \t ] * \* \/ / i) ) {
214+ ignoreEnd = lineno ;
215+ }
216+
217+ if ( null !== ignoreStart && null !== ignoreEnd ) {
218+ ignore . push ( [ ignoreStart , ignoreEnd ] ) ;
219+ ignoreStart = ignoreEnd = null ;
220+ }
221+ } ) ;
222+
223+ // Close remaining ignore block, if any
224+ if ( null !== ignoreStart ) {
225+ ignore . push ( [ ignoreStart , lines . length ] ) ;
226+ }
227+
204228 if ( ! ruleset ) {
205229 ruleset = this . getRuleset ( ) ;
206230 }
@@ -211,7 +235,7 @@ var CSSLint = (function() {
211235 ruleset = applyEmbeddedRuleset ( text , ruleset ) ;
212236 }
213237
214- reporter = new Reporter ( lines , ruleset , allow ) ;
238+ reporter = new Reporter ( lines , ruleset , allow , ignore ) ;
215239
216240 ruleset . errors = 2 ; //always report parsing errors as errors
217241 for ( i in ruleset ) {
@@ -234,7 +258,8 @@ var CSSLint = (function() {
234258 messages : reporter . messages ,
235259 stats : reporter . stats ,
236260 ruleset : reporter . ruleset ,
237- allow : reporter . allow
261+ allow : reporter . allow ,
262+ ignore : reporter . ignore
238263 } ;
239264
240265 //sort by line numbers, rollups at the bottom
0 commit comments