markdownlint-cli2
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -26,3 +26,3 @@ #!/usr/bin/env node | ||
const packageName = "markdownlint-cli2"; | ||
const packageVersion = "0.1.2"; | ||
const packageVersion = "0.1.3"; | ||
const libraryName = "markdownlint"; | ||
@@ -50,3 +50,3 @@ const libraryVersion = markdownlintLibrary.getVersion(); | ||
const readConfig = (dir, name, otherwise) => { | ||
const file = path.join(dir, name); | ||
const file = path.posix.join(dir, name); | ||
return () => fs.access(file). | ||
@@ -87,3 +87,3 @@ then( | ||
const requireConfig = (dir, name, noRequire) => { | ||
const file = path.join(dir, name); | ||
const file = path.posix.join(dir, name); | ||
// eslint-disable-next-line prefer-promise-reject-errors | ||
@@ -162,4 +162,6 @@ return () => (noRequire ? Promise.reject() : fs.access(file)). | ||
// Load markdownlint-cli2 object(s) | ||
const markdownlintCli2Jsonc = path.join(dir, ".markdownlint-cli2.jsonc"); | ||
const markdownlintCli2Yaml = path.join(dir, ".markdownlint-cli2.yaml"); | ||
const markdownlintCli2Jsonc = | ||
path.posix.join(dir, ".markdownlint-cli2.jsonc"); | ||
const markdownlintCli2Yaml = | ||
path.posix.join(dir, ".markdownlint-cli2.yaml"); | ||
tasks.push( | ||
@@ -260,3 +262,3 @@ fs.access(markdownlintCli2Jsonc). | ||
// @ts-ignore | ||
const dir = path.dirname(file); | ||
const dir = path.posix.dirname(file); | ||
getAndProcessDirInfo(tasks, dirToDirInfo, dir, noRequire, (dirInfo) => { | ||
@@ -278,3 +280,3 @@ dirInfo.files.push(file); | ||
baseDirParents[baseDirParent] = true; | ||
baseDirParent = path.dirname(baseDirParent); | ||
baseDirParent = path.posix.dirname(baseDirParent); | ||
} while (!baseDirParents[baseDirParent]); | ||
@@ -288,3 +290,3 @@ | ||
!baseDirParents[dir] && | ||
(dir = path.dirname(dir)) && | ||
(dir = path.posix.dirname(dir)) && | ||
(dir !== lastDir) | ||
@@ -334,3 +336,3 @@ ) { | ||
if (markdownlintOptions && markdownlintOptions.customRules) { | ||
markdownlintOptions.customRules = | ||
const customRules = | ||
requireIds( | ||
@@ -341,2 +343,4 @@ dir, | ||
); | ||
// Expand nested arrays (for packages that export multiple rules) | ||
markdownlintOptions.customRules = [].concat(...customRules); | ||
} | ||
@@ -438,5 +442,5 @@ if (markdownlintOptions && markdownlintOptions.markdownItPlugins) { | ||
filteredFiles = micromatch( | ||
files.map((file) => path.relative(dir, file)), | ||
files.map((file) => path.posix.relative(dir, file)), | ||
ignores | ||
).map((file) => path.join(dir, file)); | ||
).map((file) => path.posix.join(dir, file)); | ||
} | ||
@@ -505,6 +509,5 @@ // Create markdownlint options object | ||
for (const errorInfo of errorInfos) { | ||
const fileNameRelativePosix = | ||
posixPath(path.relative(baseDir, fileName)); | ||
const fileNameRelative = path.posix.relative(baseDir, fileName); | ||
summary.push({ | ||
"fileName": fileNameRelativePosix, | ||
"fileName": fileNameRelative, | ||
...errorInfo, | ||
@@ -566,6 +569,6 @@ counter | ||
const logError = params.logError || noop; | ||
const baseDir = posixPath( | ||
const baseDirSystem = | ||
(directory && path.resolve(directory)) || | ||
process.cwd() | ||
); | ||
process.cwd(); | ||
const baseDir = posixPath(baseDirSystem); | ||
// Output banner | ||
@@ -592,3 +595,4 @@ logMessage( | ||
for (const file in fileContents) { | ||
resolvedFileContents[posixPath(path.resolve(baseDir, file))] = | ||
const resolvedFile = posixPath(path.resolve(baseDirSystem, file)); | ||
resolvedFileContents[resolvedFile] = | ||
fileContents[file]; | ||
@@ -595,0 +599,0 @@ } |
{ | ||
"name": "markdownlint-cli2", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -139,4 +139,5 @@ # markdownlint-cli2 | ||
in the same directory, it overrides the value of this property | ||
- `customRules`: `Array` of `String`s of module names/paths of | ||
[custom rules][markdownlint-custom-rules] to load and use when linting | ||
- `customRules`: `Array` of `String`s (or `Array`s of `String`s) of module | ||
names/paths of [custom rules][markdownlint-custom-rules] to load and use | ||
when linting | ||
- Each `String` is passed as the `id` parameter to Node's | ||
@@ -278,3 +279,3 @@ [require function][nodejs-require] | ||
- repo: https://github.com/DavidAnson/markdownlint-cli2 | ||
rev: v0.1.2 | ||
rev: v0.1.3 | ||
hooks: | ||
@@ -306,2 +307,3 @@ - id: markdownlint-cli2 | ||
- 0.1.2 - Update use of `require` to be more flexible | ||
- 0.1.3 - Support rule collections | ||
@@ -308,0 +310,0 @@ <!-- markdownlint-disable line-length --> |
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
42572
687
352