@@ -88,6 +88,24 @@ ruleTester.run("table-column-count", rule, {
8888 | abc | def |
8989 | --- | --- |
9090 ` ,
91+ {
92+ code : dedent `
93+ | Header | Header |
94+ | ------ | ------ |
95+ | Cell | Cell |
96+ | Cell | Cell |
97+ ` ,
98+ options : [ { checkMissingCells : true } ] ,
99+ } ,
100+ {
101+ code : dedent `
102+ | Header | Header |
103+ | ------ | ------ |
104+ | Cell | |
105+ | Cell | Cell |
106+ ` ,
107+ options : [ { checkMissingCells : true } ] ,
108+ } ,
91109 ] ,
92110
93111 invalid : [
@@ -99,7 +117,7 @@ ruleTester.run("table-column-count", rule, {
99117 ` ,
100118 errors : [
101119 {
102- messageId : "inconsistentColumnCount " ,
120+ messageId : "extraCells " ,
103121 data : { actualCells : "3" , expectedCells : "2" } ,
104122 line : 3 ,
105123 column : 17 ,
@@ -116,7 +134,7 @@ ruleTester.run("table-column-count", rule, {
116134 ` ,
117135 errors : [
118136 {
119- messageId : "inconsistentColumnCount " ,
137+ messageId : "extraCells " ,
120138 data : { actualCells : "4" , expectedCells : "2" } ,
121139 line : 3 ,
122140 column : 17 ,
@@ -133,7 +151,7 @@ ruleTester.run("table-column-count", rule, {
133151 ` ,
134152 errors : [
135153 {
136- messageId : "inconsistentColumnCount " ,
154+ messageId : "extraCells " ,
137155 data : { actualCells : "2" , expectedCells : "1" } ,
138156 line : 3 ,
139157 column : 5 ,
@@ -155,7 +173,7 @@ ruleTester.run("table-column-count", rule, {
155173 ` ,
156174 errors : [
157175 {
158- messageId : "inconsistentColumnCount " ,
176+ messageId : "extraCells " ,
159177 data : { actualCells : "3" , expectedCells : "2" } ,
160178 line : 5 ,
161179 column : 21 ,
@@ -173,7 +191,7 @@ ruleTester.run("table-column-count", rule, {
173191 ` ,
174192 errors : [
175193 {
176- messageId : "inconsistentColumnCount " ,
194+ messageId : "extraCells " ,
177195 data : { actualCells : "3" , expectedCells : "2" } ,
178196 line : 4 ,
179197 column : 11 ,
@@ -191,7 +209,7 @@ ruleTester.run("table-column-count", rule, {
191209 ` ,
192210 errors : [
193211 {
194- messageId : "inconsistentColumnCount " ,
212+ messageId : "extraCells " ,
195213 data : { actualCells : "3" , expectedCells : "2" } ,
196214 line : 3 ,
197215 column : 13 ,
@@ -209,15 +227,15 @@ ruleTester.run("table-column-count", rule, {
209227 ` ,
210228 errors : [
211229 {
212- messageId : "inconsistentColumnCount " ,
230+ messageId : "extraCells " ,
213231 data : { actualCells : "3" , expectedCells : "2" } ,
214232 line : 3 ,
215233 column : 13 ,
216234 endLine : 3 ,
217235 endColumn : 23 ,
218236 } ,
219237 {
220- messageId : "inconsistentColumnCount " ,
238+ messageId : "extraCells " ,
221239 data : { actualCells : "3" , expectedCells : "2" } ,
222240 line : 4 ,
223241 column : 13 ,
@@ -236,15 +254,15 @@ ruleTester.run("table-column-count", rule, {
236254 ` ,
237255 errors : [
238256 {
239- messageId : "inconsistentColumnCount " ,
257+ messageId : "extraCells " ,
240258 data : { actualCells : "3" , expectedCells : "2" } ,
241259 line : 3 ,
242260 column : 13 ,
243261 endLine : 3 ,
244262 endColumn : 23 ,
245263 } ,
246264 {
247- messageId : "inconsistentColumnCount " ,
265+ messageId : "extraCells " ,
248266 data : { actualCells : "3" , expectedCells : "2" } ,
249267 line : 5 ,
250268 column : 13 ,
@@ -253,5 +271,154 @@ ruleTester.run("table-column-count", rule, {
253271 } ,
254272 ] ,
255273 } ,
274+ {
275+ code : dedent `
276+ | Header | Header | Header |
277+ | ------ | ------ | ------ |
278+ | Cell | Cell |
279+ ` ,
280+ options : [ { checkMissingCells : true } ] ,
281+ errors : [
282+ {
283+ messageId : "missingCells" ,
284+ data : { actualCells : "2" , expectedCells : "3" } ,
285+ line : 3 ,
286+ column : 19 ,
287+ endLine : 3 ,
288+ endColumn : 20 ,
289+ } ,
290+ ] ,
291+ } ,
292+ {
293+ code : dedent `
294+ | Col A | Col B | Col C |
295+ | ----- | ----- | ----- |
296+ | Cell | | Cell |
297+ | Cell | Cell |
298+ ` ,
299+ options : [ { checkMissingCells : true } ] ,
300+ errors : [
301+ {
302+ messageId : "missingCells" ,
303+ data : { actualCells : "2" , expectedCells : "3" } ,
304+ line : 4 ,
305+ column : 17 ,
306+ endLine : 4 ,
307+ endColumn : 18 ,
308+ } ,
309+ ] ,
310+ } ,
311+ {
312+ code : dedent `
313+ | Col A | Col B | Col C |
314+ | ----- | ----- | ----- |
315+ | Cell |
316+ | Cell | Cell |
317+ | Cell | Cell | Cell |
318+ ` ,
319+ options : [ { checkMissingCells : true } ] ,
320+ errors : [
321+ {
322+ messageId : "missingCells" ,
323+ data : { actualCells : "1" , expectedCells : "3" } ,
324+ line : 3 ,
325+ column : 9 ,
326+ endLine : 3 ,
327+ endColumn : 10 ,
328+ } ,
329+ {
330+ messageId : "missingCells" ,
331+ data : { actualCells : "2" , expectedCells : "3" } ,
332+ line : 4 ,
333+ column : 17 ,
334+ endLine : 4 ,
335+ endColumn : 18 ,
336+ } ,
337+ ] ,
338+ } ,
339+ {
340+ code : dedent `
341+ | Table |
342+ | ----- |
343+ | Cell | Cell |
344+ | Cell |
345+ | Cell | Cell |
346+ ` ,
347+ options : [ { checkMissingCells : true } ] ,
348+ errors : [
349+ {
350+ messageId : "extraCells" ,
351+ data : { actualCells : "2" , expectedCells : "1" } ,
352+ line : 3 ,
353+ column : 9 ,
354+ endLine : 3 ,
355+ endColumn : 18 ,
356+ } ,
357+ {
358+ messageId : "extraCells" ,
359+ data : { actualCells : "2" , expectedCells : "1" } ,
360+ line : 5 ,
361+ column : 9 ,
362+ endLine : 5 ,
363+ endColumn : 18 ,
364+ } ,
365+ ] ,
366+ } ,
367+ {
368+ code : dedent `
369+ | Table | Header |
370+ | ----- | ------ |
371+ | Cell | Cell | Cell |
372+ | Cell |
373+ | Cell | Cell |
374+ ` ,
375+ options : [ { checkMissingCells : true } ] ,
376+ errors : [
377+ {
378+ messageId : "extraCells" ,
379+ data : { actualCells : "3" , expectedCells : "2" } ,
380+ line : 3 ,
381+ column : 18 ,
382+ endLine : 3 ,
383+ endColumn : 28 ,
384+ } ,
385+ {
386+ messageId : "missingCells" ,
387+ data : { actualCells : "1" , expectedCells : "2" } ,
388+ line : 4 ,
389+ column : 9 ,
390+ endLine : 4 ,
391+ endColumn : 10 ,
392+ } ,
393+ ] ,
394+ } ,
395+ {
396+ code : dedent `
397+ | Table | Header | Header |
398+ | ----- | ------ | ------ |
399+ | Cell | Cell | Cell |
400+ | Cell | Cell | Cell | Cell |
401+ | Cell |
402+ ` ,
403+ options : [ { checkMissingCells : true } ] ,
404+ errors : [
405+ {
406+ messageId : "extraCells" ,
407+ data : { actualCells : "4" , expectedCells : "3" } ,
408+ line : 4 ,
409+ column : 27 ,
410+ endLine : 4 ,
411+ endColumn : 37 ,
412+ } ,
413+ {
414+ messageId : "missingCells" ,
415+ data : { actualCells : "1" , expectedCells : "3" } ,
416+ line : 5 ,
417+ column : 9 ,
418+ endLine : 5 ,
419+ endColumn : 10 ,
420+ } ,
421+ ] ,
422+ } ,
256423 ] ,
257424} ) ;
0 commit comments