@next/eslint-plugin-next
Advanced tools
Comparing version 9.4.2 to 9.4.3-canary.0
@@ -5,2 +5,3 @@ module.exports = { | ||
'no-sync-scripts': require('./rules/no-sync-scripts'), | ||
'no-html-link-for-pages': require('./rules/no-html-link-for-pages'), | ||
}, | ||
@@ -12,2 +13,3 @@ configs: { | ||
'@next/next/no-sync-scripts': 1, | ||
'@next/next/no-html-link-for-pages': 1, | ||
}, | ||
@@ -14,0 +16,0 @@ }, |
@@ -39,3 +39,5 @@ const path = require('path') | ||
const href = node.attributes.find((attr) => attr.name.name === 'href') | ||
const href = node.attributes.find( | ||
(attr) => attr.type === 'JSXAttribute' && attr.name.name === 'href' | ||
) | ||
@@ -47,2 +49,7 @@ if (!href || href.value.type !== 'Literal') { | ||
const hrefPath = normalizeURL(href.value.value) | ||
// Outgoing links are ignored | ||
if (/^(https?:\/\/|\/\/)/.test(hrefPath)) { | ||
return | ||
} | ||
urls.forEach((url) => { | ||
@@ -49,0 +56,0 @@ if (url.test(normalizeURL(hrefPath))) { |
@@ -27,3 +27,4 @@ const fs = require('fs') | ||
return parseUrlForPages(urlPrefix, directory).map( | ||
(url) => new RegExp(normalizeURL(url)) | ||
// Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly. | ||
(url) => new RegExp(`^${normalizeURL(url)}$`) | ||
) | ||
@@ -71,2 +72,6 @@ } | ||
url = url = url.replace(/(\/index\.html)$/, '/') | ||
// empty URLs should not be trailed with `/`, e.g. `#heading` | ||
if (url === '') { | ||
return url | ||
} | ||
url = url.endsWith('/') ? url : url + '/' | ||
@@ -73,0 +78,0 @@ return url |
{ | ||
"name": "@next/eslint-plugin-next", | ||
"version": "9.4.2", | ||
"version": "9.4.3-canary.0", | ||
"description": "ESLint plugin for NextJS.", | ||
@@ -11,3 +11,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "91b1548d3296dae4306ad68b97fd61d092c06ebe" | ||
"gitHead": "89bc74909ba0cb34e113b617947f5338fec755cb" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7180
202
2