eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

[no-constructed-context-values] Update isJsxContext check to allow for JSXIdentifier ending with Provider

Open liuyenwei opened this issue 2 years ago • 1 comments

jsx/no-constructed-context-values currently only works for context providers that are used as <Context.Provider value={..}>

We have a lot of use cases where, instead of exporting the context directly, we explicitly export the provider as a named export. The naming convention for this is typically ${NameOfContext}Provider

The proposed change here is to update the isJsxContext check to take the above scenario into account and run the lint rule for these elements as well.

liuyenwei avatar May 04 '22 17:05 liuyenwei

Codecov Report

Merging #3283 (03645af) into master (c8833f3) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3283      +/-   ##
==========================================
+ Coverage   97.72%   97.73%   +0.01%     
==========================================
  Files         123      123              
  Lines        8745     8746       +1     
  Branches     3170     3173       +3     
==========================================
+ Hits         8546     8548       +2     
+ Misses        199      198       -1     
Impacted Files Coverage Δ
lib/rules/jsx-no-constructed-context-values.js 94.17% <100.00%> (+1.03%) :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 c8833f3...03645af. Read the comment docs.

codecov[bot] avatar May 04 '22 17:05 codecov[bot]