Closed charlessuh closed 4 years ago
Merging #1 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #1 +/- ##
======================================
Coverage 97.1% 97.1%
======================================
Files 11 11
Lines 207 207
Branches 33 33
======================================
Hits 201 201
Misses 2 2
Partials 4 4
Impacted Files | Coverage Δ | |
---|---|---|
lib/rules/common/cache.ts | 96.29% <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 07b2e54...4a241ca. Read the comment docs.
Hi.
specifierToClasses
being static / global is okay in many cases, because these lines overwrite the cache entry (if one existed from a previous file) for a specifier name (likeStyles
inimport Styles from 'file.css'
) when processing an import declaration: https://github.com/bmatcuk/eslint-plugin-postcss-modules/blob/5e8353c25368eabcb1bcd0e4748683a7c83fb6d5/lib/rules/common/cache.ts#L161-L166However, there are cases where these lines don't run -- for example, if processing the import declaration returned early: https://github.com/bmatcuk/eslint-plugin-postcss-modules/blob/5e8353c25368eabcb1bcd0e4748683a7c83fb6d5/lib/rules/common/cache.ts#L131-L139
For example: let's say
fileA.jsx
containsimport Styles from './fileA.css'
andfileB.jsx
containsimport Styles from './fileB.scss'
(so processing the import declaration infileB.jsx
returns early.)If
fileB.jsx
is linted afterfileA.jsx
, the cached entry from the previous file may be used.