From be220b213d9225cebdd44e59aa97e33ce8c81341 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sun, 8 Nov 2020 07:24:43 +0100 Subject: [PATCH] tools: update ESLint to 7.13.0 Update ESLint to 7.13.0 PR-URL: https://github.com/nodejs/node/pull/36031 Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- tools/node_modules/eslint/README.md | 6 ++--- .../node_modules/eslint/lib/linter/timing.js | 25 +++++++++++++++++-- .../eslint/node_modules/import-fresh/index.js | 3 ++- .../node_modules/import-fresh/package.json | 2 +- .../node_modules/trim-trailing-lines/index.js | 11 +------- .../trim-trailing-lines/package.json | 18 ++++++------- .../node_modules/v8-compile-cache/README.md | 4 ++- .../v8-compile-cache/package.json | 19 +++++++------- .../v8-compile-cache/v8-compile-cache.js | 12 ++++++--- tools/node_modules/eslint/package.json | 2 +- 10 files changed, 61 insertions(+), 41 deletions(-) diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 7740b392f7c23e..0ea302e2cb5d34 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -14,7 +14,7 @@ [Rules](https://eslint.org/docs/rules/) | [Contributing](https://eslint.org/docs/developer-guide/contributing) | [Reporting Bugs](https://eslint.org/docs/developer-guide/contributing/reporting-bugs) | -[Code of Conduct](https://js.foundation/community/code-of-conduct) | +[Code of Conduct](https://eslint.org/conduct) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint) | [Chat Room](https://eslint.org/chat) @@ -85,7 +85,7 @@ The three error levels allow you fine-grained control over how ESLint applies ru ## Code of Conduct -ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct). +ESLint adheres to the [JS Foundation Code of Conduct](https://eslint.org/conduct). ## Filing Issues @@ -267,7 +267,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Automattic

Gold Sponsors

Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

