Skip to content

Commit

Permalink
support eslint when there is no build.json, phetsims/phet-info#150
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 22, 2024
1 parent 14a94b4 commit 2710e8a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions eslint/rules/todo-should-have-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@
'use strict';

const fs = require( 'fs' );
const buildJSON = JSON.parse( fs.readFileSync( '../chipper/build.json' ).toString() );

// Whitelist of directories to check that TODOs have GitHub issues
const directoriesToRequireIssues = buildJSON.common.phetLibs.filter( x => x !== 'scenery' && x !== 'dot' && x !== 'kite' );
// Handle the lack of build.json
let buildJSON = {};
try {
buildJSON = JSON.parse( fs.readFileSync( '../chipper/build.json' ).toString() );
}
catch( e ) {
buildJSON = {};
}

let directoriesToRequireIssues = [];
if ( buildJSON && buildJSON.common && buildJSON.common.phetLibs ) {

// Whitelist of directories to check that TODOs have GitHub issues
directoriesToRequireIssues = buildJSON.common.phetLibs.filter( x => x !== 'scenery' && x !== 'dot' && x !== 'kite' );
}

module.exports = function( context ) {
return {
Expand Down

0 comments on commit 2710e8a

Please sign in to comment.