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: Simplify dataflow in linter.verify #10020

Merged
merged 3 commits into from Feb 26, 2018

Conversation

not-an-aardvark
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[x] Other, please explain:

What changes did you make? (Give an overview)

This refactors linter.verify to simplify the dataflow throughout the function, and separate out some parts when possible. Specifically:

  • Rules are now run as part of a separate function
  • Environments are now resolved once, as opposed to several times in different places for parserOptions and globals.
  • The defaults for linter.verify are now processed into a consistent object in a separate function.

This should make it easier to implement #9998.

Is there anything you'd like reviewers to focus on?

Nothing in particular

@not-an-aardvark not-an-aardvark added the chore This change is not user-facing label Feb 25, 2018
linter.verify(code, { rules: { foobar: null } });
}, /Invalid config for rule 'foobar'\./);
});
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this test because we were doing config validation in two separate places: ConfigValidator which verifies all parts of a config including rule schemas, and Linter where we were only checking if a rule's configured value was null and skipping all other validation. The second validation is generally redundant with the first validation.

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Just out of curiosity, what was the effect of the incorrect configuration in conf/environments.js?

@not-an-aardvark
Copy link
Member Author

I think it meant the builtin environment would not work when used in a config file, because it was specified differently from other environments. However, we were always adding the globals from the builtin environment anyway, regardless of configuration.

@not-an-aardvark not-an-aardvark merged commit e4f52ce into master Feb 26, 2018
@not-an-aardvark not-an-aardvark deleted the simplify-linter-dataflow branch February 26, 2018 17:48
This was referenced Mar 22, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 27, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants