tackbox 0.1.91 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/tackbox-eslint.js
CHANGED
|
@@ -5,8 +5,7 @@ const { ESLint } = require('eslint')
|
|
|
5
5
|
|
|
6
6
|
const REPORTERS_FLAG = '--reporters='
|
|
7
7
|
|
|
8
|
-
// Split argv into
|
|
9
|
-
// files to lint.
|
|
8
|
+
// Split argv into `--reporters=file#func,...` declarations and the files to lint.
|
|
10
9
|
function parseArgv(argv) {
|
|
11
10
|
const decls = []
|
|
12
11
|
const files = []
|
|
@@ -87,8 +86,7 @@ function hasBinding(ast, name) {
|
|
|
87
86
|
return found
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
// Validate every
|
|
91
|
-
// `file#function` fails the whole run even when that file is not being linted.
|
|
89
|
+
// Validate every declared symbol regardless of lint scope: a dead `file#function` fails the whole run.
|
|
92
90
|
function validateDeclarations(decls) {
|
|
93
91
|
for (const d of decls) {
|
|
94
92
|
const abs = path.resolve(process.cwd(), d.file)
|
|
@@ -110,14 +108,13 @@ function validateDeclarations(decls) {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
111
|
+
// Machine contract for the hook: one {file, line, rule, message} JSON per error.
|
|
112
|
+
// Human (stylish) output is unchanged. A message with no line emits line: null -
|
|
113
|
+
// the caller over-reports, never drops it.
|
|
116
114
|
function emitMachine(results) {
|
|
117
115
|
for (const r of results) {
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// name is part of the name and rewriting it misfiles the finding.
|
|
116
|
+
// Contract paths are POSIX; path.relative yields `\` on Windows. Split on
|
|
117
|
+
// path.sep, never blanket-replace: off Windows `\` is part of a file name.
|
|
121
118
|
const file = path.relative(process.cwd(), r.filePath).split(path.sep).join('/')
|
|
122
119
|
for (const m of r.messages) {
|
|
123
120
|
if (m.severity !== 2) continue
|
package/bin/tackbox-mdlint.js
CHANGED
|
@@ -78,8 +78,7 @@ async function run() {
|
|
|
78
78
|
for (const e of errors) {
|
|
79
79
|
count++
|
|
80
80
|
if (machine) {
|
|
81
|
-
// Internal {file, line, rule} contract for the hook; human output below
|
|
82
|
-
// is unchanged.
|
|
81
|
+
// Internal {file, line, rule, message} contract for the hook; human output below is unchanged.
|
|
83
82
|
const message = e.ruleDescription + (e.errorDetail ? ' [' + e.errorDetail + ']' : '')
|
|
84
83
|
process.stdout.write(JSON.stringify({ file, line: e.lineNumber, rule: e.ruleNames[0], message }) + '\n')
|
|
85
84
|
continue
|
|
@@ -74,10 +74,8 @@ function findMarkers(tokens) {
|
|
|
74
74
|
return found
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// Validate the
|
|
78
|
-
//
|
|
79
|
-
// content against), or null (do not check content) for no marker or any invalid
|
|
80
|
-
// one.
|
|
77
|
+
// Validate the markers; emit findings for misplaced / duplicate / invalid ones.
|
|
78
|
+
// Returns the allowed set list, or null to skip the content check.
|
|
81
79
|
function resolveMarkers(markers, onError) {
|
|
82
80
|
if (markers.length === 0) return null
|
|
83
81
|
const markerErr = (m, detail) =>
|
package/package.json
CHANGED