Skip to content

Commit 6a5c491

Browse files
authored
feat: move to typescript/ESM (#1)
This migrates to typescript and does the following: - Adds support for ESM - Adds prettier - Adds google eslint config - Bumps node CI versions - Replaces testing with node built-ins
1 parent 7d7ed7a commit 6a5c491

14 files changed

+1829
-116
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_size = 2
6+
indent_style = space
7+
trim_trailing_whitespace = true

.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"google",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"rules": {
8+
"indent": "off",
9+
"quote-props": "off",
10+
"max-len": "error",
11+
"eqeqeq": "error",
12+
"no-unused-vars": "off",
13+
"spaced-comment": "off",
14+
"operator-linebreak": "off",
15+
"comma-dangle": [
16+
"error",
17+
"never"
18+
],
19+
"quotes": [
20+
"error",
21+
"single",
22+
{
23+
"avoidEscape": true,
24+
"allowTemplateLiterals": true
25+
}
26+
],
27+
"@typescript-eslint/explicit-function-return-type": [
28+
"error",
29+
{
30+
"allowExpressions": true
31+
}
32+
],
33+
"@typescript-eslint/explicit-member-accessibility": "error",
34+
"@typescript-eslint/member-delimiter-style": "error",
35+
"@typescript-eslint/no-array-constructor": "error",
36+
"@typescript-eslint/no-explicit-any": "error",
37+
"@typescript-eslint/parameter-properties": "error",
38+
"@typescript-eslint/no-inferrable-types": "off"
39+
}
40+
}

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node-version: [4.x, 6.x, 8.x, 9.x, 10.x, 12.x, 14.x, 16.x, 18.x, 19.x]
11+
node-version: [16.x, 18.x, 19.x, 20.x]
1212

1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Use Node.js ${{ matrix.node-version }}
1616
uses: actions/setup-node@v3
1717
with:
1818
node-version: ${{ matrix.node-version }}
19-
- run: npm install
20-
- run: npm run tests-only
19+
- run: npm ci
20+
- run: npm run build && npm test
2121

2222
lint:
2323
runs-on: ubuntu-latest
@@ -28,5 +28,5 @@ jobs:
2828
uses: actions/setup-node@v3
2929
with:
3030
node-version: lts/*
31-
- run: npm install
31+
- run: npm ci
3232
- run: npm run lint

.gitignore

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
# Logs
2-
logs
3-
*.log
4-
5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
9-
10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# node-waf configuration
20-
.lock-wscript
21-
22-
# Compiled binary addons (http://nodejs.org/api/addons.html)
23-
build/Release
24-
25-
# Dependency directory
26-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27-
node_modules
1+
/node_modules
2+
/lib
3+
*.swp

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bracketSpacing": false,
3+
"printWidth": 80,
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "none",
8+
"useTabs": false,
9+
"arrowParens": "always"
10+
}

index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

index.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)