tackbox 0.1.68 → 0.1.69

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.
@@ -11,9 +11,13 @@ function parseArgv(argv) {
11
11
  const decls = []
12
12
  const files = []
13
13
  let machine = false
14
- for (const a of argv) {
14
+ for (let i = 0; i < argv.length; i++) {
15
+ const a = argv[i]
15
16
  if (a === '--machine') {
16
17
  machine = true
18
+ } else if (a === '--files-from') {
19
+ // The file set rides a list-file, not positional argv (ARG_MAX safety).
20
+ files.push(...readFilesFrom(argv[++i]))
17
21
  } else if (a.startsWith(REPORTERS_FLAG)) {
18
22
  for (const d of a.slice(REPORTERS_FLAG.length).split(',')) {
19
23
  if (!d) continue
@@ -27,6 +31,12 @@ function parseArgv(argv) {
27
31
  return { decls, files, machine }
28
32
  }
29
33
 
34
+ // readFilesFrom reads a newline-separated UTF-8 list-file into its non-empty
35
+ // paths. Additive to positional paths - the bin is public on npm.
36
+ function readFilesFrom(listPath) {
37
+ return fs.readFileSync(listPath, 'utf8').split(/\r?\n/).filter(Boolean)
38
+ }
39
+
30
40
  function parseModule(file, code) {
31
41
  const ext = path.extname(file)
32
42
  if (ext === '.ts' || ext === '.tsx') {
@@ -1,11 +1,25 @@
1
1
  #!/usr/bin/env node
2
+ const fs = require('fs')
2
3
  const { lint } = require('markdownlint/promise')
3
4
  const noNonAscii = require('../js/markdownlint-rules/no-non-ascii')
4
5
 
6
+ // readFilesFrom reads a newline-separated UTF-8 list-file into its non-empty
7
+ // paths. Additive to positional paths - the bin is public on npm.
8
+ function readFilesFrom(listPath) {
9
+ return fs.readFileSync(listPath, 'utf8').split(/\r?\n/).filter(Boolean)
10
+ }
11
+
5
12
  async function run() {
6
13
  const argv = process.argv.slice(2)
7
14
  const machine = argv.includes('--machine')
8
- const files = argv.filter(a => a !== '--machine')
15
+ const files = []
16
+ for (let i = 0; i < argv.length; i++) {
17
+ const a = argv[i]
18
+ if (a === '--machine') continue
19
+ // The file set rides a list-file, not positional argv (ARG_MAX safety).
20
+ if (a === '--files-from') { files.push(...readFilesFrom(argv[++i])); continue }
21
+ files.push(a)
22
+ }
9
23
  if (files.length === 0) {
10
24
  process.stderr.write('tackbox-mdlint: no files supplied\n')
11
25
  process.exit(2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tackbox",
3
- "version": "0.1.68",
3
+ "version": "0.1.69",
4
4
  "description": "ESLint and Markdown lint plugins plus direct error-reporting helpers for JavaScript and TypeScript.",
5
5
  "license": "MIT",
6
6
  "main": "./js/eslint-plugin.js",