Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Add option to silence fixable rules while typing #1018

Merged
merged 6 commits into from
Sep 18, 2017

Conversation

Arcanemagus
Copy link
Member

Add an option that silences fixable rules while typing. The list of fixable rules is populated from ESLint itself, and only sent back to the main package code when it updates to reduce message size. This means that this will only start silencing rules after the first lint rule. Since a lint is triggered on open by default this should be largely transparent to the user.

Fixes #894.

@Arcanemagus Arcanemagus self-assigned this Sep 17, 2017
@Arcanemagus Arcanemagus requested a review from IanVS September 17, 2017 08:41
Add an option that silences fixable rules while typing. The list of
fixable rules is populated from ESLint itself, and only sent back to the
main package code when it updates to reduce message size. This means
that this will only start silencing rules after the first lint rule.
Since a lint is triggered on open by default this _should_ be largely
transparent to the user.

Fixes #894.
@Arcanemagus Arcanemagus force-pushed the arcanemagus/silence-fixable-rules branch from ad77cc4 to 07b4781 Compare September 17, 2017 08:55
@Arcanemagus
Copy link
Member Author

Just found a major bug in this, and I'm expanding the tests to check for it. (This was silencing all rules due to some unfinished code, but the specs weren't showing this!)

Arcanemagus and others added 5 commits September 17, 2017 13:33
Add an expected message to the "ignore rule while editing" specs that
stays constant, verifying that only the expected rules are being
ignored.
Restrict the list of rules sent back as fixable rules to... the rules
that are fixable, instead of _all_ rules.
Conflicts:
	src/helpers.js
	src/main.js
We need to use the instance of `linter` from `cliEngine`, so that the
plugin rules are loaded.
Copy link
Member

@IanVS IanVS left a comment

Choose a reason for hiding this comment

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

I found that initially we were not getting a list of plugin rules, so those would not have been ignored. I pushed up a commit to use the internal linter instance that is attached to the cliEngine, which will have all of the plugin rules correctly loaded. It's not exactly a public property of CliEngine, but it should be pretty safe to use I believe.

Nice work, this will be a great option to have.

@Arcanemagus
Copy link
Member Author

Thanks for fixing that up and the detailed testing @IanVS! ❤️

@Arcanemagus Arcanemagus merged commit 1f158ca into master Sep 18, 2017
@Arcanemagus Arcanemagus deleted the arcanemagus/silence-fixable-rules branch September 18, 2017 03:09
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.

3 participants