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.
@@ -5,8 +5,7 @@ const { ESLint } = require('eslint')
5
5
 
6
6
  const REPORTERS_FLAG = '--reporters='
7
7
 
8
- // Split argv into declared reporters (`--reporters=file#func,...`) and the
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 declaration's symbol, independent of the lint scope: a dead
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
- // Internal machine contract: one {file, line, rule} JSON object per error, for
114
- // the hook. Human (stylish) output is unchanged. A message with no line emits
115
- // line: null (location-unknown) - the caller over-reports, never drops it.
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
- // The contract path is POSIX; path.relative yields `\` on Windows. Split on
119
- // the platform separator, never a blanket replace: off Windows a `\` in a
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
@@ -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 marker set; emit findings for a misplaced / duplicate / invalid
78
- // marker. Return the allowed set list for a single valid marker (to check
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tackbox",
3
- "version": "0.1.91",
3
+ "version": "0.1.92",
4
4
  "description": "ESLint and Markdown lint plugins, an Oh My Pi extension, plus direct error-reporting helpers for JavaScript and TypeScript.",
5
5
  "license": "MIT",
6
6
  "main": "./js/eslint-plugin.js",