Skip to content

Commit

Permalink
move lint task and eslint package to perennial, #1489
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
  • Loading branch information
zepumph committed Oct 18, 2024
1 parent 7c07e0f commit 984a25a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 347 deletions.
16 changes: 10 additions & 6 deletions js/grunt/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ module.exports = function( grunt ) {
*
* @param {string} task - The name of the task
*/
function registerPerennialTask( task ) {
grunt.registerTask( task, 'Run grunt --help in perennial to see documentation', () => {
grunt.log.writeln( '(Forwarding task to perennial)' );
function forwardToRepo( forwardingRepo, task ) {
grunt.registerTask( task, `Run grunt --help in ${forwardingRepo} to see documentation`, () => {
grunt.log.writeln( `(Forwarding task to ${forwardingRepo})` );
const args = [ `--repo=${repo}`, ...process.argv.slice( 2 ) ];

const isWindows = /^win/.test( process.platform );
gruntSpawn( grunt, isWindows ? 'grunt.cmd' : 'grunt', args, '../perennial', argsString => {
gruntSpawn( grunt, isWindows ? 'grunt.cmd' : 'grunt', args, `../${forwardingRepo}`, argsString => {
grunt.log.debug( `running grunt ${argsString} in ../${repo}` );
} );
} );
Expand All @@ -74,8 +74,12 @@ module.exports = function( grunt ) {
'production',
'prototype',
'create-sim',
'lint-everything',
'lint-everything', // on mixed shas, prefer main
'generate-data',
'release-branch-list'
].forEach( registerPerennialTask );
].forEach( task => forwardToRepo( 'perennial', task ) );

[
'lint'
].forEach( task => forwardToRepo( 'perennial-alias', task ) );
};
2 changes: 1 addition & 1 deletion js/grunt/getPhetLibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const grunt = require( 'grunt' );
* @public
*
* @param {string} repo
* @param {string} [brand] - If not specified, it will return the dependencies for all brands.
* @param {string[]} [brand]] - If not specified, it will return the dependencies for all brands.
* @returns {Array.<string>}
*/
module.exports = function getPhetLibs( repo, brand ) {
Expand Down
290 changes: 0 additions & 290 deletions js/grunt/lint.js

This file was deleted.

8 changes: 4 additions & 4 deletions js/grunt/tasks/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import getOption from '../../../../perennial-alias/js/grunt/tasks/util/getOption

( async () => {
if ( getOption( 'lint' ) !== false ) {
await ( await import( './lint-all.ts' ) ).lintAll;
await ( await import( './lint-all.js' ) ).lintAll;
}

if ( getOption( 'report-media' ) !== false ) {
await ( await import( './report-media.ts' ) ).reportMedia;
await ( await import( './report-media.js' ) ).reportMedia;
}

await ( await import( './clean.ts' ) ).clean;
await ( await import( './clean.js' ) ).clean;

await ( await import( './build.ts' ) ).build;
await ( await import( './build.js' ) ).build;
} )();
14 changes: 5 additions & 9 deletions js/grunt/tasks/lint-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

import assert from 'assert';
import * as grunt from 'grunt';
import getOption from '../../../../perennial-alias/js/grunt/tasks/util/getOption';
import getRepo from '../../../../perennial-alias/js/grunt/tasks/util/getRepo';

const getBrands = require( '../../../../perennial-alias/js/grunt/tasks/util/getBrands' );
const lint = require( '../lint' );
import getBrands from '../../../../perennial-alias/js/grunt/tasks/util/getBrands.js';
import getOption from '../../../../perennial-alias/js/grunt/tasks/util/getOption.js';
import getRepo from '../../../../perennial-alias/js/grunt/tasks/util/getRepo.js';
import getPhetLibs from '../getPhetLibs.js';
import lint from '../../../../perennial-alias/js/grunt/lint.js';

const repo = getRepo();

// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !getOption( 'disable-eslint-cache' );
const fix = getOption( 'fix' );
const chipAway = getOption( 'chip-away' );
assert( !getOption( 'patterns' ), 'patterns not support for lint-all' );

const getPhetLibs = require( '../getPhetLibs' );

const brands = getBrands( grunt, repo );

Expand Down
Loading

0 comments on commit 984a25a

Please sign in to comment.