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

Add ability to disable jscs on constant file #26

Open
ClemMakesApps opened this issue Nov 16, 2015 · 2 comments
Open

Add ability to disable jscs on constant file #26

ClemMakesApps opened this issue Nov 16, 2015 · 2 comments

Comments

@ClemMakesApps
Copy link

It would be great if there was an ability to add the disable jscs check comment on the constant generated file as I follow the airbnb javascript convention of using single quotes for strings rather than double quotes (which is the standard for json).

@guzart
Copy link
Owner

guzart commented Nov 17, 2015

Hi, we haven't come up with a good solution for outputting single quotes. But as a quick workaround you can disable the validation for this file in your .jscsignore or using a custom template that wraps the output in comments that disable the jscs validation.

http://stackoverflow.com/a/25223150/259039

@loren138
Copy link

loren138 commented Feb 8, 2016

Here is a small piece of code you can add to your config to replace all double quotes with single quotes. (Though be careful because it will mess up your config options if any of them contain double quotes.)

gulp.task('config', function () {
  gulp.src('app/config.json')
    .pipe(ngConstant({
      // ngConstant options
    }))
    // change double quotes to single quotes
    // or you can add jshint ignore instead
    .pipe(replace(/"/g, '\''))

    .pipe(gulp.dest('dist'));
});

You will also need var replace = require('gulp-replace'); at the top of your file and "gulp-replace": "~0.5.3", in your package.json.

Also, don't forget to run npm install after editing package.json.

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

3 participants