Skip to content

Commit

Permalink
Validate company sort order in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Dec 27, 2017
1 parent cf42988 commit 1a30022
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function readmeError( msg, ...params ) {
);
}

let lastCompanyName = null;

$( 'tr' ).each( ( i, tr ) => {
if ( i === 0 ) {
// Skip the table header row.
Expand Down Expand Up @@ -65,6 +67,18 @@ $( 'tr' ).each( ( i, tr ) => {
);
}

if (
lastCompanyName &&
entry.name.toLowerCase() < lastCompanyName.toLowerCase()
) {
readmeError(
'Company is listed out of order: "%s" (should be before "%s")',
entry.name,
lastCompanyName
);
}
lastCompanyName = entry.name;

const profileLink = $td.eq( 0 ).find( 'a' ).attr( 'href' );

if ( profileLink ) {
Expand Down

0 comments on commit 1a30022

Please sign in to comment.