Skip to content

Commit 19a0cad

Browse files
committed
Updated with naming and commenting standards and fixed typos and ignored some useless stuff
1 parent dcd61d4 commit 19a0cad

16 files changed

+70
-18
lines changed

.eslintrc

+47-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,57 @@
2424
"no-undef": 1,
2525
"no-useless-catch": 1,
2626
"no-prototype-builtins": 1,
27+
"no-constant-condition": 0,
28+
"no-useless-escape": 0,
29+
"no-console": "error",
30+
"eqeqeq": ["error", "smart"],
31+
"capitalized-comments": [
32+
"warn",
33+
"always",
34+
{
35+
"ignoreInlineComments": true,
36+
"ignoreConsecutiveComments": true
37+
}
38+
],
2739
"@typescript-eslint/no-namespace": 0,
2840
"@typescript-eslint/no-explicit-any": 0,
2941
"@typescript-eslint/explicit-module-boundary-types": 0,
3042
"@typescript-eslint/no-unused-vars": "warn",
3143
"@typescript-eslint/no-inferrable-types": 0,
32-
"@typescript-eslint/no-non-null-assertion": 0
44+
"@typescript-eslint/no-non-null-assertion": 0,
45+
"@typescript-eslint/no-var-requires": 0,
46+
"@typescript-eslint/naming-convention": [
47+
"error",
48+
{
49+
"selector": "default",
50+
"format": ["camelCase"],
51+
"leadingUnderscore": "allow",
52+
"trailingUnderscore": "allowSingleOrDouble"
53+
},
54+
{
55+
"selector": "variable",
56+
"format": ["camelCase", "UPPER_CASE"],
57+
"leadingUnderscore": "allow",
58+
"trailingUnderscore": "allowSingleOrDouble"
59+
},
60+
{
61+
"selector": "parameter",
62+
"format": ["camelCase"],
63+
"trailingUnderscore": "allowSingleOrDouble"
64+
},
65+
{
66+
"selector": "typeLike",
67+
"format": ["PascalCase"],
68+
"trailingUnderscore": "allowSingleOrDouble"
69+
},
70+
{
71+
"selector": "objectLiteralProperty",
72+
"format": null
73+
},
74+
{
75+
"selector": "typeProperty",
76+
"format": null
77+
}
78+
]
3379
}
3480
}

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
/shell.nix
66
/release.nix
77
/tsconfig.json
8+
/tsconfig.build.json
9+
/jest.config.js
810
/src
911
/tests
1012
/tmp
13+
/docs
14+
/benches

docs/classes/lib_Library.default.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h3>constructor</h3>
107107
<li class="tsd-description">
108108
<aside class="tsd-sources">
109109
<ul>
110-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/Library.ts#L4">lib/Library.ts:4</a></li>
110+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/Library.ts#L4">lib/Library.ts:4</a></li>
111111
</ul>
112112
</aside>
113113
<h4 class="tsd-parameters-title">Parameters</h4>
@@ -129,7 +129,7 @@ <h3>some<wbr>Param</h3>
129129
<div class="tsd-signature tsd-kind-icon">some<wbr>Param<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
130130
<aside class="tsd-sources">
131131
<ul>
132-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/Library.ts#L2">lib/Library.ts:2</a></li>
132+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/Library.ts#L2">lib/Library.ts:2</a></li>
133133
</ul>
134134
</aside>
135135
</section>

docs/classes/lib_NumPair.default.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ <h3>constructor</h3>
108108
<li class="tsd-description">
109109
<aside class="tsd-sources">
110110
<ul>
111-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/NumPair.ts#L5">lib/NumPair.ts:5</a></li>
111+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/NumPair.ts#L5">lib/NumPair.ts:5</a></li>
112112
</ul>
113113
</aside>
114114
<h4 class="tsd-parameters-title">Parameters</h4>
@@ -133,7 +133,7 @@ <h3>num1</h3>
133133
<div class="tsd-signature tsd-kind-icon">num1<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
134134
<aside class="tsd-sources">
135135
<ul>
136-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/NumPair.ts#L2">lib/NumPair.ts:2</a></li>
136+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/NumPair.ts#L2">lib/NumPair.ts:2</a></li>
137137
</ul>
138138
</aside>
139139
</section>
@@ -143,7 +143,7 @@ <h3>num2</h3>
143143
<div class="tsd-signature tsd-kind-icon">num2<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
144144
<aside class="tsd-sources">
145145
<ul>
146-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/NumPair.ts#L3">lib/NumPair.ts:3</a></li>
146+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/NumPair.ts#L3">lib/NumPair.ts:3</a></li>
147147
</ul>
148148
</aside>
149149
</section>

