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

Chore: avoid applying eslint-env comments twice #9278

Merged
merged 1 commit into from Oct 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions lib/linter.js
Expand Up @@ -290,7 +290,7 @@ function createDisableDirectives(type, loc, value) {
*/
function modifyConfigsFromComments(filename, ast, config, linterContext) {

let commentConfig = {
const commentConfig = {
exported: {},
astGlobals: {},
rules: {},
Expand Down Expand Up @@ -319,10 +319,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 @@ -360,14 +356,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