P5.js: Unneccessary friendly error message on min() max()

Created on 8 Nov 2020  ·  9Comments  ·  Source: processing/p5.js

Most appropriate sub-area of p5.js?

  • [ ] Accessibility (Web Accessibility)
  • [ ] Build tools and processes
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [x] Friendly error system
  • [ ] Image
  • [ ] IO (Input/Output)
  • [ ] Localization
  • [ ] Math
  • [ ] Unit Testing
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Other (specify if possible)

Details about the bug:

In the documentation for min() and max() it says "accepts any number of Number parameters" but if you give it more than 2 Number parameters there is a friendly error message. The function does work with >2 parameters and the error is unnecessary.

Here is the error:
🌸 p5.js says: max() was expecting no more than 2 arguments, but received 6. (on line 14 in sketch.js [file:///C:/---]). (http://p5js.org/reference/#/p5/max)

  • p5.js version: p5.js v1.1.9 July 22, 2020
  • Web browser and version: Chrome 86.0.4240.183
  • Operating System: Windows 10
  • Steps to reproduce this:
    Use min() or max() with more than 2 parameters (not in an array)
    e.g.
    x = max(80, 3, 5, 13, 1, 2);
    console.log(x);
bug friendly-errors

Most helpful comment

The FES here is checking the function call with the function signature as defined in the documentation, it has some limations so not all functions has parameter validation enabled. In this case parameter validation should probably be disabled for max() and probably min() as well.

All 9 comments

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

The FES here is checking the function call with the function signature as defined in the documentation, it has some limations so not all functions has parameter validation enabled. In this case parameter validation should probably be disabled for max() and probably min() as well.

@limzykenneth can I work on this issue??
P.S New to this project...

@TraXIcoN Sure, go ahead! I'll assign the issue to you.

I am not able to test the changes I made...
The error is coming similar to the one in this issue #2361

This is the error I am getting:-
``Running "eslint:build" (eslint) task No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred. ⏎······· [Error/prettier/prettier]y.js:26:17: Replace ·?·'p5-test.js' with `

1 problem
Warning: Task "eslint:build" failed. Use --force to continue.

Aborted due to warnings.
npm ERR! Test failed. See above for more details.

```

I even did a clean npm install by removing the existing node_modules folder and the npm cache

Can you post some information about your environment? Node.js and NPM version, OS, etc.

OS: Windows 10 Version 1909(OS Build 18363. 1198)
Node.js: v13.11.0
npm: v6.13.7

Do you have any local eslint rule defined? Including in parent folders of where you are keeping the p5.js source code?

If you still can't identify an obvious source, can you try and edit where prettier is complaining about and see if you can get rid of the errors that way? If that is successful, go ahead and file a PR with those changes, I'll check it locally to see if those modifications causes any other problems.

Do you have any local eslint rule defined? Including in parent folders of where you are keeping the p5.js source code?

If you still can't identify an obvious source, can you try and edit where prettier is complaining about and see if you can get rid of the errors that way? If that is successful, go ahead and file a PR with those changes, I'll check it locally to see if those modifications causes any other problems.

I don''t know why the error was not clearing out....for now I just installed linux on my machine and did it :P
I will ask the windows problem in the discussion forum and see if anyone can help me with that...anyways this was a great first experience thanks for assigning me this issue!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Patchy12 picture Patchy12  ·  3Comments

bassamanator picture bassamanator  ·  3Comments

slowizzm picture slowizzm  ·  3Comments

dhowe picture dhowe  ·  3Comments

stalgiag picture stalgiag  ·  3Comments