Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve linter, formatter config #613

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 90
CommentPragmas: '^ IWYU pragma:'
CommentPragmas: "^ IWYU pragma:"
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Expand All @@ -32,13 +32,13 @@ DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
Expand All @@ -64,5 +64,5 @@ SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
...
---

12 changes: 5 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"plugins": [
"prettier"
"@typescript-eslint"
],
"extends": [
"plugin:prettier/recommended",
"eslint-config-atomic"
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/quotes": [
"error",
"double"
],
"require-await": "off"
},
"parser": "@typescript-eslint/parser",
"ignorePatterns": [
"node_modules/",
"build/",
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:
# Alpine
- os: ubuntu-22.04
docker: node:20-alpine
docker_cmd: apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake musl-dev && npm i -g pnpm && pnpm install && pnpm run prebuild
docker_cmd:
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake
musl-dev && npm i -g pnpm && pnpm install && pnpm run prebuild
node_version: 20
node_arch: x64
ARCH: x64
Expand All @@ -83,7 +85,10 @@ jobs:
path: |
./node_modules/
./build/
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
key:
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch
}}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version
}}-${{ hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"

Expand Down Expand Up @@ -156,7 +161,8 @@ jobs:
command: |
pnpm run clean
pnpm run test.skip_gc_tests
continue-on-error: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
continue-on-error:
"${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"

- name: Test Electron (Main)
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:

jobs:
Docs:
if: "startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
if:
"startsWith(github.ref, 'refs/tags/') &&
!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -37,7 +39,10 @@ jobs:
path: |
./node_modules/
./build/
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
key:
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch
}}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version
}}-${{ hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"

Expand Down
6 changes: 3 additions & 3 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'
"use strict"

module.exports = {
require: ['ts-node/register', 'rocha'],
spec: ['test/unit/*-test.ts', 'test/unit/compat/*-test.{ts,js}'],
require: ["ts-node/register", "rocha"],
spec: ["test/unit/*-test.ts", "test/unit/compat/*-test.{ts,js}"],
"expose-gc": true,
"experimental-worker": true,
recursive: true,
Expand Down
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
"tabWidth": 2,
"trailingComma": "all",
"semi": false,
"singleQuote": false
"singleQuote": false,
"overrides": [
{
"files": ["pnpm-lock.yaml", "*.md"],
"options": {
"requirePragma": true
}
}
]
}
192 changes: 99 additions & 93 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,104 +6,110 @@ python:

jobs:
include:

## TEST STAGE

- os: linux
node_js: "14"
env: ZMQ_DRAFT=true

- os: linux
node_js: "14"
env: ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true

- os: linux
env: ALPINE_CHROOT=3.10 ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true
sudo: required
node_js: "14"

- os: osx
osx_image: xcode10
env: ZMQ_DRAFT=true
node_js: "14"

- os: windows
node_js: "14"
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288
env: ZMQ_DRAFT=true YARN_GPG=no

- os: windows
node_js: "14/x86"
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288
env: ZMQ_DRAFT=true YARN_GPG=no

# Test shared libraries on Linux and macOS.
- os: linux
node_js: "14"
env: ZMQ_SHARED=true
addons: {apt: {packages: libzmq3-dev}}

- os: osx
osx_image: xcode10
node_js: "14"
env: ZMQ_SHARED=true
addons: {homebrew: {packages: zeromq, update: true}}

# Test older versions of ZMQ.
- os: linux
node_js: "14"
env: ZMQ_VERSION=4.2.4

# Test recent Node versions.
- os: linux
node_js: "14"
# Skip GC tests due to https://github.com/node-ffi-napi/weak-napi/issues/16
env: ZMQ_DRAFT=true SKIP_GC_TESTS=true INCLUDE_COMPAT_TESTS=true

- os: linux
node_js: "13"
# Skip GC tests due to https://github.com/node-ffi-napi/weak-napi/issues/16
env: ZMQ_DRAFT=true SKIP_GC_TESTS=true

## ADDITIONAL TESTS

# This test ensures the delayed resolution of read/write promises is correct
# by disabling immediate resolution (which happens 99% of the time) entirely.
- os: linux
node_js: "14"
env: ZMQ_NO_SYNC_RESOLVE=true ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true NODE_NO_WARNINGS=1

## PREBUILD STAGE

- stage: prebuild
os: linux
env: ALPINE_CHROOT=3.10 ARCHIVE_SUFFIX=-x64-musl
sudo: required
script: npm run prebuild

- stage: prebuild
os: linux
node_js: "14"
env: ARCH=arm TRIPLE=arm-linux-gnueabihf GCC=8 ARCHIVE_SUFFIX=-armv7
addons: {apt: {packages: [gcc-8-arm-linux-gnueabihf, g++-8-arm-linux-gnueabihf]}}
script: npm run prebuild

- stage: prebuild
os: linux
node_js: "14"
env: ARCH=arm64 TRIPLE=aarch64-linux-gnu GCC=8 ARCHIVE_SUFFIX=-armv8
addons: {apt: {packages: [gcc-8-aarch64-linux-gnu, g++-8-aarch64-linux-gnu]}}
script: npm run prebuild
## TEST STAGE

- os: linux
node_js: "14"
env: ZMQ_DRAFT=true

- os: linux
node_js: "14"
env: ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true

- os: linux
env: ALPINE_CHROOT=3.10 ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true
sudo: required
node_js: "14"

- os: osx
osx_image: xcode10
env: ZMQ_DRAFT=true
node_js: "14"

- os: windows
node_js: "14"
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288
env: ZMQ_DRAFT=true YARN_GPG=no

- os: windows
node_js: "14/x86"
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288
env: ZMQ_DRAFT=true YARN_GPG=no

# Test shared libraries on Linux and macOS.
- os: linux
node_js: "14"
env: ZMQ_SHARED=true
addons: {apt: {packages: libzmq3-dev}}

- os: osx
osx_image: xcode10
node_js: "14"
env: ZMQ_SHARED=true
addons: {homebrew: {packages: zeromq, update: true}}

# Test older versions of ZMQ.
- os: linux
node_js: "14"
env: ZMQ_VERSION=4.2.4

# Test recent Node versions.
- os: linux
node_js: "14"
# Skip GC tests due to https://github.com/node-ffi-napi/weak-napi/issues/16
env: ZMQ_DRAFT=true SKIP_GC_TESTS=true INCLUDE_COMPAT_TESTS=true

- os: linux
node_js: "13"
# Skip GC tests due to https://github.com/node-ffi-napi/weak-napi/issues/16
env: ZMQ_DRAFT=true SKIP_GC_TESTS=true

## ADDITIONAL TESTS

# This test ensures the delayed resolution of read/write promises is correct
# by disabling immediate resolution (which happens 99% of the time) entirely.
- os: linux
node_js: "14"
env:
ZMQ_NO_SYNC_RESOLVE=true ZMQ_DRAFT=true INCLUDE_COMPAT_TESTS=true
NODE_NO_WARNINGS=1

## PREBUILD STAGE

- stage: prebuild
os: linux
env: ALPINE_CHROOT=3.10 ARCHIVE_SUFFIX=-x64-musl
sudo: required
script: npm run prebuild

- stage: prebuild
os: linux
node_js: "14"
env: ARCH=arm TRIPLE=arm-linux-gnueabihf GCC=8 ARCHIVE_SUFFIX=-armv7
addons:
{
apt:
{packages: [gcc-8-arm-linux-gnueabihf, g++-8-arm-linux-gnueabihf]},
}
script: npm run prebuild

- stage: prebuild
os: linux
node_js: "14"
env: ARCH=arm64 TRIPLE=aarch64-linux-gnu GCC=8 ARCHIVE_SUFFIX=-armv8
addons:
{apt: {packages: [gcc-8-aarch64-linux-gnu, g++-8-aarch64-linux-gnu]}}
script: npm run prebuild

fast_finish: true

stages:
- name: test
- name: prebuild
if: tag IS present
- name: test
- name: prebuild
if: tag IS present

install:
- travis_retry script/ci/install.sh
- travis_retry script/ci/install.sh

script:
- travis_retry script/ci/test.sh
- travis_retry script/ci/test.sh
15 changes: 4 additions & 11 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
{
"include": [
"./**/*.ts"
],
"include": ["./**/*.ts"],
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": [
"es2018",
"esnext.asynciterable"
],
"lib": ["es2018", "esnext.asynciterable"],
"strict": true,
"paths": {
"zeromq": [
"../src/index.ts"
],
},
"zeromq": ["../src/index.ts"]
}
}
}
Loading
Loading