Skip to content

Commit

Permalink
Chore: avoid applying eslint-env comments twice (#9278)
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark authored and kaicataldo committed Oct 14, 2017
1 parent febb897 commit db41408
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions lib/linter.js
Expand Up @@ -291,7 +291,7 @@ function createDisableDirectives(type, loc, value) {
*/
function modifyConfigsFromComments(filename, ast, config, linterContext) {

let commentConfig = {
const commentConfig = {
exported: {},
astGlobals: {},
rules: {},
Expand Down Expand Up @@ -320,10 +320,6 @@ function modifyConfigsFromComments(filename, ast, config, linterContext) {
Object.assign(commentConfig.astGlobals, parseBooleanConfig(value, comment));
break;

case "eslint-env":
Object.assign(commentConfig.env, parseListConfig(value));
break;

case "eslint-disable":
[].push.apply(disableDirectives, createDisableDirectives("disable", comment.loc.start, value));
break;
Expand Down Expand Up @@ -361,14 +357,6 @@ function modifyConfigsFromComments(filename, ast, config, linterContext) {
}
});

// apply environment configs
Object.keys(commentConfig.env).forEach(name => {
const env = linterContext.environments.get(name);

if (env) {
commentConfig = ConfigOps.merge(commentConfig, env);
}
});
Object.assign(commentConfig.rules, commentRules);

return {
Expand Down

0 comments on commit db41408

Please sign in to comment.