|
|
@ -1,14 +1,14 @@ |
|
|
|
# Review #1 |
|
|
|
# Review no. 1 |
|
|
|
|
|
|
|
I didn't touch Imba for a while and I'm really happy with what it |
|
|
|
became. CSS syntax totally nails it! I played a bit with imba2 |
|
|
|
became. CSS syntax totally nails it! I played a bit with Imba2 |
|
|
|
and here are my notes: |
|
|
|
|
|
|
|
## require / import |
|
|
|
|
|
|
|
I used to write: |
|
|
|
|
|
|
|
```js |
|
|
|
```coffee |
|
|
|
let helpers = |
|
|
|
method1: require('lodash.method2') |
|
|
|
method2: require('lodash.method2') |
|
|
@ -16,9 +16,9 @@ let helpers = |
|
|
|
method9: require('somelib.method9') |
|
|
|
``` |
|
|
|
|
|
|
|
There's no inline equivalent of import and I need to write it like this: |
|
|
|
There's no `inline` import equivalent and I need to write it like this: |
|
|
|
|
|
|
|
```js |
|
|
|
```coffee |
|
|
|
import method1 from 'lodash.method1' |
|
|
|
import method2 from 'lodash.method2' |
|
|
|
... |
|
|
@ -27,18 +27,20 @@ import method9 from 'somelib.method9' |
|
|
|
let helpers = { method1, method2 ... method9 } |
|
|
|
``` |
|
|
|
|
|
|
|
Not terrible. Require was more predictable though and if it's not a big |
|
|
|
deal it would be nice to have both - require and import. There's a |
|
|
|
Not terrible. `require` was more predictable though and if it's not a big |
|
|
|
deal it would be nice to have both - `require` and `import`. There's a |
|
|
|
chance it would be just an alias in existing implementation. |
|
|
|
|
|
|
|
Also with import syntax it would be nice to have syntax like this: |
|
|
|
Also with `import` syntax it would be nice to have syntax like this: |
|
|
|
|
|
|
|
```js |
|
|
|
```coffee |
|
|
|
import { method1, method2 ... method3 } as helpers from 'lodash' |
|
|
|
``` |
|
|
|
|
|
|
|
_Side note:_ Actually I had random issues with importing from lodash and I finished |
|
|
|
with using lodash-es library. |
|
|
|
_Side note:_ Actually I had random issues with importing from `lodash` and I finished |
|
|
|
with using `lodash-es` library. |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/793) |
|
|
|
|
|
|
|
## assigning attributes to self |
|
|
|
|
|
|
@ -58,25 +60,32 @@ class Dog |
|
|
|
``` |
|
|
|
|
|
|
|
And I miss it here even Imba was forked from Coffeescript years ago. |
|
|
|
It could be `@` or `$` prefix or `!` postfix. |
|
|
|
It could be `@` or `$` prefix or `!` postfix to tell that argument should be assigned to `self`. |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/795) |
|
|
|
|
|
|
|
## No errors in browser while having syntax error in imba file |
|
|
|
|
|
|
|
I've been few times confused what happen after having a typo in source |
|
|
|
file. Then I find through browser tools that the file is simply not |
|
|
|
attached to the bundle. It would be much faster for a developer to have |
|
|
|
an error notive displayed in browser. |
|
|
|
an error notice displayed in browser. |
|
|
|
|
|
|
|
## I miss :symbols from Imba1 |
|
|
|
[Issue](https://github.com/imba/imba/issues/796) |
|
|
|
|
|
|
|
```js |
|
|
|
## I miss pseudo :symbols from Imba1 |
|
|
|
|
|
|
|
```coffee |
|
|
|
:symbol # => 'symbol' |
|
|
|
``` |
|
|
|
It was really small feature but I loved to use it. Why to drop it? |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/797) |
|
|
|
|
|
|
|
## one-word webcomponents |
|
|
|
|
|
|
|
I had an issue described here. Looks like you can't name a tag starting |
|
|
|
I had an issue described [here](https://discord.com/channels/682180555286380545/1019638724188979250/threads/1062282410542239765). |
|
|
|
Looks like you can't name a tag starting |
|
|
|
with a small letter if it's one word. The problem is |
|
|
|
- I have read whole documentation before writing anything and |
|
|
|
didn't notice it - even it's written there. It could be more emphasised. |
|
|
@ -89,11 +98,13 @@ I occured a situation it doesn't work as expected. |
|
|
|
Considering above I suggest allow such naming and implicitly convert it |
|
|
|
to web-component name, like `x-name`. |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/798) |
|
|
|
|
|
|
|
## one line variable or prop declarations |
|
|
|
|
|
|
|
Probably it was already discussed. Proposal: |
|
|
|
Proposal: |
|
|
|
|
|
|
|
``` |
|
|
|
```coffee |
|
|
|
let a, b, c |
|
|
|
|
|
|
|
# is equal to: |
|
|
@ -120,14 +131,16 @@ let c = 1 |
|
|
|
# and so on... |
|
|
|
``` |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/799) |
|
|
|
|
|
|
|
## short form of loops |
|
|
|
|
|
|
|
By skipping var name declaration and giving them default values (`el`, `i`, `key`, `v`) and also by |
|
|
|
skipping `for` keyword we could have a shortcut syntax for `for` loops. |
|
|
|
skipping `for` keyword we could have a short syntax for `for` loops. |
|
|
|
|
|
|
|
Examples accordingly after documentation[link]: |
|
|
|
Examples accordingly after documentation[link](https://imba.io/docs/basic-syntax/control-flow#forin-loops): |
|
|
|
|
|
|
|
``` |
|
|
|
```coffee |
|
|
|
el * 2 in [1,2,3] |
|
|
|
# num * 2 for num in [1,2,3] |
|
|
|
|
|
|
@ -166,23 +179,21 @@ console.log "{key} is {v}" of obj |
|
|
|
# console.log "{key} is {value}" for own key,value of obj |
|
|
|
``` |
|
|
|
|
|
|
|
## [bug] deleting or adding `extend tag` / `tag` definitions |
|
|
|
|
|
|
|
for some cases spins vite crazy (consumes whole processor) and requires restart. |
|
|
|
[Issue](https://github.com/imba/imba/issues/800) |
|
|
|
|
|
|
|
## [bug] no .gitignore in Vite template (after imba create) |
|
|
|
|
|
|
|
I didn't noticed and added whole node\_modules in initial commit to the |
|
|
|
repo. |
|
|
|
|
|
|
|
link to PR |
|
|
|
[PR](https://github.com/imba/imba/pull/794) |
|
|
|
|
|
|
|
### Pro-router integration |
|
|
|
|
|
|
|
This is result of my short play with Imba2: [pro-router-imba2](https://router.maniak.pr/imba2). |
|
|
|
I'm thinking about introducing syntax `?` for operating with url params: |
|
|
|
|
|
|
|
``` |
|
|
|
```coffee |
|
|
|
# url: /books/id/1 |
|
|
|
|
|
|
|
?id # => 1 |
|
|
@ -199,3 +210,5 @@ I'm thinking about introducing syntax `?` for operating with url params: |
|
|
|
|
|
|
|
Both keeps router getters and setters in loop. Also I give you for |
|
|
|
consideration to introduce such syntax in Imba by default. |
|
|
|
|
|
|
|
[Issue](https://github.com/imba/imba/issues/801) |
|
|
|