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

Allow to set quoting style #7

Closed
vilmosioo opened this issue Sep 13, 2013 · 12 comments
Closed

Allow to set quoting style #7

vilmosioo opened this issue Sep 13, 2013 · 12 comments

Comments

@vilmosioo
Copy link

JSHint does not allow double quotes.

@mlegenhausen
Copy link
Owner

This will be a little bit tricky cause the JSON.stringify method wraps everything in double quotes. Do you know any other library for this problem? It would be nice if I could also convert Date objects and keep them as Date.

@vilmosioo
Copy link
Author

I don't know any :( Can easily bypass this issue by ignoring the generated file.

Great work though!

@mlegenhausen
Copy link
Owner

That would be my advice too ;)

I will keep this open, maybe I find an alternative.

@vilmosioo
Copy link
Author

I think valid JSON should have double quotes. I set my jshint to ignore all json files and it's fine.
I would close this issue myself but I'll leave the decision to you in case you want to add this feature at some point.

@mlegenhausen
Copy link
Owner

That's right it is valid JSON, but you are not limited to JSON in an angular constant module.

@vilmosioo
Copy link
Author

True but I prefer it. I work on a medium to large app with a lot of constants spread over multiple files. I do not find it proper to define constant values in my Gruntfile. Unless I'm missing something here...

@mlegenhausen
Copy link
Owner

Nice to hear that my plugin is useful for others :)

Sure the JSON option should always be the default, but another option could be useful too.

@vilmosioo
Copy link
Author

Thanks for everything! I'll keep an eye out on this issue to see if the generated files still fail jshint.
I'll do my best to help in the meantime.

@mkhatib
Copy link

mkhatib commented Dec 20, 2013

I just sent a pull request to add a singlequote option. Check it out and let me know if that might be a possible solution.

@vilmosioo
Copy link
Author

@werk85 is everything alright with the pull request?

@kylejeske
Copy link

Is there any reason why "singlequote" didn't get pulled into master?

A work-around for this ...

        ngconstant: {
            options: {
                space: '  ',
                wrap: '/*jshint quotmark:double*/\n\n"use strict";\n\n {%= __ngModule %}',
                name: 'myConfig'
            },

@mlegenhausen
Copy link
Owner

Read #20 for more informations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants