Skip to content

Commit 105865f

Browse files
committed
Clearer success messages, links to diffs, ESLint basic rules
1 parent 4e31278 commit 105865f

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.eslintrc.cjs

+4
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ module.exports = {
1616
'eslint:recommended',
1717
'plugin:@typescript-eslint/recommended',
1818
],
19+
rules: {
20+
indent: ['error', 2],
21+
semi: ['error', 'always'],
22+
}
1923
};

Lib.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export class Lib {
66
c: 'foo'
77
}
88
};
9-
a.b?.c && console.log('Success!');
9+
a.b?.c && console.log('Own module imported successfully');
1010
}
1111
}

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ To be able to run `eslint`, we must create an `.eslintrc.cjs` file, rather than
7676

7777
npm i -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser
7878

79+
Here's the [diff to add ESLint support](https://github.com/dandv/typescript-modern-project/commit/f816fe6e8d83ce554bd3066ac6638fb4406e917f).
80+
7981

8082
# Jest
8183

@@ -100,8 +102,11 @@ To pass parameters to Node when running Jest, we'll add the following `test` lin
100102

101103
"test": "node --harmony node_modules/.bin/jest"
102104

105+
Here's the [diff to add Jest support](https://github.com/dandv/typescript-modern-project/commit/14368e9dadb5f50922ef46fbd9827eaff5334d5f).
106+
103107

104108
# Source maps
105109

106110
If your script generates an error, you'll see the line numbers from the generated `.js` files, which is not helpful. We want to see the original paths and line numbers from the `.ts` files. To do that, we'll add `sourceMap: true` to `tsconfig.json`, install [`source-map-support`](https://www.npmjs.com/package/source-map-support) and run node with the `-r source-map-support/register` parameter. Note that Jest already takes care of source mapping so you'll see the `.ts` line numbers without having to do anything extra.
107-
111+
112+
Here's [the diff to add source map support](https://github.com/dandv/typescript-modern-project/commit/4e31278833f2ce07f474d9c6348bb4509082ee97).

run.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { Lib } from './Lib';
77

88
import Influx from 'influx';
99
const influx = new Influx.InfluxDB();
10+
if (influx instanceof Influx.InfluxDB)
11+
console.info('Module without named exports imported successfully');
1012

1113
const l = new Lib();
1214
l.run();

0 commit comments

Comments
 (0)