Skip to content

refactor: typescript rewrite #818

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
28 changes: 0 additions & 28 deletions .codeclimate.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

64 changes: 64 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
env: {
node: true
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:unicorn/recommended',
'plugin:prettier/recommended'
],
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest'
},
rules: {
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'no-var': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': 'error',
'import/no-named-as-default': 'warn',
'unicorn/filename-case': [
'error',
{
cases: {
camelCase: true,
pascalCase: true
}
}
],
'unicorn/prefer-module': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-unused-properties': 'warn',
'unicorn/prefer-string-replace-all': 'warn',
'unicorn/no-unsafe-regex': 'error',
'unicorn/prefer-at': 'error',
'unicorn/prefer-node-protocol': 'error',
'unicorn/prevent-abbreviations': [
'error',
{
allowList: {
props: true,
emits: true,
Ref: true,
Refs: true
},
checkFilenames: false
}
],
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-ignore': 'allow-with-description' }
]
}
}
1 change: 0 additions & 1 deletion .eslintrc.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.yarn/ export-ignore
189 changes: 108 additions & 81 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,97 +4,124 @@ on: [push, pull_request]

env:
FORCE_COLOR: true
NODE_VERSION: latest

jobs:
test:
name: Test (${{ matrix.node_version}}-${{ matrix.os }})
setup:
name: Lint Package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

runs-on: ${{ matrix.os }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-

- name: Install Dependencies
run: yarn install --immutable

- name: Run Linter
run: yarn lint

test:
needs: [setup]
name: Test Packages (${{ matrix.node_version}})
runs-on: ubuntu-latest

strategy:
matrix:
node_version: [14, 16, 18]
os: [ubuntu-latest]
node_version: [16, 18]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use node ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Restore cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-

- name: Install yarn dependencies
run: yarn install

- name: Bootstrap lerna packages
run: yarn bootstrap

- name: Lint source code
run: yarn lint
if: ${{ matrix.node_version == 18 }}

- name: Jest with code coverage
if: ${{ matrix.node_version == 18 }}
run: yarn test:coverage

- name: Jest
if: ${{ matrix.node_version != 18 }}
run: yarn jest

- name: Upload test coverage to Code Climate
if: ${{ matrix.node_version == 18 }}
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: 7a4b78747587abb295ccb41439d7d067b9de2d885a766e7e88d5e8409599d2ea
- uses: actions/checkout@v3

build:
name: Build (${{ matrix.node_version}}-${{ matrix.os }})
needs: test
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.NODE_VERSION }}

runs-on: ${{ matrix.os }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

strategy:
matrix:
node_version: [18]
os: [ubuntu-latest]
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-

- name: Install Dependencies
run: yarn install --immutable

- name: Run Tests
run: yarn test

test-coverage:
needs: [setup]
name: Test Packages with Coverage
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use node ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Restore cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-

- name: Install yarn dependencies
run: yarn install

- name: Bootstrap lerna packages
run: yarn bootstrap

- name: Build lerna packages
run: yarn build

- name: Lint package sizes
run: yarn size
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-

- name: Install Dependencies
run: yarn install --immutable

- name: Run Coverage
run: yarn coverage

build:
needs: [test, test-coverage]
name: Build Packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-

- name: Install Dependencies
run: yarn install --immutable

- name: Build Packages
run: yarn build
Loading