Skip to content

Commit 6668006

Browse files
committed
chore(): Update depdencies and reformat
1 parent 36a96f7 commit 6668006

File tree

98 files changed

+7864
-6654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+7864
-6654
lines changed

.commitlintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": ["@commitlint/config-angular"],
3+
"rules": {
4+
"subject-case": [
5+
2,
6+
"always",
7+
["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"]
8+
],
9+
"type-enum": [
10+
2,
11+
"always",
12+
[
13+
"build",
14+
"chore",
15+
"ci",
16+
"docs",
17+
"feat",
18+
"fix",
19+
"perf",
20+
"refactor",
21+
"revert",
22+
"style",
23+
"test",
24+
"example"
25+
]
26+
]
27+
}
28+
}

.eslintrc.js

+70-57
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,82 @@
11
module.exports = {
2-
parser: "@typescript-eslint/parser",
3-
parserOptions: {
4-
project: "./tsconfig.build.json"
5-
},
6-
plugins: ["@typescript-eslint", "prettier"],
7-
extends: [
8-
"airbnb-base",
9-
"eslint:recommended",
10-
"plugin:@typescript-eslint/eslint-recommended",
11-
"plugin:@typescript-eslint/recommended",
12-
"prettier",
13-
"prettier/@typescript-eslint"
14-
],
152
env: {
163
node: true,
174
jest: true,
185
},
19-
ignorePatterns: ["**/build", "**/node_modules", "documentation"],
20-
settings:{
21-
"import/extensions": [
22-
".ts"
23-
],
24-
"import/parsers": {
25-
"@typescript-eslint/parser": [
26-
".ts"
27-
]
28-
},
29-
"import/resolver": {
30-
node: {
31-
extensions: [".ts"]
32-
},
33-
"typescript": {
34-
"alwaysTryTypes": true
35-
}
36-
}
37-
},
38-
globals: {
39-
NodeJS: 'readonly',
6+
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
project: './tsconfig.build.json',
4010
},
11+
plugins: [
12+
'@typescript-eslint',
13+
'prettier',
14+
'import',
15+
'jest',
16+
'eslint-plugin-tsdoc',
17+
],
18+
extends: [
19+
'airbnb-base',
20+
'eslint:recommended',
21+
'plugin:@typescript-eslint/eslint-recommended',
22+
'plugin:@typescript-eslint/recommended',
23+
'prettier',
24+
'prettier/@typescript-eslint',
25+
],
26+
ignorePatterns: ["**/build", "**/node_modules", "documentation"],
4127
rules: {
42-
"import/extensions": [
43-
"error",
44-
"ignorePackages",
28+
"tsdoc/syntax": "warn",
29+
'import/extensions': [
30+
'error',
31+
'ignorePackages',
4532
{
46-
"ts": "never"
47-
}
48-
],
49-
"prettier/prettier": "error",
50-
"indent": [
51-
"error",
52-
4,
53-
{ "SwitchCase": 1 }
33+
'ts': 'never',
34+
'js': 'never',
35+
},
5436
],
55-
"import/prefer-default-export": 0,
56-
"import/no-default-export": ["error"],
57-
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
58-
"object-curly-spacing": ["error", "always"],
37+
'prettier/prettier': 'error',
5938
"no-underscore-dangle": 0,
60-
"max-len": ["error", 150, 2, {
61-
ignoreComments: false,
62-
ignoreUrls: true,
63-
ignoreRegExpLiterals: true,
64-
ignoreStrings: true,
65-
ignoreTemplateLiterals: true,
66-
}]
39+
// C2FO Preference
40+
'func-names': [
41+
'error',
42+
'always',
43+
],
44+
'max-len': [
45+
'error',
46+
150,
47+
2,
48+
{
49+
'ignoreComments': false,
50+
'ignoreRegExpLiterals': true,
51+
'ignoreStrings': true,
52+
'ignoreTemplateLiterals': true,
53+
'ignoreUrls': true,
54+
},
55+
],
56+
'import/prefer-default-export': 0,
57+
'max-classes-per-file': ['error', 5],
58+
'import/no-cycle': 0,
59+
},
60+
settings: {
61+
'import/extensions': [
62+
'.ts',
63+
'.js',
64+
],
65+
'import/parsers': {
66+
'@typescript-eslint/parser': [
67+
'.ts',
68+
],
69+
},
70+
'import/resolver': {
71+
node: {
72+
'extensions': [
73+
'.ts',
74+
],
75+
},
76+
typescript: {
77+
'alwaysTryTypes': true,
78+
},
79+
},
6780
},
6881
overrides: [
6982
{
@@ -85,5 +98,5 @@ module.exports = {
8598
"@typescript-eslint/no-var-requires": "off"
8699
}
87100
}
88-
]
101+
],
89102
};

