Skip to content

Commit

Permalink
use tsc build mode + eslint
Browse files Browse the repository at this point in the history
1. use tsc build mode

Packages are built in topological order, one after the other. Typescript
recently added a "build" mode, that allows us to somewhat link all the
packages together into one compilation step, speeding up compilation
time. This commit makes use of this by rewiring the monorepo to use
tsc build and incremental mode.

Reworked a few scripts to accomodate with the new build method.

2. replace tslint with eslint

Convert most tslint rules to eslint, changed most inline comments in the
sources as well. Some tslint rules still work, hence why you will be
able to see `// tslint` comments.

Unfortunately, there is an outstanding issue regarding eslint
performance on large typescript monorepos, so we should fallback to
linting all packages individually until this is fixed.

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Jan 20, 2020
1 parent 6f16516 commit 50c8458
Show file tree
Hide file tree
Showing 568 changed files with 3,993 additions and 1,520 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
extends: [
'./configs/base.eslintrc.json',
'./configs/warnings.eslintrc.json',
'./configs/errors.eslintrc.json'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: [
'compile.tsconfig.json',
'dev-packages/*/compile.tsconfig.json',
'packages/*/compile.tsconfig.json',
'examples/*/compile.tsconfig.json'
]
}
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ plugins
gh-pages
.vscode/ipch
dev-packages/electron/compile_commands.json
*.tsbuildinfo
.eslintcache
47 changes: 23 additions & 24 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
// If one would like to add/remove/modify user preferences without modifying the content of the
// workspace settings file, then one would need to modify the `settings.json` under here:
// - Windows: %APPDATA%\Code\User\settings.json
// - Linux: $HOME/.config/Code/User/settings.json
// - Mac: $HOME/Library/Application Support/Code/User/settings.json
{
"tslint.enable": true,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"search.exclude": {
"**/node_modules": true,
"**/lib": true,
"**/coverage": true
"editor.insertSpaces": true,
"files.insertFinalNewline": true,
"clang-format.language.typescript.enable": false,
"editor.rulers": [
180
], // ESLint `max-len` rule.
"[typescript]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "vscode.typescript-language-features",
},
"[javascript]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "vscode.json-language-features",
},
"[jsonc]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "vscode.json-language-features",
},
"lcov.path": [
"packages/core/coverage/lcov.info",
Expand All @@ -34,18 +46,5 @@
"pattern": "**/*.spec.ts",
"command": "yarn test:theia"
}
],
"editor.insertSpaces": true,
"[typescript]": {
"editor.tabSize": 4
},
"[json]": {
"editor.tabSize": 2
},
"[jsonc]": {
"editor.tabSize": 2
},
"typescript.tsdk": "node_modules/typescript/lib",
"files.insertFinalNewline": true,
"clang-format.language.typescript.enable": false
]
}
162 changes: 162 additions & 0 deletions compile.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"extends": "./configs/base.tsconfig",
"include": [],
"references": [
{
"path": "dev-packages/application-manager/compile.tsconfig.json"
},
{
"path": "dev-packages/application-package/compile.tsconfig.json"
},
{
"path": "dev-packages/cli/compile.tsconfig.json"
},
{
"path": "packages/callhierarchy/compile.tsconfig.json"
},
{
"path": "packages/console/compile.tsconfig.json"
},
{
"path": "packages/core/compile.tsconfig.json"
},
{
"path": "packages/debug-nodejs/compile.tsconfig.json"
},
{
"path": "packages/debug/compile.tsconfig.json"
},
{
"path": "packages/editor-preview/compile.tsconfig.json"
},
{
"path": "packages/editor/compile.tsconfig.json"
},
{
"path": "packages/editorconfig/compile.tsconfig.json"
},
{
"path": "packages/file-search/compile.tsconfig.json"
},
{
"path": "packages/filesystem/compile.tsconfig.json"
},
{
"path": "packages/getting-started/compile.tsconfig.json"
},
{
"path": "packages/git/compile.tsconfig.json"
},
{
"path": "packages/java-debug/compile.tsconfig.json"
},
{
"path": "packages/java/compile.tsconfig.json"
},
{
"path": "packages/json/compile.tsconfig.json"
},
{
"path": "packages/keymaps/compile.tsconfig.json"
},
{
"path": "packages/languages/compile.tsconfig.json"
},
{
"path": "packages/markers/compile.tsconfig.json"
},
{
"path": "packages/merge-conflicts/compile.tsconfig.json"
},
{
"path": "packages/messages/compile.tsconfig.json"
},
{
"path": "packages/metrics/compile.tsconfig.json"
},
{
"path": "packages/mini-browser/compile.tsconfig.json"
},
{
"path": "packages/monaco/compile.tsconfig.json"
},
{
"path": "packages/navigator/compile.tsconfig.json"
},
{
"path": "packages/outline-view/compile.tsconfig.json"
},
{
"path": "packages/output/compile.tsconfig.json"
},
{
"path": "packages/plugin-dev/compile.tsconfig.json"
},
{
"path": "packages/plugin-ext-vscode/compile.tsconfig.json"
},
{
"path": "packages/plugin-ext/compile.tsconfig.json"
},
{
"path": "packages/plugin-metrics/compile.tsconfig.json"
},
{
"path": "packages/plugin/compile.tsconfig.json"
},
{
"path": "packages/preferences/compile.tsconfig.json"
},
{
"path": "packages/preview/compile.tsconfig.json"
},
{
"path": "packages/process/compile.tsconfig.json"
},
{
"path": "packages/python/compile.tsconfig.json"
},
{
"path": "packages/scm/compile.tsconfig.json"
},
{
"path": "packages/search-in-workspace/compile.tsconfig.json"
},
{
"path": "packages/task/compile.tsconfig.json"
},
{
"path": "packages/terminal/compile.tsconfig.json"
},
{
"path": "packages/textmate-grammars/compile.tsconfig.json"
},
{
"path": "packages/tslint/compile.tsconfig.json"
},
{
"path": "packages/typehierarchy/compile.tsconfig.json"
},
{
"path": "packages/typescript/compile.tsconfig.json"
},
{
"path": "packages/userstorage/compile.tsconfig.json"
},
{
"path": "packages/variable-resolver/compile.tsconfig.json"
},
{
"path": "packages/workspace/compile.tsconfig.json"
},
{
"path": "examples/api-samples/compile.tsconfig.json"
},
{
"path": "examples/browser/compile.tsconfig.json"
},
{
"path": "examples/electron/compile.tsconfig.json"
}
]
}
25 changes: 25 additions & 0 deletions configs/base.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"@typescript-eslint",
"@typescript-eslint/tslint",
"import",
"no-null"
],
"env": {
"browser": true,
"mocha": true,
"node": true
},
"ignorePatterns": [
"node_modules",
"*.d.ts"
]
}
2 changes: 1 addition & 1 deletion configs/base.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
],
"sourceMap": true
}
}
}
6 changes: 6 additions & 0 deletions configs/build.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"./base.eslintrc.json",
"./errors.eslintrc.json"
]
}
8 changes: 0 additions & 8 deletions configs/build.tslint.json

This file was deleted.

Loading

0 comments on commit 50c8458

Please sign in to comment.