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 <[email protected]>
  • Loading branch information
paul-marechal committed Jan 27, 2020
1 parent e1d08d0 commit 1ca3ec3
Show file tree
Hide file tree
Showing 582 changed files with 4,079 additions and 1,782 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: [
'./configs/base.eslintrc.json',
'./configs/warnings.eslintrc.json',
'./configs/errors.eslintrc.json'
],
ignorePatterns: [
'**/{node_modules,lib}',
'plugins'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: '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
18 changes: 14 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@
],
"editor.insertSpaces": true,
"[typescript]": {
"editor.tabSize": 4
"editor.tabSize": 4,
"editor.defaultFormatter": "vscode.typescript-language-features",
},
"[javascript]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.tabSize": 2
"editor.tabSize": 2,
"editor.defaultFormatter": "vscode.json-language-features",
},
"[jsonc]": {
"editor.tabSize": 2
"editor.tabSize": 2,
"editor.defaultFormatter": "vscode.json-language-features",
},
"typescript.tsdk": "node_modules/typescript/lib",
"files.insertFinalNewline": true,
"clang-format.language.typescript.enable": false
"clang-format.language.typescript.enable": false,
"editor.rulers": [
180
], // ESLint `max-len` rule.
}
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.

129 changes: 129 additions & 0 deletions configs/errors.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"rules": {
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/indent": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/type-annotation-spacing": "error",
"arrow-body-style": [
"error",
"as-needed"
],
"arrow-parens": [
"error",
"as-needed"
],
"camelcase": "off",
"comma-dangle": "off",
"curly": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/no-deprecated": "error",
"import/no-extraneous-dependencies": "off",
"max-len": [
"error",
{
"code": 180
}
],
"no-magic-numbers": "off",
"no-multiple-empty-lines": "error",
"no-new-wrappers": "error",
"no-null/no-null": "error",
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-underscore-dangle": "off",
"no-unused-expressions": "error",
"no-var": "error",
"no-void": "error",
"one-var": [
"error",
"never"
],
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"radix": "off",
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"spaced-comment": [
"error",
"always",
{
"exceptions": [
"*",
"+",
"-",
"/"
]
}
],
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"file-header": [
true,
"SPDX-License-Identifier: EPL-2\\.0 OR GPL-2\\.0 WITH Classpath-exception-2\\.0"
],
"jsdoc-format": [
true,
"check-multiline-start"
],
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"typedef": [
true,
"call-signature",
"property-declaration"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}
]
}
}
159 changes: 0 additions & 159 deletions configs/errors.tslint.json

This file was deleted.

Loading

0 comments on commit 1ca3ec3

Please sign in to comment.