Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.55.0 to 8.56.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0) Updates `eslint-plugin-import` from 2.29.0 to 2.29.1 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
511f073971
commit
144b7d5b16
32 changed files with 618 additions and 251 deletions
28
node_modules/.package-lock.json
generated
vendored
28
node_modules/.package-lock.json
generated
vendored
|
|
@ -448,9 +448,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.55.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz",
|
||||
"integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz",
|
||||
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
|
|
@ -2497,15 +2497,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.55.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
|
||||
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
|
||||
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "8.55.0",
|
||||
"@eslint/js": "8.56.0",
|
||||
"@humanwhocodes/config-array": "^0.11.13",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
|
@ -2719,9 +2719,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz",
|
||||
"integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==",
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
|
||||
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-includes": "^3.1.7",
|
||||
|
|
@ -2740,7 +2740,7 @@
|
|||
"object.groupby": "^1.0.1",
|
||||
"object.values": "^1.1.7",
|
||||
"semver": "^6.3.1",
|
||||
"tsconfig-paths": "^3.14.2"
|
||||
"tsconfig-paths": "^3.15.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
|
@ -5915,9 +5915,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
|
||||
"integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==",
|
||||
"version": "3.15.0",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
|
||||
"integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json5": "^0.0.29",
|
||||
|
|
|
|||
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "8.55.0",
|
||||
"version": "8.56.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {},
|
||||
|
|
|
|||
16
node_modules/eslint-plugin-import/CHANGELOG.md
generated
vendored
16
node_modules/eslint-plugin-import/CHANGELOG.md
generated
vendored
|
|
@ -6,6 +6,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.29.1] - 2023-12-14
|
||||
|
||||
### Fixed
|
||||
- [`no-extraneous-dependencies`]: ignore `export type { ... } from '...'` when `includeTypes` is `false` ([#2919], thanks [@Pandemic1617])
|
||||
- [`no-unused-modules`]: support export patterns with array destructuring ([#2930], thanks [@ljharb])
|
||||
- [Deps] update `tsconfig-paths` ([#2447], thanks [@domdomegg])
|
||||
|
||||
## [2.29.0] - 2023-10-22
|
||||
|
||||
### Added
|
||||
|
|
@ -1094,6 +1101,7 @@ for info on changes for earlier releases.
|
|||
|
||||
[`memo-parser`]: ./memo-parser/README.md
|
||||
|
||||
[#2919]: https://github.com/import-js/eslint-plugin-import/pull/2919
|
||||
[#2884]: https://github.com/import-js/eslint-plugin-import/pull/2884
|
||||
[#2854]: https://github.com/import-js/eslint-plugin-import/pull/2854
|
||||
[#2851]: https://github.com/import-js/eslint-plugin-import/pull/2851
|
||||
|
|
@ -1431,6 +1439,8 @@ for info on changes for earlier releases.
|
|||
[#211]: https://github.com/import-js/eslint-plugin-import/pull/211
|
||||
[#164]: https://github.com/import-js/eslint-plugin-import/pull/164
|
||||
[#157]: https://github.com/import-js/eslint-plugin-import/pull/157
|
||||
|
||||
[#2930]: https://github.com/import-js/eslint-plugin-import/issues/2930
|
||||
[#2687]: https://github.com/import-js/eslint-plugin-import/issues/2687
|
||||
[#2684]: https://github.com/import-js/eslint-plugin-import/issues/2684
|
||||
[#2674]: https://github.com/import-js/eslint-plugin-import/issues/2674
|
||||
|
|
@ -1438,6 +1448,7 @@ for info on changes for earlier releases.
|
|||
[#2666]: https://github.com/import-js/eslint-plugin-import/issues/2666
|
||||
[#2665]: https://github.com/import-js/eslint-plugin-import/issues/2665
|
||||
[#2577]: https://github.com/import-js/eslint-plugin-import/issues/2577
|
||||
[#2447]: https://github.com/import-js/eslint-plugin-import/issues/2447
|
||||
[#2444]: https://github.com/import-js/eslint-plugin-import/issues/2444
|
||||
[#2412]: https://github.com/import-js/eslint-plugin-import/issues/2412
|
||||
[#2392]: https://github.com/import-js/eslint-plugin-import/issues/2392
|
||||
|
|
@ -1556,7 +1567,8 @@ for info on changes for earlier releases.
|
|||
[#119]: https://github.com/import-js/eslint-plugin-import/issues/119
|
||||
[#89]: https://github.com/import-js/eslint-plugin-import/issues/89
|
||||
|
||||
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...HEAD
|
||||
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.1...HEAD
|
||||
[2.29.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1
|
||||
[2.29.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.28.1...v2.29.0
|
||||
[2.28.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.28.0...v2.28.1
|
||||
[2.28.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0
|
||||
|
|
@ -1708,6 +1720,7 @@ for info on changes for earlier releases.
|
|||
[@devinrhode2]: https://github.com/devinrhode2
|
||||
[@devongovett]: https://github.com/devongovett
|
||||
[@dmnd]: https://github.com/dmnd
|
||||
[@domdomegg]: https://github.com/domdomegg
|
||||
[@duncanbeevers]: https://github.com/duncanbeevers
|
||||
[@dwardu]: https://github.com/dwardu
|
||||
[@echenley]: https://github.com/echenley
|
||||
|
|
@ -1830,6 +1843,7 @@ for info on changes for earlier releases.
|
|||
[@ntdb]: https://github.com/ntdb
|
||||
[@nwalters512]: https://github.com/nwalters512
|
||||
[@ombene]: https://github.com/ombene
|
||||
[@Pandemic1617]: https://github.com/Pandemic1617
|
||||
[@ota-meshi]: https://github.com/ota-meshi
|
||||
[@OutdatedVersion]: https://github.com/OutdatedVersion
|
||||
[@panrafal]: https://github.com/panrafal
|
||||
|
|
|
|||
3
node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js
generated
vendored
3
node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js
generated
vendored
File diff suppressed because one or more lines are too long
23
node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js
generated
vendored
23
node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js
generated
vendored
File diff suppressed because one or more lines are too long
10
node_modules/eslint-plugin-import/package.json
generated
vendored
10
node_modules/eslint-plugin-import/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "eslint-plugin-import",
|
||||
"version": "2.29.0",
|
||||
"version": "2.29.1",
|
||||
"description": "Import with sanity.",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
|
@ -69,11 +69,11 @@
|
|||
"babel-preset-flow": "^6.23.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"babylon": "^6.18.0",
|
||||
"chai": "^4.3.7",
|
||||
"chai": "^4.3.10",
|
||||
"cross-env": "^4.0.0",
|
||||
"escope": "^3.6.0",
|
||||
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8",
|
||||
"eslint-doc-generator": "^1.4.3",
|
||||
"eslint-doc-generator": "^1.6.1",
|
||||
"eslint-import-resolver-node": "file:./resolvers/node",
|
||||
"eslint-import-resolver-typescript": "^1.0.2 || ^1.1.1",
|
||||
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
"jackspeak": "=2.1.1",
|
||||
"linklocal": "^2.8.2",
|
||||
"lodash.isarray": "^4.0.0",
|
||||
"markdownlint-cli": "^0.35.0",
|
||||
"markdownlint-cli": "^0.38.0",
|
||||
"mocha": "^3.5.3",
|
||||
"npm-which": "^3.0.1",
|
||||
"nyc": "^11.9.0",
|
||||
|
|
@ -119,6 +119,6 @@
|
|||
"object.groupby": "^1.0.1",
|
||||
"object.values": "^1.1.7",
|
||||
"semver": "^6.3.1",
|
||||
"tsconfig-paths": "^3.14.2"
|
||||
"tsconfig-paths": "^3.15.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
node_modules/eslint/README.md
generated
vendored
28
node_modules/eslint/README.md
generated
vendored
|
|
@ -103,7 +103,7 @@ We are now at or near 100% compatibility with JSCS. If you try ESLint and believ
|
|||
|
||||
### Does Prettier replace ESLint?
|
||||
|
||||
No, ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use ESLint for everything, or you can combine both using Prettier to format your code and ESLint to catch possible errors.
|
||||
No, ESLint and Prettier have diffent jobs: ESLint is a linter (looking for problematic patterns) and Prettier is a code formatter. Using both tools is common, refer to [Prettier's documentation](https://prettier.io/docs/en/install#eslint-and-other-linters) to learn how to configure them to work well with each other.
|
||||
|
||||
### Why can't ESLint find my plugins?
|
||||
|
||||
|
|
@ -209,12 +209,12 @@ The people who manage releases, review feature requests, and meet regularly to e
|
|||
|
||||
<table><tbody><tr><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/nzakas">
|
||||
<img src="https://github.com/nzakas.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/nzakas.png?s=75" width="75" height="75" alt="Nicholas C. Zakas's Avatar"><br />
|
||||
Nicholas C. Zakas
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/mdjermanovic">
|
||||
<img src="https://github.com/mdjermanovic.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/mdjermanovic.png?s=75" width="75" height="75" alt="Milos Djermanovic's Avatar"><br />
|
||||
Milos Djermanovic
|
||||
</a>
|
||||
</td></tr></tbody></table>
|
||||
|
|
@ -225,12 +225,12 @@ The people who review and implement new features.
|
|||
|
||||
<table><tbody><tr><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/aladdin-add">
|
||||
<img src="https://github.com/aladdin-add.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/aladdin-add.png?s=75" width="75" height="75" alt="唯然's Avatar"><br />
|
||||
唯然
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/snitin315">
|
||||
<img src="https://github.com/snitin315.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/snitin315.png?s=75" width="75" height="75" alt="Nitin Kumar's Avatar"><br />
|
||||
Nitin Kumar
|
||||
</a>
|
||||
</td></tr></tbody></table>
|
||||
|
|
@ -241,22 +241,22 @@ The people who review and fix bugs and help triage issues.
|
|||
|
||||
<table><tbody><tr><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/bmish">
|
||||
<img src="https://github.com/bmish.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/bmish.png?s=75" width="75" height="75" alt="Bryan Mishkin's Avatar"><br />
|
||||
Bryan Mishkin
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/fasttime">
|
||||
<img src="https://github.com/fasttime.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/fasttime.png?s=75" width="75" height="75" alt="Francesco Trotta's Avatar"><br />
|
||||
Francesco Trotta
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/ota-meshi">
|
||||
<img src="https://github.com/ota-meshi.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/ota-meshi.png?s=75" width="75" height="75" alt="Yosuke Ota's Avatar"><br />
|
||||
Yosuke Ota
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/Tanujkanti4441">
|
||||
<img src="https://github.com/Tanujkanti4441.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/Tanujkanti4441.png?s=75" width="75" height="75" alt="Tanuj Kanti's Avatar"><br />
|
||||
Tanuj Kanti
|
||||
</a>
|
||||
</td></tr></tbody></table>
|
||||
|
|
@ -267,17 +267,17 @@ Team members who focus specifically on eslint.org
|
|||
|
||||
<table><tbody><tr><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/amareshsm">
|
||||
<img src="https://github.com/amareshsm.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/amareshsm.png?s=75" width="75" height="75" alt="Amaresh S M's Avatar"><br />
|
||||
Amaresh S M
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/harish-sethuraman">
|
||||
<img src="https://github.com/harish-sethuraman.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/harish-sethuraman.png?s=75" width="75" height="75" alt="Strek's Avatar"><br />
|
||||
Strek
|
||||
</a>
|
||||
</td><td align="center" valign="top" width="11%">
|
||||
<a href="https://github.com/kecrily">
|
||||
<img src="https://github.com/kecrily.png?s=75" width="75" height="75"><br />
|
||||
<img src="https://github.com/kecrily.png?s=75" width="75" height="75" alt="Percy Ma's Avatar"><br />
|
||||
Percy Ma
|
||||
</a>
|
||||
</td></tr></tbody></table>
|
||||
|
|
@ -293,8 +293,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
||||
<p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
|
||||
## Technology Sponsors
|
||||
|
|
|
|||
4
node_modules/eslint/lib/cli-engine/cli-engine.js
generated
vendored
4
node_modules/eslint/lib/cli-engine/cli-engine.js
generated
vendored
|
|
@ -83,7 +83,7 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
|
|||
* @property {string[]} [plugins] An array of plugins to load.
|
||||
* @property {Record<string,RuleConf>} [rules] An object of rules to use.
|
||||
* @property {string[]} [rulePaths] An array of directories to load custom rules from.
|
||||
* @property {boolean} [reportUnusedDisableDirectives] `true` adds reports for unused eslint-disable directives
|
||||
* @property {boolean|string} [reportUnusedDisableDirectives] `true`, `"error"` or '"warn"' adds reports for unused eslint-disable directives
|
||||
* @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file.
|
||||
* @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD
|
||||
*/
|
||||
|
|
@ -224,7 +224,7 @@ function calculateStatsPerRun(results) {
|
|||
* @param {ConfigArray} config.config The config.
|
||||
* @param {boolean} config.fix If `true` then it does fix.
|
||||
* @param {boolean} config.allowInlineConfig If `true` then it uses directive comments.
|
||||
* @param {boolean} config.reportUnusedDisableDirectives If `true` then it reports unused `eslint-disable` comments.
|
||||
* @param {boolean|string} config.reportUnusedDisableDirectives If `true`, `"error"` or '"warn"', then it reports unused `eslint-disable` comments.
|
||||
* @param {FileEnumerator} config.fileEnumerator The file enumerator to check if a path is a target or not.
|
||||
* @param {Linter} config.linter The linter instance to verify.
|
||||
* @returns {LintResult} The result of linting.
|
||||
|
|
|
|||
25
node_modules/eslint/lib/cli.js
generated
vendored
25
node_modules/eslint/lib/cli.js
generated
vendored
|
|
@ -22,7 +22,8 @@ const fs = require("fs"),
|
|||
{ FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"),
|
||||
createCLIOptions = require("./options"),
|
||||
log = require("./shared/logging"),
|
||||
RuntimeInfo = require("./shared/runtime-info");
|
||||
RuntimeInfo = require("./shared/runtime-info"),
|
||||
{ normalizeSeverityToString } = require("./shared/severity");
|
||||
const { Legacy: { naming } } = require("@eslint/eslintrc");
|
||||
const { ModuleImporter } = require("@humanwhocodes/module-importer");
|
||||
|
||||
|
|
@ -89,6 +90,7 @@ async function translateOptions({
|
|||
plugin,
|
||||
quiet,
|
||||
reportUnusedDisableDirectives,
|
||||
reportUnusedDisableDirectivesSeverity,
|
||||
resolvePluginsRelativeTo,
|
||||
rule,
|
||||
rulesdir,
|
||||
|
|
@ -125,6 +127,14 @@ async function translateOptions({
|
|||
rules: rule ? rule : {}
|
||||
}];
|
||||
|
||||
if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) {
|
||||
overrideConfig[0].linterOptions = {
|
||||
reportUnusedDisableDirectives: reportUnusedDisableDirectives
|
||||
? "error"
|
||||
: normalizeSeverityToString(reportUnusedDisableDirectivesSeverity)
|
||||
};
|
||||
}
|
||||
|
||||
if (parser) {
|
||||
overrideConfig[0].languageOptions.parser = await importer.import(parser);
|
||||
}
|
||||
|
|
@ -177,8 +187,7 @@ async function translateOptions({
|
|||
fixTypes: fixType,
|
||||
ignore,
|
||||
overrideConfig,
|
||||
overrideConfigFile,
|
||||
reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0
|
||||
overrideConfigFile
|
||||
};
|
||||
|
||||
if (configType === "flat") {
|
||||
|
|
@ -190,6 +199,11 @@ async function translateOptions({
|
|||
options.useEslintrc = eslintrc;
|
||||
options.extensions = ext;
|
||||
options.ignorePath = ignorePath;
|
||||
if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) {
|
||||
options.reportUnusedDisableDirectives = reportUnusedDisableDirectives
|
||||
? "error"
|
||||
: normalizeSeverityToString(reportUnusedDisableDirectivesSeverity);
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
|
|
@ -386,6 +400,11 @@ const cli = {
|
|||
return 2;
|
||||
}
|
||||
|
||||
if (options.reportUnusedDisableDirectives && options.reportUnusedDisableDirectivesSeverity !== void 0) {
|
||||
log.error("The --report-unused-disable-directives option and the --report-unused-disable-directives-severity option cannot be used together.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
const ActiveESLint = usingFlatConfig ? FlatESLint : ESLint;
|
||||
|
||||
const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"));
|
||||
|
|
|
|||
23
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
23
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
|
|
@ -14,6 +14,7 @@
|
|||
* starting in Node.js v17.
|
||||
*/
|
||||
const structuredClone = require("@ungap/structured-clone").default;
|
||||
const { normalizeSeverityToNumber } = require("../shared/severity");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Type Definitions
|
||||
|
|
@ -262,6 +263,26 @@ const booleanSchema = {
|
|||
validate: "boolean"
|
||||
};
|
||||
|
||||
const ALLOWED_SEVERITIES = new Set(["error", "warn", "off", 2, 1, 0]);
|
||||
|
||||
/** @type {ObjectPropertySchema} */
|
||||
const disableDirectiveSeveritySchema = {
|
||||
merge(first, second) {
|
||||
const value = second === void 0 ? first : second;
|
||||
|
||||
if (typeof value === "boolean") {
|
||||
return value ? "warn" : "off";
|
||||
}
|
||||
|
||||
return normalizeSeverityToNumber(value);
|
||||
},
|
||||
validate(value) {
|
||||
if (!(ALLOWED_SEVERITIES.has(value) || typeof value === "boolean")) {
|
||||
throw new TypeError("Expected one of: \"error\", \"warn\", \"off\", 0, 1, 2, or a boolean.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** @type {ObjectPropertySchema} */
|
||||
const deepObjectAssignSchema = {
|
||||
merge(first = {}, second = {}) {
|
||||
|
|
@ -534,7 +555,7 @@ const flatConfigSchema = {
|
|||
linterOptions: {
|
||||
schema: {
|
||||
noInlineConfig: booleanSchema,
|
||||
reportUnusedDisableDirectives: booleanSchema
|
||||
reportUnusedDisableDirectives: disableDirectiveSeveritySchema
|
||||
}
|
||||
},
|
||||
languageOptions: {
|
||||
|
|
|
|||
13
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
13
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
|
|
@ -675,7 +675,6 @@ function processOptions({
|
|||
overrideConfig = null,
|
||||
overrideConfigFile = null,
|
||||
plugins = {},
|
||||
reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that.
|
||||
warnIgnored = true,
|
||||
...unknownOptions
|
||||
}) {
|
||||
|
|
@ -720,6 +719,9 @@ function processOptions({
|
|||
if (unknownOptionKeys.includes("rulePaths")) {
|
||||
errors.push("'rulePaths' has been removed. Please define your rules using plugins.");
|
||||
}
|
||||
if (unknownOptionKeys.includes("reportUnusedDisableDirectives")) {
|
||||
errors.push("'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.");
|
||||
}
|
||||
}
|
||||
if (typeof allowInlineConfig !== "boolean") {
|
||||
errors.push("'allowInlineConfig' must be a boolean.");
|
||||
|
|
@ -774,14 +776,6 @@ function processOptions({
|
|||
if (Array.isArray(plugins)) {
|
||||
errors.push("'plugins' doesn't add plugins to configuration to load. Please use the 'overrideConfig.plugins' option instead.");
|
||||
}
|
||||
if (
|
||||
reportUnusedDisableDirectives !== "error" &&
|
||||
reportUnusedDisableDirectives !== "warn" &&
|
||||
reportUnusedDisableDirectives !== "off" &&
|
||||
reportUnusedDisableDirectives !== null
|
||||
) {
|
||||
errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.");
|
||||
}
|
||||
if (typeof warnIgnored !== "boolean") {
|
||||
errors.push("'warnIgnored' must be a boolean.");
|
||||
}
|
||||
|
|
@ -806,7 +800,6 @@ function processOptions({
|
|||
globInputPaths,
|
||||
ignore,
|
||||
ignorePatterns,
|
||||
reportUnusedDisableDirectives,
|
||||
warnIgnored
|
||||
};
|
||||
}
|
||||
|
|
|
|||
11
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
11
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// Note: Node.js 12 does not support fs/promises.
|
||||
const fs = require("fs").promises;
|
||||
const { existsSync } = require("fs");
|
||||
const path = require("path");
|
||||
const findUp = require("find-up");
|
||||
const { version } = require("../../package.json");
|
||||
|
|
@ -83,7 +84,6 @@ const LintResultCache = require("../cli-engine/lint-result-cache");
|
|||
* doesn't do any config file lookup when `true`; considered to be a config filename
|
||||
* when a string.
|
||||
* @property {Record<string,Plugin>} [plugins] An array of plugin implementations.
|
||||
* @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives.
|
||||
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||
*/
|
||||
|
||||
|
|
@ -448,7 +448,6 @@ async function calculateConfigArray(eslint, {
|
|||
* @param {FlatConfigArray} config.configs The config.
|
||||
* @param {boolean} config.fix If `true` then it does fix.
|
||||
* @param {boolean} config.allowInlineConfig If `true` then it uses directive comments.
|
||||
* @param {boolean} config.reportUnusedDisableDirectives If `true` then it reports unused `eslint-disable` comments.
|
||||
* @param {Linter} config.linter The linter instance to verify.
|
||||
* @returns {LintResult} The result of linting.
|
||||
* @private
|
||||
|
|
@ -460,7 +459,6 @@ function verifyText({
|
|||
configs,
|
||||
fix,
|
||||
allowInlineConfig,
|
||||
reportUnusedDisableDirectives,
|
||||
linter
|
||||
}) {
|
||||
const filePath = providedFilePath || "<text>";
|
||||
|
|
@ -480,7 +478,6 @@ function verifyText({
|
|||
allowInlineConfig,
|
||||
filename: filePathToVerify,
|
||||
fix,
|
||||
reportUnusedDisableDirectives,
|
||||
|
||||
/**
|
||||
* Check if the linter should adopt a given code block or not.
|
||||
|
|
@ -748,7 +745,6 @@ class FlatESLint {
|
|||
cwd,
|
||||
fix,
|
||||
fixTypes,
|
||||
reportUnusedDisableDirectives,
|
||||
globInputPaths,
|
||||
errorOnUnmatchedPattern,
|
||||
warnIgnored
|
||||
|
|
@ -766,7 +762,7 @@ class FlatESLint {
|
|||
const errorCode = error && error.code;
|
||||
|
||||
// Ignore errors when no such file exists or file system is read only (and cache file does not exist)
|
||||
if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !(await fs.exists(cacheFilePath)))) {
|
||||
if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !existsSync(cacheFilePath))) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -858,7 +854,6 @@ class FlatESLint {
|
|||
cwd,
|
||||
fix: fixer,
|
||||
allowInlineConfig,
|
||||
reportUnusedDisableDirectives,
|
||||
linter
|
||||
});
|
||||
|
||||
|
|
@ -943,7 +938,6 @@ class FlatESLint {
|
|||
allowInlineConfig,
|
||||
cwd,
|
||||
fix,
|
||||
reportUnusedDisableDirectives,
|
||||
warnIgnored: constructorWarnIgnored
|
||||
} = eslintOptions;
|
||||
const results = [];
|
||||
|
|
@ -967,7 +961,6 @@ class FlatESLint {
|
|||
cwd,
|
||||
fix,
|
||||
allowInlineConfig,
|
||||
reportUnusedDisableDirectives,
|
||||
linter
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
36
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
36
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
|
|
@ -15,7 +15,10 @@ const levn = require("levn"),
|
|||
Legacy: {
|
||||
ConfigOps
|
||||
}
|
||||
} = require("@eslint/eslintrc/universal");
|
||||
} = require("@eslint/eslintrc/universal"),
|
||||
{
|
||||
directivesPattern
|
||||
} = require("../shared/directives");
|
||||
|
||||
const debug = require("debug")("eslint:config-comment-parser");
|
||||
|
||||
|
|
@ -148,4 +151,35 @@ module.exports = class ConfigCommentParser {
|
|||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {Comment} comment The comment node with the directive to be parsed.
|
||||
* @returns {{directiveText: string, directiveValue: string}} The directive text and value.
|
||||
*/
|
||||
parseDirective(comment) {
|
||||
const { directivePart } = this.extractDirectiveComment(comment.value);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(match.index + directiveText.length);
|
||||
|
||||
return { directiveText, directiveValue };
|
||||
}
|
||||
};
|
||||
|
|
|
|||
33
node_modules/eslint/lib/linter/linter.js
generated
vendored
33
node_modules/eslint/lib/linter/linter.js
generated
vendored
|
|
@ -44,6 +44,7 @@ const { getRuleFromConfig } = require("../config/flat-config-helpers");
|
|||
const { FlatConfigArray } = require("../config/flat-config-array");
|
||||
const { RuleValidator } = require("../config/rule-validator");
|
||||
const { assertIsRuleOptions, assertIsRuleSeverity } = require("../config/flat-config-schema");
|
||||
const { normalizeSeverityToString } = require("../shared/severity");
|
||||
const debug = require("debug")("eslint:linter");
|
||||
const MAX_AUTOFIX_PASSES = 10;
|
||||
const DEFAULT_PARSER_NAME = "espree";
|
||||
|
|
@ -316,24 +317,6 @@ function createDisableDirectives(options) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
function extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses comments in file to extract file-specific config of rules, globals
|
||||
* and environments and merges them with global config; also code blocks
|
||||
|
|
@ -355,7 +338,7 @@ function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig) {
|
|||
});
|
||||
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
const { directivePart, justificationPart } = commentParser.extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
|
|
@ -500,7 +483,7 @@ function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper) {
|
|||
const disableDirectives = [];
|
||||
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
const { directivePart, justificationPart } = commentParser.extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
|
|
@ -620,7 +603,7 @@ function findEslintEnv(text) {
|
|||
if (match[0].endsWith("*/")) {
|
||||
retv = Object.assign(
|
||||
retv || {},
|
||||
commentParser.parseListConfig(extractDirectiveComment(match[1]).directivePart)
|
||||
commentParser.parseListConfig(commentParser.extractDirectiveComment(match[1]).directivePart)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -671,9 +654,11 @@ function normalizeVerifyOptions(providedOptions, config) {
|
|||
reportUnusedDisableDirectives = reportUnusedDisableDirectives ? "error" : "off";
|
||||
}
|
||||
if (typeof reportUnusedDisableDirectives !== "string") {
|
||||
reportUnusedDisableDirectives =
|
||||
linterOptions.reportUnusedDisableDirectives
|
||||
? "warn" : "off";
|
||||
if (typeof linterOptions.reportUnusedDisableDirectives === "boolean") {
|
||||
reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives ? "warn" : "off";
|
||||
} else {
|
||||
reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives === void 0 ? "off" : normalizeSeverityToString(linterOptions.reportUnusedDisableDirectives);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
8
node_modules/eslint/lib/options.js
generated
vendored
8
node_modules/eslint/lib/options.js
generated
vendored
|
|
@ -48,6 +48,7 @@ const optionator = require("optionator");
|
|||
* @property {string[]} [plugin] Specify plugins
|
||||
* @property {string} [printConfig] Print the configuration for the given file
|
||||
* @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable and eslint-enable directives
|
||||
* @property {string | undefined} reportUnusedDisableDirectivesSeverity A severity string indicating if and how unused disable and enable directives should be tracked and reported.
|
||||
* @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default
|
||||
* @property {Object} [rule] Specify rules
|
||||
* @property {string[]} [rulesdir] Load additional rules from this directory. Deprecated: Use rules from plugins
|
||||
|
|
@ -306,6 +307,13 @@ module.exports = function(usingFlatConfig) {
|
|||
default: void 0,
|
||||
description: "Adds reported errors for unused eslint-disable and eslint-enable directives"
|
||||
},
|
||||
{
|
||||
option: "report-unused-disable-directives-severity",
|
||||
type: "String",
|
||||
default: void 0,
|
||||
description: "Chooses severity level for reporting unused eslint-disable and eslint-enable directives",
|
||||
enum: ["off", "warn", "error", "0", "1", "2"]
|
||||
},
|
||||
{
|
||||
heading: "Caching"
|
||||
},
|
||||
|
|
|
|||
2
node_modules/eslint/lib/rules/no-invalid-this.js
generated
vendored
2
node_modules/eslint/lib/rules/no-invalid-this.js
generated
vendored
|
|
@ -96,7 +96,7 @@ module.exports = {
|
|||
|
||||
if (codePath.origin === "program") {
|
||||
const scope = sourceCode.getScope(node);
|
||||
const features = context.parserOptions.ecmaFeatures || {};
|
||||
const features = context.languageOptions.parserOptions.ecmaFeatures || {};
|
||||
|
||||
// `this` at the top level of scripts always refers to the global object
|
||||
stack.push({
|
||||
|
|
|
|||
15
node_modules/eslint/lib/rules/no-promise-executor-return.js
generated
vendored
15
node_modules/eslint/lib/rules/no-promise-executor-return.js
generated
vendored
|
|
@ -209,12 +209,15 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
|
||||
suggest.push({
|
||||
messageId: "wrapBraces",
|
||||
fix(fixer) {
|
||||
return curlyWrapFixer(sourceCode, node, fixer);
|
||||
}
|
||||
});
|
||||
// Do not suggest wrapping an unnamed FunctionExpression in braces as that would be invalid syntax.
|
||||
if (!(node.body.type === "FunctionExpression" && !node.body.id)) {
|
||||
suggest.push({
|
||||
messageId: "wrapBraces",
|
||||
fix(fixer) {
|
||||
return curlyWrapFixer(sourceCode, node, fixer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: node.body,
|
||||
|
|
|
|||
41
node_modules/eslint/lib/rules/no-restricted-properties.js
generated
vendored
41
node_modules/eslint/lib/rules/no-restricted-properties.js
generated
vendored
|
|
@ -142,40 +142,27 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);`
|
||||
* @param {ASTNode} node An AssignmentExpression or AssignmentPattern node
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function checkDestructuringAssignment(node) {
|
||||
if (node.right.type === "Identifier") {
|
||||
const objectName = node.right.name;
|
||||
|
||||
if (node.left.type === "ObjectPattern") {
|
||||
node.left.properties.forEach(property => {
|
||||
checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
checkPropertyAccess(node, node.object && node.object.name, astUtils.getStaticPropertyName(node));
|
||||
},
|
||||
VariableDeclarator(node) {
|
||||
if (node.init && node.init.type === "Identifier") {
|
||||
const objectName = node.init.name;
|
||||
ObjectPattern(node) {
|
||||
let objectName = null;
|
||||
|
||||
if (node.id.type === "ObjectPattern") {
|
||||
node.id.properties.forEach(property => {
|
||||
checkPropertyAccess(node.id, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
if (node.parent.type === "VariableDeclarator") {
|
||||
if (node.parent.init && node.parent.init.type === "Identifier") {
|
||||
objectName = node.parent.init.name;
|
||||
}
|
||||
} else if (node.parent.type === "AssignmentExpression" || node.parent.type === "AssignmentPattern") {
|
||||
if (node.parent.right.type === "Identifier") {
|
||||
objectName = node.parent.right.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
AssignmentExpression: checkDestructuringAssignment,
|
||||
AssignmentPattern: checkDestructuringAssignment
|
||||
|
||||
node.properties.forEach(property => {
|
||||
checkPropertyAccess(node, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
49
node_modules/eslint/lib/shared/severity.js
generated
vendored
Normal file
49
node_modules/eslint/lib/shared/severity.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* @fileoverview Helpers for severity values (e.g. normalizing different types).
|
||||
* @author Bryan Mishkin
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Convert severity value of different types to a string.
|
||||
* @param {string|number} severity severity value
|
||||
* @throws error if severity is invalid
|
||||
* @returns {string} severity string
|
||||
*/
|
||||
function normalizeSeverityToString(severity) {
|
||||
if ([2, "2", "error"].includes(severity)) {
|
||||
return "error";
|
||||
}
|
||||
if ([1, "1", "warn"].includes(severity)) {
|
||||
return "warn";
|
||||
}
|
||||
if ([0, "0", "off"].includes(severity)) {
|
||||
return "off";
|
||||
}
|
||||
throw new Error(`Invalid severity value: ${severity}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert severity value of different types to a number.
|
||||
* @param {string|number} severity severity value
|
||||
* @throws error if severity is invalid
|
||||
* @returns {number} severity number
|
||||
*/
|
||||
function normalizeSeverityToNumber(severity) {
|
||||
if ([2, "2", "error"].includes(severity)) {
|
||||
return 2;
|
||||
}
|
||||
if ([1, "1", "warn"].includes(severity)) {
|
||||
return 1;
|
||||
}
|
||||
if ([0, "0", "off"].includes(severity)) {
|
||||
return 0;
|
||||
}
|
||||
throw new Error(`Invalid severity value: ${severity}`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
normalizeSeverityToString,
|
||||
normalizeSeverityToNumber
|
||||
};
|
||||
25
node_modules/eslint/lib/source-code/source-code.js
generated
vendored
25
node_modules/eslint/lib/source-code/source-code.js
generated
vendored
|
|
@ -212,24 +212,6 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) {
|
|||
// Directive Comments
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
function extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that variables representing built-in properties of the Global Object,
|
||||
* and any globals declared by special block comments, are present in the global
|
||||
|
|
@ -921,7 +903,7 @@ class SourceCode extends TokenStore {
|
|||
return false;
|
||||
}
|
||||
|
||||
const { directivePart } = extractDirectiveComment(comment.value);
|
||||
const { directivePart } = commentParser.extractDirectiveComment(comment.value);
|
||||
|
||||
const directiveMatch = directivesPattern.exec(directivePart);
|
||||
|
||||
|
|
@ -977,10 +959,7 @@ class SourceCode extends TokenStore {
|
|||
|
||||
this.getInlineConfigNodes().forEach(comment => {
|
||||
|
||||
const { directivePart } = extractDirectiveComment(comment.value);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(match.index + directiveText.length);
|
||||
const { directiveText, directiveValue } = commentParser.parseDirective(comment);
|
||||
|
||||
switch (directiveText) {
|
||||
case "exported":
|
||||
|
|
|
|||
12
node_modules/eslint/package.json
generated
vendored
12
node_modules/eslint/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "eslint",
|
||||
"version": "8.55.0",
|
||||
"version": "8.56.0",
|
||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||
"description": "An AST-based pattern checker for JavaScript.",
|
||||
"bin": {
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "8.55.0",
|
||||
"@eslint/js": "8.56.0",
|
||||
"@humanwhocodes/config-array": "^0.11.13",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
|
@ -119,11 +119,11 @@
|
|||
"eslint": "file:.",
|
||||
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-eslint-plugin": "^5.1.0",
|
||||
"eslint-plugin-eslint-plugin": "^5.2.1",
|
||||
"eslint-plugin-internal-rules": "file:tools/internal-rules",
|
||||
"eslint-plugin-jsdoc": "^46.2.5",
|
||||
"eslint-plugin-n": "^16.0.0",
|
||||
"eslint-plugin-unicorn": "^42.0.0",
|
||||
"eslint-plugin-n": "^16.4.0",
|
||||
"eslint-plugin-unicorn": "^49.0.0",
|
||||
"eslint-release": "^3.2.0",
|
||||
"eslump": "^3.0.0",
|
||||
"esprima": "^4.0.1",
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
"load-perf": "^0.2.0",
|
||||
"markdown-it": "^12.2.0",
|
||||
"markdown-it-container": "^3.0.0",
|
||||
"markdownlint": "^0.31.1",
|
||||
"markdownlint": "^0.32.0",
|
||||
"markdownlint-cli": "^0.37.0",
|
||||
"marked": "^4.0.8",
|
||||
"memfs": "^3.0.1",
|
||||
|
|
|
|||
6
node_modules/tsconfig-paths/CHANGELOG.md
generated
vendored
6
node_modules/tsconfig-paths/CHANGELOG.md
generated
vendored
|
|
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.15.0] - 2023-12-14
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for extends as array of strings to v3 (backport of #245). See PR #260. Thanks to [@domdomegg](https://github.com/domdomegg) for this PR!
|
||||
|
||||
## [3.14.1] - 2022-03-22
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
94
node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js
generated
vendored
94
node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js
generated
vendored
|
|
@ -112,25 +112,30 @@ describe("walkForTsConfig", function () {
|
|||
});
|
||||
});
|
||||
describe("loadConfig", function () {
|
||||
it("It should load a config", function () {
|
||||
it("should load a config", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return JSON.stringify(config); });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("It should load a config with comments", function () {
|
||||
it("should load a config with comments", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n // my comment\n \"compilerOptions\": { \n \"baseUrl\": \"hej\"\n }\n }"; });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("It should load a config with trailing commas", function () {
|
||||
it("should load a config with trailing commas", function () {
|
||||
var config = { compilerOptions: { baseUrl: "hej" } };
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n \"compilerOptions\": { \n \"baseUrl\": \"hej\",\n },\n }"; });
|
||||
// assert.deepEqual(res, config);
|
||||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
it("It should load a config with extends and overwrite all options", function () {
|
||||
it("should throw an error including the file path when encountering invalid JSON5", function () {
|
||||
expect(function () {
|
||||
return (0, tsconfig_loader_1.loadTsconfig)("/root/dir1/tsconfig.json", function (path) { return path === "/root/dir1/tsconfig.json"; }, function (_) { return "{\n \"compilerOptions\": {\n }"; });
|
||||
}).toThrowError("/root/dir1/tsconfig.json is malformed JSON5: invalid end of input at 3:12");
|
||||
});
|
||||
it("should load a config with string extends and overwrite all options", function () {
|
||||
var firstConfig = {
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -170,7 +175,7 @@ describe("loadConfig", function () {
|
|||
},
|
||||
});
|
||||
});
|
||||
it("It should load a config with extends from node_modules and overwrite all options", function () {
|
||||
it("should load a config with string extends from node_modules and overwrite all options", function () {
|
||||
var firstConfig = {
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -210,7 +215,7 @@ describe("loadConfig", function () {
|
|||
},
|
||||
});
|
||||
});
|
||||
it("Should use baseUrl relative to location of extended tsconfig", function () {
|
||||
it("should use baseUrl relative to location of extended tsconfig", function () {
|
||||
var firstConfig = { compilerOptions: { baseUrl: "." } };
|
||||
var firstConfigPath = (0, path_1.join)("/root", "first-config.json");
|
||||
var secondConfig = { extends: "../first-config.json" };
|
||||
|
|
@ -242,5 +247,82 @@ describe("loadConfig", function () {
|
|||
compilerOptions: { baseUrl: (0, path_1.join)("..", "..") },
|
||||
});
|
||||
});
|
||||
it("should load a config with array extends and overwrite all options", function () {
|
||||
var baseConfig1 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
var baseConfig1Path = (0, path_1.join)("/root", "base-config-1.json");
|
||||
var baseConfig2 = { compilerOptions: { baseUrl: "." } };
|
||||
var baseConfig2Path = (0, path_1.join)("/root", "dir1", "base-config-2.json");
|
||||
var baseConfig3 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
var baseConfig3Path = (0, path_1.join)("/root", "dir1", "dir2", "base-config-3.json");
|
||||
var actualConfig = {
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
};
|
||||
var actualConfigPath = (0, path_1.join)("/root", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "tsconfig.json"), function (path) {
|
||||
return [
|
||||
baseConfig1Path,
|
||||
baseConfig2Path,
|
||||
baseConfig3Path,
|
||||
actualConfigPath,
|
||||
].indexOf(path) >= 0;
|
||||
}, function (path) {
|
||||
if (path === baseConfig1Path) {
|
||||
return JSON.stringify(baseConfig1);
|
||||
}
|
||||
if (path === baseConfig2Path) {
|
||||
return JSON.stringify(baseConfig2);
|
||||
}
|
||||
if (path === baseConfig3Path) {
|
||||
return JSON.stringify(baseConfig3);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expect(res).toEqual({
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
compilerOptions: {
|
||||
baseUrl: (0, path_1.join)("dir1", "dir2"),
|
||||
paths: { foo: ["bar2"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
it("should load a config with array extends without .json extension", function () {
|
||||
var baseConfig = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
var baseConfigPath = (0, path_1.join)("/root", "base-config-1.json");
|
||||
var actualConfig = { extends: ["./base-config-1"] };
|
||||
var actualConfigPath = (0, path_1.join)("/root", "tsconfig.json");
|
||||
var res = (0, tsconfig_loader_1.loadTsconfig)((0, path_1.join)("/root", "tsconfig.json"), function (path) { return [baseConfigPath, actualConfigPath].indexOf(path) >= 0; }, function (path) {
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expect(res).toEqual({
|
||||
extends: ["./base-config-1"],
|
||||
compilerOptions: {
|
||||
baseUrl: ".",
|
||||
paths: { foo: ["bar"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=tsconfig-loader.test.js.map
|
||||
2
node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map
generated
vendored
2
node_modules/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts
generated
vendored
2
node_modules/tsconfig-paths/lib/tsconfig-loader.d.ts
generated
vendored
|
|
@ -2,7 +2,7 @@
|
|||
* Typing for the parts of tsconfig that we care about
|
||||
*/
|
||||
export interface Tsconfig {
|
||||
extends?: string;
|
||||
extends?: string | string[];
|
||||
compilerOptions?: {
|
||||
baseUrl?: string;
|
||||
paths?: {
|
||||
|
|
|
|||
66
node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
66
node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
|
|
@ -82,30 +82,60 @@ function loadTsconfig(configFilePath, existsSync, readFileSync) {
|
|||
}
|
||||
var configString = readFileSync(configFilePath);
|
||||
var cleanedJson = StripBom(configString);
|
||||
var config = JSON5.parse(cleanedJson);
|
||||
var config;
|
||||
try {
|
||||
config = JSON5.parse(cleanedJson);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
|
||||
}
|
||||
var extendedConfig = config.extends;
|
||||
if (extendedConfig) {
|
||||
if (typeof extendedConfig === "string" &&
|
||||
extendedConfig.indexOf(".json") === -1) {
|
||||
extendedConfig += ".json";
|
||||
var base = void 0;
|
||||
if (Array.isArray(extendedConfig)) {
|
||||
base = extendedConfig.reduce(function (currBase, extendedConfigElement) {
|
||||
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync, readFileSync));
|
||||
}, {});
|
||||
}
|
||||
var currentDir = path.dirname(configFilePath);
|
||||
var extendedConfigPath = path.join(currentDir, extendedConfig);
|
||||
if (extendedConfig.indexOf("/") !== -1 &&
|
||||
extendedConfig.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)) {
|
||||
extendedConfigPath = path.join(currentDir, "node_modules", extendedConfig);
|
||||
else {
|
||||
base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync, readFileSync);
|
||||
}
|
||||
var base = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
// baseUrl should be interpreted as relative to the base tsconfig,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if (base.compilerOptions && base.compilerOptions.baseUrl) {
|
||||
var extendsDir = path.dirname(extendedConfig);
|
||||
base.compilerOptions.baseUrl = path.join(extendsDir, base.compilerOptions.baseUrl);
|
||||
}
|
||||
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
|
||||
return mergeTsconfigs(base, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
exports.loadTsconfig = loadTsconfig;
|
||||
/**
|
||||
* Intended to be called only from loadTsconfig.
|
||||
* Parameters don't have defaults because they should use the same as loadTsconfig.
|
||||
*/
|
||||
function loadTsconfigFromExtends(configFilePath, extendedConfigValue,
|
||||
// eslint-disable-next-line no-shadow
|
||||
existsSync, readFileSync) {
|
||||
var _a;
|
||||
if (typeof extendedConfigValue === "string" &&
|
||||
extendedConfigValue.indexOf(".json") === -1) {
|
||||
extendedConfigValue += ".json";
|
||||
}
|
||||
var currentDir = path.dirname(configFilePath);
|
||||
var extendedConfigPath = path.join(currentDir, extendedConfigValue);
|
||||
if (extendedConfigValue.indexOf("/") !== -1 &&
|
||||
extendedConfigValue.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)) {
|
||||
extendedConfigPath = path.join(currentDir, "node_modules", extendedConfigValue);
|
||||
}
|
||||
var config = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
// baseUrl should be interpreted as relative to extendedConfigPath,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
|
||||
var extendsDir = path.dirname(extendedConfigValue);
|
||||
config.compilerOptions.baseUrl = path.join(extendsDir, config.compilerOptions.baseUrl);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
function mergeTsconfigs(base, config) {
|
||||
base = base || {};
|
||||
config = config || {};
|
||||
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
|
||||
}
|
||||
//# sourceMappingURL=tsconfig-loader.js.map
|
||||
2
node_modules/tsconfig-paths/lib/tsconfig-loader.js.map
generated
vendored
2
node_modules/tsconfig-paths/lib/tsconfig-loader.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"tsconfig-loader.js","sourceRoot":"","sources":["../src/tsconfig-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,uBAAyB;AACzB,oCAAoC;AACpC,6BAAgC;AAChC,oCAAuC;AA+BvC,SAAgB,cAAc,CAAC,EAIR;QAHrB,MAAM,YAAA,EACN,GAAG,SAAA,EACH,gBAA0B,EAA1B,QAAQ,mBAAG,eAAe,KAAA;IAE1B,IAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAClD,IAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAElD,sEAAsE;IACtE,8DAA8D;IAC9D,IAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;IACnE,OAAO,UAAU,CAAC;AACpB,CAAC;AAZD,wCAYC;AAED,SAAS,eAAe,CACtB,GAAW,EACX,QAAiB,EACjB,OAAgB;IAEhB,2FAA2F;IAE3F,IAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,CAAC,UAAU,EAAE;QACf,OAAO;YACL,YAAY,EAAE,SAAS;YACvB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,SAAS;SACjB,CAAC;KACH;IACD,IAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;IAExC,OAAO;QACL,YAAY,EAAE,UAAU;QACxB,OAAO,EACL,OAAO;YACP,CAAC,MAAM,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC;QACtE,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,KAAK;KACxE,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW,E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ACT,eAAe,wBACV,IAAI,CAAC,eAAe,GACpB,MAAM,CAAC,eAAe,KAE3B;AACJ,CAAC"}
|
||||
2
node_modules/tsconfig-paths/package.json
generated
vendored
2
node_modules/tsconfig-paths/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tsconfig-paths",
|
||||
"version": "3.14.2",
|
||||
"version": "3.15.0",
|
||||
"description": "Load node modules according to tsconfig paths, in run-time or via API.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
|
|
|||
116
node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
116
node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
|
|
@ -133,7 +133,7 @@ describe("walkForTsConfig", () => {
|
|||
});
|
||||
|
||||
describe("loadConfig", () => {
|
||||
it("It should load a config", () => {
|
||||
it("should load a config", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -144,7 +144,7 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with comments", () => {
|
||||
it("should load a config with comments", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -160,7 +160,7 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with trailing commas", () => {
|
||||
it("should load a config with trailing commas", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -175,7 +175,21 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with extends and overwrite all options", () => {
|
||||
it("should throw an error including the file path when encountering invalid JSON5", () => {
|
||||
expect(() =>
|
||||
loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => `{
|
||||
"compilerOptions": {
|
||||
}`
|
||||
)
|
||||
).toThrowError(
|
||||
"/root/dir1/tsconfig.json is malformed JSON5: invalid end of input at 3:12"
|
||||
);
|
||||
});
|
||||
|
||||
it("should load a config with string extends and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -221,7 +235,7 @@ describe("loadConfig", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("It should load a config with extends from node_modules and overwrite all options", () => {
|
||||
it("should load a config with string extends from node_modules and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -273,7 +287,7 @@ describe("loadConfig", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("Should use baseUrl relative to location of extended tsconfig", () => {
|
||||
it("should use baseUrl relative to location of extended tsconfig", () => {
|
||||
const firstConfig = { compilerOptions: { baseUrl: "." } };
|
||||
const firstConfigPath = join("/root", "first-config.json");
|
||||
const secondConfig = { extends: "../first-config.json" };
|
||||
|
|
@ -309,4 +323,94 @@ describe("loadConfig", () => {
|
|||
compilerOptions: { baseUrl: join("..", "..") },
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends and overwrite all options", () => {
|
||||
const baseConfig1 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfig1Path = join("/root", "base-config-1.json");
|
||||
const baseConfig2 = { compilerOptions: { baseUrl: "." } };
|
||||
const baseConfig2Path = join("/root", "dir1", "base-config-2.json");
|
||||
const baseConfig3 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
const baseConfig3Path = join("/root", "dir1", "dir2", "base-config-3.json");
|
||||
const actualConfig = {
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
};
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) =>
|
||||
[
|
||||
baseConfig1Path,
|
||||
baseConfig2Path,
|
||||
baseConfig3Path,
|
||||
actualConfigPath,
|
||||
].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfig1Path) {
|
||||
return JSON.stringify(baseConfig1);
|
||||
}
|
||||
if (path === baseConfig2Path) {
|
||||
return JSON.stringify(baseConfig2);
|
||||
}
|
||||
if (path === baseConfig3Path) {
|
||||
return JSON.stringify(baseConfig3);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
compilerOptions: {
|
||||
baseUrl: join("dir1", "dir2"),
|
||||
paths: { foo: ["bar2"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends without .json extension", () => {
|
||||
const baseConfig = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfigPath = join("/root", "base-config-1.json");
|
||||
const actualConfig = { extends: ["./base-config-1"] };
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) => [baseConfigPath, actualConfigPath].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: ["./base-config-1"],
|
||||
compilerOptions: {
|
||||
baseUrl: ".",
|
||||
paths: { foo: ["bar"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
136
node_modules/tsconfig-paths/src/tsconfig-loader.ts
generated
vendored
136
node_modules/tsconfig-paths/src/tsconfig-loader.ts
generated
vendored
|
|
@ -9,7 +9,7 @@ import StripBom = require("strip-bom");
|
|||
* Typing for the parts of tsconfig that we care about
|
||||
*/
|
||||
export interface Tsconfig {
|
||||
extends?: string;
|
||||
extends?: string | string[];
|
||||
compilerOptions?: {
|
||||
baseUrl?: string;
|
||||
paths?: { [key: string]: Array<string> };
|
||||
|
|
@ -122,51 +122,105 @@ export function loadTsconfig(
|
|||
|
||||
const configString = readFileSync(configFilePath);
|
||||
const cleanedJson = StripBom(configString);
|
||||
const config: Tsconfig = JSON5.parse(cleanedJson);
|
||||
let config: Tsconfig;
|
||||
try {
|
||||
config = JSON5.parse(cleanedJson);
|
||||
} catch (e) {
|
||||
throw new Error(`${configFilePath} is malformed ${e.message}`);
|
||||
}
|
||||
|
||||
let extendedConfig = config.extends;
|
||||
|
||||
if (extendedConfig) {
|
||||
if (
|
||||
typeof extendedConfig === "string" &&
|
||||
extendedConfig.indexOf(".json") === -1
|
||||
) {
|
||||
extendedConfig += ".json";
|
||||
}
|
||||
const currentDir = path.dirname(configFilePath);
|
||||
let extendedConfigPath = path.join(currentDir, extendedConfig);
|
||||
if (
|
||||
extendedConfig.indexOf("/") !== -1 &&
|
||||
extendedConfig.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)
|
||||
) {
|
||||
extendedConfigPath = path.join(
|
||||
currentDir,
|
||||
"node_modules",
|
||||
extendedConfig
|
||||
let base: Tsconfig;
|
||||
|
||||
if (Array.isArray(extendedConfig)) {
|
||||
base = extendedConfig.reduce(
|
||||
(currBase, extendedConfigElement) =>
|
||||
mergeTsconfigs(
|
||||
currBase,
|
||||
loadTsconfigFromExtends(
|
||||
configFilePath,
|
||||
extendedConfigElement,
|
||||
existsSync,
|
||||
readFileSync
|
||||
)
|
||||
),
|
||||
{}
|
||||
);
|
||||
} else {
|
||||
base = loadTsconfigFromExtends(
|
||||
configFilePath,
|
||||
extendedConfig,
|
||||
existsSync,
|
||||
readFileSync
|
||||
);
|
||||
}
|
||||
|
||||
const base =
|
||||
loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
|
||||
// baseUrl should be interpreted as relative to the base tsconfig,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if (base.compilerOptions && base.compilerOptions.baseUrl) {
|
||||
const extendsDir = path.dirname(extendedConfig);
|
||||
base.compilerOptions.baseUrl = path.join(
|
||||
extendsDir,
|
||||
base.compilerOptions.baseUrl
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...base,
|
||||
...config,
|
||||
compilerOptions: {
|
||||
...base.compilerOptions,
|
||||
...config.compilerOptions,
|
||||
},
|
||||
};
|
||||
return mergeTsconfigs(base, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intended to be called only from loadTsconfig.
|
||||
* Parameters don't have defaults because they should use the same as loadTsconfig.
|
||||
*/
|
||||
function loadTsconfigFromExtends(
|
||||
configFilePath: string,
|
||||
extendedConfigValue: string,
|
||||
// eslint-disable-next-line no-shadow
|
||||
existsSync: (path: string) => boolean,
|
||||
readFileSync: (filename: string) => string
|
||||
): Tsconfig {
|
||||
if (
|
||||
typeof extendedConfigValue === "string" &&
|
||||
extendedConfigValue.indexOf(".json") === -1
|
||||
) {
|
||||
extendedConfigValue += ".json";
|
||||
}
|
||||
const currentDir = path.dirname(configFilePath);
|
||||
let extendedConfigPath = path.join(currentDir, extendedConfigValue);
|
||||
if (
|
||||
extendedConfigValue.indexOf("/") !== -1 &&
|
||||
extendedConfigValue.indexOf(".") !== -1 &&
|
||||
!existsSync(extendedConfigPath)
|
||||
) {
|
||||
extendedConfigPath = path.join(
|
||||
currentDir,
|
||||
"node_modules",
|
||||
extendedConfigValue
|
||||
);
|
||||
}
|
||||
|
||||
const config =
|
||||
loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
||||
|
||||
// baseUrl should be interpreted as relative to extendedConfigPath,
|
||||
// but we need to update it so it is relative to the original tsconfig being loaded
|
||||
if (config.compilerOptions?.baseUrl) {
|
||||
const extendsDir = path.dirname(extendedConfigValue);
|
||||
config.compilerOptions.baseUrl = path.join(
|
||||
extendsDir,
|
||||
config.compilerOptions.baseUrl
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function mergeTsconfigs(
|
||||
base: Tsconfig | undefined,
|
||||
config: Tsconfig | undefined
|
||||
): Tsconfig {
|
||||
base = base || {};
|
||||
config = config || {};
|
||||
|
||||
return {
|
||||
...base,
|
||||
...config,
|
||||
compilerOptions: {
|
||||
...base.compilerOptions,
|
||||
...config.compilerOptions,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
32
package-lock.json
generated
32
package-lock.json
generated
|
|
@ -48,11 +48,11 @@
|
|||
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
||||
"@typescript-eslint/parser": "^6.14.0",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.4.0",
|
||||
|
|
@ -505,9 +505,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.55.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz",
|
||||
"integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz",
|
||||
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
|
|
@ -2554,15 +2554,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.55.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
|
||||
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
|
||||
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "8.55.0",
|
||||
"@eslint/js": "8.56.0",
|
||||
"@humanwhocodes/config-array": "^0.11.13",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
|
@ -2776,9 +2776,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz",
|
||||
"integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==",
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
|
||||
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-includes": "^3.1.7",
|
||||
|
|
@ -2797,7 +2797,7 @@
|
|||
"object.groupby": "^1.0.1",
|
||||
"object.values": "^1.1.7",
|
||||
"semver": "^6.3.1",
|
||||
"tsconfig-paths": "^3.14.2"
|
||||
"tsconfig-paths": "^3.15.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
|
@ -5972,9 +5972,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
|
||||
"integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==",
|
||||
"version": "3.15.0",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
|
||||
"integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json5": "^0.0.29",
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@
|
|||
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
||||
"@typescript-eslint/parser": "^6.14.0",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.4.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue