Skip to content

Commit

Permalink
add json
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Nov 12, 2021
1 parent 4516862 commit afc71e8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions eslint-plugin-expensify/prefer-import-module-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ function isHigherOrderComponent(source) {
* @returns {Boolean}
*/
function isContextComponent(source) {
return /context/.test(source.toLowerCase());
return /context|provider/.test(source.toLowerCase());
}

/**
* @param {String} source
* @returns {Boolean}
*/
function isJSONFile(source) {
return /\.json/.test(source.toLowerCase());
}

module.exports = {
Expand All @@ -52,7 +60,11 @@ module.exports = {
return;
}

if (isFromNodeModules(sourceValue) || isHigherOrderComponent(sourceValue) || isContextComponent(sourceValue)) {
if (isFromNodeModules(sourceValue)
|| isHigherOrderComponent(sourceValue)
|| isContextComponent(sourceValue)
|| isJSONFile(sourceValue)
) {
return;
}

Expand Down

0 comments on commit afc71e8

Please sign in to comment.