.github/workflows/test.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: # Array of patterns that match refs/heads
6+
- master # Push events on master branch
7+
pull_request: # Specify a second event with pattern matching
8+
env:
9+
CI: true
10+
jobs:
11+
unit:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [10.x, 12.x, 14.x]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm ci
23+
- run: npm run bootstrap
24+
- run: npm test
25+
- name: Coveralls GitHub Action
26+
uses: coverallsapp/github-action@master
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
flag-name: run-unit-${{ matrix.node-version }}
30+
parallel: true
31+
32+
finish:
33+
needs: unit
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Coveralls Finished
37+
uses: coverallsapp/github-action@master
38+
with:
39+
github-token: ${{ secrets.github_token }}
40+
parallel-finished: true

.huskyrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2+
"skipCI": false,
23
"hooks": {
4+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
35
"pre-commit": "npm test"
46
}
5-
}
7+
}

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v12
1+
v14

.travis.yml

-12
This file was deleted.

_config.yml

-1
This file was deleted.

examples/benchmark/.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
project: null,
44
},
55
rules: {
6-
"no-console": 0,
6+
'no-console': 0,
77
},
88
};

examples/benchmark/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ const promisfyStream = (stream, expectedRows) => {
2424
});
2525
};
2626

27-
const benchmarkFastCsv = type => num => {
27+
const benchmarkFastCsv = (type) => (num) => {
2828
const file = path.resolve(__dirname, `./assets/${num}.${type}.csv`);
2929
const stream = fs
3030
.createReadStream(file)
3131
.pipe(fastCsv.parse({ headers: true }))
32-
.transform(data => {
32+
.transform((data) => {
3333
const ret = {};
34-
['first_name', 'last_name', 'email_address'].forEach(prop => {
34+
['first_name', 'last_name', 'email_address'].forEach((prop) => {
3535
ret[camelize(prop)] = data[prop];
3636
});
3737
ret.address = data.address;
@@ -73,23 +73,23 @@ function benchmarks(type) {
7373

7474
console.log('Starting Benchmarks');
7575
benchmarks('nonquoted')
76-
.then(nonQuotedResults => {
77-
return benchmarks('quoted').then(quotedResults => {
76+
.then((nonQuotedResults) => {
77+
return benchmarks('quoted').then((quotedResults) => {
7878
return [...nonQuotedResults, ...quotedResults];
7979
});
8080
})
81-
.then(results => {
81+
.then((results) => {
8282
const resultsTable = [
8383
['Type', 'Row Count', 'No. Runs', 'Avg'],
8484
['-', '-', '-', '-'],
8585
...results.map(({ type, rows, runs, avg }) => [type, rows, runs, `${avg}ms`]),
8686
]
87-
.map(r => `|${r.join('|')}|`)
87+
.map((r) => `|${r.join('|')}|`)
8888
.join('\n');
8989
fs.writeFileSync(path.resolve(__dirname, 'README.md'), `## Benchmark Results\n\n${resultsTable}`);
9090
})
9191
.then(() => process.exit())
92-
.catch(e => {
92+
.catch((e) => {
9393
console.error(e.stack);
9494
return process.exit(1);
9595
});

examples/example-runner/bin/run-examples

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#!/usr/bin/env node
2-
/* eslint-disable no-shadow */
2+
/* eslint-disable no-shadow,no-unused-expressions */
33

44
const { EOL } = require('os');
55
const fs = require('fs');
66
const cp = require('child_process');
77
const path = require('path');
88
const globby = require('globby');
9-
const diffDefault = require('jest-diff');
9+
const diffDefault = require('jest-diff').default;
1010
const yargs = require('yargs');
1111

1212
const OUTPUT_REGEXP = new RegExp(`\\/\\/ Output: *${EOL}`);
1313
const OUTPUT_LINE_REGEXP = /^\/\/ /;
14+
const SOURCE_MAP_COMMENT_REGEXP = /^\/\/ # sourceMappingURL=.*$/;
1415

15-
const getExampleFiles = async examplesDir => {
16+
const getExampleFiles = async (examplesDir) => {
1617
const files = await globby(path.resolve(process.cwd(), examplesDir, '**', '*.example.js'), { stats: true });
1718
return files.reduce((map, f) => ({ ...map, ...{ [f.name.replace('.example.js', '')]: f.path } }), {});
1819
};
1920

20-
const printExamples = examples => console.log(`Available Examples:\n\t${Object.keys(examples).join('\n\t')}`);
21+
const printExamples = (examples) => console.log(`Available Examples:\n\t${Object.keys(examples).join('\n\t')}`);
2122

22-
const getExpectedOutput = examplePath => {
23+
const getExpectedOutput = (examplePath) => {
2324
const contents = fs.readFileSync(examplePath).toString();
2425
const outputCommentMatch = contents.match(OUTPUT_REGEXP);
2526
if (!outputCommentMatch) {
@@ -29,8 +30,9 @@ const getExpectedOutput = examplePath => {
2930
return contents
3031
.slice(startIndex)
3132
.split(EOL)
32-
.filter(l => OUTPUT_LINE_REGEXP.test(l))
33-
.map(l => {
33+
.filter((l) => OUTPUT_LINE_REGEXP.test(l))
34+
.filter((l) => !SOURCE_MAP_COMMENT_REGEXP.test(l))
35+
.map((l) => {
3436
return l.replace(OUTPUT_LINE_REGEXP, '');
3537
})
3638
.join(EOL);
@@ -74,17 +76,17 @@ yargs
7476
.command(
7577
'list',
7678
'list all examples',
77-
yarg => yarg.option('examplesDir'),
78-
async argv => {
79+
(yarg) => yarg.option('examplesDir'),
80+
async (argv) => {
7981
const examples = await getExampleFiles(argv.examplesDir);
8082
printExamples(examples);
8183
},
8284
)
8385
.command(
8486
'all',
8587
'run all examples',
86-
yarg => yarg.option('examplesDir'),
87-
async argv => {
88+
(yarg) => yarg.option('examplesDir'),
89+
async (argv) => {
8890
const examples = await getExampleFiles(argv.examplesDir);
8991
return Object.keys(examples).reduce(async (prev, exampleName) => {
9092
await prev;
@@ -96,13 +98,13 @@ yargs
9698
.command(
9799
'run [example]',
98100
'run a specific example',
99-
yargs => {
101+
(yargs) => {
100102
return yargs.option('examplesDir').positional('example', {
101103
type: 'string',
102104
describe: 'the example to run',
103105
});
104106
},
105-
async argv => {
107+
async (argv) => {
106108
const examples = await getExampleFiles(argv.examplesDir);
107109
const output = await runExample(argv.example, examples);
108110
await checkOutput(argv.example, examples, output);

examples/example-runner/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
},
1010
"dependencies": {
1111
"@types/yargs": "^13.0.4",
12-
"globby": "^10.0.1",
13-
"jest-diff": "^24.9.0",
14-
"typescript": "^3.7.3",
15-
"yargs": "^15.0.2"
12+
"globby": "^11.0.0",
13+
"jest-diff": "^26.0.1",
14+
"typescript": "^3.9.2",
15+
"yargs": "^15.3.1"
1616
}
1717
}

0 commit comments

Comments
 (0)