+

Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/linter/timing.js b/tools/node_modules/eslint/lib/linter/timing.js index 8396d9215b54dc..58230306855abe 100644 --- a/tools/node_modules/eslint/lib/linter/timing.js +++ b/tools/node_modules/eslint/lib/linter/timing.js @@ -44,6 +44,26 @@ const enabled = !!process.env.TIMING; const HEADERS = ["Rule", "Time (ms)", "Relative"]; const ALIGN = [alignLeft, alignRight, alignRight]; +/** + * Decide how many rules to show in the output list. + * @returns {number} the number of rules to show + */ +function getListSize() { + const MINIMUM_SIZE = 10; + + if (typeof process.env.TIMING !== "string") { + return MINIMUM_SIZE; + } + + if (process.env.TIMING.toLowerCase() === "all") { + return Number.POSITIVE_INFINITY; + } + + const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10); + + return TIMING_ENV_VAR_AS_INTEGER > 10 ? TIMING_ENV_VAR_AS_INTEGER : MINIMUM_SIZE; +} + /* istanbul ignore next */ /** * display the data @@ -61,7 +81,7 @@ function display(data) { return [key, time]; }) .sort((a, b) => b[1] - a[1]) - .slice(0, 10); + .slice(0, getListSize()); rows.forEach(row => { row.push(`${(row[1] * 100 / total).toFixed(1)}%`); @@ -133,7 +153,8 @@ module.exports = (function() { return { time, - enabled + enabled, + getListSize }; }()); diff --git a/tools/node_modules/eslint/node_modules/import-fresh/index.js b/tools/node_modules/eslint/node_modules/import-fresh/index.js index 425ed98c42f68e..0a4c5d52f6d322 100644 --- a/tools/node_modules/eslint/node_modules/import-fresh/index.js +++ b/tools/node_modules/eslint/node_modules/import-fresh/index.js @@ -10,7 +10,8 @@ module.exports = moduleId => { const parentPath = parentModule(__filename); - const filePath = resolveFrom(path.dirname(parentPath), moduleId); + const cwd = parentPath ? path.dirname(parentPath) : __dirname; + const filePath = resolveFrom(cwd, moduleId); const oldModule = require.cache[filePath]; // Delete itself from module parent diff --git a/tools/node_modules/eslint/node_modules/import-fresh/package.json b/tools/node_modules/eslint/node_modules/import-fresh/package.json index 38892a62e43136..893bb4a523fbca 100644 --- a/tools/node_modules/eslint/node_modules/import-fresh/package.json +++ b/tools/node_modules/eslint/node_modules/import-fresh/package.json @@ -47,5 +47,5 @@ "heapdump": "node heapdump.js", "test": "xo && ava && tsd" }, - "version": "3.2.1" + "version": "3.2.2" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/trim-trailing-lines/index.js b/tools/node_modules/eslint/node_modules/trim-trailing-lines/index.js index 0f2d48b52fc567..eff85c6baedffb 100644 --- a/tools/node_modules/eslint/node_modules/trim-trailing-lines/index.js +++ b/tools/node_modules/eslint/node_modules/trim-trailing-lines/index.js @@ -2,16 +2,7 @@ module.exports = trimTrailingLines -var line = '\n' - // Remove final newline characters from `value`. function trimTrailingLines(value) { - var val = String(value) - var index = val.length - - while (val.charAt(--index) === line) { - // Empty - } - - return val.slice(0, index + 1) + return String(value).replace(/\n+$/, '') } diff --git a/tools/node_modules/eslint/node_modules/trim-trailing-lines/package.json b/tools/node_modules/eslint/node_modules/trim-trailing-lines/package.json index bbf4660f41bdda..c0242dc1299bdc 100644 --- a/tools/node_modules/eslint/node_modules/trim-trailing-lines/package.json +++ b/tools/node_modules/eslint/node_modules/trim-trailing-lines/package.json @@ -19,14 +19,14 @@ "deprecated": false, "description": "Remove final line feeds from a string", "devDependencies": { - "browserify": "^16.0.0", + "browserify": "^17.0.0", "nyc": "^15.0.0", - "prettier": "^1.0.0", - "remark-cli": "^7.0.0", - "remark-preset-wooorm": "^6.0.0", - "tape": "^4.0.0", - "tinyify": "^2.0.0", - "xo": "^0.25.0" + "prettier": "^2.0.0", + "remark-cli": "^9.0.0", + "remark-preset-wooorm": "^8.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "xo": "^0.34.0" }, "files": [ "index.js" @@ -72,12 +72,12 @@ "build": "npm run build-bundle && npm run build-mangle", "build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js", "build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js", - "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", "test": "npm run format && npm run build && npm run test-coverage", "test-api": "node test", "test-coverage": "nyc --reporter lcov tape test.js" }, - "version": "1.1.3", + "version": "1.1.4", "xo": { "prettier": true, "esnext": false, diff --git a/tools/node_modules/eslint/node_modules/v8-compile-cache/README.md b/tools/node_modules/eslint/node_modules/v8-compile-cache/README.md index 9580f6943205e1..6e0b99fbaa6304 100644 --- a/tools/node_modules/eslint/node_modules/v8-compile-cache/README.md +++ b/tools/node_modules/eslint/node_modules/v8-compile-cache/README.md @@ -26,9 +26,11 @@ The ability to tap into V8 to produce/consume this cache was introduced in [Node Set the environment variable `DISABLE_V8_COMPILE_CACHE=1` to disable the cache. +Cache directory is defined by environment variable `V8_COMPILE_CACHE_CACHE_DIR` or defaults to `/v8-compile-cache-`. + ## Internals -The caches are stored in `$TMP/v8-compile-cache/V8_VERSION`, where there are `.BLOB` and `.MAP` files corresponding to the entry module that required `v8-compile-cache`. The cache is _entry module specific_ because it is faster to load the entire code cache into memory at once, than it is to read it from disk on a file-by-file basis. +Cache files are suffixed `.BLOB` and `.MAP` corresponding to the entry module that required `v8-compile-cache`. The cache is _entry module specific_ because it is faster to load the entire code cache into memory at once, than it is to read it from disk on a file-by-file basis. ## Benchmarks diff --git a/tools/node_modules/eslint/node_modules/v8-compile-cache/package.json b/tools/node_modules/eslint/node_modules/v8-compile-cache/package.json index 83d66522f04c29..25540b730159b7 100644 --- a/tools/node_modules/eslint/node_modules/v8-compile-cache/package.json +++ b/tools/node_modules/eslint/node_modules/v8-compile-cache/package.json @@ -11,15 +11,15 @@ "deprecated": false, "description": "Require hook for automatic V8 compile cache persistence", "devDependencies": { - "babel-core": "6.23.1", - "eslint": "^3.15.0", - "flow-parser": "0.38.0", + "babel-core": "6.26.3", + "eslint": "^7.12.1", + "flow-parser": "0.136.0", "rimraf": "^2.5.4", - "rxjs": "5.2.0", + "rxjs": "6.6.3", "semver": "^5.3.0", "tap": "^10.1.1", "temp": "^0.8.3", - "yarn": "0.20.3" + "yarn": "1.22.10" }, "files": [ "v8-compile-cache.js" @@ -34,9 +34,10 @@ }, "scripts": { "bench": "bench/run.sh", - "lint": "eslint --max-warnings=0 .", - "posttest": "npm run lint", - "test": "tap test/*-test.js" + "eslint": "eslint --max-warnings=0 .", + "posttest": "npm run eslint", + "tap": "tap test/*-test.js", + "test": "npm run tap" }, - "version": "2.1.1" + "version": "2.2.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js b/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js index 69f053667046ca..b9c09288cb310b 100644 --- a/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js +++ b/tools/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js @@ -86,8 +86,6 @@ class FileSystemBlobStore { try { fs.writeFileSync(this._blobFilename, blobToStore); fs.writeFileSync(this._mapFilename, mapToStore); - } catch (error) { - throw error; } finally { fs.unlinkSync(this._lockFilename); } @@ -301,7 +299,8 @@ function slashEscape(str) { '\x00': 'z0', 'z': 'zZ', }; - return str.replace(/[\\:\/\x00z]/g, match => (ESCAPE_LOOKUP[match])); + const ESCAPE_REGEX = /[\\:/\x00z]/g; // eslint-disable-line no-control-regex + return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); } function supportsCachedData() { @@ -311,6 +310,11 @@ function supportsCachedData() { } function getCacheDir() { + const v8_compile_cache_cache_dir = process.env.V8_COMPILE_CACHE_CACHE_DIR; + if (v8_compile_cache_cache_dir) { + return v8_compile_cache_cache_dir; + } + // Avoid cache ownership issues on POSIX systems. const dirname = typeof process.getuid === 'function' ? 'v8-compile-cache-' + process.getuid() @@ -348,7 +352,7 @@ if (!process.env.DISABLE_V8_COMPILE_CACHE && supportsCachedData()) { nativeCompileCache.setCacheStore(blobStore); nativeCompileCache.install(); - process.once('exit', code => { + process.once('exit', () => { if (blobStore.isDirty()) { blobStore.save(); } diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index a5f0c57b98a18d..53d055bc094d51 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.12.1" + "version": "7.13.0" } \ No newline at end of file