@@ -28,22 +28,6 @@ function linesOf(lines: string[]): GetLineText {
2828// Pattern matching
2929// ---------------------------------------------------------------------------
3030describe ( 'YAML_LINT_DISABLE_PATTERN' , ( ) => {
31- it ( 'should match a plain disable comment' , ( ) => {
32- expect ( YAML_LINT_DISABLE_PATTERN . test ( '# yaml-lint-disable' ) ) . to . be . true ;
33- } ) ;
34-
35- it ( 'should match with leading whitespace' , ( ) => {
36- expect ( YAML_LINT_DISABLE_PATTERN . test ( ' # yaml-lint-disable' ) ) . to . be . true ;
37- } ) ;
38-
39- it ( 'should match with extra spaces after #' , ( ) => {
40- expect ( YAML_LINT_DISABLE_PATTERN . test ( '# yaml-lint-disable' ) ) . to . be . true ;
41- } ) ;
42-
43- it ( 'should match with specifiers after the keyword' , ( ) => {
44- expect ( YAML_LINT_DISABLE_PATTERN . test ( '# yaml-lint-disable Incorrect type' ) ) . to . be . true ;
45- } ) ;
46-
4731 it ( 'should capture specifiers in group 1' , ( ) => {
4832 const match = YAML_LINT_DISABLE_PATTERN . exec ( '# yaml-lint-disable Incorrect type, not accepted' ) ;
4933 expect ( match ) . to . not . be . null ;
@@ -55,22 +39,6 @@ describe('YAML_LINT_DISABLE_PATTERN', () => {
5539 expect ( match ) . to . not . be . null ;
5640 expect ( match [ 1 ] . trim ( ) ) . to . equal ( '' ) ;
5741 } ) ;
58-
59- it ( 'should not match a regular comment' , ( ) => {
60- expect ( YAML_LINT_DISABLE_PATTERN . test ( '# this is a regular comment' ) ) . to . be . false ;
61- } ) ;
62-
63- it ( 'should not match a partial keyword' , ( ) => {
64- expect ( YAML_LINT_DISABLE_PATTERN . test ( '# yaml-lint-disabl' ) ) . to . be . false ;
65- } ) ;
66-
67- it ( 'should not match without the hash' , ( ) => {
68- expect ( YAML_LINT_DISABLE_PATTERN . test ( 'yaml-lint-disable' ) ) . to . be . false ;
69- } ) ;
70-
71- it ( 'should not match an inline value that contains the phrase' , ( ) => {
72- expect ( YAML_LINT_DISABLE_PATTERN . test ( 'key: value # yaml-lint-disable' ) ) . to . be . false ;
73- } ) ;
7442} ) ;
7543
7644// ---------------------------------------------------------------------------
@@ -137,7 +105,7 @@ describe('shouldSuppressDiagnostic', () => {
137105describe ( 'filterSuppressedDiagnostics' , ( ) => {
138106 // Use inline arrows for getStartLine and getMessage so TypeScript infers T
139107 // from the diagnostics array and preserves all properties on the result.
140- const filter = ( diagnostics : ReturnType < typeof makeDiag > [ ] , lines : GetLineText ) =>
108+ const filter = ( diagnostics : ReturnType < typeof makeDiag > [ ] , lines : GetLineText ) : ReturnType < typeof makeDiag > [ ] =>
141109 filterSuppressedDiagnostics (
142110 diagnostics ,
143111 ( d ) => d . startLine ,
@@ -234,13 +202,7 @@ describe('filterSuppressedDiagnostics', () => {
234202 } ) ;
235203
236204 it ( 'should handle multiple disable comments for different lines' , ( ) => {
237- const lines = linesOf ( [
238- '# yaml-lint-disable' ,
239- 'line1: bad' ,
240- 'line2: ok' ,
241- '# yaml-lint-disable' ,
242- 'line4: also-bad' ,
243- ] ) ;
205+ const lines = linesOf ( [ '# yaml-lint-disable' , 'line1: bad' , 'line2: ok' , '# yaml-lint-disable' , 'line4: also-bad' ] ) ;
244206 const diagnostics = [ makeDiag ( 1 , 'error on line 1' ) , makeDiag ( 2 , 'error on line 2' ) , makeDiag ( 4 , 'error on line 4' ) ] ;
245207
246208 const result = filter ( diagnostics , lines ) ;
0 commit comments