Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Create new checker for every jscs target run #1

Merged
merged 1 commit into from
Oct 7, 2013

Conversation

markelog
Copy link
Member

@markelog markelog commented Oct 6, 2013

Say, for example, you have this in Gruntfile

jscs: {
    main: "main.js",
    secondary: "secondary.js"
}

You don't have errors in main.js, but you do have one in secondary.js.
Then, you run grunt jscs command without specifying the target, as a result, both targets will be run.
In stdout you get three absolutely identical errors found in secondary.js, instead of one.

This would happen because

jscs.registerDefaultRules();
jscs.configure( require( cfgPath ) );

lines will be executed twice, whereas Checker constructor (which is initialized from out of context of jscs task) saves the rules in the returned object, so they will be augment every time.

This commit resolves the problem.

@gustavohenke
Copy link
Member

Thanks for the fix!

gustavohenke pushed a commit that referenced this pull request Oct 7, 2013
Create new checker for every jscs target run
@gustavohenke gustavohenke merged commit 8837e9a into jscs-dev:master Oct 7, 2013
@gustavohenke
Copy link
Member

0.2.0 published with this fix.

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

Successfully merging this pull request may close these issues.

None yet

2 participants