Skip to content

Commit

Permalink
Improve the TypeScript lint/intellisense experience (#573)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eemeli authored Sep 13, 2021
1 parent 3d3c862 commit 30afac9
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ overrides:
- files: ["*/src/*.ts"]
parser: "@typescript-eslint/parser"
parserOptions:
project: ./tsconfig.json
project: ./fluent-*/tsconfig.json
extends:
- eslint:recommended
- ./eslint-base.yaml
Expand Down
3 changes: 2 additions & 1 deletion fluent-bundle/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./esm"
"outDir": "./esm",
"rootDir": "./src"
},
"include": ["./src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions fluent-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"reactjs"
],
"scripts": {
"build": "tsc",
"build": "tsc -p ./tsconfig.build.json",
"postbuild": "rollup -c ../rollup.config.mjs --globals @fluent/sequence:FluentSequence,cached-iterable:CachedIterable,react:React,prop-types:PropTypes",
"docs": "typedoc --options ../typedoc.config.cjs",
"docs": "typedoc --options ../typedoc.config.cjs --tsconfig ./tsconfig.build.json",
"test": "jest --collect-coverage"
},
"engines": {
Expand Down
7 changes: 7 additions & 0 deletions fluent-react/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./esm"
},
"include": ["./src/**/*.ts"]
}
11 changes: 7 additions & 4 deletions fluent-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.build.json",
"compilerOptions": {
"outDir": "./esm"
},
"include": ["./src/**/*.ts"]
"baseUrl": ".",
"paths": {
"@fluent/bundle": ["../fluent-bundle/src/index.ts"],
"@fluent/sequence": ["../fluent-sequence/src/index.ts"]
}
}
}
4 changes: 2 additions & 2 deletions fluent-sequence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"ftl"
],
"scripts": {
"build": "tsc",
"build": "tsc -p ./tsconfig.build.json",
"postbuild": "rollup -c ../rollup.config.mjs",
"docs": "typedoc --options ../typedoc.config.cjs",
"docs": "typedoc --options ../typedoc.config.cjs --tsconfig ./tsconfig.build.json",
"test": "mocha 'test/*_test.js'"
},
"engines": {
Expand Down
8 changes: 8 additions & 0 deletions fluent-sequence/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./esm",
"rootDir": "./src"
},
"include": ["./src/**/*.ts"]
}
8 changes: 5 additions & 3 deletions fluent-sequence/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.build.json",
"compilerOptions": {
"outDir": "./esm"
"baseUrl": ".",
"paths": {
"@fluent/bundle": ["../fluent-bundle/src/index.ts"]
}
},
"include": ["./src/**/*.ts"]
}

0 comments on commit 30afac9

Please sign in to comment.