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

feat: bunch of updates #5

Merged
merged 12 commits into from
Jul 5, 2022
Merged
10 changes: 10 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
comment: off

coverage:
status:
patch:
default:
target: 100%
project:
default:
target: 100%
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage/
lib/
!.eslintrc.js
22 changes: 19 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ module.exports = {
'plugin:node/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
plugins: [
'eslint-plugin',
'eslint-comments',
'node',
'prettier',
'import',
'@typescript-eslint',
],
Expand All @@ -28,10 +26,11 @@ module.exports = {
rules: {
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'eslint-comments/no-unused-disable': 'error',
'eslint-plugin/test-case-property-ordering': 'error',
'no-else-return': 'error',
'no-negated-condition': 'error',
eqeqeq: ['error', 'smart'],
Expand All @@ -56,6 +55,23 @@ module.exports = {
'error',
{ alphabetize: { order: 'asc' }, 'newlines-between': 'never' },
],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{ blankLine: 'always', prev: 'directive', next: '*' },
{ blankLine: 'any', prev: 'directive', next: 'directive' },
],

'prefer-spread': 'error',
'prefer-rest-params': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
'no-var': 'error',
},
overrides: [
{
Expand Down
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["config:base"],
"lockFileMaintenance": { "enabled": true, "automerge": true },
"rangeStrategy": "replace",
"postUpdateOptions": ["yarnDedupeHighest"]
}
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v1.2.2
- uses: wagoid/commitlint-github-action@v5
with:
configFile: './package.json'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Danger
uses: danger/danger-js@9.1.8
uses: danger/danger-js@11.0.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108 changes: 89 additions & 19 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,135 @@
name: Unit tests
name: Unit tests & Release

on:
push:
branches:
- master
- main
- next
pull_request:
branches:
- master
- main
- next

jobs:
prepare-yarn-cache:
name: Prepare yarn cache
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn

- name: Validate cache
env:
# Use PnP and disable postinstall scripts as this just needs to
# populate the cache for the other jobs
YARN_NODE_LINKER: pnp
YARN_ENABLE_SCRIPTS: false
run: yarn --immutable

prettier:
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: install
run: yarn
- name: run prettier
run: yarn prettier:check

typecheck:
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: install
run: yarn
- name: run typecheck
run: yarn typecheck

test-node:
name:
# prettier-ignore
Test on Node.js v${{ matrix.node-version }} and eslint v${{matrix.eslint-version }}
Test on Node.js v${{ matrix.node-version }}, eslint v${{ matrix.eslint-version }}
needs: prepare-yarn-cache
strategy:
fail-fast: false
matrix:
node-version: [8.x, 10.x, 12.x, 13.x]
eslint-version: [5, 6]
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]
eslint-version: [6, 7, 8]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: install with eslint v${{matrix.eslint-version }}
cache: yarn
- name:
# prettier-ignore
install with eslint v${{ matrix.eslint-version }}
run: |
yarn
yarn add --dev eslint@${{matrix.eslint-version }}
- name: run prettylint
run: yarn prettylint
- name: run typecheck
run: yarn typecheck
yarn add --dev eslint@${{ matrix.eslint-version }}
- name: run tests
run: yarn test --coverage
env:
CI: true
- uses: codecov/codecov-action@v3
test-os:
name: Test on ${{ matrix.os }} using Node.js LTS
needs: prepare-yarn-cache
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: lts/*
cache: yarn
- name: install
run: yarn
- name: run prettylint
run: yarn prettylint
- name: run typecheck
run: yarn typecheck
- name: run tests
run: yarn test --coverage
env:
CI: true
- uses: codecov/codecov-action@v3

release:
if:
# prettier-ignore
${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/main' || github.event.ref == 'refs/heads/next') }}
name: Release new version
needs: [prettier, typecheck, test-node, test-os]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
- name: install
run: yarn
- run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/release.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ node_modules/
coverage/
lib/
*.log
.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.yarn/*
lib/*
coverage/*
CHANGELOG.md