From aff032ad74371e2e10c04acb4fefa88e4a50cbb4 Mon Sep 17 00:00:00 2001 From: Craig Spence Date: Fri, 18 Sep 2020 14:38:50 +1200 Subject: [PATCH] Revert "Ignore git changes in watch (#287)" This reverts commit b984fdc6fb48ab1b41db4181005fca58c4b2e50d. --- package.json | 8 +- packages/betterer/package.json | 1 - packages/betterer/src/watcher/watcher.ts | 10 +- yarn.lock | 153 +++++++++++++++-------- 4 files changed, 104 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index 6bc3cf580..3f0a36daa 100644 --- a/package.json +++ b/package.json @@ -35,13 +35,13 @@ "@types/graceful-fs": "^4.1.3", "@types/jest": "^26.0.0", "@types/node": "^14.6.1", - "@typescript-eslint/eslint-plugin": "^4.1.1", - "@typescript-eslint/parser": "^4.1.1", + "@typescript-eslint/eslint-plugin": "^4.0.0", + "@typescript-eslint/parser": "^3.10.1", "ansi-regex": "^5.0.0", "cz-conventional-changelog": "^3.3.0", - "eslint": "^7.9.0", + "eslint": "^7.3.1", "eslint-config-prettier": "^6.11.0", - "eslint-plugin-jest": "^24.0.1", + "eslint-plugin-jest": "^24.0.0", "eslint-plugin-prettier": "^3.1.4", "fs-extra": "^9.0.1", "graceful-fs": "^4.2.3", diff --git a/packages/betterer/package.json b/packages/betterer/package.json index 0a239c099..6303b6e6b 100644 --- a/packages/betterer/package.json +++ b/packages/betterer/package.json @@ -37,7 +37,6 @@ "globby": "^11.0.1", "jest-diff": "^26.1.0", "lines-and-columns": "^1.1.6", - "minimatch": "^3.0.4", "safe-string-literal": "^1.0.1", "ts-node": "^9.0.0", "tslib": "^2.0.1" diff --git a/packages/betterer/src/watcher/watcher.ts b/packages/betterer/src/watcher/watcher.ts index 0c45dface..073efa06a 100644 --- a/packages/betterer/src/watcher/watcher.ts +++ b/packages/betterer/src/watcher/watcher.ts @@ -1,7 +1,5 @@ import { watch as chokidar, FSWatcher } from 'chokidar'; import * as globby from 'globby'; -import * as minimatch from 'minimatch'; -import * as path from 'path'; import { BettererContext, BettererRuns } from '../context'; import { getNormalisedPath } from '../utils'; @@ -9,7 +7,6 @@ import { BettererWatchChangeHandler, BettererWatchRunHandler } from './types'; const EMIT_EVENTS = ['add', 'change']; const DEBOUNCE_TIME = 200; -const GIT_DIRECTORY = '.git/**'; export class BettererWatcher { private _files: Array = []; @@ -22,16 +19,13 @@ export class BettererWatcher { public async setup(): Promise { const { cwd, ignores, resultsPath } = this._context.config; - const isGitIgnored = globby.gitignore.sync(); - const watchIgnores = [...ignores, GIT_DIRECTORY].map((ignore) => path.join(cwd, ignore)); + const isIgnored = globby.gitignore.sync(); const watcher = chokidar(cwd, { ignoreInitial: true, ignored: (itemPath: string) => { return ( itemPath !== getNormalisedPath(cwd) && - (itemPath === getNormalisedPath(resultsPath) || - watchIgnores.some((ignore) => minimatch(itemPath, ignore, { matchBase: true })) || - isGitIgnored(itemPath)) + (itemPath === getNormalisedPath(resultsPath) || ignores.includes(itemPath) || isIgnored(itemPath)) ); } }); diff --git a/yarn.lock b/yarn.lock index 051716df7..bf69201c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1622,6 +1622,11 @@ resolved "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/eslint@^7.2.2": version "7.2.2" resolved "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.2.tgz#c88426b896efeb0b2732a92431ce8aa7ec0dee61" @@ -1755,28 +1760,39 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.1.1.tgz#78d5b18e259b13c2f4ec41dd9105af269a161a75" - integrity sha512-Hoxyt99EA9LMmqo/5PuWWPeWeB3mKyvibfJ1Hy5SfiUpjE8Nqp+5QNd9fOkzL66+fqvIWSIE+Ett16LGMzCGnQ== +"@typescript-eslint/eslint-plugin@^4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.0.0.tgz#99349a501447fed91de18346705c0c65cf603bee" + integrity sha512-5e6q1TR7gS2P+8W2xndCu7gBh3BzmYEo70OyIdsmCmknHha/yNbz2vdevl+tP1uoaMOcrzg4gyrAijuV3DDBHA== dependencies: - "@typescript-eslint/experimental-utils" "4.1.1" - "@typescript-eslint/scope-manager" "4.1.1" + "@typescript-eslint/experimental-utils" "4.0.0" + "@typescript-eslint/scope-manager" "4.0.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.1.1.tgz#52ff4e37c93113eb96385a4e6d075abece1ea72d" - integrity sha512-jzYsNciHoa4Z3c1URtmeT/bamYm8Dwfw6vuN3WHIE/BXb1iC4KveAnXDErTAZtPVxTYBaYn3n2gbt6F6D2rm1A== +"@typescript-eslint/experimental-utils@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686" + integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/typescript-estree" "3.10.1" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + +"@typescript-eslint/experimental-utils@4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.0.0.tgz#fbec21a3b5ab59127edb6ce2e139ed378cc50eb5" + integrity sha512-hbX6zR+a/vcpFVNJYN/Nbd7gmaMosDTxHEKcvmhWeWcq/0UDifrqmCfkkodbAKL46Fn4ekSBMTyq2zlNDzcQxw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.1.1" - "@typescript-eslint/types" "4.1.1" - "@typescript-eslint/typescript-estree" "4.1.1" + "@typescript-eslint/scope-manager" "4.0.0" + "@typescript-eslint/types" "4.0.0" + "@typescript-eslint/typescript-estree" "4.0.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -1792,15 +1808,24 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.1.1.tgz#324b4b35e314075adbc92bd8330cf3ef0c88cf3e" - integrity sha512-NLIhmicpKGfJbdXyQBz9j48PA6hq6e+SDOoXy7Ak6bq1ebGqbgG+fR1UIDAuay6OjQdot69c/URu2uLlsP8GQQ== +"@typescript-eslint/parser@^3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467" + integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw== dependencies: - "@typescript-eslint/scope-manager" "4.1.1" - "@typescript-eslint/types" "4.1.1" - "@typescript-eslint/typescript-estree" "4.1.1" - debug "^4.1.1" + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "3.10.1" + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/typescript-estree" "3.10.1" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/scope-manager@4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.0.0.tgz#8c9e3b3b8cdf5a1fbe671d9fad73ff67bc027ea8" + integrity sha512-9gcWUPoWo7gk/+ZQPg7L1ySRmR5HLIy3Vu6/LfhQbuzIkGm6v2CGIjpVRISoDLFRovNRDImd4aP/sa8O4yIEBg== + dependencies: + "@typescript-eslint/types" "4.0.0" + "@typescript-eslint/visitor-keys" "4.0.0" "@typescript-eslint/scope-manager@4.0.1": version "4.0.1" @@ -1810,31 +1835,42 @@ "@typescript-eslint/types" "4.0.1" "@typescript-eslint/visitor-keys" "4.0.1" -"@typescript-eslint/scope-manager@4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.1.1.tgz#bdb8526e82435f32b4ccd9dd4cec01af97b48850" - integrity sha512-0W8TTobCvIIQ2FsrYTffyZGAAFUyIbEHq5EYJb1m7Rpd005jrnOvKOo8ywCLhs/Bm17C+KsrUboBvBAARQVvyA== - dependencies: - "@typescript-eslint/types" "4.1.1" - "@typescript-eslint/visitor-keys" "4.1.1" +"@typescript-eslint/types@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" + integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== + +"@typescript-eslint/types@4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.0.tgz#ec1f9fc06b8558a1d5afa6e337182d08beece7f5" + integrity sha512-bK+c2VLzznX2fUWLK6pFDv3cXGTp7nHIuBMq1B9klA+QCsqLHOOqe5TQReAQDl7DN2RfH+neweo0oC5hYlG7Rg== "@typescript-eslint/types@4.0.1": version "4.0.1" resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2" integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg== -"@typescript-eslint/types@4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.1.1.tgz#57500c4a86b28cb47094c1a62f1177ea279a09cb" - integrity sha512-zrBiqOKYerMTllKcn+BP+i1b7LW/EbMMYytroXMxUTvFPn1smkCu0D7lSAx29fTUO4jnwV0ljSvYQtn2vNrNxA== +"@typescript-eslint/typescript-estree@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" + integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== + dependencies: + "@typescript-eslint/types" "3.10.1" + "@typescript-eslint/visitor-keys" "3.10.1" + debug "^4.1.1" + glob "^7.1.6" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@4.0.1": - version "4.0.1" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f" - integrity sha512-zGzleORFXrRWRJAMLTB2iJD1IZbCPkg4hsI8mGdpYlKaqzvKYSEWVAYh14eauaR+qIoZVWrXgYSXqLtTlxotiw== +"@typescript-eslint/typescript-estree@4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.0.tgz#2244c63de2f2190bc5718eb0fb3fd2c437d42097" + integrity sha512-ewFMPi2pMLDNIXGMPdf8r7El2oPSZw9PEYB0j+WcpKd7AX2ARmajGa7RUHTukllWX2bj4vWX6JLE1Oih2BMokA== dependencies: - "@typescript-eslint/types" "4.0.1" - "@typescript-eslint/visitor-keys" "4.0.1" + "@typescript-eslint/types" "4.0.0" + "@typescript-eslint/visitor-keys" "4.0.0" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -1842,13 +1878,13 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz#2015a84d71303ecdb6f46efd807ac19a51aab490" - integrity sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw== +"@typescript-eslint/typescript-estree@4.0.1": + version "4.0.1" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f" + integrity sha512-zGzleORFXrRWRJAMLTB2iJD1IZbCPkg4hsI8mGdpYlKaqzvKYSEWVAYh14eauaR+qIoZVWrXgYSXqLtTlxotiw== dependencies: - "@typescript-eslint/types" "4.1.1" - "@typescript-eslint/visitor-keys" "4.1.1" + "@typescript-eslint/types" "4.0.1" + "@typescript-eslint/visitor-keys" "4.0.1" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -1856,6 +1892,21 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/visitor-keys@3.10.1": + version "3.10.1" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" + integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== + dependencies: + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/visitor-keys@4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.0.tgz#e2bbb69d98076d6a3f06abcb2048225a74362c33" + integrity sha512-sTouJbv6rjVJeTE4lpSBVYXq/u5K3gbB6LKt7ccFEZPTZB/VeQ0ssUz9q5Hx++sCqBbdF8PzrrgvEnicXAR6NQ== + dependencies: + "@typescript-eslint/types" "4.0.0" + eslint-visitor-keys "^2.0.0" + "@typescript-eslint/visitor-keys@4.0.1": version "4.0.1" resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz#d4e8de62775f2a6db71c7e8539633680039fdd6c" @@ -1864,14 +1915,6 @@ "@typescript-eslint/types" "4.0.1" eslint-visitor-keys "^2.0.0" -"@typescript-eslint/visitor-keys@4.1.1": - version "4.1.1" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.1.tgz#bb05664bf4bea28dc120d1da94f3027d42ab0f6f" - integrity sha512-/EOOXbA2ferGLG6RmCHEQ0lTTLkOlXYDgblCmQk3tIU7mTPLm4gKhFMeeUSe+bcchTUsKeCk8xcpbop5Zr/8Rw== - dependencies: - "@typescript-eslint/types" "4.1.1" - eslint-visitor-keys "^2.0.0" - "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" @@ -3882,7 +3925,7 @@ eslint-config-prettier@^6.11.0: dependencies: get-stdin "^6.0.0" -eslint-plugin-jest@^24.0.1: +eslint-plugin-jest@^24.0.0: version "24.0.1" resolved "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.0.1.tgz#ad5e091d47cf895e15dc115e18f98471135a334f" integrity sha512-8tYFDqOHGr7vVfdVYspmlV4sRBTylrM4gSLgkGKlO6F+djDOEJ+tEU7I50smUs7AIvFnNZutXUQAMgI9s9N6xQ== @@ -3929,7 +3972,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@>=5.0.0, eslint@^7.9.0: +eslint@>=5.0.0, eslint@^7.3.1: version "7.9.0" resolved "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz#522aeccc5c3a19017cf0cb46ebfd660a79acf337" integrity sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA== @@ -4647,7 +4690,7 @@ glob@7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==