spadarian / docblock-python

Atom plugin to insert documentation blocks for python functions
GNU General Public License v2.0
22 stars 9 forks source link

adopted the google style guide #13

Closed SKalt closed 6 years ago

SKalt commented 6 years ago

Addresses #10.

spadarian commented 6 years ago

I'm happy to add this, but I can't get eslint to work on the dockblock-python.js file. It works fine for the other files.

It just finds 1 error (related to the use of ::). What version of eslint do you have? v5.2.0 here.

SKalt commented 6 years ago

The version I used in this PR was 5.0.1, per the package.json. I'm not sure why you're getting linting errors: (1) linting passed in Travis [log] and (2) this PR removes all experimental / nonstandard bind syntax with arrow functions [docblock-ptython.js L187, L385].

spadarian commented 6 years ago

I didn't mean I get an error when trying this PR.

You are suggesting to add support for eslint but I can't make it work on my file (before applying the changes in this PR).

When I run eslint lib/docblock-python.js on my file I just get:

... lib/docblock-python.js
  258:14  error  Parsing error: Unexpected token :

✖ 1 problem (1 error, 0 warnings)
SKalt commented 6 years ago

All the changes in this PR are necessary to make this project work with eslint; before those changes, eslint won't work. In this specific case, the problem is the proposed :: operator, which has been in limbo in stage 0 since 2015. My solution was replacing array::fmap statements with vanilla Array.map((element, index) => ...). Another solution is moving the splitting docblock-python.js's default export into many export const and export functions or an equivalent statement at the foot of the file, export {name1, name2, ...etc}, eliminating the need to bind this. There's a final solution which is keeping it andusing use babel-eslint with stage-0 features enabled.

spadarian commented 6 years ago

I think I'm not explaining the problem correctly.

I'm running eslint on my computer, using your config file.

If I run it on lib/config.js or lib/templates.js, it shows the problems with " and the missing trailing commas.

If I run it on lib/dockblock-python.js it just shows the :: problem. I know I have problems with the indentation (> 2 spaces) or string with ", so I was wondering why it's not showing that.

SKalt commented 6 years ago

Ok, this I can explain: syntax errors like :: block other linting, since they block generation of the abstract syntax tree which the linter relies on. Once your file is standard ECMAScript, the linter should work. Thanks for bearing with me.

On Mon, Jul 30, 2018 at 11:33 PM José Padarian notifications@github.com wrote:

I think I'm not explaining the problem correctly.

I'm running eslint on my computer, using your config file.

If I run it on lib/config.js or lib/templates.js, it shows the problems with " and the missing trailing commas.

If I run it on lib/dockblock-python.js it just shows the :: problem. I know I have problems with the indentation (> 2 spaces) or string with ", so I was wondering why it's not showing that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spadarian/docblock-python/pull/13#issuecomment-409083431, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ9G5Tjt5lkEhMBHLoYFZnJGAgUSVWj1ks5uL9AkgaJpZM4U_eLD .