-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run lint via npx eslint #1429
Comments
Here's one that took a bit longer:
|
Applying the specific tsconfigs from #1415 (comment) then running via |
I added all
It got up past 4GB and slowed near the end, but completed successfully without a memory error after 3.7 minutes. |
I added npxLint. Here is a patch that uses it and adjusts the ignore patterns. Subject: [PATCH] Add npxLint, see https://github.com/phetsims/chipper/issues/1429
---
Index: chipper/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/Gruntfile.js b/chipper/js/grunt/Gruntfile.js
--- a/chipper/js/grunt/Gruntfile.js (revision 6f7c6672bdf09c5b7237ed7d73874d6ae91f3547)
+++ b/chipper/js/grunt/Gruntfile.js (date 1711131001041)
@@ -349,7 +349,7 @@
--disable-with-comment: add an es-lint disable with comment to lint errors
--repos: comma separated list of repos to lint in addition to the repo from running`,
wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -359,7 +359,7 @@
const extraRepos = grunt.option( 'repos' ) ? grunt.option( 'repos' ).split( ',' ) : [];
- const lintReturnValue = await lint( [ repo, ...extraRepos ], {
+ const lintReturnValue = await npxLint( [ repo, ...extraRepos ], {
cache: cache,
fix: fix,
chipAway: chipAway,
@@ -372,7 +372,7 @@
} ) );
grunt.registerTask( 'lint-all', 'lint all js files that are required to build this repository (for the specified brands)', wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -385,7 +385,7 @@
const brands = getBrands( grunt, repo, buildLocal );
- const lintReturnValue = await lint( getPhetLibs( repo, brands ), {
+ const lintReturnValue = await npxLint( getPhetLibs( repo, brands ), {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: perennial/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial/js/grunt/Gruntfile.js b/perennial/js/grunt/Gruntfile.js
--- a/perennial/js/grunt/Gruntfile.js (revision 610c97d5a0204e9e822e83a02e6c4794e32c982e)
+++ b/perennial/js/grunt/Gruntfile.js (date 1711131022310)
@@ -537,8 +537,9 @@
// Don't always require this, as we may have an older chipper checked out. Also make sure it is the promise-based lint.
const lint = require( '../../../chipper/js/grunt/lint' );
- if ( lint.chipperAPIVersion === 'promisesPerRepo1' ) {
- const lintReturnValue = await lint( activeRepos, {
+ const npxLint = require( '../../../chipper/js/grunt/npxLint' );
+ if ( lint.chipperAPIVersion === 'promisesPerRepo1' && npxLint ) {
+ const lintReturnValue = await npxLint( activeRepos, {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: chipper/js/scripts/hook-pre-commit-task.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/scripts/hook-pre-commit-task.js b/chipper/js/scripts/hook-pre-commit-task.js
--- a/chipper/js/scripts/hook-pre-commit-task.js (revision 6f7c6672bdf09c5b7237ed7d73874d6ae91f3547)
+++ b/chipper/js/scripts/hook-pre-commit-task.js (date 1711131001022)
@@ -16,7 +16,7 @@
const generatePhetioMacroAPI = require( '../phet-io/generatePhetioMacroAPI' );
const CacheLayer = require( '../../../chipper/js/common/CacheLayer' );
const phetioCompareAPISets = require( '../phet-io/phetioCompareAPISets' );
-const lint = require( '../../../chipper/js/grunt/lint' );
+const npxLint = require( '../../../chipper/js/grunt/npxLint' );
const reportMedia = require( '../../../chipper/js/grunt/reportMedia' );
const puppeteerQUnit = require( '../../../aqua/js/local/puppeteerQUnit' );
const Transpiler = require( '../../../chipper/js/common/Transpiler' );
@@ -43,7 +43,7 @@
// Run lint tests if they exist in the checked-out SHAs.
// lint() automatically filters out non-lintable repos
- const lintReturnValue = await lint( [ repo ] );
+ const lintReturnValue = await npxLint( [ repo ] );
outputToConsole && console.log( `Linting passed with results.length: ${lintReturnValue.results.length}` );
process.exit( lintReturnValue.ok ? 0 : 1 );
}
Index: perennial-alias/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial-alias/js/grunt/Gruntfile.js b/perennial-alias/js/grunt/Gruntfile.js
--- a/perennial-alias/js/grunt/Gruntfile.js (revision 610c97d5a0204e9e822e83a02e6c4794e32c982e)
+++ b/perennial-alias/js/grunt/Gruntfile.js (date 1711131022316)
@@ -537,8 +537,9 @@
// Don't always require this, as we may have an older chipper checked out. Also make sure it is the promise-based lint.
const lint = require( '../../../chipper/js/grunt/lint' );
- if ( lint.chipperAPIVersion === 'promisesPerRepo1' ) {
- const lintReturnValue = await lint( activeRepos, {
+ const npxLint = require( '../../../chipper/js/grunt/npxLint' );
+ if ( lint.chipperAPIVersion === 'promisesPerRepo1' && npxLint ) {
+ const lintReturnValue = await npxLint( activeRepos, {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: chipper/eslint/.eslintignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/eslint/.eslintignore b/chipper/eslint/.eslintignore
--- a/chipper/eslint/.eslintignore (revision 6f7c6672bdf09c5b7237ed7d73874d6ae91f3547)
+++ b/chipper/eslint/.eslintignore (date 1711136677379)
@@ -11,6 +11,11 @@
**/images/**/*_jpg.ts
**/images/**/*_png.ts
**/sounds/**/*_mp3.ts
+**/mipmaps/**/*_png.js
+**/mipmaps/**/*_png.ts
+**/mipmaps/**/*_jpg.js
+**/mipmaps/**/*_jpg.ts
+
../phet-io-website/root/assets/js/jquery-1.12.3.min.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.pack.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.js
@@ -29,4 +34,16 @@
../scenery/js/display/guillotiere/pkg
../alpenglow/doc/lib/
../yotta/js/reports/by-simulation.html
-**/*.json
\ No newline at end of file
+**/*.json
+**/*.md
+**/*.pegjs
+**/*_svg.ts
+**/*_mp3.js
+**/*_en.html
+**/*_a11y_view.html
+**/*_wav.js
+**/fenster/**
+**/binder/**
+**/decaf/**
+**/scenery-lab-demo/**
+**/assets/**
\ No newline at end of file
@zepumph and I are optimistic about this approach but will need to schedule time to bring it to production. |
Please visit the following issue after this one is complete: |
I just got this error in trying to reproduce the
But I likely have other repos sneaking in. |
Good progress for 10 minutes with @samreid just now. This newest patch is our first run on windows, and it is working well!
Subject: [PATCH] doc update, https://github.com/phetsims/phet-io-wrappers/issues/637
---
Index: chipper/eslint/.eslintignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/eslint/.eslintignore b/chipper/eslint/.eslintignore
--- a/chipper/eslint/.eslintignore (revision f158a3bd7f490a94c3fd577a3cea9c953cbfbde2)
+++ b/chipper/eslint/.eslintignore (date 1712265583645)
@@ -11,6 +11,11 @@
**/images/**/*_jpg.ts
**/images/**/*_png.ts
**/sounds/**/*_mp3.ts
+**/mipmaps/**/*_png.js
+**/mipmaps/**/*_png.ts
+**/mipmaps/**/*_jpg.js
+**/mipmaps/**/*_jpg.ts
+
../phet-io-website/root/assets/js/jquery-1.12.3.min.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.pack.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.js
@@ -29,4 +34,15 @@
../scenery/js/display/guillotiere/pkg
../alpenglow/doc/lib/
../yotta/js/reports/by-simulation.html
-**/*.json
\ No newline at end of file
+**/*.json
+**/*.md
+**/*.pegjs
+**/*_svg.ts
+**/*_mp3.js
+**/*_en.html
+**/*_a11y_view.html
+**/*_wav.js
+**/fenster/**
+**/decaf/**
+**/scenery-lab-demo/**
+**/assets/**
\ No newline at end of file
Index: chipper/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/Gruntfile.js b/chipper/js/grunt/Gruntfile.js
--- a/chipper/js/grunt/Gruntfile.js (revision f158a3bd7f490a94c3fd577a3cea9c953cbfbde2)
+++ b/chipper/js/grunt/Gruntfile.js (date 1712265492492)
@@ -349,7 +349,7 @@
--disable-with-comment: add an es-lint disable with comment to lint errors
--repos: comma separated list of repos to lint in addition to the repo from running`,
wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -359,7 +359,7 @@
const extraRepos = grunt.option( 'repos' ) ? grunt.option( 'repos' ).split( ',' ) : [];
- const lintReturnValue = await lint( [ repo, ...extraRepos ], {
+ const lintReturnValue = await npxLint( [ repo, ...extraRepos ], {
cache: cache,
fix: fix,
chipAway: chipAway,
@@ -372,7 +372,7 @@
} ) );
grunt.registerTask( 'lint-all', 'lint all js files that are required to build this repository (for the specified brands)', wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -385,7 +385,7 @@
const brands = getBrands( grunt, repo, buildLocal );
- const lintReturnValue = await lint( getPhetLibs( repo, brands ), {
+ const lintReturnValue = await npxLint( getPhetLibs( repo, brands ), {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: perennial/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial/js/grunt/Gruntfile.js b/perennial/js/grunt/Gruntfile.js
--- a/perennial/js/grunt/Gruntfile.js (revision 89a59a976596404533605544ed5485aa4b4165e8)
+++ b/perennial/js/grunt/Gruntfile.js (date 1712265492501)
@@ -537,8 +537,9 @@
// Don't always require this, as we may have an older chipper checked out. Also make sure it is the promise-based lint.
const lint = require( '../../../chipper/js/grunt/lint' );
- if ( lint.chipperAPIVersion === 'promisesPerRepo1' ) {
- const lintReturnValue = await lint( activeRepos, {
+ const npxLint = require( '../../../chipper/js/grunt/npxLint' );
+ if ( lint.chipperAPIVersion === 'promisesPerRepo1' && npxLint ) {
+ const lintReturnValue = await npxLint( activeRepos, {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: chipper/js/scripts/hook-pre-commit-task.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/scripts/hook-pre-commit-task.js b/chipper/js/scripts/hook-pre-commit-task.js
--- a/chipper/js/scripts/hook-pre-commit-task.js (revision f158a3bd7f490a94c3fd577a3cea9c953cbfbde2)
+++ b/chipper/js/scripts/hook-pre-commit-task.js (date 1712265492496)
@@ -16,7 +16,7 @@
const generatePhetioMacroAPI = require( '../phet-io/generatePhetioMacroAPI' );
const CacheLayer = require( '../../../chipper/js/common/CacheLayer' );
const phetioCompareAPISets = require( '../phet-io/phetioCompareAPISets' );
-const lint = require( '../../../chipper/js/grunt/lint' );
+const npxLint = require( '../../../chipper/js/grunt/npxLint' );
const reportMedia = require( '../../../chipper/js/grunt/reportMedia' );
const puppeteerQUnit = require( '../../../aqua/js/local/puppeteerQUnit' );
const Transpiler = require( '../../../chipper/js/common/Transpiler' );
@@ -43,7 +43,7 @@
// Run lint tests if they exist in the checked-out SHAs.
// lint() automatically filters out non-lintable repos
- const lintReturnValue = await lint( [ repo ] );
+ const lintReturnValue = await npxLint( [ repo ] );
outputToConsole && console.log( `Linting passed with results.length: ${lintReturnValue.results.length}` );
process.exit( lintReturnValue.ok ? 0 : 1 );
}
Index: chipper/js/grunt/npxLint.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/npxLint.js b/chipper/js/grunt/npxLint.js
--- a/chipper/js/grunt/npxLint.js (revision f158a3bd7f490a94c3fd577a3cea9c953cbfbde2)
+++ b/chipper/js/grunt/npxLint.js (date 1712266337364)
@@ -29,7 +29,7 @@
console.log( `running in cwd ../chipper: npx ${args.join( ' ' )}` );
- const eslint = spawn( 'npx', args, {
+ const eslint = spawn( /^win/.test( process.platform ) ? 'npx.cmd' : 'npx', args, {
cwd: '../chipper'
} );
|
Building on the patch above, I added --fix and --disable-eslint-cache options. I tested each and they worked well. Subject: [PATCH] Add npx.cmd, options.cache, and options.fix, see https://github.com/phetsims/chipper/issues/1429
---
Index: chipper/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/Gruntfile.js b/chipper/js/grunt/Gruntfile.js
--- a/chipper/js/grunt/Gruntfile.js (revision aba682fffe1f05b2f2df65781e23123047653db4)
+++ b/chipper/js/grunt/Gruntfile.js (date 1712269024399)
@@ -349,7 +349,7 @@
--disable-with-comment: add an es-lint disable with comment to lint errors
--repos: comma separated list of repos to lint in addition to the repo from running`,
wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -359,7 +359,7 @@
const extraRepos = grunt.option( 'repos' ) ? grunt.option( 'repos' ).split( ',' ) : [];
- const lintReturnValue = await lint( [ repo, ...extraRepos ], {
+ const lintReturnValue = await npxLint( [ repo, ...extraRepos ], {
cache: cache,
fix: fix,
chipAway: chipAway,
@@ -372,7 +372,7 @@
} ) );
grunt.registerTask( 'lint-all', 'lint all js files that are required to build this repository (for the specified brands)', wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -385,7 +385,7 @@
const brands = getBrands( grunt, repo, buildLocal );
- const lintReturnValue = await lint( getPhetLibs( repo, brands ), {
+ const lintReturnValue = await npxLint( getPhetLibs( repo, brands ), {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: perennial/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial/js/grunt/Gruntfile.js b/perennial/js/grunt/Gruntfile.js
--- a/perennial/js/grunt/Gruntfile.js (revision c95e245cfa2f79680e406a2d636cf21eabfdfd20)
+++ b/perennial/js/grunt/Gruntfile.js (date 1712269024413)
@@ -537,8 +537,9 @@
// Don't always require this, as we may have an older chipper checked out. Also make sure it is the promise-based lint.
const lint = require( '../../../chipper/js/grunt/lint' );
- if ( lint.chipperAPIVersion === 'promisesPerRepo1' ) {
- const lintReturnValue = await lint( activeRepos, {
+ const npxLint = require( '../../../chipper/js/grunt/npxLint' );
+ if ( lint.chipperAPIVersion === 'promisesPerRepo1' && npxLint ) {
+ const lintReturnValue = await npxLint( activeRepos, {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: chipper/js/scripts/hook-pre-commit-task.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/scripts/hook-pre-commit-task.js b/chipper/js/scripts/hook-pre-commit-task.js
--- a/chipper/js/scripts/hook-pre-commit-task.js (revision aba682fffe1f05b2f2df65781e23123047653db4)
+++ b/chipper/js/scripts/hook-pre-commit-task.js (date 1712269024408)
@@ -16,7 +16,7 @@
const generatePhetioMacroAPI = require( '../phet-io/generatePhetioMacroAPI' );
const CacheLayer = require( '../../../chipper/js/common/CacheLayer' );
const phetioCompareAPISets = require( '../phet-io/phetioCompareAPISets' );
-const lint = require( '../../../chipper/js/grunt/lint' );
+const npxLint = require( '../../../chipper/js/grunt/npxLint' );
const reportMedia = require( '../../../chipper/js/grunt/reportMedia' );
const puppeteerQUnit = require( '../../../aqua/js/local/puppeteerQUnit' );
const Transpiler = require( '../../../chipper/js/common/Transpiler' );
@@ -43,7 +43,7 @@
// Run lint tests if they exist in the checked-out SHAs.
// lint() automatically filters out non-lintable repos
- const lintReturnValue = await lint( [ repo ] );
+ const lintReturnValue = await npxLint( [ repo ] );
outputToConsole && console.log( `Linting passed with results.length: ${lintReturnValue.results.length}` );
process.exit( lintReturnValue.ok ? 0 : 1 );
}
Index: chipper/js/grunt/npxLint.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/npxLint.js b/chipper/js/grunt/npxLint.js
--- a/chipper/js/grunt/npxLint.js (revision aba682fffe1f05b2f2df65781e23123047653db4)
+++ b/chipper/js/grunt/npxLint.js (date 1712270910800)
@@ -9,15 +9,35 @@
// modules
const { spawn } = require( 'child_process' ); // eslint-disable-line require-statement-match
+const _ = require( 'lodash' );
+
+function runEslint( repos, options ) {
-function runEslint( repos ) {
+ options = _.assignIn( {
+
+ // Cache results for a speed boost
+ cache: true,
+
+ // Fix things that can be autofixed
+ fix: false
+ }, options );
const patterns = repos.map( repo => `../${repo}/` );
return new Promise( ( resolve, reject ) => {
- const args = [
- 'eslint',
- '--cache',
- '--cache-location', '../chipper/eslint/cache/.eslintcache',
+ const args = [ 'eslint' ];
+
+ // Conditionally add cache options based on the cache flag in options
+ if ( options.cache ) {
+ args.push( '--cache', '--cache-location', '../chipper/eslint/cache/.eslintcache' );
+ }
+
+ // Add the '--fix' option if fix is true
+ if ( options.fix ) {
+ args.push( '--fix' );
+ }
+
+ // Continue building the args array
+ args.push( ...[
'--rulesdir', '../chipper/eslint/rules/',
'--resolve-plugins-relative-to', '../chipper',
'--no-error-on-unmatched-pattern',
@@ -25,11 +45,11 @@
'--ext', '.js,.jsx,.ts,.tsx,.mjs,.cjs,.html',
'--quiet',
...patterns
- ];
+ ] );
console.log( `running in cwd ../chipper: npx ${args.join( ' ' )}` );
- const eslint = spawn( 'npx', args, {
+ const eslint = spawn( /^win/.test( process.platform ) ? 'npx.cmd' : 'npx', args, {
cwd: '../chipper'
} );
@@ -61,7 +81,7 @@
*/
const npxLint = async ( originalRepos, options ) => {
try {
- const result = await runEslint( originalRepos );
+ const result = await runEslint( originalRepos, options );
console.log( 'ESLint output:', result );
if ( result.trim().length === 0 ) {
return { results: [], ok: true };
Index: chipper/eslint/.eslintignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/eslint/.eslintignore b/chipper/eslint/.eslintignore
--- a/chipper/eslint/.eslintignore (revision aba682fffe1f05b2f2df65781e23123047653db4)
+++ b/chipper/eslint/.eslintignore (date 1712269024392)
@@ -11,6 +11,11 @@
**/images/**/*_jpg.ts
**/images/**/*_png.ts
**/sounds/**/*_mp3.ts
+**/mipmaps/**/*_png.js
+**/mipmaps/**/*_png.ts
+**/mipmaps/**/*_jpg.js
+**/mipmaps/**/*_jpg.ts
+
../phet-io-website/root/assets/js/jquery-1.12.3.min.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.pack.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.js
@@ -29,4 +34,15 @@
../scenery/js/display/guillotiere/pkg
../alpenglow/doc/lib/
../yotta/js/reports/by-simulation.html
-**/*.json
\ No newline at end of file
+**/*.json
+**/*.md
+**/*.pegjs
+**/*_svg.ts
+**/*_mp3.js
+**/*_en.html
+**/*_a11y_view.html
+**/*_wav.js
+**/fenster/**
+**/decaf/**
+**/scenery-lab-demo/**
+**/assets/**
\ No newline at end of file
Other options we can decide whether to support or not:
|
Here's a makeshift progress bar. // Prepare environment for spawn process
const env = Object.create(process.env);
if (options.showProgressBar) {
env.DEBUG = 'eslint:cli-engine';
}
const eslint = spawn(/^win/.test(process.platform) ? 'npx.cmd' : 'npx', args, {
cwd: '../chipper',
env: env // Use the prepared environment
}); But maybe it would be better to omit altogether. When is the last time we used |
Should we add on |
I did some more work here, and I believe that it would be best to discuss in person before too long.
Subject: [PATCH] update doc, https://github.com/phetsims/chipper/issues/1429
---
Index: chipper/js/scripts/hook-pre-commit-task.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/scripts/hook-pre-commit-task.js b/chipper/js/scripts/hook-pre-commit-task.js
--- a/chipper/js/scripts/hook-pre-commit-task.js (revision 392601ebc89317087297fb34d91fcd55b34c5549)
+++ b/chipper/js/scripts/hook-pre-commit-task.js (date 1712594936795)
@@ -16,7 +16,7 @@
const generatePhetioMacroAPI = require( '../phet-io/generatePhetioMacroAPI' );
const CacheLayer = require( '../../../chipper/js/common/CacheLayer' );
const phetioCompareAPISets = require( '../phet-io/phetioCompareAPISets' );
-const lint = require( '../../../chipper/js/grunt/lint' );
+const npxLint = require( '../../../chipper/js/grunt/npxLint' );
const reportMedia = require( '../../../chipper/js/grunt/reportMedia' );
const puppeteerQUnit = require( '../../../aqua/js/local/puppeteerQUnit' );
const Transpiler = require( '../../../chipper/js/common/Transpiler' );
@@ -43,7 +43,7 @@
// Run lint tests if they exist in the checked-out SHAs.
// lint() automatically filters out non-lintable repos
- const lintReturnValue = await lint( [ repo ] );
+ const lintReturnValue = await npxLint( [ repo ] );
outputToConsole && console.log( `Linting passed with results.length: ${lintReturnValue.results.length}` );
process.exit( lintReturnValue.ok ? 0 : 1 );
}
Index: chipper/eslint/.eslintignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/eslint/.eslintignore b/chipper/eslint/.eslintignore
--- a/chipper/eslint/.eslintignore (revision 392601ebc89317087297fb34d91fcd55b34c5549)
+++ b/chipper/eslint/.eslintignore (date 1712594936785)
@@ -11,6 +11,11 @@
**/images/**/*_jpg.ts
**/images/**/*_png.ts
**/sounds/**/*_mp3.ts
+**/mipmaps/**/*_png.js
+**/mipmaps/**/*_png.ts
+**/mipmaps/**/*_jpg.js
+**/mipmaps/**/*_jpg.ts
+
../phet-io-website/root/assets/js/jquery-1.12.3.min.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.pack.js
../phet-io-website/root/assets/highlight.js-9.1.0/highlight.js
@@ -29,4 +34,15 @@
../scenery/js/display/guillotiere/pkg
../alpenglow/doc/lib/
../yotta/js/reports/by-simulation.html
-**/*.json
\ No newline at end of file
+**/*.json
+**/*.md
+**/*.pegjs
+**/*_svg.ts
+**/*_mp3.js
+**/*_en.html
+**/*_a11y_view.html
+**/*_wav.js
+**/fenster/**
+**/decaf/**
+**/scenery-lab-demo/**
+**/assets/**
\ No newline at end of file
Index: perennial/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/perennial/js/grunt/Gruntfile.js b/perennial/js/grunt/Gruntfile.js
--- a/perennial/js/grunt/Gruntfile.js (revision 89a59a976596404533605544ed5485aa4b4165e8)
+++ b/perennial/js/grunt/Gruntfile.js (date 1712599843721)
@@ -535,10 +535,12 @@
const disableWithComment = grunt.option( 'disable-with-comment' );
const showProgressBar = !grunt.option( 'hide-progress-bar' );
+ // TODO: only need one of these, https://github.com/phetsims/chipper/issues/1429
// Don't always require this, as we may have an older chipper checked out. Also make sure it is the promise-based lint.
const lint = require( '../../../chipper/js/grunt/lint' );
- if ( lint.chipperAPIVersion === 'promisesPerRepo1' ) {
- const lintReturnValue = await lint( activeRepos, {
+ const npxLint = require( '../../../chipper/js/grunt/npxLint' );
+ if ( lint.chipperAPIVersion === 'promisesPerRepo1' && npxLint ) {
+ const lintReturnValue = await npxLint( activeRepos, {
cache: cache,
fix: fix,
chipAway: chipAway,
Index: chipper/js/grunt/Gruntfile.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/grunt/Gruntfile.js b/chipper/js/grunt/Gruntfile.js
--- a/chipper/js/grunt/Gruntfile.js (revision 392601ebc89317087297fb34d91fcd55b34c5549)
+++ b/chipper/js/grunt/Gruntfile.js (date 1712599843728)
@@ -349,7 +349,7 @@
--disable-with-comment: add an es-lint disable with comment to lint errors
--repos: comma separated list of repos to lint in addition to the repo from running`,
wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -359,7 +359,7 @@
const extraRepos = grunt.option( 'repos' ) ? grunt.option( 'repos' ).split( ',' ) : [];
- const lintReturnValue = await lint( [ repo, ...extraRepos ], {
+ const lintReturnValue = await npxLint( [ repo, ...extraRepos ], {
cache: cache,
fix: fix,
chipAway: chipAway,
@@ -372,7 +372,7 @@
} ) );
grunt.registerTask( 'lint-all', 'lint all js files that are required to build this repository (for the specified brands)', wrapTask( async () => {
- const lint = require( './lint' );
+ const npxLint = require( './npxLint' );
// --disable-eslint-cache disables the cache, useful for developing rules
const cache = !grunt.option( 'disable-eslint-cache' );
@@ -385,7 +385,7 @@
const brands = getBrands( grunt, repo, buildLocal );
- const lintReturnValue = await lint( getPhetLibs( repo, brands ), {
+ const lintReturnValue = await npxLint( getPhetLibs( repo, brands ), {
cache: cache,
fix: fix,
chipAway: chipAway, |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Lots more progress this afternoon. I added chip-away, which involved using the json output for linting. I don't know if we will want this forever, since it saves all the output until the end of the process (so grunt lint-everything doesn't give in-progress results). We should discuss more. |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
…1429 Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Alright. I finally was able to push the full conversion. Main is now running |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Oh man. CTQ had a few things to say about how we were doing the logging parsing. The JSON output isn't always in a single chunk. I believe we are doing much better, and I gave the file another once over. Please take it from here. |
I reviewed the commits above. CT seems stable. I do not see any lint-related issues on CT at the moment. I believe we are in good shape to close this issue. Nice work @zepumph |
We discovered that --disable-eslint-cache does't clear a (say, bad) cache. I'll propose a fix |
Additionally, we believe it would be preferable to always write to the cache, even on |
I love these commits, and for a while I believe that |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
From #1415 and related to #1425, @zepumph and I are interested in running lint via
npx eslint
. This is described in https://eslint.org/docs/latest/use/command-line-interface like so:We experimented with running this command in chipper/
It seems to be working very well, and it stays under the memory limit (with our current tsconfig/all). An uncached version takes around 4m on my machine. A cached version with no changes takes around 10 seconds
Some comments:
--quiet
is necessary to suppress warnings about files getting ignored. When we upgrade to the new "flat" configuration file, we can use--no-warn-ignore
instead. But this means for now we cannot get warnings from other rules since it must be suppressed to hide the 100+ ignore warnings.const EXCLUDE_REPOS = [ 'binder', 'fenster', 'decaf', 'scenery-lab-demo' ];
are being linted by thisnpx
process even though they don't need to be. If we expand out patterns from the perennial/data lists, we could ignore these again.npx
from agrunt
script.Some questions:
grunt lint
orlint-all
orlint-everything
to use this entry point?DEBUG=eslint:cli-engine
to the command to see the progress as it goes. I tested this and it may be an acceptable replacement.The text was updated successfully, but these errors were encountered: