mysticatea / eslint-plugin-eslint-comments

Additional ESLint rules for directive comments of ESLint.
https://mysticatea.github.io/eslint-plugin-eslint-comments/
MIT License
354 stars 44 forks source link

Fix: support ESLint ^4.4.0 #3

Closed not-an-aardvark closed 6 years ago

not-an-aardvark commented 6 years ago

ESLint 4.4.0 will probably be released today. It includes https://github.com/eslint/eslint/pull/8997, which refactors RuleContext to rename some internal properties. Since this plugin relies on context.eslint as a private API, it won't work because that property was renamed to context._linter to clarify that it usually shouldn't be used.

Additionally, since ESLint 3.18.0, node type listeners need to be added before traversal starts (because they are indexed beforehand in node-event-generator in order to support selectors). Since no-unused-disable adds a listener at runtime, this could cause a false negative if no other active rules added a Program:exit listener. For example, no error is reported for the following code:

/* eslint-disable new-parens */
a;

Unfortunately, this wasn't caught with RuleTester because RuleTester also adds a Program:exit listener. (In general, I think RuleTester doesn't support adding listeners at runtime.)

codecov-io commented 6 years ago

Codecov Report

Merging #3 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #3      +/-   ##
==========================================
+ Coverage   98.35%   98.36%   +<.01%     
==========================================
  Files          14       14              
  Lines         182      183       +1     
==========================================
+ Hits          179      180       +1     
  Misses          3        3
Impacted Files Coverage Δ
tests/lib/rules/no-unused-disable.js 100% <ø> (ø) :arrow_up:
lib/rules/no-unused-disable.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c6fb10f...85fa282. Read the comment docs.

mysticatea commented 6 years ago

Oh, wow, thank you very much!! And I apology that I have not contributed to ESLint recently. I'll back after eslint-plugin-vue get steadied.

not-an-aardvark commented 6 years ago

No problem! eslint-plugin-vue looks like a useful project.