Skip to content

Commit 30afac9

Browse files
authored
Improve the TypeScript lint/intellisense experience (#573)
* chore: Set up TypeScript path mapping for internal dependencies * chore: Use local tsconfig.json files when linting * chore: Use proper tsconfig files for docs generation
1 parent 3d3c862 commit 30afac9

File tree

8 files changed

+34
-13
lines changed

8 files changed

+34
-13
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ overrides:
1515
- files: ["*/src/*.ts"]
1616
parser: "@typescript-eslint/parser"
1717
parserOptions:
18-
project: ./tsconfig.json
18+
project: ./fluent-*/tsconfig.json
1919
extends:
2020
- eslint:recommended
2121
- ./eslint-base.yaml

fluent-bundle/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./esm"
4+
"outDir": "./esm",
5+
"rootDir": "./src"
56
},
67
"include": ["./src/**/*.ts"]
78
}

fluent-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"reactjs"
4242
],
4343
"scripts": {
44-
"build": "tsc",
44+
"build": "tsc -p ./tsconfig.build.json",
4545
"postbuild": "rollup -c ../rollup.config.mjs --globals @fluent/sequence:FluentSequence,cached-iterable:CachedIterable,react:React,prop-types:PropTypes",
46-
"docs": "typedoc --options ../typedoc.config.cjs",
46+
"docs": "typedoc --options ../typedoc.config.cjs --tsconfig ./tsconfig.build.json",
4747
"test": "jest --collect-coverage"
4848
},
4949
"engines": {

fluent-react/tsconfig.build.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./esm"
5+
},
6+
"include": ["./src/**/*.ts"]
7+
}

fluent-react/tsconfig.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
4-
"outDir": "./esm"
5-
},
6-
"include": ["./src/**/*.ts"]
4+
"baseUrl": ".",
5+
"paths": {
6+
"@fluent/bundle": ["../fluent-bundle/src/index.ts"],
7+
"@fluent/sequence": ["../fluent-sequence/src/index.ts"]
8+
}
9+
}
710
}

fluent-sequence/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"ftl"
2828
],
2929
"scripts": {
30-
"build": "tsc",
30+
"build": "tsc -p ./tsconfig.build.json",
3131
"postbuild": "rollup -c ../rollup.config.mjs",
32-
"docs": "typedoc --options ../typedoc.config.cjs",
32+
"docs": "typedoc --options ../typedoc.config.cjs --tsconfig ./tsconfig.build.json",
3333
"test": "mocha 'test/*_test.js'"
3434
},
3535
"engines": {

fluent-sequence/tsconfig.build.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./esm",
5+
"rootDir": "./src"
6+
},
7+
"include": ["./src/**/*.ts"]
8+
}

fluent-sequence/tsconfig.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
4-
"outDir": "./esm"
4+
"baseUrl": ".",
5+
"paths": {
6+
"@fluent/bundle": ["../fluent-bundle/src/index.ts"]
7+
}
58
},
6-
"include": ["./src/**/*.ts"]
79
}

0 commit comments

Comments
 (0)