Skip to content

Commit 854620e

Browse files
authored
fix: support long running "watch" lint sessions (#973)
1 parent fec73b0 commit 854620e

33 files changed

Lines changed: 506 additions & 119 deletions

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
//
3636

3737
'comma-dangle': ['error', 'always-multiline'],
38+
'constructor-super': 'off',
3839
curly: ['error', 'all'],
3940
'no-mixed-operators': 'error',
4041
'no-console': 'error',
@@ -113,7 +114,8 @@ module.exports = {
113114
ecmaFeatures: {
114115
jsx: false,
115116
},
116-
project: './tsconfig.base.json',
117+
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'],
118+
tsconfigRootDir: __dirname,
117119
},
118120
overrides: [
119121
{

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ jspm_packages/
5757
# next.js build output
5858
.next
5959

60-
.DS_Store
61-
.idea
62-
dist
6360

6461
# Editor-specific metadata folders
6562
.vs
63+
64+
.DS_Store
65+
.idea
66+
dist
67+
*.tsbuildinfo
68+
.watchmanconfig

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"javascript.preferences.importModuleSpecifier": "auto",
2323
"typescript.preferences.importModuleSpecifier": "auto",
2424
"javascript.preferences.quoteStyle": "single",
25-
"typescript.preferences.quoteStyle": "single"
25+
"typescript.preferences.quoteStyle": "single",
26+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2627
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"pre-push": "yarn format-check",
3434
"postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install && opencollective-postinstall",
3535
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
36-
"test": "lerna run test --parallel",
36+
"test": "lerna run test --concurrency 1",
3737
"typecheck": "lerna run typecheck"
3838
},
3939
"config": {
@@ -70,7 +70,6 @@
7070
"lint-staged": "^9.2.5",
7171
"opencollective-postinstall": "^2.0.2",
7272
"prettier": "^1.18.2",
73-
"rimraf": "^3.0.0",
7473
"ts-jest": "^24.0.0",
7574
"ts-node": "^8.3.0",
7675
"tslint": "^5.19.0",

packages/eslint-plugin-tslint/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
},
2424
"license": "MIT",
2525
"scripts": {
26-
"build": "tsc -p tsconfig.build.json",
27-
"clean": "rimraf dist/",
26+
"build": "tsc -b tsconfig.build.json",
27+
"clean": "tsc -b tsconfig.build.json --clean",
2828
"format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore",
29-
"prebuild": "npm run clean",
29+
"lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'",
3030
"test": "jest --coverage",
31-
"typecheck": "tsc --noEmit"
31+
"typecheck": "tsc -p tsconfig.json --noEmit"
3232
},
3333
"dependencies": {
3434
"@typescript-eslint/experimental-utils": "2.3.3",
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"outDir": "./dist"
4+
"outDir": "./dist",
5+
"rootDir": "./src",
6+
"resolveJsonModule": true
57
},
6-
"include": ["src"]
8+
"include": ["src"],
9+
"references": [
10+
{ "path": "../experimental-utils/tsconfig.build.json" },
11+
{ "path": "../parser/tsconfig.build.json" },
12+
{ "path": "../typescript-estree/tsconfig.build.json" }
13+
]
714
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"extends": "./tsconfig.build.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"noEmit": true
6+
},
37
"include": ["src", "tests"],
48
"exclude": ["tests/test-project", "tests/test-tslint-rules-directory"]
59
}

packages/eslint-plugin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
"license": "MIT",
3030
"main": "dist/index.js",
3131
"scripts": {
32-
"build": "tsc -p tsconfig.build.json",
32+
"build": "tsc -b tsconfig.build.json",
3333
"check:docs": "../../node_modules/.bin/ts-node --files ./tools/validate-docs/index.ts",
3434
"check:configs": "../../node_modules/.bin/ts-node --files ./tools/validate-configs/index.ts",
35-
"clean": "rimraf dist/",
35+
"clean": "tsc -b tsconfig.build.json --clean",
3636
"format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore",
3737
"generate:configs": "../../node_modules/.bin/ts-node --files tools/generate-configs.ts",
38-
"prebuild": "npm run clean",
38+
"lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'",
3939
"test": "jest --coverage",
40-
"typecheck": "tsc --noEmit"
40+
"typecheck": "tsc -p tsconfig.json --noEmit"
4141
},
4242
"dependencies": {
4343
"@typescript-eslint/experimental-utils": "2.3.3",

packages/eslint-plugin/tests/RuleTester.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { TSESLint, ESLintUtils } from '@typescript-eslint/experimental-utils';
2+
import { clearCaches } from '@typescript-eslint/parser';
23
import * as path from 'path';
34

45
const parser = '@typescript-eslint/parser';
@@ -74,4 +75,10 @@ function getFixturesRootDir(): string {
7475

7576
const { batchedSingleLineTests } = ESLintUtils;
7677

78+
// make sure that the parser doesn't hold onto file handles between tests
79+
// on linux (i.e. our CI env), there can be very a limited number of watch handles available
80+
afterAll(() => {
81+
clearCaches();
82+
});
83+
7784
export { RuleTester, getFixturesRootDir, batchedSingleLineTests };

packages/eslint-plugin/tsconfig.build.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"declaration": false,
66
"declarationMap": false,
77
"outDir": "./dist",
8+
"rootDir": "./src",
89
"resolveJsonModule": true
910
},
10-
"include": [
11-
"src",
12-
"typings",
13-
// include the parser's ambient typings because the parser exports them in its type defs
14-
"../parser/typings"
11+
"include": ["src", "typings"],
12+
"references": [
13+
{ "path": "../experimental-utils/tsconfig.build.json" },
14+
{ "path": "../parser/tsconfig.build.json" },
15+
{ "path": "../typescript-estree/tsconfig.build.json" }
1516
]
1617
}

0 commit comments

Comments
 (0)