From 4a1c9f304cf7ccd0503d97be6037e3f692b057fb Mon Sep 17 00:00:00 2001 From: Xianming Zhong Date: Sun, 24 Nov 2019 17:48:49 +0800 Subject: [PATCH] Output and check errors lines (#92) --- test/_lint.js | 1 + test/rules/badge.js | 3 ++ test/rules/code-of-conduct.js | 3 ++ test/rules/contributing.js | 2 ++ test/rules/git-repo-age.js | 2 ++ test/rules/github.js | 10 ++++++ test/rules/heading.js | 4 +++ test/rules/license.js | 5 +++ test/rules/list-item.js | 10 +++--- test/rules/no-ci-badge.js | 2 ++ test/rules/snapshots/list-item.js.md | 44 +++++++++++------------ test/rules/snapshots/list-item.js.snap | Bin 835 -> 905 bytes test/rules/snapshots/spell-check.js.md | 31 ++++++++++++++++ test/rules/snapshots/spell-check.js.snap | Bin 1022 -> 1185 bytes test/rules/toc.js | 5 +++ 15 files changed, 93 insertions(+), 29 deletions(-) diff --git a/test/_lint.js b/test/_lint.js index 792ad8f..8da9561 100644 --- a/test/_lint.js +++ b/test/_lint.js @@ -3,6 +3,7 @@ import lint from '..'; export default async options => { const result = await lint(options); return result.reduce((list, file) => list.concat(file.messages), []).map(error => ({ + line: error.line, ruleId: error.ruleId, message: error.message })); diff --git a/test/rules/badge.js b/test/rules/badge.js index 75fbfa5..de7370d 100644 --- a/test/rules/badge.js +++ b/test/rules/badge.js @@ -12,6 +12,7 @@ test('badge - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/badge/error0.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-badge', message: 'Missing Awesome badge after the main heading' } @@ -22,6 +23,7 @@ test('badge - incorrect source', async t => { const messages = await lint({config, filename: 'test/fixtures/badge/error1.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-badge', message: 'Invalid badge source' } @@ -32,6 +34,7 @@ test('badge - incorrect source raw git', async t => { const messages = await lint({config, filename: 'test/fixtures/badge/error2.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-badge', message: 'Invalid badge source' } diff --git a/test/rules/code-of-conduct.js b/test/rules/code-of-conduct.js index cbd2ba3..f744809 100644 --- a/test/rules/code-of-conduct.js +++ b/test/rules/code-of-conduct.js @@ -12,6 +12,7 @@ test('code-of-conduct - invalid if empty', async t => { const messages = await lint({config, filename: 'test/fixtures/code-of-conduct/error0/readme.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-code-of-conduct', message: 'code-of-conduct.md file must not be empty' } @@ -22,6 +23,7 @@ test('code-of-conduct - invalid if has placeholder', async t => { const messages = await lint({config, filename: 'test/fixtures/code-of-conduct/error1/readme.md'}); t.deepEqual(messages, [ { + line: 58, ruleId: 'awesome-code-of-conduct', message: 'The email placeholder must be replaced with yours' } @@ -32,6 +34,7 @@ test('code-of-conduct - invalid if just copyed', async t => { const messages = await lint({config, filename: 'test/fixtures/code-of-conduct/error2/readme.md'}); t.deepEqual(messages, [ { + line: 57, ruleId: 'awesome-code-of-conduct', message: 'The default email must be replaced with yours' } diff --git a/test/rules/contributing.js b/test/rules/contributing.js index 7924853..72c7d39 100644 --- a/test/rules/contributing.js +++ b/test/rules/contributing.js @@ -11,6 +11,7 @@ test('contributing - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/contributing/error0/readme.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-contributing', message: 'Missing file contributing.md' } @@ -21,6 +22,7 @@ test('contributing - empty', async t => { const messages = await lint({config, filename: 'test/fixtures/contributing/error1/readme.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-contributing', message: 'contributing.md file must not be empty' } diff --git a/test/rules/git-repo-age.js b/test/rules/git-repo-age.js index 3a54206..65fe21b 100644 --- a/test/rules/git-repo-age.js +++ b/test/rules/git-repo-age.js @@ -29,6 +29,7 @@ test.serial('git-repo-age - error invalid git repo', async t => { const messages = await lint({config, filename: 'test/fixtures/git-repo-age/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-git-repo-age', message: 'Awesome list must reside in a valid deep-cloned Git repository (see https://github.com/sindresorhus/awesome-lint#tip for more information)' } @@ -49,6 +50,7 @@ test.serial('git-repo-age - error repo is not old enough', async t => { const messages = await lint({config, filename: 'test/fixtures/git-repo-age/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-git-repo-age', message: 'Git repository must be at least 30 days old' } diff --git a/test/rules/github.js b/test/rules/github.js index b9bca76..faec2e7 100644 --- a/test/rules/github.js +++ b/test/rules/github.js @@ -29,6 +29,7 @@ test.serial('github - error invalid git repo', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'Awesome list must reside in a valid git repository' } @@ -56,9 +57,11 @@ test.serial('github - repo without description and license', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'The repository should have a description' }, { + line: null, ruleId: 'awesome-github', message: 'License was not detected by GitHub' } @@ -88,6 +91,7 @@ test.serial('github - missing topic awesome-list', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'The repository should have "awesome-list" as a GitHub topic' } @@ -117,6 +121,7 @@ test.serial('github - missing topic awesome', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'The repository should have "awesome" as a GitHub topic' } @@ -133,6 +138,7 @@ test.serial('github - remote origin is an GitLab repo', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'Repository should be on GitHub' } @@ -156,6 +162,7 @@ test.serial('github - invalid token', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'Unauthorized access or token is invalid' } @@ -184,6 +191,7 @@ test.serial('github - API rate limit exceeded with token', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'API rate limit of 5000 requests per hour exceeded' } @@ -212,6 +220,7 @@ test.serial('github - API rate limit exceeded without token', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'API rate limit of 60 requests per hour exceeded. Use a personal token to increase the number of requests' } @@ -236,6 +245,7 @@ test.serial('github - API offline', async t => { const messages = await lint({config, filename: 'test/fixtures/github/0.md'}); t.deepEqual(messages, [ { + line: null, ruleId: 'awesome-github', message: 'There was a problem trying to connect to GitHub: getaddrinfo ENOTFOUND api.github.com api.github.com:443' } diff --git a/test/rules/heading.js b/test/rules/heading.js index 349143e..9d93b7c 100644 --- a/test/rules/heading.js +++ b/test/rules/heading.js @@ -12,6 +12,7 @@ test('heading - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/heading/error0.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-heading', message: 'Missing main list heading' } @@ -22,6 +23,7 @@ test('heading - not in title case', async t => { const messages = await lint({config, filename: 'test/fixtures/heading/error1.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-heading', message: 'Main heading must be in title case' } @@ -32,6 +34,7 @@ test('heading - more than one heading', async t => { const messages = await lint({config, filename: 'test/fixtures/heading/error2.md'}); t.deepEqual(messages, [ { + line: 3, ruleId: 'awesome-heading', message: 'List can only have one heading' } @@ -42,6 +45,7 @@ test('heading - depth is bigger than 1', async t => { const messages = await lint({config, filename: 'test/fixtures/heading/error3.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-heading', message: 'Main list heading must be of depth 1' } diff --git a/test/rules/license.js b/test/rules/license.js index 0851e1e..4a4a25b 100644 --- a/test/rules/license.js +++ b/test/rules/license.js @@ -13,6 +13,7 @@ test('license - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/license/error0.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-license', message: 'Missing License section' } @@ -27,6 +28,7 @@ test('license - empty', async t => { // message: 'Remove empty section: "License"' // }, { + line: 11, ruleId: 'awesome-license', message: 'License must not be empty' } @@ -37,6 +39,7 @@ test('license - not last section', async t => { const messages = await lint({config, filename: 'test/fixtures/license/error2.md'}); t.deepEqual(messages, [ { + line: 11, ruleId: 'awesome-license', message: 'License must be the last section' } @@ -47,6 +50,7 @@ test('license - incorrect heading depth', async t => { const messages = await lint({config, filename: 'test/fixtures/license/error3.md'}); t.deepEqual(messages, [ { + line: 11, ruleId: 'awesome-license', message: 'License section must be at heading depth 2' } @@ -57,6 +61,7 @@ test('license - png image', async t => { const messages = await lint({config, filename: 'test/fixtures/license/error4.md'}); t.deepEqual(messages, [ { + line: 3, ruleId: 'awesome-license', message: 'License image must be SVG' } diff --git a/test/rules/list-item.js b/test/rules/list-item.js index e7ae0f9..270bbc6 100644 --- a/test/rules/list-item.js +++ b/test/rules/list-item.js @@ -18,16 +18,16 @@ test('list-item - invalid', async t => { t.snapshot(messages); }); -test('list-item - invalid sublist punctuation', async t => { - const messages = await lint({config, filename: 'test/fixtures/list-item/3.md'}); - t.snapshot(messages); -}); - test('list-item - valid ignoring Contents section', async t => { const messages = await lint({config, filename: 'test/fixtures/list-item/2.md'}); t.deepEqual(messages, []); }); +test('list-item - invalid sublist punctuation', async t => { + const messages = await lint({config, filename: 'test/fixtures/list-item/3.md'}); + t.snapshot(messages); +}); + test('list-item - disable, enable, and ignore comments', async t => { const messages = await lint({config, filename: 'test/fixtures/list-item/4.md'}); t.snapshot(messages); diff --git a/test/rules/no-ci-badge.js b/test/rules/no-ci-badge.js index a86caa1..9ee9d4f 100644 --- a/test/rules/no-ci-badge.js +++ b/test/rules/no-ci-badge.js @@ -12,10 +12,12 @@ test('no-ci-badge - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/no-ci-badge/0.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-no-ci-badge', message: 'Readme must not contain CI badge' }, { + line: 3, ruleId: 'awesome-no-ci-badge', message: 'Readme must not contain CI badge' } diff --git a/test/rules/snapshots/list-item.js.md b/test/rules/snapshots/list-item.js.md index b535729..c41f289 100644 --- a/test/rules/snapshots/list-item.js.md +++ b/test/rules/snapshots/list-item.js.md @@ -4,24 +4,28 @@ The actual snapshot is saved in `list-item.js.snap`. Generated by [AVA](https://ava.li). -## list-item - disable,enable and ignore by remark-message-control +## list-item - disable, enable, and ignore comments > Snapshot 1 [ { + line: 1, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 2, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 11, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 18, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, @@ -33,54 +37,67 @@ Generated by [AVA](https://ava.li). [ { + line: 3, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 4, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 5, message: 'List item link and description must be separated with a dash', ruleId: 'awesome-list-item', }, { + line: 6, message: 'List item description must end with proper punctuation', ruleId: 'awesome-list-item', }, { + line: 7, message: 'Invalid list item link URL', ruleId: 'awesome-list-item', }, { + line: 8, message: 'Invalid list item link URL', ruleId: 'awesome-list-item', }, { + line: 9, message: 'Invalid list item link text', ruleId: 'awesome-list-item', }, { + line: 13, message: 'List item link and description separated by invalid whitespace', ruleId: 'awesome-list-item', }, { + line: 14, message: 'List item link and description separated by invalid en-dash', ruleId: 'awesome-list-item', }, { + line: 16, message: 'List item description must end with proper punctuation', ruleId: 'awesome-list-item', }, { + line: 17, message: 'List item description must end with proper punctuation', ruleId: 'awesome-list-item', }, { + line: 10, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, { + line: 11, message: 'List item description must start with valid casing', ruleId: 'awesome-list-item', }, @@ -92,34 +109,13 @@ Generated by [AVA](https://ava.li). [ { + line: 10, message: 'List item description must end with proper punctuation', ruleId: 'awesome-list-item', }, { + line: 12, message: 'Invalid list item link URL', ruleId: 'awesome-list-item', }, ] - -## list-item - disable, enable, and ignore comments - -> Snapshot 1 - - [ - { - message: 'List item description must start with valid casing', - ruleId: 'awesome-list-item', - }, - { - message: 'List item description must start with valid casing', - ruleId: 'awesome-list-item', - }, - { - message: 'List item description must start with valid casing', - ruleId: 'awesome-list-item', - }, - { - message: 'List item description must start with valid casing', - ruleId: 'awesome-list-item', - }, - ] diff --git a/test/rules/snapshots/list-item.js.snap b/test/rules/snapshots/list-item.js.snap index 16351bcc245bbe95c746776e295aab2e937beffb..69e5bf5661e9c92fa23a715a8cba22f99f4929f4 100644 GIT binary patch literal 905 zcmV;419tpDRzV~_Q2>U|+55$Hce~q#Ca9N0iz2a`6hS3fRu&OOG`o9pCwIqXXEsytrRb##y_HcB z(n~=ZJyj1rbRm%*>>;AdO9|ye1VyCzAoZWKy6Oxy7+bo+$NV#XGyXeg#yw{bA;eA& zpS^pddri@tj%BOlq5hpWDd9h7{DibT>Z^SI;>Wwefsa?~mv(niaWozvq^j-Z{NCQ; zq0=2d%X^w%l~ZwaL6~39EzYMNT6_@O2uOe?Z~~kIZQwfS01v8(&sf@|Ql zQFohkFP?@VC3vW>120~w1Ac>EJYEloXE_MRHiIXOq9dWGOzb#J zzjG&!onCPigUQR@v? zbfq&1RvjDJ4a-eTYfQ4T1TI|0FKpS-Q2-sC79H1(cEni?lB~weWg|?|SV~UII*VmH z%Ti3%;(2fDvS?fJhdavD;clsPV~VAvR7Q>J8JP=t@9DPaIk#HPj%s53-QBypChuK5 zQ>csAqRYJBbkW&yJ?~`#7GE?#6S5R$4tfT%dxEh8?2_++3EAP-1NGIWT)4dvD`$w1D=6J)N+=) z3(7vAf!jviKA{PY)qqcx2eat^eZ7nsTxTV=RbVTq1Ba{zIlCHCa)aDPa%-qAl3PRd zlk6G_W4Q$5R|>X(OV&f*4W$Qs0_$y-3!Eer4V(w>jkmJ zY3BPt;A%persD2IIUy~B&$rIbmS@h5&(}Uly{M()?p%NnJ8_GZsfU&y#x(?@APLTZ zelQ3|z&N-A9)c&}C3p=sP*;FD_iCD)qI5C&{eD7A2rVPjN9l*`CP z?F+@bIzq=-*r2vttf;6E>L`>kFmG1v7PZbnNF%u5FsTlUdLPOZsB)TAr$s#gr4#g< zRhLDbfHDa(X4P#`gDyfEfa)@-9*a5*7~O$-YxS{l_QY?YHx*=9R#h1XRbyO-*SD(Z1bRwLGeLQK+GT-IcRMY46tQbg8!3Q|$iD!&X<7xs^9y>X^V z@q`*S5;7MGQp=V$HQRyc%3rDLQ2RfzU*#|MGuTO^ARD&iIc`hGER>Rzh2oMu_<$al z!>k}R?fRXXm>T>qo`AJf%Ub!*{0ns~8};lvaBTv6@{MoV@oax?eCs3G@eONSK^z4c zl6Q&?JQ1T#X5=)P4S^A)={83 NegGk!U14An0012bhuQ!D diff --git a/test/rules/snapshots/spell-check.js.md b/test/rules/snapshots/spell-check.js.md index 7a8d118..47f3960 100644 --- a/test/rules/snapshots/spell-check.js.md +++ b/test/rules/snapshots/spell-check.js.md @@ -10,126 +10,157 @@ Generated by [AVA](https://ava.li). [ { + line: 7, message: 'Text "nodejs" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 8, message: 'Text "nodejs" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 8, message: 'Text "nodejs" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 9, message: 'Text "nodejs" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 15, message: 'Text "nodejs" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 16, message: 'Text "node.js" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 17, message: 'Text "NodeJS" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 18, message: 'Text "nodeJS" should be written as "Node.js"', ruleId: 'awesome-spell-check', }, { + line: 20, message: 'Text "StackOverflow" should be written as "Stack Overflow"', ruleId: 'awesome-spell-check', }, { + line: 21, message: 'Text "stackoverflow" should be written as "Stack Overflow"', ruleId: 'awesome-spell-check', }, { + line: 22, message: 'Text "stack overflow" should be written as "Stack Overflow"', ruleId: 'awesome-spell-check', }, { + line: 24, message: 'Text "javascript" should be written as "JavaScript"', ruleId: 'awesome-spell-check', }, { + line: 25, message: 'Text "Javascript" should be written as "JavaScript"', ruleId: 'awesome-spell-check', }, { + line: 27, message: 'Text "javascript" should be written as "JavaScript"', ruleId: 'awesome-spell-check', }, { + line: 28, message: 'Text "Javascript" should be written as "JavaScript"', ruleId: 'awesome-spell-check', }, { + line: 30, message: 'Text "macos" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 31, message: 'Text "MacOS" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 32, message: 'Text "Mac OS" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 33, message: 'Text "mac OS" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 34, message: 'Text "Mac OS X" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 35, message: 'Text "Mac OSX" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 36, message: 'Text "OSX" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 37, message: 'Text "OS X" should be written as "macOS"', ruleId: 'awesome-spell-check', }, { + line: 39, message: 'Text "Youtube" should be written as "YouTube"', ruleId: 'awesome-spell-check', }, { + line: 40, message: 'Text "You Tube" should be written as "YouTube"', ruleId: 'awesome-spell-check', }, { + line: 41, message: 'Text "youtube" should be written as "YouTube"', ruleId: 'awesome-spell-check', }, { + line: 42, message: 'Text "you tube" should be written as "YouTube"', ruleId: 'awesome-spell-check', }, { + line: 44, message: 'Text "Github" should be written as "GitHub"', ruleId: 'awesome-spell-check', }, { + line: 45, message: 'Text "Git Hub" should be written as "GitHub"', ruleId: 'awesome-spell-check', }, { + line: 46, message: 'Text "github" should be written as "GitHub"', ruleId: 'awesome-spell-check', }, { + line: 47, message: 'Text "git hub" should be written as "GitHub"', ruleId: 'awesome-spell-check', }, diff --git a/test/rules/snapshots/spell-check.js.snap b/test/rules/snapshots/spell-check.js.snap index 3b0c55434c8c31690ab44a6ab448e86c06f3c837..1053935eda4c571bed27c7b278151b371040bf88 100644 GIT binary patch literal 1185 zcmV;S1YY|=RzV7@8X6#97(`w3-;iq5-ye$z00000000B+ zmThPoWdO&YYtl4H(_G$@HhsB8N4KuYWa0}B1lfnKMOR8I+rTN8x;C*lgoC6oZ zci;;6op$(9ABck#NP`E#Ca?u;2YH}_XTkH}0GJ1Ff#cvq@F`dXm%$I<8VF0Spw#+E zxvb7f(vr!tOe8On`iRsnNq@2B)Y2_%4Am#7wlIB}s)Olis!paqQf+0La6ny5hp4tO ztxSL->?O=L%`W)3T z)1y=)OuwcYW$Jc8V@w~Q8fUtbYJ%xOs+~;FQte`TjcSr<3O88lW;#Z-hv{Cbz4W#_ z-+`V4pMf6tKexd(nw`>e6{%%e1Azd`N0B@Zo(3QBxkJdWBDoHN9zu3_xZEk^`;i<3 z$H5IgZx! zJwpC2l2c$240dq2SID14k_UUiB|dK#a-W}&5XgWR{ao%7@(+-F3@(FvWG?Rz@+^`9 z*ayDibH9*#0))t59oQ4#a#=hXB&Wb4SRLf@fRJxRvIES4Pxw42L6U0Jd zkdVKMFapEiP=d?5g?s_Y1#ku2-^t}YLS8^J4PF9Y@_Db2ySoVSg8@+O;_^Q6+>smu z3m}^0a^=>%gFWA5G%XQo_)K&bC#N;`!bzWJw_Iy0X@;Th(w1HiPH4|ml+?7I*QSh= zVifdhF|TAbWwtz7sc6%RYAC5KxSGLb?svJ$)uJ|>UwRobbnIksOOx_u%*?ni6X0OT2we^`LHK#Xx3gP1Dcr(WJSsV8l`}-?BPB9rb zuslw&VcjZg>q_>l<9}y^hj;z#lx-`%?=F*l>u%n+^7HOCnb%*RXUDYFCezj|O|#*y z_FMa(d%Iq(RI^&6dAK}5FE?S}8k2#U<$=nCJqy=bJHk2Jj&Q)*5n`ZX)51Y(pDja^ zl|nV!XdkX_#?>awOI!PB#sFor9s4rYj&GMu$G6_v@nN3QjD3FtBm$E(XBz+jKGIJz literal 1022 zcmVymNt=&0O_MZjqqW+1x#|2!#}L_6WJpDA*jlhbS`oH1Irb~XNxSxa$%Pl;^rD4_KIJ^^ z`Sm?Csn9e{*F4sdf16@mx6XY#diL#E^O>&EM{iiu$}~5-?$O01e4YT;!CmkOJO#gl zzrY*n@U2xK3?d*3J_W6y9dv^fFu{H>4o-q|;4+v5cfb^Q0-l3Ez-tiFT|wQsIg?53 z)Abqi`~8|;sp(Cc?$z~oyqs*MgU67@Ngb>QNy}I#NXuEDk~&%O3v0TIbv3D*btkEZ z^$=+V>lM;U)?Z1ztd4SM6>F5#$J#|&&3c&B&w7Ygj)b4YBSbtz{i2 ztz-R$w4U`DX_(dJf-YhGm~<)YZqf$UW2DPiuaP#gJ||ty>cL~zSI}cGTMJze#@&TS z;OgiZFp^o_F{^<9 zmeVRF_4;t8Amx)%pOT(IavuC6r`1aOLA9negZQ~Y$NUi~=UrGZ?`U#Rv;HaDi zmGmZ(?}0lYr8P>r9?56mYdH-m>1`zUfHx?mwMx1PNh>%Zr*%qt56Kj$sgcrpCEbD~ z22ROoSV@0C@(=_=Qo2O_gF(^;&dBLfC4GS8N6=U+r435jjwB8)%IPvC{TazLXs(me zMkVb=@+Fv%)8$I~8cr#^nW@uP9n(z^{_ zr`$t^WhHuznXlKxjlEeB88%bKfE5u|pP5UiM2{iHGX2@CF)R|6h_vHs3oc7P%azHc zjkeUxm!ZU%VVOfl)EY6;>1eXgNDeM;Slsa58>0VjXtDbs=q|BN`yYmF8#d%ObY>ID z!H!WQvnOqi6`R75n5{~?$fBE>3u4j6Ig7-?n6x%OX&^D0u#%bnk!-O!F%+HoqO?_T>pT5!>zBP&kHO`;P$=L@74>2YNDX#fKLF01#H~UjP6A diff --git a/test/rules/toc.js b/test/rules/toc.js index 13f6e18..616f3c3 100644 --- a/test/rules/toc.js +++ b/test/rules/toc.js @@ -22,6 +22,7 @@ test('toc - missing', async t => { const messages = await lint({config, filename: 'test/fixtures/toc/2.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-toc', message: 'Missing or invalid Table of Contents' } @@ -32,14 +33,17 @@ test('toc - missing items', async t => { const messages = await lint({config, filename: 'test/fixtures/toc/3.md'}); t.deepEqual(messages, [ { + line: 6, ruleId: 'awesome-toc', message: 'ToC missing item for "Foo B"' }, { + line: 8, ruleId: 'awesome-toc', message: 'ToC item "Bar" does not match corresponding heading "Bar A"' }, { + line: 5, ruleId: 'awesome-toc', message: 'ToC missing item for "Baz"' } @@ -50,6 +54,7 @@ test('toc - exceed max depth', async t => { const messages = await lint({config, filename: 'test/fixtures/toc/4.md'}); t.deepEqual(messages, [ { + line: 1, ruleId: 'awesome-toc', message: 'Exceeded max depth of 2 levels' }