Skip to content

Commit

Permalink
Add TypeScript and ESM support. (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb authored Sep 15, 2021
1 parent 1c6264b commit bf54305
Show file tree
Hide file tree
Showing 14 changed files with 5,690 additions and 1,913 deletions.
38 changes: 38 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"root": true,
"extends": ["eslint:recommended", "prettier"],
"ignorePatterns": ["dist/**"],
"overrides": [
{
"files": ["*.js"],
"env": {
"node": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": "latest"
}
},
{
"files": ["*.ts"],
"plugins": ["eslint-plugin-tsdoc"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"parserOptions": {
"project": "tsconfig.json"
},
"rules": {
"tsdoc/syntax": "warn",
// Aligns with our style-guide.
"@typescript-eslint/switch-exhaustiveness-check": "error"
}
},
{
"files": ["tests.ts"],
"extends": ["plugin:jest/recommended"]
}
]
}
28 changes: 18 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [6.x, 14.x]
node-version: [12.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
65 changes: 65 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Quality

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
prettier:
name: 'Prettier'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run Prettier check
run: npm run prettier-check

eslint:
name: 'ESLint'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run ESLint check
run: npm run eslint-check

types:
name: 'TypeScript'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run TypeScript type check
run: npm run type-check
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# build
dist/

# dependencies
node_modules
node_modules/

# logs
npm-debug.log
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"

npx lint-staged
162 changes: 0 additions & 162 deletions index.js

This file was deleted.

Loading

0 comments on commit bf54305

Please sign in to comment.