From 75693dd0411060f4707376b67dd082670993fb38 Mon Sep 17 00:00:00 2001 From: Mestery Date: Sat, 29 Jan 2022 21:31:01 +0100 Subject: [PATCH] build,tools: change the quotes in YAML Remove useless quotes and use single quotes when needed. --- .github/ISSUE_TEMPLATE/1-bug-report.yml | 2 +- .github/ISSUE_TEMPLATE/2-feature-request.yml | 4 +- .../ISSUE_TEMPLATE/3-api-ref-docs-problem.yml | 4 +- .../ISSUE_TEMPLATE/4-report-a-flaky-test.yml | 2 +- .github/workflows/authors.yml | 12 +-- .github/workflows/auto-start-ci.yml | 2 +- .github/workflows/build-tarball.yml | 12 +-- .github/workflows/build-windows.yml | 4 +- .github/workflows/close-stalled.yml | 2 +- .github/workflows/commit-lint.yml | 2 +- .github/workflows/commit-queue.yml | 2 +- .github/workflows/coverage-linux.yml | 12 +-- .github/workflows/coverage-windows.yml | 16 ++-- .github/workflows/daily.yml | 2 +- .../workflows/find-inactive-collaborators.yml | 6 +- .github/workflows/find-inactive-tsc.yml | 6 +- .github/workflows/license-builder.yml | 6 +- .github/workflows/linters.yml | 2 +- .github/workflows/notify-force-push.yml | 2 +- .github/workflows/test-asan.yml | 12 +-- .github/workflows/test-linux.yml | 4 +- .github/workflows/test-macos.yml | 12 +-- .github/workflows/tools.yml | 14 +-- lib/.eslintrc.yaml | 86 +++++++++---------- test/.eslintrc.yaml | 76 ++++++++-------- tools/.eslintrc.yaml | 6 +- 26 files changed, 155 insertions(+), 155 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml index 07a8f075ee55c0..820df7bb0952f3 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -1,4 +1,4 @@ -name: "\U0001F41B Bug report" +name: \U0001F41B Bug report description: Create a report to help us improve body: - type: markdown diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.yml b/.github/ISSUE_TEMPLATE/2-feature-request.yml index 1c5c2fda14e1df..14da0d364132d1 100644 --- a/.github/ISSUE_TEMPLATE/2-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/2-feature-request.yml @@ -1,6 +1,6 @@ -name: "\U0001F680 Feature request" +name: \U0001F680 Feature request description: Suggest an idea for this project -labels: ["feature request"] +labels: [feature request] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.yml b/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.yml index 9b3bdc35197f24..bfafc4a23d36b9 100644 --- a/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.yml +++ b/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.yml @@ -1,6 +1,6 @@ -name: "\U0001F4D7 Open an issue regarding the Node.js API reference docs" +name: \U0001F4D7 Open an issue regarding the Node.js API reference docs description: Let us know about any problematic API reference documents -labels: ["doc"] +labels: [doc] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/4-report-a-flaky-test.yml b/.github/ISSUE_TEMPLATE/4-report-a-flaky-test.yml index c557accfb15b92..dd6fa5091e3f15 100644 --- a/.github/ISSUE_TEMPLATE/4-report-a-flaky-test.yml +++ b/.github/ISSUE_TEMPLATE/4-report-a-flaky-test.yml @@ -1,6 +1,6 @@ name: Report a flaky test description: Report a flaky test in our CI -labels: ["flaky-test"] +labels: [flaky-test] body: - type: markdown attributes: diff --git a/.github/workflows/authors.yml b/.github/workflows/authors.yml index 0a14c94f1d7e74..edf94e7b878e02 100644 --- a/.github/workflows/authors.yml +++ b/.github/workflows/authors.yml @@ -1,8 +1,8 @@ -name: "authors update" +name: authors update on: schedule: # Run once a week at 00:05 AM UTC on Sunday. - - cron: '5 0 * * 0' + - cron: 5 0 * * 0 workflow_dispatch: @@ -15,7 +15,7 @@ jobs: with: fetch-depth: '0' # This is required to actually get all the authors persist-credentials: false - - run: "tools/update-authors.js" # Run the AUTHORS tool + - run: tools/update-authors.js # Run the AUTHORS tool - uses: gr2m/create-or-update-pull-request-action@v1 # Create a PR or update the Action's existing PR env: GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} @@ -25,7 +25,7 @@ jobs: Here are some new additions to the AUTHORS file. This is an automatically generated PR by the `authors.yml` GitHub Action, which runs `tools/update-authors.js`. - branch: "actions/authors-update" # Custom branch *just* for this Action. - commit-message: "meta: update AUTHORS" + branch: actions/authors-update # Custom branch *just* for this Action. + commit-message: 'meta: update AUTHORS' labels: meta - title: "meta: update AUTHORS" + title: 'meta: update AUTHORS' diff --git a/.github/workflows/auto-start-ci.yml b/.github/workflows/auto-start-ci.yml index 632fdc0a970ceb..db644edd37a1ae 100644 --- a/.github/workflows/auto-start-ci.yml +++ b/.github/workflows/auto-start-ci.yml @@ -6,7 +6,7 @@ on: # optimistic, it can take longer to run. # To understand why `schedule` is used instead of other events, refer to # ./doc/contributing/commit-queue.md - - cron: "*/5 * * * *" + - cron: '*/5 * * * *' env: NODE_VERSION: lts/* diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index ebf6458889410f..8756f28bf6fd1b 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -4,10 +4,10 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/build-tarball.yml' push: @@ -17,10 +17,10 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/build-tarball.yml' diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 7c49f14fa64794..4d1241957b7333 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -3,7 +3,7 @@ name: build-windows on: pull_request: paths-ignore: - - "README.md" + - README.md - .github/** - '!.github/workflows/build-windows.yml' types: [opened, synchronize, reopened, ready_for_review] @@ -15,7 +15,7 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: - - "README.md" + - README.md - .github/** - '!.github/workflows/build-windows.yml' diff --git a/.github/workflows/close-stalled.yml b/.github/workflows/close-stalled.yml index 9a3dad5621b971..347b22bd70caf3 100644 --- a/.github/workflows/close-stalled.yml +++ b/.github/workflows/close-stalled.yml @@ -1,7 +1,7 @@ name: Close stalled issues and PRs on: schedule: - - cron: "0 0 * * *" + - cron: 0 0 * * * env: CLOSE_MESSAGE: > diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index 524df2224074fc..56da77c36db733 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -1,4 +1,4 @@ -name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q" +name: First commit message adheres to guidelines at https://goo.gl/p2fr5Q on: [pull_request] diff --git a/.github/workflows/commit-queue.yml b/.github/workflows/commit-queue.yml index 509be21815bb06..f4aee6dd37a3ee 100644 --- a/.github/workflows/commit-queue.yml +++ b/.github/workflows/commit-queue.yml @@ -11,7 +11,7 @@ on: # be read-only, and the Action won't have access to any other repository # secrets, which it needs to access Jenkins API. schedule: - - cron: "*/5 * * * *" + - cron: '*/5 * * * *' env: NODE_VERSION: lts/* diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index e6200f67e8b74a..3ed424c5a16e64 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -5,9 +5,9 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths-ignore: - '**.md' - - 'benchmark/**' - - 'deps/**' - - 'doc/**' + - benchmark/** + - deps/* + - doc/** - .github/** - '!.github/workflows/coverage-linux.yml' push: @@ -16,9 +16,9 @@ on: - main paths-ignore: - '**.md' - - 'benchmark/**' - - 'deps/**' - - 'doc/**' + - benchmark/** + - deps/** + - doc/** - .github/** - '!.github/workflows/coverage-linux.yml' diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml index f6bae771da43fd..82360015777227 100644 --- a/.github/workflows/coverage-windows.yml +++ b/.github/workflows/coverage-windows.yml @@ -5,10 +5,10 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths-ignore: - '**.md' - - 'benchmark/**' - - 'deps/**' - - 'doc/**' - - 'tools/**' + - benchmark/** + - deps/** + - doc/** + - tools/** - .github/** - '!.github/workflows/coverage-windows.yml' push: @@ -17,10 +17,10 @@ on: - main paths-ignore: - '**.md' - - 'benchmark/**' - - 'deps/**' - - 'doc/**' - - 'tools/**' + - benchmark/** + - deps/** + - doc/** + - tools/** - .github/** - '!.github/workflows/coverage-windows.yml' diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 2f2560dd751c1d..79294ca966ddef 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -3,7 +3,7 @@ name: Node.js daily job on: workflow_dispatch: schedule: - - cron: "0 0 * * *" + - cron: 0 0 * * * env: NODE_VERSION: lts/* diff --git a/.github/workflows/find-inactive-collaborators.yml b/.github/workflows/find-inactive-collaborators.yml index 643e3ea4a6b4b1..21f0f0297d5f11 100644 --- a/.github/workflows/find-inactive-collaborators.yml +++ b/.github/workflows/find-inactive-collaborators.yml @@ -3,7 +3,7 @@ name: Find inactive collaborators on: schedule: # Run every Monday at 4:05 AM UTC. - - cron: '5 4 * * 1' + - cron: 5 4 * * 1 workflow_dispatch: @@ -37,6 +37,6 @@ jobs: author: Node.js GitHub Bot branch: actions/inactive-collaborators body: This PR was generated by tools/find-inactive-collaborators.yml. - commit-message: "meta: move one or more collaborators to emeritus" + commit-message: 'meta: move one or more collaborators to emeritus' labels: meta - title: "meta: move one or more collaborators to emeritus" + title: 'meta: move one or more collaborators to emeritus' diff --git a/.github/workflows/find-inactive-tsc.yml b/.github/workflows/find-inactive-tsc.yml index 5d834c8cb25d70..9276de8b6a5c3a 100644 --- a/.github/workflows/find-inactive-tsc.yml +++ b/.github/workflows/find-inactive-tsc.yml @@ -3,7 +3,7 @@ name: Find inactive TSC members on: schedule: # Run every Tuesday 12:05 AM UTC. - - cron: '5 0 * * 2' + - cron: 5 0 * * 2 workflow_dispatch: @@ -51,6 +51,6 @@ jobs: @nodejs/tsc ${{ env.INACTIVE_TSC_HANDLES }} ${{ env.DETAILS_FOR_COMMIT_BODY }} - commit-message: "meta: move one or more TSC members to emeritus" + commit-message: 'meta: move one or more TSC members to emeritus' labels: meta - title: "meta: move one or more TSC members to emeritus" + title: 'meta: move one or more TSC members to emeritus' diff --git a/.github/workflows/license-builder.yml b/.github/workflows/license-builder.yml index 0f83e16194b37f..ab988c8687d987 100644 --- a/.github/workflows/license-builder.yml +++ b/.github/workflows/license-builder.yml @@ -3,7 +3,7 @@ on: schedule: # 00:00:00 every Monday # https://crontab.guru/#0_0_*_*_1 - - cron: "0 0 * * 1" + - cron: 0 0 * * 1 workflow_dispatch: jobs: @@ -14,14 +14,14 @@ jobs: - uses: actions/checkout@v2 with: persist-credentials: false - - run: "./tools/license-builder.sh" # Run the license builder tool + - run: ./tools/license-builder.sh # Run the license builder tool - uses: gr2m/create-or-update-pull-request-action@v1.x # Create a PR or update the Action's existing PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: author: Node.js GitHub Bot branch: actions/license-builder - title: "doc: run license-builder" + title: 'doc: run license-builder' body: > License is likely out of date. This is an automatically generated PR by the `license-builder.yml` GitHub Action, which runs `license-builder.sh` diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 166846ae3f8705..ea59d8a9bd53d9 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -138,7 +138,7 @@ jobs: persist-credentials: false - uses: mszostok/codeowners-validator@v0.6.0 with: - checks: "files,duppatterns" + checks: files,duppatterns lint-pr-url: if: ${{ github.event.pull_request }} runs-on: ubuntu-latest diff --git a/.github/workflows/notify-force-push.yml b/.github/workflows/notify-force-push.yml index 9c2fc3a6a4e64d..3e2a73cc471706 100644 --- a/.github/workflows/notify-force-push.yml +++ b/.github/workflows/notify-force-push.yml @@ -16,7 +16,7 @@ jobs: env: SLACK_COLOR: '#DE512A' SLACK_ICON: https://github.com/nodejs.png?size=48 - SLACK_TITLE: '${{ github.actor }} force-pushed to ${{ github.ref }}' + SLACK_TITLE: ${{ github.actor }} force-pushed to ${{ github.ref }} SLACK_MESSAGE: | A commit was force-pushed to by diff --git a/.github/workflows/test-asan.yml b/.github/workflows/test-asan.yml index 29956196d0216f..2ed41649bd3e83 100644 --- a/.github/workflows/test-asan.yml +++ b/.github/workflows/test-asan.yml @@ -4,10 +4,10 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/test-asan.yml' push: @@ -18,10 +18,10 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/test-asan.yml' diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index ba2244aa116bc3..47e64c036dd4cc 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -3,7 +3,7 @@ name: test-linux on: pull_request: paths-ignore: - - "README.md" + - README.md - .github/** - '!.github/workflows/test-linux.yml' types: [opened, synchronize, reopened, ready_for_review] @@ -15,7 +15,7 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: - - "README.md" + - README.md - .github/** - '!.github/workflows/test-linux.yml' diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index bdea886801a784..ec5f649d328291 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -4,10 +4,10 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/test-macos.yml' push: @@ -18,10 +18,10 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: - - '.mailmap' + - .mailmap - '**.md' - - 'AUTHORS' - - 'doc/**' + - AUTHORS + - doc/** - .github/** - '!.github/workflows/test-macos.yml' diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 5750c41b0fc775..ce40b6fb57bc5b 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -1,8 +1,8 @@ -name: "tools update" +name: tools update on: schedule: # Run once a week at 00:05 AM UTC on Saturday. - - cron: '5 0 * * 6' + - cron: 5 0 * * 6 workflow_dispatch: @@ -23,7 +23,7 @@ jobs: echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV ./update-eslint.sh fi - - id: "lint-md-dependencies" + - id: lint-md-dependencies run: | cd tools/lint-md npm ci @@ -63,8 +63,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} with: author: Node.js GitHub Bot - body: "This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}." - branch: "actions/tools-update-${{ matrix.id }}" # Custom branch *just* for this Action. - commit-message: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}" + body: This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}. + branch: actions/tools-update-${{ matrix.id }} # Custom branch *just* for this Action. + commit-message: 'tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}' labels: tools - title: "tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}" + title: 'tools: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}' diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index c5e1058a3068e1..d4ddb044e361b6 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -6,89 +6,89 @@ rules: no-buffer-constructor: error no-mixed-operators: - error - - groups: [["&&", "||"]] + - groups: [['&&', '||']] no-restricted-syntax: # Config copied from .eslintrc.js - error - - selector: "CallExpression[callee.object.name='assert']:not([callee.property.name='ok']):not([callee.property.name='fail']):not([callee.property.name='ifError'])" - message: "Please only use simple assertions in ./lib" - - selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]" - message: "setTimeout() must be invoked with at least two arguments." - - selector: "CallExpression[callee.name='setInterval'][arguments.length<2]" - message: "setInterval() must be invoked with at least 2 arguments." - - selector: "ThrowStatement > CallExpression[callee.name=/Error$/]" - message: "Use new keyword when throwing an Error." + - selector: CallExpression[callee.object.name='assert']:not([callee.property.name='ok']):not([callee.property.name='fail']):not([callee.property.name='ifError']) + message: Please only use simple assertions in ./lib + - selector: CallExpression[callee.name='setTimeout'][arguments.length<2] + message: setTimeout() must be invoked with at least two arguments. + - selector: CallExpression[callee.name='setInterval'][arguments.length<2] + message: setInterval() must be invoked with at least 2 arguments. + - selector: ThrowStatement > CallExpression[callee.name=/Error$/] + message: Use new keyword when throwing an Error. # Config specific to lib - - selector: "NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError)$/])" - message: "Use an error exported by the internal/errors module." - - selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']" - message: "Please use `require('internal/errors').hideStackFrames()` instead." - - selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])" - message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'." - - selector: "ThrowStatement > NewExpression[callee.name=/^ERR_[A-Z_]+$/] > ObjectExpression:first-child:not(:has([key.name='message']):has([key.name='code']):has([key.name='syscall']))" - message: "The context passed into SystemError constructor must have .code, .syscall and .message." + - selector: NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError)$/]) + message: Use an error exported by the internal/errors module. + - selector: CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace'] + message: Please use `require('internal/errors').hideStackFrames()` instead. + - selector: AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace']) + message: Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'. + - selector: ThrowStatement > NewExpression[callee.name=/^ERR_[A-Z_]+$/] > ObjectExpression:first-child:not(:has([key.name='message']):has([key.name='code']):has([key.name='syscall'])) + message: The context passed into SystemError constructor must have .code, .syscall and .message. no-restricted-globals: - error - name: AbortController - message: "Use `const { AbortController } = require('internal/abort_controller');` instead of the global." + message: Use `const { AbortController } = require('internal/abort_controller');` instead of the global. - name: AbortSignal - message: "Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global." + message: Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global. # Atomics is not available in primordials because it can be # disabled with --no-harmony-atomics CLI flag. - name: Atomics - message: "Use `const { Atomics } = globalThis;` instead of the global." + message: Use `const { Atomics } = globalThis;` instead of the global. - name: Blob - message: "Use `const { Blob } = require('buffer');` instead of the global." + message: Use `const { Blob } = require('buffer');` instead of the global. - name: Buffer - message: "Use `const { Buffer } = require('buffer');` instead of the global." + message: Use `const { Buffer } = require('buffer');` instead of the global. - name: DOMException - message: "Use lazy function `const { lazyDOMException } = require('internal/util');` instead of the global." + message: Use lazy function `const { lazyDOMException } = require('internal/util');` instead of the global. - name: Event - message: "Use `const { Event } = require('internal/event_target');` instead of the global." + message: Use `const { Event } = require('internal/event_target');` instead of the global. - name: EventTarget - message: "Use `const { EventTarget } = require('internal/event_target');` instead of the global." + message: Use `const { EventTarget } = require('internal/event_target');` instead of the global. # Intl is not available in primordials because it can be # disabled with --without-intl build flag. - name: Intl - message: "Use `const { Intl } = globalThis;` instead of the global." + message: Use `const { Intl } = globalThis;` instead of the global. - name: BroadcastChannel - message: "Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global." + message: Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global. - name: MessageChannel - message: "Use `const { MessageChannel } = require('internal/worker/io');` instead of the global." + message: Use `const { MessageChannel } = require('internal/worker/io');` instead of the global. - name: MessageEvent - message: "Use `const { MessageEvent } = require('internal/worker/io');` instead of the global." + message: Use `const { MessageEvent } = require('internal/worker/io');` instead of the global. - name: MessagePort - message: "Use `const { MessagePort } = require('internal/worker/io');` instead of the global." + message: Use `const { MessagePort } = require('internal/worker/io');` instead of the global. # SharedArrayBuffer is not available in primordials because it can be # disabled with --no-harmony-sharedarraybuffer CLI flag. - name: SharedArrayBuffer - message: "Use `const { SharedArrayBuffer } = globalThis;` instead of the global." + message: Use `const { SharedArrayBuffer } = globalThis;` instead of the global. - name: TextDecoder - message: "Use `const { TextDecoder } = require('internal/encoding');` instead of the global." + message: Use `const { TextDecoder } = require('internal/encoding');` instead of the global. - name: TextEncoder - message: "Use `const { TextEncoder } = require('internal/encoding');` instead of the global." + message: Use `const { TextEncoder } = require('internal/encoding');` instead of the global. - name: URL - message: "Use `const { URL } = require('internal/url');` instead of the global." + message: Use `const { URL } = require('internal/url');` instead of the global. - name: URLSearchParams - message: "Use `const { URLSearchParams } = require('internal/url');` instead of the global." + message: Use `const { URLSearchParams } = require('internal/url');` instead of the global. # WebAssembly is not available in primordials because it can be # disabled with --jitless CLI flag. - name: WebAssembly - message: "Use `const { WebAssembly } = globalThis;` instead of the global." + message: Use `const { WebAssembly } = globalThis;` instead of the global. - name: atob - message: "Use `const { atob } = require('buffer');` instead of the global." + message: Use `const { atob } = require('buffer');` instead of the global. - name: btoa - message: "Use `const { btoa } = require('buffer');` instead of the global." + message: Use `const { btoa } = require('buffer');` instead of the global. - name: global - message: "Use `const { globalThis } = primordials;` instead of `global`." + message: Use `const { globalThis } = primordials;` instead of `global`. - name: globalThis - message: "Use `const { globalThis } = primordials;` instead of the global." + message: Use `const { globalThis } = primordials;` instead of the global. - name: performance - message: "Use `const { performance } = require('perf_hooks');` instead of the global." + message: Use `const { performance } = require('perf_hooks');` instead of the global. - name: queueMicrotask - message: "Use `const { queueMicrotask } = require('internal/process/task_queues');` instead of the global." + message: Use `const { queueMicrotask } = require('internal/process/task_queues');` instead of the global. - name: structuredClone - message: "Use `const { structuredClone } = require('internal/structured_clone');` instead of the global." + message: Use `const { structuredClone } = require('internal/structured_clone');` instead of the global. # Custom rules in tools/eslint-rules node-core/lowercase-name-for-primitive: error node-core/non-ascii-character: error diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 55e8ff6af8c390..454e3e9bb9932b 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -8,47 +8,47 @@ rules: no-var: error prefer-const: error symbol-description: off - multiline-comment-style: ["error", "separate-lines"] + multiline-comment-style: [error, separate-lines] no-restricted-syntax: # Config copied from .eslintrc.js - error - - selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])" - message: "Use strictEqual instead of deepStrictEqual for literals or undefined." - - selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])" - message: "Use notStrictEqual instead of notDeepStrictEqual for literals or undefined." - - selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']" - message: "Do not use a literal for the third argument of assert.deepStrictEqual()" - - selector: "CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow'])" - message: "Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead." - - selector: "CallExpression:matches([callee.name='doesNotReject'], [callee.property.name='doesNotReject'])" - message: "Do not use `assert.doesNotReject()`. Write the code without the wrapper and add a comment instead." - - selector: "CallExpression:matches([callee.name='rejects'], [callee.property.name='rejects'])[arguments.length<2]" - message: "`assert.rejects()` must be invoked with at least two arguments." - - selector: "CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal']" - message: "Do not use a literal for the third argument of assert.strictEqual()" - - selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.1.type='Literal']:not([arguments.1.regex])" - message: "Use an object as second argument of `assert.throws()`." - - selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2]" - message: "`assert.throws()` must be invoked with at least two arguments." - - selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]" - message: "`setTimeout()` must be invoked with at least two arguments." - - selector: "CallExpression[callee.name='setInterval'][arguments.length<2]" - message: "`setInterval()` must be invoked with at least two arguments." - - selector: "ThrowStatement > CallExpression[callee.name=/Error$/]" - message: "Use `new` keyword when throwing an `Error`." - - selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])" - message: "The first argument should be the `actual`, not the `expected` value." - - selector: "CallExpression:matches([callee.name='notStrictEqual'], [callee.property.name='notStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])" - message: "The first argument should be the `actual`, not the `expected` value." - - selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])" - message: "The first argument should be the `actual`, not the `expected` value." - - selector: "CallExpression:matches([callee.name='strictEqual'], [callee.property.name='strictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])" - message: "The first argument should be the `actual`, not the `expected` value." - - selector: "CallExpression[callee.name='isNaN']" - message: "Use Number.isNaN() instead of the global isNaN() function." - - selector: "VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test'])" - message: "Use 'test' as debuglog value in tests." + - selector: CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined']) + message: Use strictEqual instead of deepStrictEqual for literals or undefined. + - selector: CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined']) + message: Use notStrictEqual instead of notDeepStrictEqual for literals or undefined. + - selector: CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal'] + message: Do not use a literal for the third argument of assert.deepStrictEqual() + - selector: CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow']) + message: Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead. + - selector: CallExpression:matches([callee.name='doesNotReject'], [callee.property.name='doesNotReject']) + message: Do not use `assert.doesNotReject()`. Write the code without the wrapper and add a comment instead. + - selector: CallExpression:matches([callee.name='rejects'], [callee.property.name='rejects'])[arguments.length<2] + message: '`assert.rejects()` must be invoked with at least two arguments.' + - selector: CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal'] + message: Do not use a literal for the third argument of assert.strictEqual() + - selector: CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.1.type='Literal']:not([arguments.1.regex]) + message: Use an object as second argument of `assert.throws()`. + - selector: CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2] + message: '`assert.throws()` must be invoked with at least two arguments.' + - selector: CallExpression[callee.name='setTimeout'][arguments.length<2] + message: '`setTimeout()` must be invoked with at least two arguments.' + - selector: CallExpression[callee.name='setInterval'][arguments.length<2] + message: '`setInterval()` must be invoked with at least two arguments.' + - selector: ThrowStatement > CallExpression[callee.name=/Error$/] + message: Use `new` keyword when throwing an `Error`. + - selector: CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression']) + message: The first argument should be the `actual`, not the `expected` value. + - selector: CallExpression:matches([callee.name='notStrictEqual'], [callee.property.name='notStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression']) + message: The first argument should be the `actual`, not the `expected` value. + - selector: CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression']) + message: The first argument should be the `actual`, not the `expected` value. + - selector: CallExpression:matches([callee.name='strictEqual'], [callee.property.name='strictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression']) + message: The first argument should be the `actual`, not the `expected` value. + - selector: CallExpression[callee.name='isNaN'] + message: Use Number.isNaN() instead of the global isNaN() function. + - selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test']) + message: Use 'test' as debuglog value in tests. # Custom rules in tools/eslint-rules node-core/prefer-assert-iferror: error @@ -62,7 +62,7 @@ rules: ## common module is mandatory in tests node-core/required-modules: - error - - common: 'common(/index\.(m)?js)?$' + - common: common(/index\.(m)?js)?$ node-core/require-common-first: error node-core/no-duplicate-requires: off diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml index d2fe553393693d..de30cf6d123f33 100644 --- a/tools/.eslintrc.yaml +++ b/tools/.eslintrc.yaml @@ -5,11 +5,11 @@ env: rules: camelcase: - error - - properties: 'never' + - properties: never ignoreDestructuring: true - allow: ['child_process'] + allow: [child_process] no-unused-vars: - error - - args: 'after-used' + - args: after-used prefer-arrow-callback: error no-var: error