From 13ee0657f9d51f09a16978d8a81788bf2a7fdae4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 18 Sep 2023 14:37:36 +0300 Subject: [PATCH] chore: lint --- .github/workflows/nodejs-pr.yml | 5 ++--- .github/workflows/nodejs.yml | 5 ++--- package.json | 4 +--- packages/formatter-progress-bar/lib/progress-bar.js | 1 + packages/formatter-progress-bar/lib/progress-bar.spec.js | 1 + packages/formatter-short/lib/short.spec.js | 1 + packages/formatter-tap/lib/tap.spec.js | 1 + packages/operator-stub/lib/stub.js | 6 ++---- packages/supertape/bin/supertape.mjs | 1 + packages/supertape/lib/cli.js | 1 + packages/supertape/lib/cli.spec.js | 1 + packages/supertape/lib/is-debug.js | 1 + packages/supertape/lib/run-tests.js | 1 + packages/supertape/lib/run-tests.spec.js | 1 + packages/supertape/lib/supertape.js | 1 + packages/supertape/lib/supertape.spec.js | 1 + 16 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/nodejs-pr.yml b/.github/workflows/nodejs-pr.yml index 2af568a..f57f774 100644 --- a/.github/workflows/nodejs-pr.yml +++ b/.github/workflows/nodejs-pr.yml @@ -29,9 +29,8 @@ jobs: run: redrun bootstrap - name: Lint run: redrun lint - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + - name: Install Rust + run: rustup update - uses: actions/cache@v3 with: path: | diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8f48e87..66e966d 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -29,9 +29,8 @@ jobs: run: bun i -f --no-save - name: Lint run: redrun fix:lint - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + - name: Install Rust + run: rustup update - uses: actions/cache@v3 with: path: | diff --git a/package.json b/package.json index d65be38..3981e03 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,6 @@ "engines": { "node": ">=16" }, - "workspaces": [ - "packages/*" - ], + "workspaces": ["packages/*"], "dependencies": {} } diff --git a/packages/formatter-progress-bar/lib/progress-bar.js b/packages/formatter-progress-bar/lib/progress-bar.js index e38964b..e154bbd 100644 --- a/packages/formatter-progress-bar/lib/progress-bar.js +++ b/packages/formatter-progress-bar/lib/progress-bar.js @@ -3,6 +3,7 @@ import cliProgress from 'cli-progress'; import chalk from 'chalk'; import fullstore from 'fullstore'; import {isCI} from 'ci-info'; +import process from 'node:process'; global._isCI = isCI; diff --git a/packages/formatter-progress-bar/lib/progress-bar.spec.js b/packages/formatter-progress-bar/lib/progress-bar.spec.js index f4d825b..2bd980d 100644 --- a/packages/formatter-progress-bar/lib/progress-bar.spec.js +++ b/packages/formatter-progress-bar/lib/progress-bar.spec.js @@ -5,6 +5,7 @@ import { stub, createTest, } from 'supertape'; +import process from 'node:process'; import * as progressBar from './progress-bar.js'; const {env} = process; diff --git a/packages/formatter-short/lib/short.spec.js b/packages/formatter-short/lib/short.spec.js index 57d69b1..8e332df 100644 --- a/packages/formatter-short/lib/short.spec.js +++ b/packages/formatter-short/lib/short.spec.js @@ -4,6 +4,7 @@ import { test, createTest, } from 'supertape'; +import process from 'node:process'; import * as shortFormatter from './short.js'; const pull = async (stream, i = 9) => { diff --git a/packages/formatter-tap/lib/tap.spec.js b/packages/formatter-tap/lib/tap.spec.js index 614e22c..a444388 100644 --- a/packages/formatter-tap/lib/tap.spec.js +++ b/packages/formatter-tap/lib/tap.spec.js @@ -4,6 +4,7 @@ import { test, createTest, } from 'supertape'; +import process from 'node:process'; import * as tapFormatter from './tap.js'; const pull = async (stream, i = 9) => { diff --git a/packages/operator-stub/lib/stub.js b/packages/operator-stub/lib/stub.js index 22d10e8..b7c62ba 100644 --- a/packages/operator-stub/lib/stub.js +++ b/packages/operator-stub/lib/stub.js @@ -36,8 +36,7 @@ export const calledWith = (operator) => (fn, args, message = `should be called w if (!isArray(args)) return operator.fail(`Expected 'args' to be 'array' but received: ${stringify(args)}`); - const {length} = fn.args; - const calledArgs = fn.args[length - 1]; + const calledArgs = fn.args.at(-1); return operator.deepEqual(calledArgs, args, message); }; @@ -52,8 +51,7 @@ export const calledWithNoArgs = (operator) => (fn, message = 'should be called w if (!isString(message)) return operator.fail(`'t.calledWithNoArgs' expects message to be string, but received: '${stringify(message)}', looks like you need 't.calledWith'`); - const {length} = fn.args; - const calledArgs = fn.args[length - 1]; + const calledArgs = fn.args.at(-1); return operator.deepEqual(calledArgs, [], message); }; diff --git a/packages/supertape/bin/supertape.mjs b/packages/supertape/bin/supertape.mjs index 5083c5e..f3020e5 100755 --- a/packages/supertape/bin/supertape.mjs +++ b/packages/supertape/bin/supertape.mjs @@ -1,5 +1,6 @@ #!/usr/bin/env node +import process from 'node:process'; import cli from '../lib/cli.js'; const { diff --git a/packages/supertape/lib/cli.js b/packages/supertape/lib/cli.js index 46b4f85..3057202 100644 --- a/packages/supertape/lib/cli.js +++ b/packages/supertape/lib/cli.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const {resolve: resolvePath} = require('path'); const {once} = require('events'); const {pathToFileURL} = require('url'); diff --git a/packages/supertape/lib/cli.spec.js b/packages/supertape/lib/cli.spec.js index 75b99b7..1e01002 100644 --- a/packages/supertape/lib/cli.spec.js +++ b/packages/supertape/lib/cli.spec.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const {join, dirname} = require('path'); const {Transform} = require('stream'); diff --git a/packages/supertape/lib/is-debug.js b/packages/supertape/lib/is-debug.js index 93d3414..3df1607 100644 --- a/packages/supertape/lib/is-debug.js +++ b/packages/supertape/lib/is-debug.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const argv = process.execArgv.join(); module.exports = argv.includes('inspect') || argv.includes('debug'); diff --git a/packages/supertape/lib/run-tests.js b/packages/supertape/lib/run-tests.js index 60a9fde..8d2f975 100644 --- a/packages/supertape/lib/run-tests.js +++ b/packages/supertape/lib/run-tests.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const fullstore = require('fullstore'); const wraptile = require('wraptile'); const tryToCatch = require('try-to-catch'); diff --git a/packages/supertape/lib/run-tests.spec.js b/packages/supertape/lib/run-tests.spec.js index beeca11..d04a275 100644 --- a/packages/supertape/lib/run-tests.spec.js +++ b/packages/supertape/lib/run-tests.spec.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const {once, EventEmitter} = require('events'); const montag = require('montag'); diff --git a/packages/supertape/lib/supertape.js b/packages/supertape/lib/supertape.js index 85e48e0..d72bf59 100644 --- a/packages/supertape/lib/supertape.js +++ b/packages/supertape/lib/supertape.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const {EventEmitter} = require('events'); const {PassThrough} = require('stream'); diff --git a/packages/supertape/lib/supertape.spec.js b/packages/supertape/lib/supertape.spec.js index 2277251..cb2f8cf 100644 --- a/packages/supertape/lib/supertape.spec.js +++ b/packages/supertape/lib/supertape.spec.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('process'); const {once} = require('events'); const {Transform} = require('stream');