@next/eslint-plugin-next
Advanced tools
Comparing version 15.2.0-canary.6 to 15.2.0-canary.7
@@ -112,2 +112,17 @@ "use strict"; | ||
var fsExistsSyncCache = {}; | ||
var memoize = function(fn) { | ||
var cache = {}; | ||
return function() { | ||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ | ||
args[_key] = arguments[_key]; | ||
} | ||
var key = JSON.stringify(args); | ||
if (cache[key] === undefined) { | ||
cache[key] = fn.apply(void 0, _to_consumable_array(args)); | ||
} | ||
return cache[key]; | ||
}; | ||
}; | ||
var cachedGetUrlFromPagesDirectories = memoize(_url.getUrlFromPagesDirectories); | ||
var cachedGetUrlFromAppDirectory = memoize(_url.getUrlFromAppDirectory); | ||
var url = 'https://nextjs.org/docs/messages/no-html-link-for-pages'; | ||
@@ -177,5 +192,5 @@ module.exports = (0, _definerule.defineRule)({ | ||
} | ||
var pageUrls = (0, _url.getUrlFromPagesDirectories)('/', foundPagesDirs); | ||
var appDirUrls = (0, _url.getUrlFromAppDirectory)('/', foundAppDirs); | ||
var allUrls = _to_consumable_array(pageUrls).concat(_to_consumable_array(appDirUrls)); | ||
var pageUrls = cachedGetUrlFromPagesDirectories('/', foundPagesDirs); | ||
var appDirUrls = cachedGetUrlFromAppDirectory('/', foundAppDirs); | ||
var allUrlRegex = _to_consumable_array(pageUrls).concat(_to_consumable_array(appDirUrls)); | ||
return { | ||
@@ -212,3 +227,3 @@ JSXOpeningElement: function JSXOpeningElement(node) { | ||
} | ||
allUrls.forEach(function(foundUrl) { | ||
allUrlRegex.forEach(function(foundUrl) { | ||
if (foundUrl.test((0, _url.normalizeURL)(hrefPath))) { | ||
@@ -215,0 +230,0 @@ context.report({ |
{ | ||
"name": "@next/eslint-plugin-next", | ||
"version": "15.2.0-canary.6", | ||
"version": "15.2.0-canary.7", | ||
"description": "ESLint plugin for Next.js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
82962
2056