Skip to content

fix linting warnings - #9103

Merged
ksen0 merged 5 commits into
processing:mainfrom
Vaivaswat2244:fix/lint-warnings
Sep 11, 2026
Merged

fix linting warnings#9103
ksen0 merged 5 commits into
processing:mainfrom
Vaivaswat2244:fix/lint-warnings

Conversation

@Vaivaswat2244

@Vaivaswat2244 Vaivaswat2244 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Resolves partially: #9070

Changes:

Fixes all 143 oxlint warnings; npm run lint now exits clean. No lint config was changed. Every warning was resolved in code.

Mostly mechanical:

  • unused imports, variables and orphaned functions removed
  • bare catch {} for unused catch params
  • == → ===
  • // falls through on intentional switch fallthroughs
  • { } around case bodies containing declarations
  • dead if (0) blocks and unreachable post-throw code deleted

One behaviour change worth review: Renderer3D declared remove() twice. The first (canvas teardown, added in 2fa995a) was silently shadowed by a second added later in ef28cbc for _textCanvas, so wrappedElt cleanup has never run. I merged them, Renderer2D.remove() has the identical four lines, which is what it was meant to mirror. WebGL/WebGPU canvases are now actually detached on remove().

Two edits look behavioural but aren't: return FES.internalError(...) is unreachable (it always throws), and if (0) → if (debug) in textCore.js uses a param that arrives falsy.

Screenshots of the change:

image

PR Checklist

  • npm run lint passes
  • [Inline reference] is included / updated — N/A, no public API changes
  • [Unit tests] are included / updated — N/A, no behaviour to cover; existing suites pass unchanged
Verification
  • npm run lint -> 0 warnings (was 143)
  • npm run build -> passes
  • unit-tests -> 2098 passed, 0 failed
  • webgpu p5.Shader + p5.Framebuffer -> 105 passed, 0 failed

WebGPU visual cases and p5.RendererWebGPU were not run locally cuz no software WebGPU adapter available :) leaving those to CI.

Signed-off-by: Vaivaswat <vaivaswat2244@gmail.com>

@ksen0 ksen0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, I did some spot checks. If tests all pass then its fine, however I did see changes in the test suite, could you briefly clarify please?

Comment thread test/unit/image/loading.js
@ksen0

ksen0 commented Sep 10, 2026

Copy link
Copy Markdown
Member

@Vaivaswat2244 I was just checking this again, there's a merge conflict now, could you resolve and ping on Discord please (just in the main contribute-to-p5 channel) so we could merge this before more changes and more merge conflicts? Sorry, thank you!

@ksen0
ksen0 merged commit 411caca into processing:main Sep 11, 2026
4 checks passed
@ksen0

ksen0 commented Sep 11, 2026

Copy link
Copy Markdown
Member

Hi @Vaivaswat2244 ! So sorry I merged this is too fast (I just reverted) - leaving a few comments

Comment thread src/color/p5.Color.js
}

// Will do conversion in-Gamut as out of Gamut conversion is only really useful for futher conversions
#toColorMode(mode) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to fix warnings but code should not be removed, you can add a flag o ignore the warning maybe?

@ksen0 ksen0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't flag before; I did a few manual tests and overall the cleanups are helpful I think but could you reinstate some of the code that got factored out?

Comment thread src/core/p5.Renderer.js
* Adapted from http://stackoverflow.com/a/25355178
* @private
*/
function calculateOffset(object) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this

Comment thread src/core/p5.Renderer3D.js
}
}

remove() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where this went but it still feels like a refactor

Comment thread src/core/p5.Renderer3D.js
throw Error('_yAlignOffset: height is required');
}

let { textLeading, textBaseline, textSize, textFont } = this.states;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same (minor)

Comment thread src/io/csv.js

function escapeRegExp(str) {
return str.replace(/[-\[\]/\{}\()\*+\?.\\^\$|]/g, '\\$&');
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/io/files.js
*
* @private
*/
function destroyClickedElement(event) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

// mat3; // only need to allocate in this rare case
} else if (multMatrix instanceof MatrixNumjs) {
_src = multMatrix.mat3;
// tempMatrix already holds the matrix we need

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/strands/ir_dag.js
return id;
}

function getNodeKey(node) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants