Skip to content

Commit

Permalink
chore: add linters and some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepolischuk committed Mar 6, 2024
1 parent a06923b commit 4de0076
Show file tree
Hide file tree
Showing 33 changed files with 8,678 additions and 22,234 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@rambler-tech/commitlint-config/shared"]
}
11 changes: 1 addition & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
"@typescript-eslint/explicit-function-return-type": [
"error",
{"allowExpressions": true}
]
}
"extends": ["@rambler-tech/eslint-config", "@rambler-tech/eslint-config/ts"]
}
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- run: yarn build
- run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- run: yarn docs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: public
67 changes: 67 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Test

on:
push:
branches:
- master
tags-ignore:
- v*

pull_request:
types:
- opened
- synchronize

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- run: yarn test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- run: yarn lint
- run: yarn typecheck

size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- run: yarn sizecheck

commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '18.x'
- run: yarn
- uses: wagoid/commitlint-github-action@v3
env:
NODE_PATH: ${{ github.workspace }}/node_modules
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ yarn-error.log
coverage
.nyc_output
.vscode
cjs
esm
dist
deploy
public
spec.*
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env 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 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts,tsx}": ["prettier --write", "eslint --fix"],
"*.json": ["prettier --write"]
}
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@rambler-tech/prettier-config"
8 changes: 4 additions & 4 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"name": "The size of the provider",
"limit": "5 KB",
"path": "esm/index.js",
"limit": "3.7 KB",
"path": "dist/index.js",
"import": "{Provider}"
},
{
"name": "The size of the consumer",
"limit": "5 KB",
"path": "esm/index.js",
"limit": "3.7 KB",
"path": "dist/index.js",
"import": "{Consumer}"
}
]
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['./src'],
moduleDirectories: ['packages', 'node_modules'],
collectCoverage: true,
coverageReporters: ['text']
}
Loading

0 comments on commit 4de0076

Please sign in to comment.