@salesforcedevs/sfdocs-no-relative-link
Advanced tools
Comparing version 0.0.1-alpha to 0.0.1-alphav2
@@ -13,3 +13,2 @@ "use strict"; | ||
const vfile_message_1 = __importDefault(require("vfile-message")); | ||
const path_1 = __importDefault(require("path")); | ||
/** | ||
@@ -32,5 +31,5 @@ * To find whether a given link is of internal markdown file. | ||
function check(node) { | ||
const denyInternalLinkInFile = path_1.default.basename(path_1.default.dirname(file.path)) === folder; | ||
const denyInternalLinkInFile = file.path.includes(folder); | ||
if (isInternalPath(node.url) && denyInternalLinkInFile) { | ||
const errorMessage = new vfile_message_1.default(`Internal link is not allowed in ${folder} files: ${node.url}`, node, "relative-link-not-allowed"); | ||
const errorMessage = new vfile_message_1.default(`Using relative links is not allowed in ${folder} files. Please use absolute links instead of ${node.url}.`, node, "relative-link-not-allowed"); | ||
errorMessage.fatal = true; | ||
@@ -37,0 +36,0 @@ file.messages.push(errorMessage); |
{ | ||
"name": "@salesforcedevs/sfdocs-no-relative-link", | ||
"version": "0.0.1-alpha", | ||
"version": "0.0.1-alphav2", | ||
"description": "Validate the relative links in any folder and throw error/warning after check", | ||
@@ -5,0 +5,0 @@ "author": "SFDocs Team", |
@@ -65,3 +65,3 @@ import dedent from 'dedent'; | ||
expect(result.messages[0].fatal).toBeTruthy(); | ||
expect(result.messages[0].toString()).toBe('2:1-2:32: Internal link is not allowed in shared files: ./testing.md'); | ||
expect(result.messages[0].toString()).toBe('2:1-2:32: Using relative links is not allowed in shared files. Please use absolute links instead of ./testing.md.'); | ||
}); | ||
@@ -89,3 +89,3 @@ | ||
expect(result.messages[0].fatal).toBeTruthy(); | ||
expect(result.messages[0].toString()).toBe('2:1-2:40: Internal link is not allowed in shared files: ../guides/testing.md'); | ||
expect(result.messages[0].toString()).toBe('2:1-2:40: Using relative links is not allowed in shared files. Please use absolute links instead of ../guides/testing.md.'); | ||
}); | ||
@@ -92,0 +92,0 @@ |
@@ -11,3 +11,2 @@ /** | ||
import VMessage, { VFileMessage } from 'vfile-message'; | ||
import path from 'path'; | ||
@@ -33,6 +32,6 @@ /** | ||
const denyInternalLinkInFile = path.basename(path.dirname(file.path)) === folder; | ||
const denyInternalLinkInFile = file.path.includes(folder); | ||
if (isInternalPath(node.url) && denyInternalLinkInFile) { | ||
const errorMessage: VFileMessage = new VMessage(`Internal link is not allowed in ${folder} files: ${node.url}`, node, "relative-link-not-allowed"); | ||
const errorMessage: VFileMessage = new VMessage(`Using relative links is not allowed in ${folder} files. Please use absolute links instead of ${node.url}.`, node, "relative-link-not-allowed"); | ||
errorMessage.fatal = true; | ||
@@ -39,0 +38,0 @@ file.messages.push(errorMessage); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
79296
728