Skip to content
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

less 3.x throws an error if there's no return value for a node #3182

Closed
fpsqdb opened this issue Feb 27, 2018 · 8 comments
Closed

less 3.x throws an error if there's no return value for a node #3182

fpsqdb opened this issue Feb 27, 2018 · 8 comments

Comments

@fpsqdb
Copy link

fpsqdb commented Feb 27, 2018

After upgrade to 3.0.1 from 2.7.3, less throw an error
" Cannot read property 'length' of undefined" at antd\lib\style\color\bezierEasing.less (line 1, column -1)
it works fine when I down to 2.7.3.

And this is the bezierEasing.less file:

bezierEasing.less

@matthew-dean
Copy link
Member

Looks like the error has an error.

@seven-phases-max
Copy link
Member

seven-phases-max commented Jun 5, 2018

I've fixed the link in the first post. It seems they also have already fixed the issue (by adding return '' there) though it would be nice to have some feedback.

@matthew-dean
Copy link
Member

matthew-dean commented Jun 6, 2018

It seems there were a few issues that this touched on.

  1. not having javascriptEnabled: true and using inline JS
  2. A bug introduced where the lack of a return statement from, presumably, some node or sub-node of a value property causes an error? Meaning since there wasn't a string returned, it's probably trying to get the length of that string. That one SHOULD be a pretty simple fix.

While you're reading this, do you have time to review the pile of Less bug fixes I've made recently?

@matthew-dean
Copy link
Member

Duplicate of #3113.

@matthew-dean
Copy link
Member

matthew-dean commented Jun 25, 2018

Re-opening since this is an issue in the current release, and the previous one (#3113) was thought to be related to alpha bugs.

@matthew-dean matthew-dean changed the title less 3.x throw error with antd less 3.x throws an error if there's no return value for a node Jul 3, 2018
@matthew-dean
Copy link
Member

@seven-phases-max

I've fixed the link in the first post. It seems they also have already fixed the issue (by adding return '' there) though it would be nice to have some feedback.

Should we fix this? This seems to apply in this case to inline JS, which is deprecated.

@rjgotten
Copy link
Contributor

rjgotten commented Jul 3, 2018

@matthew-dean
Should we fix this?

Any custom function or visitor that manipulates the node tree into containing something that evaluates particular types of nodes to undefined can trigger this situation, I believe.

Some time ago I wrote a few custom functions that did some on the fly AST generation for some hacked together each loops that could take a ruleset as a parameter and have an @item parameter injected into it (similar to @arguments) to hold each item from the looped over list. I ran across the same issue back then due to a missed return statement on a node.

@matthew-dean
Copy link
Member

Any custom function or visitor that manipulates the node tree into containing something that evaluates particular types of nodes to undefined can trigger this situation, I believe.

Okay, then it's worth checking out. I thought I handled null nodes, but maybe specifically it was for values of null.

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

No branches or pull requests

4 participants