-
Notifications
You must be signed in to change notification settings - Fork 122
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
Object access dot operator #47
Conversation
Linting is failing because of the eslint rules conflicting with prettier output. Maybe it's a good idea to disable code formatting rules at all because we're forcing prettier formatting so after all there is no need to check them by eslint. |
The eslint + prettier setup is there to ensure properly formatted code is committed to master. Looking at the eslint errors they are legit. Strings must use double quotes, this is default prettier setup. The project uses mostly default prettier style + trailing commas. |
Wasn't it agreed that no string access and declaration would be allowed to avoid confusion? |
But prettier soubleQuote is not always double quote but prefer double quote. https://prettier.io/docs/en/options.html#quotes Using prettier in validation step ensures us that code formatting is correct so having eslint for that is unneccessary. In situations like this there is no way to have eslint and prettier pass because code is properly formated after prettier pass. |
I see what you mean now. Yeah, our eslint-rule for quotes is misconfigured https://eslint.org/docs/rules/quotes#avoidescape we should have had an My primary concern was that it would be difficult to track down what is wrong with the source if there is only prettier validation as it'll simply point a file should be prettified but not which line/why it's failing. We could discuss disabling formatting rules, even though wouldn't really buy us anything. For the errors you're getting, just edit the quote rule as it's misconfigured. |
Waiting for review and initial feedback so I can improve things and convert examples/documentation. |
My initial feedback is similar to the original PR. Since the [
targetNode,
parameterNode
] All we should need to do is to map the params to something array subscript can consume. Which is a Line 26 in 296f1cb
I don't really see a reason for us to keep track of the tokens in expression to figure out if it's an access operator or not. |
I gave updating this branch a shot, but it's way out of date by this point. It's been a while since any updates, so I think I'm going to consider this PR abandoned and implement the dot operator a bit differently. At this point it's a bit of a blocker for some other features. |
Fantastic. I was able to necromance the branch! I hope you see why I went in a different direction. The changes to AST generators and validation made this feature a 3 line change. Thanks for the help! |
Second attempt to resolve #28. New PR because I've started work from scratch and I want to keep clean git history.
This solution leverages parser rather than tokenizer so no new tokens were added to syntax. One not so nice part is checking if last operator and last operand in the
parser/expressions
are like we would like them. This probably can be improved but I'm counting on some feedback first.I've also added error when we're trying to access object field that doesn't exist. New error inside Context:
TypeError
was introduced because it was more suitable for this type of error.There are some formatting changes and they are not related to my PR but I was forced by prettier to add them because of wrong formatting on some files that were on
master
branch.