docs/modules/bin_typescript_demo_lib.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>default</h3>
9090
<li class="tsd-description">
9191
<aside class="tsd-sources">
9292
<ul>
93-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/bin/typescript-demo-lib.ts#L11">bin/typescript-demo-lib.ts:11</a></li>
93+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/bin/typescript-demo-lib.ts#L12">bin/typescript-demo-lib.ts:12</a></li>
9494
</ul>
9595
</aside>
9696
<h4 class="tsd-parameters-title">Parameters</h4>

docs/modules/lib_test_level.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>default</h3>
9090
<li class="tsd-description">
9191
<aside class="tsd-sources">
9292
<ul>
93-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/test-level.ts#L6">lib/test-level.ts:6</a></li>
93+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/test-level.ts#L6">lib/test-level.ts:6</a></li>
9494
</ul>
9595
</aside>
9696
<h4 class="tsd-parameters-title">Parameters</h4>

docs/modules/lib_test_utp_native.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>default</h3>
9090
<li class="tsd-description">
9191
<aside class="tsd-sources">
9292
<ul>
93-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/test-utp-native.ts#L4">lib/test-utp-native.ts:4</a></li>
93+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/test-utp-native.ts#L4">lib/test-utp-native.ts:4</a></li>
9494
</ul>
9595
</aside>
9696
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>

docs/modules/lib_workers_test_workers.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>default</h3>
9090
<li class="tsd-description">
9191
<aside class="tsd-sources">
9292
<ul>
93-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/lib/workers/test-workers.ts#L6">lib/workers/test-workers.ts:6</a></li>
93+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/lib/workers/test-workers.ts#L6">lib/workers/test-workers.ts:6</a></li>
9494
</ul>
9595
</aside>
9696
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>

docs/modules/utils.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>sleep</h3>
9090
<li class="tsd-description">
9191
<aside class="tsd-sources">
9292
<ul>
93-
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/d3a5cc2/src/utils.ts#L1">utils.ts:1</a></li>
93+
<li>Defined in <a href="https://github.com/MatrixAI/TypeScript-Demo-Lib/blob/dcd61d4/src/utils.ts#L1">utils.ts:1</a></li>
9494
</ul>
9595
</aside>
9696
<h4 class="tsd-parameters-title">Parameters</h4>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"test": "jest",
2727
"lint": "eslint '{src,tests}/**/*.{js,ts}'",
2828
"lintfix": "eslint '{src,tests}/**/*.{js,ts}' --fix",
29-
"docs": "typedoc --out ./docs src && touch ./docs/.nojekyll",
29+
"docs": "typedoc --tsconfig ./tsconfig.build.json --out ./docs src && touch ./docs/.nojekyll",
3030
"typescript-demo-lib": "ts-node -r tsconfig-paths/register src/bin/typescript-demo-lib.ts"
3131
},
3232
"dependencies": {

src/lib/test-utp-native.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import utp from 'utp-native';
22
import { sleep } from '../utils';
33

4-
async function testUptNative() {
5-
// upt-native tests
4+
async function testUtpNative() {
5+
// Utp-native tests
66
process.stdout.write('Lets test utp-native.\n');
77
const server = utp.createServer((socket) => {
88
socket.pipe(socket);
@@ -25,4 +25,4 @@ async function testUptNative() {
2525
await sleep(2000);
2626
}
2727

28-
export default testUptNative;
28+
export default testUtpNative;

src/lib/workers/test-workers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//testing worker threads.
1+
//Testing worker threads.
22
import { Pool, spawn, Worker } from 'threads';
33
import process from 'process';
44
import * as os from 'os';

tests/bin/typescript-demo-lib.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('main', () => {
2020
});
2121
});
2222
test('main takes synthetic parameters', async () => {
23-
// jest can also "spy on" the console object
23+
// Jest can also "spy on" the console object
2424
// and then you can test on stdout
2525
const mockLog = mockProcessStdout();
2626
expect(await main(['', '', '1', '2', dataDir])).toEqual(0);

tests/globalSetup.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
async function setup() {
2+
// eslint-disable-next-line no-console
23
console.log('\nGLOBAL SETUP');
34
}
45

tests/globalTeardown.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
async function teardown() {
2+
// eslint-disable-next-line no-console
23
console.log('GLOBAL TEARDOWN');
34
}
45

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"allowSyntheticDefaultImports": true,
1111
"moduleResolution": "node",
1212
"module": "CommonJS",
13-
"target": "ES2016",
13+
"target": "ES2020",
1414
"baseUrl": "./src",
1515
"paths": {
1616
"@": ["index"],

0 commit comments

Comments
 (0)