Skip to content

Commit 25738ae

Browse files
authored
Use neostandard + add more static code analysis (#142)
* Use neostandard * ci: add knip + rimraf + clean up with help of knip * only run workflows on on `master` branch and PR:s * tweak new npm scripts * add installed-check
1 parent 6be8fff commit 25738ae

29 files changed

+85
-287
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
name: tests
22

3-
on: [pull_request, push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- '*'
9+
pull_request:
10+
branches:
11+
- master
412

513
env:
614
FORCE_COLOR: 2
715

816
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Use Node.js lts/*
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: lts/*
25+
- run: npm i
26+
- run: npm run check
27+
928
test:
1029
runs-on: ${{ matrix.os }}
1130

@@ -22,14 +41,14 @@ jobs:
2241
with:
2342
node-version: ${{ matrix.node }}
2443
- run: npm i
25-
- run: npm test
44+
- run: npm run test-mocha
2645
- uses: codecov/codecov-action@v4
2746
if: ${{ github.event_name == 'pull_request' }}
2847
with:
2948
flags: ${{ matrix.os }}-${{ matrix.node }}
3049

3150
automerge:
32-
needs: test
51+
needs: [lint, test]
3352
runs-on: ubuntu-latest
3453
permissions:
3554
pull-requests: write

.knip.jsonc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": ["lib/index.js", "bin/*/*.js", "test-workspace/tasks/*.js"],
4+
"ignoreDependencies": ["rimraf", "yarn"]
5+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Downloads/month](https://img.shields.io/npm/dm/npm-run-all2.svg)](http://www.npmtrends.com/npm-run-all2)
88
[![tests](https://github.com/bcomnes/npm-run-all2/workflows/tests/badge.svg)](https://github.com/bcomnes/npm-run-all2/actions)
99
[![Coverage Status](https://codecov.io/gh/bcomnes/npm-run-all2/branch/master/graph/badge.svg)](https://codecov.io/gh/bcomnes/npm-run-all2)
10+
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
1011

1112
A CLI tool to run multiple npm-scripts in parallel or sequential.
1213

bin/common/bootstrap.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// ------------------------------------------------------------------------------
99
// Public Interface
1010
// ------------------------------------------------------------------------------
11-
/* eslint-disable no-process-exit */
1211

1312
module.exports = function bootstrap (name) {
1413
const argv = process.argv.slice(2)
@@ -47,5 +46,3 @@ module.exports = function bootstrap (name) {
4746
)
4847
}
4948
}
50-
51-
/* eslint-enable */

bin/common/parse-cli-args.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
'use strict'
77

8-
/* eslint-disable no-process-env */
9-
108
// ------------------------------------------------------------------------------
119
// Helpers
1210
// ------------------------------------------------------------------------------
@@ -243,5 +241,3 @@ function parseCLIArgsCore (set, args) {
243241
module.exports = function parseCLIArgs (args, initialValues, options) {
244242
return parseCLIArgsCore(new ArgumentSet(initialValues, options), args)
245243
}
246-
247-
/* eslint-enable */

bin/npm-run-all/main.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module.exports = function npmRunAll (args, stdout, stderr) {
5252
arguments: argv.rest,
5353
race: group.parallel && argv.race,
5454
npmPath: argv.npmPath,
55-
aggregateOutput: group.parallel && argv.aggregateOutput
55+
aggregateOutput: group.parallel && argv.aggregateOutput,
5656
}
5757
))
5858
},
@@ -61,14 +61,12 @@ module.exports = function npmRunAll (args, stdout, stderr) {
6161

6262
if (!argv.silent) {
6363
promise.catch(err => {
64-
// eslint-disable-next-line no-console
6564
console.error('ERROR:', err.message)
6665
})
6766
}
6867

6968
return promise
7069
} catch (err) {
71-
// eslint-disable-next-line no-console
7270
console.error('ERROR:', err.message)
7371

7472
return Promise.reject(err)

bin/run-p/main.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,18 @@ module.exports = function npmRunAll (args, stdout, stderr) {
5252
arguments: argv.rest,
5353
race: argv.race,
5454
npmPath: argv.npmPath,
55-
aggregateOutput: argv.aggregateOutput
55+
aggregateOutput: argv.aggregateOutput,
5656
}
5757
)
5858

5959
if (!argv.silent) {
6060
promise.catch(err => {
61-
// eslint-disable-next-line no-console
6261
console.error('ERROR:', err.message)
6362
})
6463
}
6564

6665
return promise
6766
} catch (err) {
68-
// eslint-disable-next-line no-console
6967
console.error('ERROR:', err.message)
7068

7169
return Promise.reject(err)

bin/run-s/main.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,18 @@ module.exports = function npmRunAll (args, stdout, stderr) {
4949
packageConfig: argv.packageConfig,
5050
silent: argv.silent,
5151
arguments: argv.rest,
52-
npmPath: argv.npmPath
52+
npmPath: argv.npmPath,
5353
}
5454
)
5555

5656
if (!argv.silent) {
5757
promise.catch(err => {
58-
// eslint-disable-next-line no-console
5958
console.error('ERROR:', err.message)
6059
})
6160
}
6261

6362
return promise
6463
} catch (err) {
65-
// eslint-disable-next-line no-console
6664
console.error('ERROR:', err.message)
6765

6866
return Promise.reject(err)

eslint.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
3+
module.exports = [
4+
...require('neostandard')({
5+
env: ['mocha'],
6+
ignores: require('neostandard').resolveIgnoresFromGitignore(),
7+
ts: true,
8+
}),
9+
]

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function maxLength (length, name) {
228228
* @returns {Promise}
229229
* A promise object which becomes fullfilled when all npm-scripts are completed.
230230
*/
231-
module.exports = function npmRunAll (patternOrPatterns, options) { // eslint-disable-line complexity
231+
module.exports = function npmRunAll (patternOrPatterns, options) {
232232
const stdin = (options && options.stdin) || null
233233
const stdout = (options && options.stdout) || null
234234
const stderr = (options && options.stderr) || null
@@ -290,14 +290,14 @@ module.exports = function npmRunAll (patternOrPatterns, options) { // eslint-dis
290290
enabled: printLabel,
291291
width: labelWidth,
292292
lastPrefix: null,
293-
lastIsLinebreak: true
293+
lastIsLinebreak: true,
294294
},
295295
printName,
296296
packageInfo: x.packageInfo,
297297
race,
298298
maxParallel,
299299
npmPath,
300-
aggregateOutput
300+
aggregateOutput,
301301
})
302302
})
303303
} catch (err) {

0 commit comments

Comments
 (0)