Yomguithereal / baobab

JavaScript & TypeScript persistent and optionally immutable data tree with cursors.
MIT License
3.15k stars 117 forks source link

Only use es2015 if supported #399

Closed kirjs closed 8 years ago

kirjs commented 9 years ago

Move iteration support to helpers module. Only add it when it is supported. This would allow to avoid having to include babel runtime See #386

Yomguithereal commented 9 years ago

Hello @kirjs. The method is the correct one. However, I feel that moving this part into the helpers isn't really a good thing since the helper will only be used once since the code is really relative to the cursor file and that it would be better to keep this logic inside it. What do you think?

kirjs commented 9 years ago

I wanted to have it in a function to simplify testing, but then I couldn't see any reason for cursors to expose it, so I moved it to helpers.

Also if we're planning to have map (#383) for baobab instances, it would probably make sense to make it iterable too.

I don't have super strong feelings about the placements though, let me know if you still want me to move it into the cursor file.

Yomguithereal commented 9 years ago

The tree's methods are bootstrapped from the root cursor's prototype so I guess the helper wouldn't be needed. If you have some time, I am currently fixing the lib's linter. Let me commit this so you can have a clean base on which to work on because I fear you may have merging issues otherwise.

Yomguithereal commented 9 years ago

Done! I've updated the linter etc.

Yomguithereal commented 9 years ago

Any update @kirjs?

kirjs commented 9 years ago

Will do this week10:14 AM, December 1, 2015, Guillaume Plique notifications@github.com:Any update @kirjs? —Reply to this email directly or view it on GitHub. Sent from Yandex.Mail for mobile: http://m.ya.ru/ymail

kirjs commented 8 years ago

Hi Guillaume,

I got rid of the helper code, and just added the check in the cursor module instead.

I tried running npm lint but got a bunch of errors in other files, ptal;

kirjs$ npm run lint

> baobab@2.1.1 lint /Users/kirjs/code/baobab
> eslint ./*.js && eslint ./src

/Users/kirjs/code/baobab/benchmark.js
   1:1   error  Unexpected var, use let or const instead                no-var
   1:1   error  Split 'var' declarations into multiple statements       one-var
   2:5   error  Expected indentation of 2 space characters but found 4  indent
   4:1   error  Unexpected var, use let or const instead                no-var
   6:1   error  Unexpected var, use let or const instead                no-var
   9:1   error  Unexpected var, use let or const instead                no-var
  12:22  error  Missing function expression name                        func-names
  15:22  error  Missing function expression name                        func-names
  18:24  error  Missing function expression name                        func-names
  21:29  error  Missing function expression name                        func-names
  22:17  error  There should be no space after '{'                      object-curly-spacing
  22:22  error  There should be no space after '{'                      object-curly-spacing
  22:27  error  There should be no space after '{'                      object-curly-spacing
  22:32  error  There should be no space after '{'                      object-curly-spacing
  22:39  error  There should be no space before '}'                     object-curly-spacing
  22:41  error  There should be no space before '}'                     object-curly-spacing
  22:43  error  There should be no space before '}'                     object-curly-spacing
  22:45  error  There should be no space before '}'                     object-curly-spacing
  25:31  error  Missing function expression name                        func-names
  28:30  error  Missing function expression name                        func-names
  31:33  error  Missing function expression name                        func-names
  34:32  error  Missing function expression name                        func-names
  37:16  error  Missing function expression name                        func-names

/Users/kirjs/code/baobab/gulpfile.js
   1:1   error    Split 'var' declarations into multiple statements       one-var
   1:1   error    Unexpected var, use let or const instead                no-var
   2:5   error    Expected indentation of 2 space characters but found 4  indent
   3:5   error    Expected indentation of 2 space characters but found 4  indent
   4:5   error    Expected indentation of 2 space characters but found 4  indent
   5:5   error    Expected indentation of 2 space characters but found 4  indent
   6:5   error    Expected indentation of 2 space characters but found 4  indent
   7:5   error    Expected indentation of 2 space characters but found 4  indent
   8:5   error    Expected indentation of 2 space characters but found 4  indent
   9:5   error    Expected indentation of 2 space characters but found 4  indent
  10:5   error    Expected indentation of 2 space characters but found 4  indent
  13:1   error    Unexpected var, use let or const instead                no-var
  13:1   error    Split 'var' declarations into multiple statements       one-var
  14:1   warning  Line 14 exceeds the maximum line length of 80           max-len
  14:5   error    Expected indentation of 2 space characters but found 4  indent
  17:23  error    Missing function expression name                        func-names
  24:34  error    Missing function expression name                        func-names
  28:21  error    Missing trailing comma                                  comma-dangle

✖ 41 problems (40 errors, 1 warning)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v5.1.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! baobab@2.1.1 lint: `eslint ./*.js && eslint ./src`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the baobab@2.1.1 lint script 'eslint ./*.js && eslint ./src'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the baobab package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint ./*.js && eslint ./src
npm ERR! You can get their info via:
npm ERR!     npm owner ls baobab
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kirjs/code/baobab/npm-debug.log
Yomguithereal commented 8 years ago

Hello @kirjs. Thanks for the update! Let me pull this and fix the merging issues so you don't have to deal with those :).

Yomguithereal commented 8 years ago

Done @kirjs! Thanks.

Yomguithereal commented 8 years ago

Do you need a new release on npm soon?

kirjs commented 8 years ago

No rush here, I'm using a pre-build version.

Thanks a lot!

Yomguithereal commented 8 years ago

Just released 2.2.0 @kirjs. Thanks for your help!