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

Underscore characters in 'opts.theme_opts' and subsequent options keys violate typescript-eslint camelCase rule #37

Closed
ShaggyTech opened this issue Feb 11, 2020 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@ShaggyTech
Copy link

ShaggyTech commented Feb 11, 2020

Describe the bug

Within my current typescript project I am using a jsdoc.js Javascript file type as opposed to the default jdsoc.json JSON file type. I'm also using npm packages eslint + prettier/recommended and typescript-eslint/recommended plugins.

There is an error to do with theme_opts and subsequent options keys, caused by the underscore characters in the key names violating the typescript-eslint camelCase rule when the key names are NOT enclosed in quote characters.

The following theme options keys violate the above mentioned rule (and probably many other style guides):

opts.theme_opts
opts.theme_opts.create_style
opts.theme_opts.add_style_path
opts.theme_opts.add_scripts
opts.theme_opts.add_script_path

They can be found in this repos publish.js file


To Reproduce

Use this theme:

  • within a Typescript project.
  • with npm packages: prettier/recommended + eslint + typescript-eslint/recommended
  • with a jsdoc.js Javascript file type as opposed to the default jdsoc.json JSON file type.

Expected behavior

The theme options not to violate the typescript-eslint camelCase rule.


Additional context

If I enclose the key names in quote characters in order to rid myself of the typescript-eslint rule violation, this then violates the prettier/recommended rules and I'm still left with an error.

Either way I'm forced to enclose the key names within quotes and add eslint-disable-next-line above each of them.

There are some possible pros and cons to implementing a fix for this issue:

  • Pros:

    • Removing the underscore characters in the theme options found in publish.js will make this theme eslint compatible (when using with a jsdoc.js Javascript file type) .
    • Easy modification to the publish.js file
  • Cons:

    • Depending on implementation of modifying the publish.js file, there is the possibility of causing a breaking change. Users would be forced to update their existing jsdoc config files if the bugfix implementation is not backwards compatible.

I plan on forking this repo to implement a modified publish.js file for my personal project. Are you open to pull requests if I can implement a fix? I believe I can make it backwards version compatible.

P.S. Love the theme and your work so far. It's my favorite of all the themes I've tried.

@ankitskvmdam
Copy link
Owner

Yes, we are open for pull requests and also waiting for it.

@ankitskvmdam
Copy link
Owner

@ShaggyTech are you woking on this?

@ShaggyTech
Copy link
Author

Unfortunately, I have decided to go with another theme and don't have the time to invest in making this fix as I originally said I would.

@ankitskvmdam
Copy link
Owner

Okay. Btw thanks for reporting the issue 👍

@ankitskvmdam ankitskvmdam added the help wanted Extra attention is needed label Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants