first commit
This commit is contained in:
50
app_vue/node_modules/@eslint/eslintrc/CHANGELOG.md
generated
vendored
Normal file
50
app_vue/node_modules/@eslint/eslintrc/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
v0.4.3 - July 17, 2021
|
||||
|
||||
* [`ce78027`](https://github.com/eslint/eslintrc/commit/ce78027f6a319a29fdf0b78ac1e7071373acffc4) Fix: ensure config files are files (#42) (Tom Jenkinson)
|
||||
* [`95b1c9b`](https://github.com/eslint/eslintrc/commit/95b1c9b30267479a75cd07768f8f9e9cfa63c105) Chore: pin fs-teardown@0.1.1 (#45) (Milos Djermanovic)
|
||||
* [`593fbe3`](https://github.com/eslint/eslintrc/commit/593fbe3c2c1c5f723f71810963ed21a56caed4c1) Chore: fix failing test (#44) (Tom Jenkinson)
|
||||
|
||||
v0.4.2 - June 4, 2021
|
||||
|
||||
* [`cc79a4d`](https://github.com/eslint/eslintrc/commit/cc79a4db45a2ca0236a846ed8eba28eea07d4db5) Upgrade: update globals to version 13.6 (#32) (Rouven Weßling)
|
||||
|
||||
v0.4.1 - May 7, 2021
|
||||
|
||||
* [`aa38ef4`](https://github.com/eslint/eslintrc/commit/aa38ef40c3123f8f534c7f9b0b7c306f5f011dce) Fix: Properly export module resolver (#34) (Richie Bendall)
|
||||
* [`62ea4bd`](https://github.com/eslint/eslintrc/commit/62ea4bd74b78fbeff12ffb21f1f978817601d4d1) Build: add node v16 (#33) (薛定谔的猫)
|
||||
* [`7c43d77`](https://github.com/eslint/eslintrc/commit/7c43d7784e39cf0b7b102af64f703cade11252bb) Chore: add tests for built-in rules config schema validation (fixes #15) (#31) (Milos Djermanovic)
|
||||
* [`d8ea601`](https://github.com/eslint/eslintrc/commit/d8ea601ecb4b9f81cdc332b012b6b1bbc984366c) Chore: Test on Node 15.x (#30) (Milos Djermanovic)
|
||||
* [`0b2f80d`](https://github.com/eslint/eslintrc/commit/0b2f80d6f6b33e4c5e168b08468867653f726754) Chore: lint test files (#18) (Milos Djermanovic)
|
||||
|
||||
v0.4.0 - February 27, 2021
|
||||
|
||||
* [`d9a527b`](https://github.com/eslint/eslintrc/commit/d9a527bdb16af46a28d37fa9022131149970a438) New: Implement DotCompat class (#20) (Nicholas C. Zakas)
|
||||
* [`dac76c0`](https://github.com/eslint/eslintrc/commit/dac76c035a9ab9d315050f688867373966aab288) Chore: Replace usage of lodash with cache set (#29) (Tim van der Lippe)
|
||||
* [`3ae2d77`](https://github.com/eslint/eslintrc/commit/3ae2d770cb810c026de817e6861e25dac111da9f) Update: add AggregateError global to es2021 environment (#28) (Milos Djermanovic)
|
||||
|
||||
v0.3.0 - January 15, 2021
|
||||
|
||||
* [`5184490`](https://github.com/eslint/eslintrc/commit/51844902bc4132f264f05a0614f2cdeb89290f68) Upgrade: lodash@4.17.20 (#24) (Milos Djermanovic)
|
||||
* [`f1179c5`](https://github.com/eslint/eslintrc/commit/f1179c587ae09fabb5c3402598363cfcec2494f7) Update: Implement missing functionality from ESLint port (fixes #12) (#23) (Nicholas C. Zakas)
|
||||
|
||||
v0.2.2 - December 5, 2020
|
||||
|
||||
* [`1746840`](https://github.com/eslint/eslintrc/commit/17468407c1baf05747cb261c91f7f7b7c2a82422) Fix: include loadRules in internalSlotsMap cache (#19) (Henry Q. Dineen)
|
||||
* [`f30bb49`](https://github.com/eslint/eslintrc/commit/f30bb4935aaf3f4c1b268490da495a59647e58d8) Chore: Test fixes for CascadingConfigArrayFactory (#17) (Nicholas C. Zakas)
|
||||
* [`4440df8`](https://github.com/eslint/eslintrc/commit/4440df8237a127e15cbde5c697353e1224f12ec1) Chore: Fix config-array tests (#16) (Nicholas C. Zakas)
|
||||
* [`7890e02`](https://github.com/eslint/eslintrc/commit/7890e027df530a0fb53bcf5751c8c7a008b2a494) Chore: Test fixes for config-array-factory.js (#13) (Nicholas C. Zakas)
|
||||
|
||||
v0.2.1 - October 26, 2020
|
||||
|
||||
* [`8b202ff`](https://github.com/eslint/eslintrc/commit/8b202ff866a39efdaad6394fde9f88372afbfca8) Fix: validate schema for built-in rules (#14) (Milos Djermanovic)
|
||||
* [`04f3cae`](https://github.com/eslint/eslintrc/commit/04f3cae17fe07b2fd0b74fd3e88482b3094e75e3) Fix: cache compiled config schema (#9) (Milos Djermanovic)
|
||||
|
||||
v0.2.0 - October 16, 2020
|
||||
|
||||
* [`cb12255`](https://github.com/eslint/eslintrc/commit/cb12255b85390e932e1942e479c2c97310149390) Update: Allow eslint:all and eslint:recommended paths to be passed in (#11) (Nicholas C. Zakas)
|
||||
* [`a75bacd`](https://github.com/eslint/eslintrc/commit/a75bacd9a743a7bbcdb8c59e5d4f9de3dc8b0f20) Chore: use GitHub Actions (#10) (Milos Djermanovic)
|
||||
|
||||
v0.1.3 - September 1, 2020
|
||||
|
||||
* [`8647a61`](https://github.com/eslint/eslintrc/commit/8647a61991fe121f923d33e96232475209b78210) Fix: version number and eslint-release version (refs #6) (Nicholas C. Zakas)
|
||||
|
21
app_vue/node_modules/@eslint/eslintrc/LICENSE
generated
vendored
Normal file
21
app_vue/node_modules/@eslint/eslintrc/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 ESLint
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
61
app_vue/node_modules/@eslint/eslintrc/README.md
generated
vendored
Normal file
61
app_vue/node_modules/@eslint/eslintrc/README.md
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
# ESLintRC Library
|
||||
|
||||
This repository contains the legacy ESLintRC configuration file format for ESLint.
|
||||
|
||||
**Note:** This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install the package as follows:
|
||||
|
||||
```
|
||||
npm install @eslint/eslintrc --save-dev
|
||||
|
||||
# or
|
||||
|
||||
yarn add @eslint/eslintrc -D
|
||||
```
|
||||
|
||||
## Future Usage
|
||||
|
||||
**Note:** This package is not intended for public use at this time. The following is an example of how it will be used in the future.
|
||||
|
||||
The primary class in this package is `FlatCompat`, which is a utility to translate ESLintRC-style configs into flat configs. Here's how you use it inside of your `eslint.config.js` file:
|
||||
|
||||
```js
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const compat = new FlatCompat();
|
||||
|
||||
export default [
|
||||
|
||||
// mimic ESLintRC-style extends
|
||||
compat.extends("standard", "example"),
|
||||
|
||||
// mimic environments
|
||||
compat.env({
|
||||
es2020: true,
|
||||
node: true
|
||||
}),
|
||||
|
||||
// mimic plugins
|
||||
compat.plugins("airbnb", "react"),
|
||||
|
||||
// translate an entire config
|
||||
compat.config({
|
||||
plugins: ["airbnb", "react"],
|
||||
extends: "standard",
|
||||
env: {
|
||||
es2020: true,
|
||||
node: true
|
||||
},
|
||||
rules: {
|
||||
semi: "error"
|
||||
}
|
||||
})
|
||||
];
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
81
app_vue/node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
Normal file
81
app_vue/node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @fileoverview Defines a schema for configs.
|
||||
* @author Sylvan Mably
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const baseConfigProperties = {
|
||||
$schema: { type: "string" },
|
||||
env: { type: "object" },
|
||||
extends: { $ref: "#/definitions/stringOrStrings" },
|
||||
globals: { type: "object" },
|
||||
overrides: {
|
||||
type: "array",
|
||||
items: { $ref: "#/definitions/overrideConfig" },
|
||||
additionalItems: false
|
||||
},
|
||||
parser: { type: ["string", "null"] },
|
||||
parserOptions: { type: "object" },
|
||||
plugins: { type: "array" },
|
||||
processor: { type: "string" },
|
||||
rules: { type: "object" },
|
||||
settings: { type: "object" },
|
||||
noInlineConfig: { type: "boolean" },
|
||||
reportUnusedDisableDirectives: { type: "boolean" },
|
||||
|
||||
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
|
||||
};
|
||||
|
||||
const configSchema = {
|
||||
definitions: {
|
||||
stringOrStrings: {
|
||||
oneOf: [
|
||||
{ type: "string" },
|
||||
{
|
||||
type: "array",
|
||||
items: { type: "string" },
|
||||
additionalItems: false
|
||||
}
|
||||
]
|
||||
},
|
||||
stringOrStringsRequired: {
|
||||
oneOf: [
|
||||
{ type: "string" },
|
||||
{
|
||||
type: "array",
|
||||
items: { type: "string" },
|
||||
additionalItems: false,
|
||||
minItems: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Config at top-level.
|
||||
objectConfig: {
|
||||
type: "object",
|
||||
properties: {
|
||||
root: { type: "boolean" },
|
||||
ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
|
||||
...baseConfigProperties
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
|
||||
// Config in `overrides`.
|
||||
overrideConfig: {
|
||||
type: "object",
|
||||
properties: {
|
||||
excludedFiles: { $ref: "#/definitions/stringOrStrings" },
|
||||
files: { $ref: "#/definitions/stringOrStringsRequired" },
|
||||
...baseConfigProperties
|
||||
},
|
||||
required: ["files"],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
|
||||
$ref: "#/definitions/objectConfig"
|
||||
};
|
||||
|
||||
module.exports = configSchema;
|
180
app_vue/node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
Normal file
180
app_vue/node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
/**
|
||||
* @fileoverview Defines environment settings and globals.
|
||||
* @author Elan Shanker
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const globals = require("globals");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get the object that has difference.
|
||||
* @param {Record<string,boolean>} current The newer object.
|
||||
* @param {Record<string,boolean>} prev The older object.
|
||||
* @returns {Record<string,boolean>} The difference object.
|
||||
*/
|
||||
function getDiff(current, prev) {
|
||||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
|
||||
const newGlobals2017 = {
|
||||
Atomics: false,
|
||||
SharedArrayBuffer: false
|
||||
};
|
||||
const newGlobals2020 = {
|
||||
BigInt: false,
|
||||
BigInt64Array: false,
|
||||
BigUint64Array: false,
|
||||
globalThis: false
|
||||
};
|
||||
|
||||
const newGlobals2021 = {
|
||||
AggregateError: false,
|
||||
FinalizationRegistry: false,
|
||||
WeakRef: false
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {Map<string, import("../lib/shared/types").Environment>} */
|
||||
module.exports = new Map(Object.entries({
|
||||
|
||||
// Language
|
||||
builtin: {
|
||||
globals: globals.es5
|
||||
},
|
||||
es6: {
|
||||
globals: newGlobals2015,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6
|
||||
}
|
||||
},
|
||||
es2015: {
|
||||
globals: newGlobals2015,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6
|
||||
}
|
||||
},
|
||||
es2017: {
|
||||
globals: { ...newGlobals2015, ...newGlobals2017 },
|
||||
parserOptions: {
|
||||
ecmaVersion: 8
|
||||
}
|
||||
},
|
||||
es2020: {
|
||||
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
|
||||
parserOptions: {
|
||||
ecmaVersion: 11
|
||||
}
|
||||
},
|
||||
es2021: {
|
||||
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
|
||||
parserOptions: {
|
||||
ecmaVersion: 12
|
||||
}
|
||||
},
|
||||
|
||||
// Platforms
|
||||
browser: {
|
||||
globals: globals.browser
|
||||
},
|
||||
node: {
|
||||
globals: globals.node,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
globalReturn: true
|
||||
}
|
||||
}
|
||||
},
|
||||
"shared-node-browser": {
|
||||
globals: globals["shared-node-browser"]
|
||||
},
|
||||
worker: {
|
||||
globals: globals.worker
|
||||
},
|
||||
serviceworker: {
|
||||
globals: globals.serviceworker
|
||||
},
|
||||
|
||||
// Frameworks
|
||||
commonjs: {
|
||||
globals: globals.commonjs,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
globalReturn: true
|
||||
}
|
||||
}
|
||||
},
|
||||
amd: {
|
||||
globals: globals.amd
|
||||
},
|
||||
mocha: {
|
||||
globals: globals.mocha
|
||||
},
|
||||
jasmine: {
|
||||
globals: globals.jasmine
|
||||
},
|
||||
jest: {
|
||||
globals: globals.jest
|
||||
},
|
||||
phantomjs: {
|
||||
globals: globals.phantomjs
|
||||
},
|
||||
jquery: {
|
||||
globals: globals.jquery
|
||||
},
|
||||
qunit: {
|
||||
globals: globals.qunit
|
||||
},
|
||||
prototypejs: {
|
||||
globals: globals.prototypejs
|
||||
},
|
||||
shelljs: {
|
||||
globals: globals.shelljs
|
||||
},
|
||||
meteor: {
|
||||
globals: globals.meteor
|
||||
},
|
||||
mongo: {
|
||||
globals: globals.mongo
|
||||
},
|
||||
protractor: {
|
||||
globals: globals.protractor
|
||||
},
|
||||
applescript: {
|
||||
globals: globals.applescript
|
||||
},
|
||||
nashorn: {
|
||||
globals: globals.nashorn
|
||||
},
|
||||
atomtest: {
|
||||
globals: globals.atomtest
|
||||
},
|
||||
embertest: {
|
||||
globals: globals.embertest
|
||||
},
|
||||
webextensions: {
|
||||
globals: globals.webextensions
|
||||
},
|
||||
greasemonkey: {
|
||||
globals: globals.greasemonkey
|
||||
}
|
||||
}));
|
12
app_vue/node_modules/@eslint/eslintrc/conf/eslint-all.js
generated
vendored
Normal file
12
app_vue/node_modules/@eslint/eslintrc/conf/eslint-all.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @fileoverview Stub eslint:all config
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
settings: {
|
||||
"eslint:all": true
|
||||
}
|
||||
};
|
12
app_vue/node_modules/@eslint/eslintrc/conf/eslint-recommended.js
generated
vendored
Normal file
12
app_vue/node_modules/@eslint/eslintrc/conf/eslint-recommended.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @fileoverview Stub eslint:recommended config
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
settings: {
|
||||
"eslint:recommended": true
|
||||
}
|
||||
};
|
519
app_vue/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
Normal file
519
app_vue/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
Normal file
@ -0,0 +1,519 @@
|
||||
/**
|
||||
* @fileoverview `CascadingConfigArrayFactory` class.
|
||||
*
|
||||
* `CascadingConfigArrayFactory` class has a responsibility:
|
||||
*
|
||||
* 1. Handles cascading of config files.
|
||||
*
|
||||
* It provides two methods:
|
||||
*
|
||||
* - `getConfigArrayForFile(filePath)`
|
||||
* Get the corresponded configuration of a given file. This method doesn't
|
||||
* throw even if the given file didn't exist.
|
||||
* - `clearCache()`
|
||||
* Clear the internal cache. You have to call this method when
|
||||
* `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends
|
||||
* on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const ConfigValidator = require("./shared/config-validator");
|
||||
const { emitDeprecationWarning } = require("./shared/deprecation-warnings");
|
||||
const { ConfigArrayFactory } = require("./config-array-factory");
|
||||
const { ConfigArray, ConfigDependency, IgnorePattern } = require("./config-array");
|
||||
const debug = require("debug")("eslintrc:cascading-config-array-factory");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Define types for VSCode IntelliSense.
|
||||
/** @typedef {import("./shared/types").ConfigData} ConfigData */
|
||||
/** @typedef {import("./shared/types").Parser} Parser */
|
||||
/** @typedef {import("./shared/types").Plugin} Plugin */
|
||||
/** @typedef {import("./shared/types").Rule} Rule */
|
||||
/** @typedef {ReturnType<ConfigArrayFactory["create"]>} ConfigArray */
|
||||
|
||||
/**
|
||||
* @typedef {Object} CascadingConfigArrayFactoryOptions
|
||||
* @property {Map<string,Plugin>} [additionalPluginPool] The map for additional plugins.
|
||||
* @property {ConfigData} [baseConfig] The config by `baseConfig` option.
|
||||
* @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.
|
||||
* @property {string} [cwd] The base directory to start lookup.
|
||||
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
||||
* @property {string[]} [rulePaths] The value of `--rulesdir` option.
|
||||
* @property {string} [specificConfigPath] The value of `--config` option.
|
||||
* @property {boolean} [useEslintrc] if `false` then it doesn't load config files.
|
||||
* @property {Function} loadRules The function to use to load rules.
|
||||
* @property {Map<string,Rule>} builtInRules The rules that are built in to ESLint.
|
||||
* @property {Object} [resolver=ModuleResolver] The module resolver object.
|
||||
* @property {string} eslintAllPath The path to the definitions for eslint:all.
|
||||
* @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} CascadingConfigArrayFactoryInternalSlots
|
||||
* @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.
|
||||
* @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.
|
||||
* @property {ConfigArray} cliConfigArray The config array of CLI options.
|
||||
* @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.
|
||||
* @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.
|
||||
* @property {Map<string, ConfigArray>} configCache The cache from directory paths to config arrays.
|
||||
* @property {string} cwd The base directory to start lookup.
|
||||
* @property {WeakMap<ConfigArray, ConfigArray>} finalizeCache The cache from config arrays to finalized config arrays.
|
||||
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
||||
* @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.
|
||||
* @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.
|
||||
* @property {boolean} useEslintrc if `false` then it doesn't load config files.
|
||||
* @property {Function} loadRules The function to use to load rules.
|
||||
* @property {Map<string,Rule>} builtInRules The rules that are built in to ESLint.
|
||||
* @property {Object} [resolver=ModuleResolver] The module resolver object.
|
||||
* @property {string} eslintAllPath The path to the definitions for eslint:all.
|
||||
* @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.
|
||||
*/
|
||||
|
||||
/** @type {WeakMap<CascadingConfigArrayFactory, CascadingConfigArrayFactoryInternalSlots>} */
|
||||
const internalSlotsMap = new WeakMap();
|
||||
|
||||
/**
|
||||
* Create the config array from `baseConfig` and `rulePaths`.
|
||||
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
||||
* @returns {ConfigArray} The config array of the base configs.
|
||||
*/
|
||||
function createBaseConfigArray({
|
||||
configArrayFactory,
|
||||
baseConfigData,
|
||||
rulePaths,
|
||||
cwd,
|
||||
loadRules
|
||||
}) {
|
||||
const baseConfigArray = configArrayFactory.create(
|
||||
baseConfigData,
|
||||
{ name: "BaseConfig" }
|
||||
);
|
||||
|
||||
/*
|
||||
* Create the config array element for the default ignore patterns.
|
||||
* This element has `ignorePattern` property that ignores the default
|
||||
* patterns in the current working directory.
|
||||
*/
|
||||
baseConfigArray.unshift(configArrayFactory.create(
|
||||
{ ignorePatterns: IgnorePattern.DefaultPatterns },
|
||||
{ name: "DefaultIgnorePattern" }
|
||||
)[0]);
|
||||
|
||||
/*
|
||||
* Load rules `--rulesdir` option as a pseudo plugin.
|
||||
* Use a pseudo plugin to define rules of `--rulesdir`, so we can validate
|
||||
* the rule's options with only information in the config array.
|
||||
*/
|
||||
if (rulePaths && rulePaths.length > 0) {
|
||||
baseConfigArray.push({
|
||||
type: "config",
|
||||
name: "--rulesdir",
|
||||
filePath: "",
|
||||
plugins: {
|
||||
"": new ConfigDependency({
|
||||
definition: {
|
||||
rules: rulePaths.reduce(
|
||||
(map, rulesPath) => Object.assign(
|
||||
map,
|
||||
loadRules(rulesPath, cwd)
|
||||
),
|
||||
{}
|
||||
)
|
||||
},
|
||||
filePath: "",
|
||||
id: "",
|
||||
importerName: "--rulesdir",
|
||||
importerPath: ""
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return baseConfigArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the config array from CLI options.
|
||||
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
||||
* @returns {ConfigArray} The config array of the base configs.
|
||||
*/
|
||||
function createCLIConfigArray({
|
||||
cliConfigData,
|
||||
configArrayFactory,
|
||||
cwd,
|
||||
ignorePath,
|
||||
specificConfigPath
|
||||
}) {
|
||||
const cliConfigArray = configArrayFactory.create(
|
||||
cliConfigData,
|
||||
{ name: "CLIOptions" }
|
||||
);
|
||||
|
||||
cliConfigArray.unshift(
|
||||
...(ignorePath
|
||||
? configArrayFactory.loadESLintIgnore(ignorePath)
|
||||
: configArrayFactory.loadDefaultESLintIgnore())
|
||||
);
|
||||
|
||||
if (specificConfigPath) {
|
||||
cliConfigArray.unshift(
|
||||
...configArrayFactory.loadFile(
|
||||
specificConfigPath,
|
||||
{ name: "--config", basePath: cwd }
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return cliConfigArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* The error type when there are files matched by a glob, but all of them have been ignored.
|
||||
*/
|
||||
class ConfigurationNotFoundError extends Error {
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @param {string} directoryPath The directory path.
|
||||
*/
|
||||
constructor(directoryPath) {
|
||||
super(`No ESLint configuration found in ${directoryPath}.`);
|
||||
this.messageTemplate = "no-config-found";
|
||||
this.messageData = { directoryPath };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides the functionality that enumerates every file which is
|
||||
* matched by given glob patterns and that configuration.
|
||||
*/
|
||||
class CascadingConfigArrayFactory {
|
||||
|
||||
/**
|
||||
* Initialize this enumerator.
|
||||
* @param {CascadingConfigArrayFactoryOptions} options The options.
|
||||
*/
|
||||
constructor({
|
||||
additionalPluginPool = new Map(),
|
||||
baseConfig: baseConfigData = null,
|
||||
cliConfig: cliConfigData = null,
|
||||
cwd = process.cwd(),
|
||||
ignorePath,
|
||||
resolvePluginsRelativeTo,
|
||||
rulePaths = [],
|
||||
specificConfigPath = null,
|
||||
useEslintrc = true,
|
||||
builtInRules = new Map(),
|
||||
loadRules,
|
||||
resolver,
|
||||
eslintRecommendedPath,
|
||||
eslintAllPath
|
||||
} = {}) {
|
||||
const configArrayFactory = new ConfigArrayFactory({
|
||||
additionalPluginPool,
|
||||
cwd,
|
||||
resolvePluginsRelativeTo,
|
||||
builtInRules,
|
||||
resolver,
|
||||
eslintRecommendedPath,
|
||||
eslintAllPath
|
||||
});
|
||||
|
||||
internalSlotsMap.set(this, {
|
||||
baseConfigArray: createBaseConfigArray({
|
||||
baseConfigData,
|
||||
configArrayFactory,
|
||||
cwd,
|
||||
rulePaths,
|
||||
loadRules,
|
||||
resolver
|
||||
}),
|
||||
baseConfigData,
|
||||
cliConfigArray: createCLIConfigArray({
|
||||
cliConfigData,
|
||||
configArrayFactory,
|
||||
cwd,
|
||||
ignorePath,
|
||||
specificConfigPath
|
||||
}),
|
||||
cliConfigData,
|
||||
configArrayFactory,
|
||||
configCache: new Map(),
|
||||
cwd,
|
||||
finalizeCache: new WeakMap(),
|
||||
ignorePath,
|
||||
rulePaths,
|
||||
specificConfigPath,
|
||||
useEslintrc,
|
||||
builtInRules,
|
||||
loadRules
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The path to the current working directory.
|
||||
* This is used by tests.
|
||||
* @type {string}
|
||||
*/
|
||||
get cwd() {
|
||||
const { cwd } = internalSlotsMap.get(this);
|
||||
|
||||
return cwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the config array of a given file.
|
||||
* If `filePath` was not given, it returns the config which contains only
|
||||
* `baseConfigData` and `cliConfigData`.
|
||||
* @param {string} [filePath] The file path to a file.
|
||||
* @param {Object} [options] The options.
|
||||
* @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||
* @returns {ConfigArray} The config array of the file.
|
||||
*/
|
||||
getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {
|
||||
const {
|
||||
baseConfigArray,
|
||||
cliConfigArray,
|
||||
cwd
|
||||
} = internalSlotsMap.get(this);
|
||||
|
||||
if (!filePath) {
|
||||
return new ConfigArray(...baseConfigArray, ...cliConfigArray);
|
||||
}
|
||||
|
||||
const directoryPath = path.dirname(path.resolve(cwd, filePath));
|
||||
|
||||
debug(`Load config files for ${directoryPath}.`);
|
||||
|
||||
return this._finalizeConfigArray(
|
||||
this._loadConfigInAncestors(directoryPath),
|
||||
directoryPath,
|
||||
ignoreNotFoundError
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the config data to override all configs.
|
||||
* Require to call `clearCache()` method after this method is called.
|
||||
* @param {ConfigData} configData The config data to override all configs.
|
||||
* @returns {void}
|
||||
*/
|
||||
setOverrideConfig(configData) {
|
||||
const slots = internalSlotsMap.get(this);
|
||||
|
||||
slots.cliConfigData = configData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear config cache.
|
||||
* @returns {void}
|
||||
*/
|
||||
clearCache() {
|
||||
const slots = internalSlotsMap.get(this);
|
||||
|
||||
slots.baseConfigArray = createBaseConfigArray(slots);
|
||||
slots.cliConfigArray = createCLIConfigArray(slots);
|
||||
slots.configCache.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and normalize config files from the ancestor directories.
|
||||
* @param {string} directoryPath The path to a leaf directory.
|
||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @private
|
||||
*/
|
||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||
const {
|
||||
baseConfigArray,
|
||||
configArrayFactory,
|
||||
configCache,
|
||||
cwd,
|
||||
useEslintrc
|
||||
} = internalSlotsMap.get(this);
|
||||
|
||||
if (!useEslintrc) {
|
||||
return baseConfigArray;
|
||||
}
|
||||
|
||||
let configArray = configCache.get(directoryPath);
|
||||
|
||||
// Hit cache.
|
||||
if (configArray) {
|
||||
debug(`Cache hit: ${directoryPath}.`);
|
||||
return configArray;
|
||||
}
|
||||
debug(`No cache found: ${directoryPath}.`);
|
||||
|
||||
const homePath = os.homedir();
|
||||
|
||||
// Consider this is root.
|
||||
if (directoryPath === homePath && cwd !== homePath) {
|
||||
debug("Stop traversing because of considered root.");
|
||||
if (configsExistInSubdirs) {
|
||||
const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);
|
||||
|
||||
if (filePath) {
|
||||
emitDeprecationWarning(
|
||||
filePath,
|
||||
"ESLINT_PERSONAL_CONFIG_SUPPRESS"
|
||||
);
|
||||
}
|
||||
}
|
||||
return this._cacheConfig(directoryPath, baseConfigArray);
|
||||
}
|
||||
|
||||
// Load the config on this directory.
|
||||
try {
|
||||
configArray = configArrayFactory.loadInDirectory(directoryPath);
|
||||
} catch (error) {
|
||||
/* istanbul ignore next */
|
||||
if (error.code === "EACCES") {
|
||||
debug("Stop traversing because of 'EACCES' error.");
|
||||
return this._cacheConfig(directoryPath, baseConfigArray);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (configArray.length > 0 && configArray.isRoot()) {
|
||||
debug("Stop traversing because of 'root:true'.");
|
||||
configArray.unshift(...baseConfigArray);
|
||||
return this._cacheConfig(directoryPath, configArray);
|
||||
}
|
||||
|
||||
// Load from the ancestors and merge it.
|
||||
const parentPath = path.dirname(directoryPath);
|
||||
const parentConfigArray = parentPath && parentPath !== directoryPath
|
||||
? this._loadConfigInAncestors(
|
||||
parentPath,
|
||||
configsExistInSubdirs || configArray.length > 0
|
||||
)
|
||||
: baseConfigArray;
|
||||
|
||||
if (configArray.length > 0) {
|
||||
configArray.unshift(...parentConfigArray);
|
||||
} else {
|
||||
configArray = parentConfigArray;
|
||||
}
|
||||
|
||||
// Cache and return.
|
||||
return this._cacheConfig(directoryPath, configArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze and cache a given config.
|
||||
* @param {string} directoryPath The path to a directory as a cache key.
|
||||
* @param {ConfigArray} configArray The config array as a cache value.
|
||||
* @returns {ConfigArray} The `configArray` (frozen).
|
||||
*/
|
||||
_cacheConfig(directoryPath, configArray) {
|
||||
const { configCache } = internalSlotsMap.get(this);
|
||||
|
||||
Object.freeze(configArray);
|
||||
configCache.set(directoryPath, configArray);
|
||||
|
||||
return configArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize a given config array.
|
||||
* Concatenate `--config` and other CLI options.
|
||||
* @param {ConfigArray} configArray The parent config array.
|
||||
* @param {string} directoryPath The path to the leaf directory to find config files.
|
||||
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @private
|
||||
*/
|
||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||
const {
|
||||
cliConfigArray,
|
||||
configArrayFactory,
|
||||
finalizeCache,
|
||||
useEslintrc,
|
||||
builtInRules
|
||||
} = internalSlotsMap.get(this);
|
||||
|
||||
let finalConfigArray = finalizeCache.get(configArray);
|
||||
|
||||
if (!finalConfigArray) {
|
||||
finalConfigArray = configArray;
|
||||
|
||||
// Load the personal config if there are no regular config files.
|
||||
if (
|
||||
useEslintrc &&
|
||||
configArray.every(c => !c.filePath) &&
|
||||
cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.
|
||||
) {
|
||||
const homePath = os.homedir();
|
||||
|
||||
debug("Loading the config file of the home directory:", homePath);
|
||||
|
||||
const personalConfigArray = configArrayFactory.loadInDirectory(
|
||||
homePath,
|
||||
{ name: "PersonalConfig" }
|
||||
);
|
||||
|
||||
if (
|
||||
personalConfigArray.length > 0 &&
|
||||
!directoryPath.startsWith(homePath)
|
||||
) {
|
||||
const lastElement =
|
||||
personalConfigArray[personalConfigArray.length - 1];
|
||||
|
||||
emitDeprecationWarning(
|
||||
lastElement.filePath,
|
||||
"ESLINT_PERSONAL_CONFIG_LOAD"
|
||||
);
|
||||
}
|
||||
|
||||
finalConfigArray = finalConfigArray.concat(personalConfigArray);
|
||||
}
|
||||
|
||||
// Apply CLI options.
|
||||
if (cliConfigArray.length > 0) {
|
||||
finalConfigArray = finalConfigArray.concat(cliConfigArray);
|
||||
}
|
||||
|
||||
// Validate rule settings and environments.
|
||||
const validator = new ConfigValidator({
|
||||
builtInRules
|
||||
});
|
||||
|
||||
validator.validateConfigArray(finalConfigArray);
|
||||
|
||||
// Cache it.
|
||||
Object.freeze(finalConfigArray);
|
||||
finalizeCache.set(configArray, finalConfigArray);
|
||||
|
||||
debug(
|
||||
"Configuration was determined: %o on %s",
|
||||
finalConfigArray,
|
||||
directoryPath
|
||||
);
|
||||
}
|
||||
|
||||
// At least one element (the default ignore patterns) exists.
|
||||
if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {
|
||||
throw new ConfigurationNotFoundError(directoryPath);
|
||||
}
|
||||
|
||||
return finalConfigArray;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = { CascadingConfigArrayFactory };
|
1099
app_vue/node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
Normal file
1099
app_vue/node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
524
app_vue/node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
Normal file
524
app_vue/node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
Normal file
@ -0,0 +1,524 @@
|
||||
/**
|
||||
* @fileoverview `ConfigArray` class.
|
||||
*
|
||||
* `ConfigArray` class expresses the full of a configuration. It has the entry
|
||||
* config file, base config files that were extended, loaded parsers, and loaded
|
||||
* plugins.
|
||||
*
|
||||
* `ConfigArray` class provides three properties and two methods.
|
||||
*
|
||||
* - `pluginEnvironments`
|
||||
* - `pluginProcessors`
|
||||
* - `pluginRules`
|
||||
* The `Map` objects that contain the members of all plugins that this
|
||||
* config array contains. Those map objects don't have mutation methods.
|
||||
* Those keys are the member ID such as `pluginId/memberName`.
|
||||
* - `isRoot()`
|
||||
* If `true` then this configuration has `root:true` property.
|
||||
* - `extractConfig(filePath)`
|
||||
* Extract the final configuration for a given file. This means merging
|
||||
* every config array element which that `criteria` property matched. The
|
||||
* `filePath` argument must be an absolute path.
|
||||
*
|
||||
* `ConfigArrayFactory` provides the loading logic of config files.
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const { ExtractedConfig } = require("./extracted-config");
|
||||
const { IgnorePattern } = require("./ignore-pattern");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Define types for VSCode IntelliSense.
|
||||
/** @typedef {import("../../shared/types").Environment} Environment */
|
||||
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
||||
/** @typedef {import("../../shared/types").RuleConf} RuleConf */
|
||||
/** @typedef {import("../../shared/types").Rule} Rule */
|
||||
/** @typedef {import("../../shared/types").Plugin} Plugin */
|
||||
/** @typedef {import("../../shared/types").Processor} Processor */
|
||||
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
||||
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
||||
/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */
|
||||
|
||||
/**
|
||||
* @typedef {Object} ConfigArrayElement
|
||||
* @property {string} name The name of this config element.
|
||||
* @property {string} filePath The path to the source file of this config element.
|
||||
* @property {InstanceType<OverrideTester>|null} criteria The tester for the `files` and `excludedFiles` of this config element.
|
||||
* @property {Record<string, boolean>|undefined} env The environment settings.
|
||||
* @property {Record<string, GlobalConf>|undefined} globals The global variable settings.
|
||||
* @property {IgnorePattern|undefined} ignorePattern The ignore patterns.
|
||||
* @property {boolean|undefined} noInlineConfig The flag that disables directive comments.
|
||||
* @property {DependentParser|undefined} parser The parser loader.
|
||||
* @property {Object|undefined} parserOptions The parser options.
|
||||
* @property {Record<string, DependentPlugin>|undefined} plugins The plugin loaders.
|
||||
* @property {string|undefined} processor The processor name to refer plugin's processor.
|
||||
* @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
|
||||
* @property {boolean|undefined} root The flag to express root.
|
||||
* @property {Record<string, RuleConf>|undefined} rules The rule settings
|
||||
* @property {Object|undefined} settings The shared settings.
|
||||
* @property {"config" | "ignore" | "implicit-processor"} type The element type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ConfigArrayInternalSlots
|
||||
* @property {Map<string, ExtractedConfig>} cache The cache to extract configs.
|
||||
* @property {ReadonlyMap<string, Environment>|null} envMap The map from environment ID to environment definition.
|
||||
* @property {ReadonlyMap<string, Processor>|null} processorMap The map from processor ID to environment definition.
|
||||
* @property {ReadonlyMap<string, Rule>|null} ruleMap The map from rule ID to rule definition.
|
||||
*/
|
||||
|
||||
/** @type {WeakMap<ConfigArray, ConfigArrayInternalSlots>} */
|
||||
const internalSlotsMap = new class extends WeakMap {
|
||||
get(key) {
|
||||
let value = super.get(key);
|
||||
|
||||
if (!value) {
|
||||
value = {
|
||||
cache: new Map(),
|
||||
envMap: null,
|
||||
processorMap: null,
|
||||
ruleMap: null
|
||||
};
|
||||
super.set(key, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}();
|
||||
|
||||
/**
|
||||
* Get the indices which are matched to a given file.
|
||||
* @param {ConfigArrayElement[]} elements The elements.
|
||||
* @param {string} filePath The path to a target file.
|
||||
* @returns {number[]} The indices.
|
||||
*/
|
||||
function getMatchedIndices(elements, filePath) {
|
||||
const indices = [];
|
||||
|
||||
for (let i = elements.length - 1; i >= 0; --i) {
|
||||
const element = elements[i];
|
||||
|
||||
if (!element.criteria || (filePath && element.criteria.test(filePath))) {
|
||||
indices.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a value is a non-null object.
|
||||
* @param {any} x The value to check.
|
||||
* @returns {boolean} `true` if the value is a non-null object.
|
||||
*/
|
||||
function isNonNullObject(x) {
|
||||
return typeof x === "object" && x !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge two objects.
|
||||
*
|
||||
* Assign every property values of `y` to `x` if `x` doesn't have the property.
|
||||
* If `x`'s property value is an object, it does recursive.
|
||||
* @param {Object} target The destination to merge
|
||||
* @param {Object|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
*/
|
||||
function mergeWithoutOverwrite(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(source)) {
|
||||
if (key === "__proto__") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isNonNullObject(target[key])) {
|
||||
mergeWithoutOverwrite(target[key], source[key]);
|
||||
} else if (target[key] === void 0) {
|
||||
if (isNonNullObject(source[key])) {
|
||||
target[key] = Array.isArray(source[key]) ? [] : {};
|
||||
mergeWithoutOverwrite(target[key], source[key]);
|
||||
} else if (source[key] !== void 0) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The error for plugin conflicts.
|
||||
*/
|
||||
class PluginConflictError extends Error {
|
||||
|
||||
/**
|
||||
* Initialize this error object.
|
||||
* @param {string} pluginId The plugin ID.
|
||||
* @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.
|
||||
*/
|
||||
constructor(pluginId, plugins) {
|
||||
super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`);
|
||||
this.messageTemplate = "plugin-conflict";
|
||||
this.messageData = { pluginId, plugins };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge plugins.
|
||||
* `target`'s definition is prior to `source`'s.
|
||||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
*/
|
||||
function mergePlugins(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(source)) {
|
||||
if (key === "__proto__") {
|
||||
continue;
|
||||
}
|
||||
const targetValue = target[key];
|
||||
const sourceValue = source[key];
|
||||
|
||||
// Adopt the plugin which was found at first.
|
||||
if (targetValue === void 0) {
|
||||
if (sourceValue.error) {
|
||||
throw sourceValue.error;
|
||||
}
|
||||
target[key] = sourceValue;
|
||||
} else if (sourceValue.filePath !== targetValue.filePath) {
|
||||
throw new PluginConflictError(key, [
|
||||
{
|
||||
filePath: targetValue.filePath,
|
||||
importerName: targetValue.importerName
|
||||
},
|
||||
{
|
||||
filePath: sourceValue.filePath,
|
||||
importerName: sourceValue.importerName
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge rule configs.
|
||||
* `target`'s definition is prior to `source`'s.
|
||||
* @param {Record<string, Array>} target The destination to merge
|
||||
* @param {Record<string, RuleConf>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
*/
|
||||
function mergeRuleConfigs(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(source)) {
|
||||
if (key === "__proto__") {
|
||||
continue;
|
||||
}
|
||||
const targetDef = target[key];
|
||||
const sourceDef = source[key];
|
||||
|
||||
// Adopt the rule config which was found at first.
|
||||
if (targetDef === void 0) {
|
||||
if (Array.isArray(sourceDef)) {
|
||||
target[key] = [...sourceDef];
|
||||
} else {
|
||||
target[key] = [sourceDef];
|
||||
}
|
||||
|
||||
/*
|
||||
* If the first found rule config is severity only and the current rule
|
||||
* config has options, merge the severity and the options.
|
||||
*/
|
||||
} else if (
|
||||
targetDef.length === 1 &&
|
||||
Array.isArray(sourceDef) &&
|
||||
sourceDef.length >= 2
|
||||
) {
|
||||
targetDef.push(...sourceDef.slice(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the extracted config.
|
||||
* @param {ConfigArray} instance The config elements.
|
||||
* @param {number[]} indices The indices to use.
|
||||
* @returns {ExtractedConfig} The extracted config.
|
||||
*/
|
||||
function createConfig(instance, indices) {
|
||||
const config = new ExtractedConfig();
|
||||
const ignorePatterns = [];
|
||||
|
||||
// Merge elements.
|
||||
for (const index of indices) {
|
||||
const element = instance[index];
|
||||
|
||||
// Adopt the parser which was found at first.
|
||||
if (!config.parser && element.parser) {
|
||||
if (element.parser.error) {
|
||||
throw element.parser.error;
|
||||
}
|
||||
config.parser = element.parser;
|
||||
}
|
||||
|
||||
// Adopt the processor which was found at first.
|
||||
if (!config.processor && element.processor) {
|
||||
config.processor = element.processor;
|
||||
}
|
||||
|
||||
// Adopt the noInlineConfig which was found at first.
|
||||
if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {
|
||||
config.noInlineConfig = element.noInlineConfig;
|
||||
config.configNameOfNoInlineConfig = element.name;
|
||||
}
|
||||
|
||||
// Adopt the reportUnusedDisableDirectives which was found at first.
|
||||
if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {
|
||||
config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
|
||||
}
|
||||
|
||||
// Collect ignorePatterns
|
||||
if (element.ignorePattern) {
|
||||
ignorePatterns.push(element.ignorePattern);
|
||||
}
|
||||
|
||||
// Merge others.
|
||||
mergeWithoutOverwrite(config.env, element.env);
|
||||
mergeWithoutOverwrite(config.globals, element.globals);
|
||||
mergeWithoutOverwrite(config.parserOptions, element.parserOptions);
|
||||
mergeWithoutOverwrite(config.settings, element.settings);
|
||||
mergePlugins(config.plugins, element.plugins);
|
||||
mergeRuleConfigs(config.rules, element.rules);
|
||||
}
|
||||
|
||||
// Create the predicate function for ignore patterns.
|
||||
if (ignorePatterns.length > 0) {
|
||||
config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect definitions.
|
||||
* @template T, U
|
||||
* @param {string} pluginId The plugin ID for prefix.
|
||||
* @param {Record<string,T>} defs The definitions to collect.
|
||||
* @param {Map<string, U>} map The map to output.
|
||||
* @param {function(T): U} [normalize] The normalize function for each value.
|
||||
* @returns {void}
|
||||
*/
|
||||
function collect(pluginId, defs, map, normalize) {
|
||||
if (defs) {
|
||||
const prefix = pluginId && `${pluginId}/`;
|
||||
|
||||
for (const [key, value] of Object.entries(defs)) {
|
||||
map.set(
|
||||
`${prefix}${key}`,
|
||||
normalize ? normalize(value) : value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a rule definition.
|
||||
* @param {Function|Rule} rule The rule definition to normalize.
|
||||
* @returns {Rule} The normalized rule definition.
|
||||
*/
|
||||
function normalizePluginRule(rule) {
|
||||
return typeof rule === "function" ? { create: rule } : rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the mutation methods from a given map.
|
||||
* @param {Map<any, any>} map The map object to delete.
|
||||
* @returns {void}
|
||||
*/
|
||||
function deleteMutationMethods(map) {
|
||||
Object.defineProperties(map, {
|
||||
clear: { configurable: true, value: void 0 },
|
||||
delete: { configurable: true, value: void 0 },
|
||||
set: { configurable: true, value: void 0 }
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
||||
* @param {ConfigArrayElement[]} elements The config elements.
|
||||
* @param {ConfigArrayInternalSlots} slots The internal slots.
|
||||
* @returns {void}
|
||||
*/
|
||||
function initPluginMemberMaps(elements, slots) {
|
||||
const processed = new Set();
|
||||
|
||||
slots.envMap = new Map();
|
||||
slots.processorMap = new Map();
|
||||
slots.ruleMap = new Map();
|
||||
|
||||
for (const element of elements) {
|
||||
if (!element.plugins) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const [pluginId, value] of Object.entries(element.plugins)) {
|
||||
const plugin = value.definition;
|
||||
|
||||
if (!plugin || processed.has(pluginId)) {
|
||||
continue;
|
||||
}
|
||||
processed.add(pluginId);
|
||||
|
||||
collect(pluginId, plugin.environments, slots.envMap);
|
||||
collect(pluginId, plugin.processors, slots.processorMap);
|
||||
collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);
|
||||
}
|
||||
}
|
||||
|
||||
deleteMutationMethods(slots.envMap);
|
||||
deleteMutationMethods(slots.processorMap);
|
||||
deleteMutationMethods(slots.ruleMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
||||
* @param {ConfigArray} instance The config elements.
|
||||
* @returns {ConfigArrayInternalSlots} The extracted config.
|
||||
*/
|
||||
function ensurePluginMemberMaps(instance) {
|
||||
const slots = internalSlotsMap.get(instance);
|
||||
|
||||
if (!slots.ruleMap) {
|
||||
initPluginMemberMaps(instance, slots);
|
||||
}
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The Config Array.
|
||||
*
|
||||
* `ConfigArray` instance contains all settings, parsers, and plugins.
|
||||
* You need to call `ConfigArray#extractConfig(filePath)` method in order to
|
||||
* extract, merge and get only the config data which is related to an arbitrary
|
||||
* file.
|
||||
* @extends {Array<ConfigArrayElement>}
|
||||
*/
|
||||
class ConfigArray extends Array {
|
||||
|
||||
/**
|
||||
* Get the plugin environments.
|
||||
* The returned map cannot be mutated.
|
||||
* @type {ReadonlyMap<string, Environment>} The plugin environments.
|
||||
*/
|
||||
get pluginEnvironments() {
|
||||
return ensurePluginMemberMaps(this).envMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plugin processors.
|
||||
* The returned map cannot be mutated.
|
||||
* @type {ReadonlyMap<string, Processor>} The plugin processors.
|
||||
*/
|
||||
get pluginProcessors() {
|
||||
return ensurePluginMemberMaps(this).processorMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plugin rules.
|
||||
* The returned map cannot be mutated.
|
||||
* @returns {ReadonlyMap<string, Rule>} The plugin rules.
|
||||
*/
|
||||
get pluginRules() {
|
||||
return ensurePluginMemberMaps(this).ruleMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this config has `root` flag.
|
||||
* @returns {boolean} `true` if this config array is root.
|
||||
*/
|
||||
isRoot() {
|
||||
for (let i = this.length - 1; i >= 0; --i) {
|
||||
const root = this[i].root;
|
||||
|
||||
if (typeof root === "boolean") {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the config data which is related to a given file.
|
||||
* @param {string} filePath The absolute path to the target file.
|
||||
* @returns {ExtractedConfig} The extracted config data.
|
||||
*/
|
||||
extractConfig(filePath) {
|
||||
const { cache } = internalSlotsMap.get(this);
|
||||
const indices = getMatchedIndices(this, filePath);
|
||||
const cacheKey = indices.join(",");
|
||||
|
||||
if (!cache.has(cacheKey)) {
|
||||
cache.set(cacheKey, createConfig(this, indices));
|
||||
}
|
||||
|
||||
return cache.get(cacheKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given path is an additional lint target.
|
||||
* @param {string} filePath The absolute path to the target file.
|
||||
* @returns {boolean} `true` if the file is an additional lint target.
|
||||
*/
|
||||
isAdditionalTargetPath(filePath) {
|
||||
for (const { criteria, type } of this) {
|
||||
if (
|
||||
type === "config" &&
|
||||
criteria &&
|
||||
!criteria.endsWithWildcard &&
|
||||
criteria.test(filePath)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const exportObject = {
|
||||
ConfigArray,
|
||||
|
||||
/**
|
||||
* Get the used extracted configs.
|
||||
* CLIEngine will use this method to collect used deprecated rules.
|
||||
* @param {ConfigArray} instance The config array object to get.
|
||||
* @returns {ExtractedConfig[]} The used extracted configs.
|
||||
* @private
|
||||
*/
|
||||
getUsedExtractedConfigs(instance) {
|
||||
const { cache } = internalSlotsMap.get(instance);
|
||||
|
||||
return Array.from(cache.values());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = exportObject;
|
116
app_vue/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
Normal file
116
app_vue/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* @fileoverview `ConfigDependency` class.
|
||||
*
|
||||
* `ConfigDependency` class expresses a loaded parser or plugin.
|
||||
*
|
||||
* If the parser or plugin was loaded successfully, it has `definition` property
|
||||
* and `filePath` property. Otherwise, it has `error` property.
|
||||
*
|
||||
* When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it
|
||||
* omits `definition` property.
|
||||
*
|
||||
* `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers
|
||||
* or plugins.
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const util = require("util");
|
||||
|
||||
/**
|
||||
* The class is to store parsers or plugins.
|
||||
* This class hides the loaded object from `JSON.stringify()` and `console.log`.
|
||||
* @template T
|
||||
*/
|
||||
class ConfigDependency {
|
||||
|
||||
/**
|
||||
* Initialize this instance.
|
||||
* @param {Object} data The dependency data.
|
||||
* @param {T} [data.definition] The dependency if the loading succeeded.
|
||||
* @param {Error} [data.error] The error object if the loading failed.
|
||||
* @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.
|
||||
* @param {string} data.id The ID of this dependency.
|
||||
* @param {string} data.importerName The name of the config file which loads this dependency.
|
||||
* @param {string} data.importerPath The path to the config file which loads this dependency.
|
||||
*/
|
||||
constructor({
|
||||
definition = null,
|
||||
error = null,
|
||||
filePath = null,
|
||||
id,
|
||||
importerName,
|
||||
importerPath
|
||||
}) {
|
||||
|
||||
/**
|
||||
* The loaded dependency if the loading succeeded.
|
||||
* @type {T|null}
|
||||
*/
|
||||
this.definition = definition;
|
||||
|
||||
/**
|
||||
* The error object if the loading failed.
|
||||
* @type {Error|null}
|
||||
*/
|
||||
this.error = error;
|
||||
|
||||
/**
|
||||
* The loaded dependency if the loading succeeded.
|
||||
* @type {string|null}
|
||||
*/
|
||||
this.filePath = filePath;
|
||||
|
||||
/**
|
||||
* The ID of this dependency.
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = id;
|
||||
|
||||
/**
|
||||
* The name of the config file which loads this dependency.
|
||||
* @type {string}
|
||||
*/
|
||||
this.importerName = importerName;
|
||||
|
||||
/**
|
||||
* The path to the config file which loads this dependency.
|
||||
* @type {string}
|
||||
*/
|
||||
this.importerPath = importerPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
const obj = this[util.inspect.custom]();
|
||||
|
||||
// Display `error.message` (`Error#message` is unenumerable).
|
||||
if (obj.error instanceof Error) {
|
||||
obj.error = { ...obj.error, message: obj.error.message };
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
const {
|
||||
definition: _ignore, // eslint-disable-line no-unused-vars
|
||||
...obj
|
||||
} = this;
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
/** @typedef {ConfigDependency<import("../../shared/types").Parser>} DependentParser */
|
||||
/** @typedef {ConfigDependency<import("../../shared/types").Plugin>} DependentPlugin */
|
||||
|
||||
module.exports = { ConfigDependency };
|
146
app_vue/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
Normal file
146
app_vue/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @fileoverview `ExtractedConfig` class.
|
||||
*
|
||||
* `ExtractedConfig` class expresses a final configuration for a specific file.
|
||||
*
|
||||
* It provides one method.
|
||||
*
|
||||
* - `toCompatibleObjectAsConfigFileContent()`
|
||||
* Convert this configuration to the compatible object as the content of
|
||||
* config files. It converts the loaded parser and plugins to strings.
|
||||
* `CLIEngine#getConfigForFile(filePath)` method uses this method.
|
||||
*
|
||||
* `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { IgnorePattern } = require("./ignore-pattern");
|
||||
|
||||
// For VSCode intellisense
|
||||
/** @typedef {import("../../shared/types").ConfigData} ConfigData */
|
||||
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
||||
/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */
|
||||
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
||||
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
||||
|
||||
/**
|
||||
* Check if `xs` starts with `ys`.
|
||||
* @template T
|
||||
* @param {T[]} xs The array to check.
|
||||
* @param {T[]} ys The array that may be the first part of `xs`.
|
||||
* @returns {boolean} `true` if `xs` starts with `ys`.
|
||||
*/
|
||||
function startsWith(xs, ys) {
|
||||
return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The class for extracted config data.
|
||||
*/
|
||||
class ExtractedConfig {
|
||||
constructor() {
|
||||
|
||||
/**
|
||||
* The config name what `noInlineConfig` setting came from.
|
||||
* @type {string}
|
||||
*/
|
||||
this.configNameOfNoInlineConfig = "";
|
||||
|
||||
/**
|
||||
* Environments.
|
||||
* @type {Record<string, boolean>}
|
||||
*/
|
||||
this.env = {};
|
||||
|
||||
/**
|
||||
* Global variables.
|
||||
* @type {Record<string, GlobalConf>}
|
||||
*/
|
||||
this.globals = {};
|
||||
|
||||
/**
|
||||
* The glob patterns that ignore to lint.
|
||||
* @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
|
||||
*/
|
||||
this.ignores = void 0;
|
||||
|
||||
/**
|
||||
* The flag that disables directive comments.
|
||||
* @type {boolean|undefined}
|
||||
*/
|
||||
this.noInlineConfig = void 0;
|
||||
|
||||
/**
|
||||
* Parser definition.
|
||||
* @type {DependentParser|null}
|
||||
*/
|
||||
this.parser = null;
|
||||
|
||||
/**
|
||||
* Options for the parser.
|
||||
* @type {Object}
|
||||
*/
|
||||
this.parserOptions = {};
|
||||
|
||||
/**
|
||||
* Plugin definitions.
|
||||
* @type {Record<string, DependentPlugin>}
|
||||
*/
|
||||
this.plugins = {};
|
||||
|
||||
/**
|
||||
* Processor ID.
|
||||
* @type {string|null}
|
||||
*/
|
||||
this.processor = null;
|
||||
|
||||
/**
|
||||
* The flag that reports unused `eslint-disable` directive comments.
|
||||
* @type {boolean|undefined}
|
||||
*/
|
||||
this.reportUnusedDisableDirectives = void 0;
|
||||
|
||||
/**
|
||||
* Rule settings.
|
||||
* @type {Record<string, [SeverityConf, ...any[]]>}
|
||||
*/
|
||||
this.rules = {};
|
||||
|
||||
/**
|
||||
* Shared settings.
|
||||
* @type {Object}
|
||||
*/
|
||||
this.settings = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert this config to the compatible object as a config file content.
|
||||
* @returns {ConfigData} The converted object.
|
||||
*/
|
||||
toCompatibleObjectAsConfigFileContent() {
|
||||
const {
|
||||
/* eslint-disable no-unused-vars */
|
||||
configNameOfNoInlineConfig: _ignore1,
|
||||
processor: _ignore2,
|
||||
/* eslint-enable no-unused-vars */
|
||||
ignores,
|
||||
...config
|
||||
} = this;
|
||||
|
||||
config.parser = config.parser && config.parser.filePath;
|
||||
config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
|
||||
config.ignorePatterns = ignores ? ignores.patterns : [];
|
||||
|
||||
// Strip the default patterns from `ignorePatterns`.
|
||||
if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
|
||||
config.ignorePatterns =
|
||||
config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { ExtractedConfig };
|
237
app_vue/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
Normal file
237
app_vue/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
/**
|
||||
* @fileoverview `IgnorePattern` class.
|
||||
*
|
||||
* `IgnorePattern` class has the set of glob patterns and the base path.
|
||||
*
|
||||
* It provides two static methods.
|
||||
*
|
||||
* - `IgnorePattern.createDefaultIgnore(cwd)`
|
||||
* Create the default predicate function.
|
||||
* - `IgnorePattern.createIgnore(ignorePatterns)`
|
||||
* Create the predicate function from multiple `IgnorePattern` objects.
|
||||
*
|
||||
* It provides two properties and a method.
|
||||
*
|
||||
* - `patterns`
|
||||
* The glob patterns that ignore to lint.
|
||||
* - `basePath`
|
||||
* The base path of the glob patterns. If absolute paths existed in the
|
||||
* glob patterns, those are handled as relative paths to the base path.
|
||||
* - `getPatternsRelativeTo(basePath)`
|
||||
* Get `patterns` as modified for a given base path. It modifies the
|
||||
* absolute paths in the patterns as prepending the difference of two base
|
||||
* paths.
|
||||
*
|
||||
* `ConfigArrayFactory` creates `IgnorePattern` objects when it processes
|
||||
* `ignorePatterns` properties.
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const ignore = require("ignore");
|
||||
const debug = require("debug")("eslintrc:ignore-pattern");
|
||||
|
||||
/** @typedef {ReturnType<import("ignore").default>} Ignore */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get the path to the common ancestor directory of given paths.
|
||||
* @param {string[]} sourcePaths The paths to calculate the common ancestor.
|
||||
* @returns {string} The path to the common ancestor directory.
|
||||
*/
|
||||
function getCommonAncestorPath(sourcePaths) {
|
||||
let result = sourcePaths[0];
|
||||
|
||||
for (let i = 1; i < sourcePaths.length; ++i) {
|
||||
const a = result;
|
||||
const b = sourcePaths[i];
|
||||
|
||||
// Set the shorter one (it's the common ancestor if one includes the other).
|
||||
result = a.length < b.length ? a : b;
|
||||
|
||||
// Set the common ancestor.
|
||||
for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {
|
||||
if (a[j] !== b[j]) {
|
||||
result = a.slice(0, lastSepPos);
|
||||
break;
|
||||
}
|
||||
if (a[j] === path.sep) {
|
||||
lastSepPos = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resolvedResult = result || path.sep;
|
||||
|
||||
// if Windows common ancestor is root of drive must have trailing slash to be absolute.
|
||||
if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") {
|
||||
resolvedResult += path.sep;
|
||||
}
|
||||
return resolvedResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make relative path.
|
||||
* @param {string} from The source path to get relative path.
|
||||
* @param {string} to The destination path to get relative path.
|
||||
* @returns {string} The relative path.
|
||||
*/
|
||||
function relative(from, to) {
|
||||
const relPath = path.relative(from, to);
|
||||
|
||||
if (path.sep === "/") {
|
||||
return relPath;
|
||||
}
|
||||
return relPath.split(path.sep).join("/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the trailing slash if existed.
|
||||
* @param {string} filePath The path to check.
|
||||
* @returns {string} The trailing slash if existed.
|
||||
*/
|
||||
function dirSuffix(filePath) {
|
||||
const isDir = (
|
||||
filePath.endsWith(path.sep) ||
|
||||
(process.platform === "win32" && filePath.endsWith("/"))
|
||||
);
|
||||
|
||||
return isDir ? "/" : "";
|
||||
}
|
||||
|
||||
const DefaultPatterns = Object.freeze(["/**/node_modules/*"]);
|
||||
const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class IgnorePattern {
|
||||
|
||||
/**
|
||||
* The default patterns.
|
||||
* @type {string[]}
|
||||
*/
|
||||
static get DefaultPatterns() {
|
||||
return DefaultPatterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the default predicate function.
|
||||
* @param {string} cwd The current working directory.
|
||||
* @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
||||
* The preficate function.
|
||||
* The first argument is an absolute path that is checked.
|
||||
* The second argument is the flag to not ignore dotfiles.
|
||||
* If the predicate function returned `true`, it means the path should be ignored.
|
||||
*/
|
||||
static createDefaultIgnore(cwd) {
|
||||
return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the predicate function from multiple `IgnorePattern` objects.
|
||||
* @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.
|
||||
* @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
||||
* The preficate function.
|
||||
* The first argument is an absolute path that is checked.
|
||||
* The second argument is the flag to not ignore dotfiles.
|
||||
* If the predicate function returned `true`, it means the path should be ignored.
|
||||
*/
|
||||
static createIgnore(ignorePatterns) {
|
||||
debug("Create with: %o", ignorePatterns);
|
||||
|
||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||
const patterns = [].concat(
|
||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||
);
|
||||
const ig = ignore().add([...DotPatterns, ...patterns]);
|
||||
const dotIg = ignore().add(patterns);
|
||||
|
||||
debug(" processed: %o", { basePath, patterns });
|
||||
|
||||
return Object.assign(
|
||||
(filePath, dot = false) => {
|
||||
assert(path.isAbsolute(filePath), "'filePath' should be an absolute path.");
|
||||
const relPathRaw = relative(basePath, filePath);
|
||||
const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));
|
||||
const adoptedIg = dot ? dotIg : ig;
|
||||
const result = relPath !== "" && adoptedIg.ignores(relPath);
|
||||
|
||||
debug("Check", { filePath, dot, relativePath: relPath, result });
|
||||
return result;
|
||||
},
|
||||
{ basePath, patterns }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new `IgnorePattern` instance.
|
||||
* @param {string[]} patterns The glob patterns that ignore to lint.
|
||||
* @param {string} basePath The base path of `patterns`.
|
||||
*/
|
||||
constructor(patterns, basePath) {
|
||||
assert(path.isAbsolute(basePath), "'basePath' should be an absolute path.");
|
||||
|
||||
/**
|
||||
* The glob patterns that ignore to lint.
|
||||
* @type {string[]}
|
||||
*/
|
||||
this.patterns = patterns;
|
||||
|
||||
/**
|
||||
* The base path of `patterns`.
|
||||
* @type {string}
|
||||
*/
|
||||
this.basePath = basePath;
|
||||
|
||||
/**
|
||||
* If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.
|
||||
*
|
||||
* It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.
|
||||
* It's `false` as-is for `ignorePatterns` property in config files.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.loose = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get `patterns` as modified for a given base path. It modifies the
|
||||
* absolute paths in the patterns as prepending the difference of two base
|
||||
* paths.
|
||||
* @param {string} newBasePath The base path.
|
||||
* @returns {string[]} Modifired patterns.
|
||||
*/
|
||||
getPatternsRelativeTo(newBasePath) {
|
||||
assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path.");
|
||||
const { basePath, loose, patterns } = this;
|
||||
|
||||
if (newBasePath === basePath) {
|
||||
return patterns;
|
||||
}
|
||||
const prefix = `/${relative(newBasePath, basePath)}`;
|
||||
|
||||
return patterns.map(pattern => {
|
||||
const negative = pattern.startsWith("!");
|
||||
const head = negative ? "!" : "";
|
||||
const body = negative ? pattern.slice(1) : pattern;
|
||||
|
||||
if (body.startsWith("/") || body.startsWith("../")) {
|
||||
return `${head}${prefix}${body}`;
|
||||
}
|
||||
return loose ? pattern : `${head}${prefix}/**/${body}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { IgnorePattern };
|
20
app_vue/node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
Normal file
20
app_vue/node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @fileoverview `ConfigArray` class.
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { ConfigArray, getUsedExtractedConfigs } = require("./config-array");
|
||||
const { ConfigDependency } = require("./config-dependency");
|
||||
const { ExtractedConfig } = require("./extracted-config");
|
||||
const { IgnorePattern } = require("./ignore-pattern");
|
||||
const { OverrideTester } = require("./override-tester");
|
||||
|
||||
module.exports = {
|
||||
ConfigArray,
|
||||
ConfigDependency,
|
||||
ExtractedConfig,
|
||||
IgnorePattern,
|
||||
OverrideTester,
|
||||
getUsedExtractedConfigs
|
||||
};
|
223
app_vue/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
Normal file
223
app_vue/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
/**
|
||||
* @fileoverview `OverrideTester` class.
|
||||
*
|
||||
* `OverrideTester` class handles `files` property and `excludedFiles` property
|
||||
* of `overrides` config.
|
||||
*
|
||||
* It provides one method.
|
||||
*
|
||||
* - `test(filePath)`
|
||||
* Test if a file path matches the pair of `files` property and
|
||||
* `excludedFiles` property. The `filePath` argument must be an absolute
|
||||
* path.
|
||||
*
|
||||
* `ConfigArrayFactory` creates `OverrideTester` objects when it processes
|
||||
* `overrides` properties.
|
||||
*
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const util = require("util");
|
||||
const { Minimatch } = require("minimatch");
|
||||
const minimatchOpts = { dot: true, matchBase: true };
|
||||
|
||||
/**
|
||||
* @typedef {Object} Pattern
|
||||
* @property {InstanceType<Minimatch>[] | null} includes The positive matchers.
|
||||
* @property {InstanceType<Minimatch>[] | null} excludes The negative matchers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Normalize a given pattern to an array.
|
||||
* @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.
|
||||
* @returns {string[]|null} Normalized patterns.
|
||||
* @private
|
||||
*/
|
||||
function normalizePatterns(patterns) {
|
||||
if (Array.isArray(patterns)) {
|
||||
return patterns.filter(Boolean);
|
||||
}
|
||||
if (typeof patterns === "string" && patterns) {
|
||||
return [patterns];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the matchers of given patterns.
|
||||
* @param {string[]} patterns The patterns.
|
||||
* @returns {InstanceType<Minimatch>[] | null} The matchers.
|
||||
*/
|
||||
function toMatcher(patterns) {
|
||||
if (patterns.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return patterns.map(pattern => {
|
||||
if (/^\.[/\\]/u.test(pattern)) {
|
||||
return new Minimatch(
|
||||
pattern.slice(2),
|
||||
|
||||
// `./*.js` should not match with `subdir/foo.js`
|
||||
{ ...minimatchOpts, matchBase: false }
|
||||
);
|
||||
}
|
||||
return new Minimatch(pattern, minimatchOpts);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a given matcher to string.
|
||||
* @param {Pattern} matchers The matchers.
|
||||
* @returns {string} The string expression of the matcher.
|
||||
*/
|
||||
function patternToJson({ includes, excludes }) {
|
||||
return {
|
||||
includes: includes && includes.map(m => m.pattern),
|
||||
excludes: excludes && excludes.map(m => m.pattern)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The class to test given paths are matched by the patterns.
|
||||
*/
|
||||
class OverrideTester {
|
||||
|
||||
/**
|
||||
* Create a tester with given criteria.
|
||||
* If there are no criteria, returns `null`.
|
||||
* @param {string|string[]} files The glob patterns for included files.
|
||||
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
||||
* @param {string} basePath The path to the base directory to test paths.
|
||||
* @returns {OverrideTester|null} The created instance or `null`.
|
||||
*/
|
||||
static create(files, excludedFiles, basePath) {
|
||||
const includePatterns = normalizePatterns(files);
|
||||
const excludePatterns = normalizePatterns(excludedFiles);
|
||||
let endsWithWildcard = false;
|
||||
|
||||
if (includePatterns.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Rejects absolute paths or relative paths to parents.
|
||||
for (const pattern of includePatterns) {
|
||||
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
||||
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
||||
}
|
||||
if (pattern.endsWith("*")) {
|
||||
endsWithWildcard = true;
|
||||
}
|
||||
}
|
||||
for (const pattern of excludePatterns) {
|
||||
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
||||
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
||||
}
|
||||
}
|
||||
|
||||
const includes = toMatcher(includePatterns);
|
||||
const excludes = toMatcher(excludePatterns);
|
||||
|
||||
return new OverrideTester(
|
||||
[{ includes, excludes }],
|
||||
basePath,
|
||||
endsWithWildcard
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine two testers by logical and.
|
||||
* If either of the testers was `null`, returns the other tester.
|
||||
* The `basePath` property of the two must be the same value.
|
||||
* @param {OverrideTester|null} a A tester.
|
||||
* @param {OverrideTester|null} b Another tester.
|
||||
* @returns {OverrideTester|null} Combined tester.
|
||||
*/
|
||||
static and(a, b) {
|
||||
if (!b) {
|
||||
return a && new OverrideTester(
|
||||
a.patterns,
|
||||
a.basePath,
|
||||
a.endsWithWildcard
|
||||
);
|
||||
}
|
||||
if (!a) {
|
||||
return new OverrideTester(
|
||||
b.patterns,
|
||||
b.basePath,
|
||||
b.endsWithWildcard
|
||||
);
|
||||
}
|
||||
|
||||
assert.strictEqual(a.basePath, b.basePath);
|
||||
return new OverrideTester(
|
||||
a.patterns.concat(b.patterns),
|
||||
a.basePath,
|
||||
a.endsWithWildcard || b.endsWithWildcard
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this instance.
|
||||
* @param {Pattern[]} patterns The matchers.
|
||||
* @param {string} basePath The base path.
|
||||
* @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.
|
||||
*/
|
||||
constructor(patterns, basePath, endsWithWildcard = false) {
|
||||
|
||||
/** @type {Pattern[]} */
|
||||
this.patterns = patterns;
|
||||
|
||||
/** @type {string} */
|
||||
this.basePath = basePath;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.endsWithWildcard = endsWithWildcard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a given path is matched or not.
|
||||
* @param {string} filePath The absolute path to the target file.
|
||||
* @returns {boolean} `true` if the path was matched.
|
||||
*/
|
||||
test(filePath) {
|
||||
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
||||
throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);
|
||||
}
|
||||
const relativePath = path.relative(this.basePath, filePath);
|
||||
|
||||
return this.patterns.every(({ includes, excludes }) => (
|
||||
(!includes || includes.some(m => m.match(relativePath))) &&
|
||||
(!excludes || !excludes.some(m => m.match(relativePath)))
|
||||
));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
if (this.patterns.length === 1) {
|
||||
return {
|
||||
...patternToJson(this.patterns[0]),
|
||||
basePath: this.basePath
|
||||
};
|
||||
}
|
||||
return {
|
||||
AND: this.patterns.map(patternToJson),
|
||||
basePath: this.basePath
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
return this.toJSON();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { OverrideTester };
|
308
app_vue/node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
Normal file
308
app_vue/node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
Normal file
@ -0,0 +1,308 @@
|
||||
/**
|
||||
* @fileoverview Compatibility class for flat config.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const path = require("path");
|
||||
const environments = require("../conf/environments");
|
||||
const createDebug = require("debug");
|
||||
const { ConfigArrayFactory } = require("./config-array-factory");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("../../shared/types").Environment} Environment */
|
||||
/** @typedef {import("../../shared/types").Processor} Processor */
|
||||
|
||||
const debug = createDebug("eslintrc:flat-compat");
|
||||
const cafactory = Symbol("cafactory");
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config object into a flag-config-style config
|
||||
* object.
|
||||
* @param {Object} eslintrcConfig An ESLintRC-style config object.
|
||||
* @param {Object} options Options to help translate the config.
|
||||
* @param {string} options.resolveConfigRelativeTo To the directory to resolve
|
||||
* configs from.
|
||||
* @param {string} options.resolvePluginsRelativeTo The directory to resolve
|
||||
* plugins from.
|
||||
* @param {ReadOnlyMap<string,Environment>} options.pluginEnvironments A map of plugin environment
|
||||
* names to objects.
|
||||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
||||
* names to objects.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
*/
|
||||
function translateESLintRC(eslintrcConfig, {
|
||||
resolveConfigRelativeTo,
|
||||
resolvePluginsRelativeTo,
|
||||
pluginEnvironments,
|
||||
pluginProcessors
|
||||
}) {
|
||||
|
||||
const flatConfig = {};
|
||||
const configs = [];
|
||||
const languageOptions = {};
|
||||
const linterOptions = {};
|
||||
const keysToCopy = ["settings", "rules", "processor"];
|
||||
const languageOptionsKeysToCopy = ["globals", "parser", "parserOptions"];
|
||||
const linterOptionsKeysToCopy = ["noInlineConfig", "reportUnusedDisableDirectives"];
|
||||
|
||||
// check for special settings for eslint:all and eslint:recommended:
|
||||
if (eslintrcConfig.settings) {
|
||||
if (eslintrcConfig.settings["eslint:all"] === true) {
|
||||
return ["eslint:all"];
|
||||
}
|
||||
|
||||
if (eslintrcConfig.settings["eslint:recommended"] === true) {
|
||||
return ["eslint:recommended"];
|
||||
}
|
||||
}
|
||||
|
||||
// copy over simple translations
|
||||
for (const key of keysToCopy) {
|
||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
||||
flatConfig[key] = eslintrcConfig[key];
|
||||
}
|
||||
}
|
||||
|
||||
// copy over languageOptions
|
||||
for (const key of languageOptionsKeysToCopy) {
|
||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
||||
|
||||
// create the languageOptions key in the flat config
|
||||
flatConfig.languageOptions = languageOptions;
|
||||
|
||||
if (key === "parser") {
|
||||
debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`);
|
||||
|
||||
if (eslintrcConfig[key].error) {
|
||||
throw eslintrcConfig[key].error;
|
||||
}
|
||||
|
||||
languageOptions[key] = eslintrcConfig[key].definition;
|
||||
continue;
|
||||
}
|
||||
|
||||
// clone any object values that are in the eslintrc config
|
||||
if (eslintrcConfig[key] && typeof eslintrcConfig[key] === "object") {
|
||||
languageOptions[key] = {
|
||||
...eslintrcConfig[key]
|
||||
};
|
||||
} else {
|
||||
languageOptions[key] = eslintrcConfig[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copy over linterOptions
|
||||
for (const key of linterOptionsKeysToCopy) {
|
||||
if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") {
|
||||
flatConfig.linterOptions = linterOptions;
|
||||
linterOptions[key] = eslintrcConfig[key];
|
||||
}
|
||||
}
|
||||
|
||||
// move ecmaVersion a level up
|
||||
if (languageOptions.parserOptions) {
|
||||
|
||||
if ("ecmaVersion" in languageOptions.parserOptions) {
|
||||
languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion;
|
||||
delete languageOptions.parserOptions.ecmaVersion;
|
||||
}
|
||||
|
||||
if ("sourceType" in languageOptions.parserOptions) {
|
||||
languageOptions.sourceType = languageOptions.parserOptions.sourceType;
|
||||
delete languageOptions.parserOptions.sourceType;
|
||||
}
|
||||
|
||||
// check to see if we even need parserOptions anymore and remove it if not
|
||||
if (Object.keys(languageOptions.parserOptions).length === 0) {
|
||||
delete languageOptions.parserOptions;
|
||||
}
|
||||
}
|
||||
|
||||
// overrides
|
||||
if (eslintrcConfig.criteria) {
|
||||
flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)];
|
||||
}
|
||||
|
||||
// translate plugins
|
||||
if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === "object") {
|
||||
debug(`Translating plugins: ${eslintrcConfig.plugins}`);
|
||||
|
||||
flatConfig.plugins = {};
|
||||
|
||||
for (const pluginName of Object.keys(eslintrcConfig.plugins)) {
|
||||
|
||||
debug(`Translating plugin: ${pluginName}`);
|
||||
debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);
|
||||
|
||||
const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
flatConfig.plugins[pluginName] = plugin;
|
||||
|
||||
// create a config for any processors
|
||||
if (plugin.processors) {
|
||||
for (const processorName of Object.keys(plugin.processors)) {
|
||||
if (processorName.startsWith(".")) {
|
||||
debug(`Assigning processor: ${pluginName}/${processorName}`);
|
||||
|
||||
configs.unshift({
|
||||
files: [`**/*${processorName}`],
|
||||
processor: pluginProcessors.get(`${pluginName}/${processorName}`)
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// translate env - must come after plugins
|
||||
if (eslintrcConfig.env && typeof eslintrcConfig.env === "object") {
|
||||
for (const envName of Object.keys(eslintrcConfig.env)) {
|
||||
|
||||
// only add environments that are true
|
||||
if (eslintrcConfig.env[envName]) {
|
||||
debug(`Translating environment: ${envName}`);
|
||||
|
||||
if (environments.has(envName)) {
|
||||
|
||||
// built-in environments should be defined first
|
||||
configs.unshift(...translateESLintRC(environments.get(envName), {
|
||||
resolveConfigRelativeTo,
|
||||
resolvePluginsRelativeTo
|
||||
}));
|
||||
} else if (pluginEnvironments.has(envName)) {
|
||||
|
||||
// if the environment comes from a plugin, it should come after the plugin config
|
||||
configs.push(...translateESLintRC(pluginEnvironments.get(envName), {
|
||||
resolveConfigRelativeTo,
|
||||
resolvePluginsRelativeTo
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only add if there are actually keys in the config
|
||||
if (Object.keys(flatConfig).length > 0) {
|
||||
configs.push(flatConfig);
|
||||
}
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A compatibility class for working with configs.
|
||||
*/
|
||||
class FlatCompat {
|
||||
|
||||
constructor({
|
||||
baseDirectory = process.cwd(),
|
||||
resolvePluginsRelativeTo = baseDirectory
|
||||
} = {}) {
|
||||
this.baseDirectory = baseDirectory;
|
||||
this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
||||
this[cafactory] = new ConfigArrayFactory({
|
||||
cwd: baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
eslintAllPath: path.resolve(__dirname, "../conf/eslint-all.js"),
|
||||
eslintRecommendedPath: path.resolve(__dirname, "../conf/eslint-recommended.js")
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
||||
* @param {Object} eslintrcConfig The ESLintRC-style config object.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
*/
|
||||
config(eslintrcConfig) {
|
||||
const eslintrcArray = this[cafactory].create(eslintrcConfig, {
|
||||
basePath: this.baseDirectory
|
||||
});
|
||||
|
||||
const flatArray = [];
|
||||
let hasIgnorePatterns = false;
|
||||
|
||||
eslintrcArray.forEach(configData => {
|
||||
if (configData.type === "config") {
|
||||
hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern;
|
||||
flatArray.push(...translateESLintRC(configData, {
|
||||
resolveConfigRelativeTo: path.join(this.baseDirectory, "__placeholder.js"),
|
||||
resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, "__placeholder.js"),
|
||||
pluginEnvironments: eslintrcArray.pluginEnvironments,
|
||||
pluginProcessors: eslintrcArray.pluginProcessors
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
// combine ignorePatterns to emulate ESLintRC behavior better
|
||||
if (hasIgnorePatterns) {
|
||||
flatArray.unshift({
|
||||
ignores: [filePath => {
|
||||
|
||||
// Compute the final config for this file.
|
||||
// This filters config array elements by `files`/`excludedFiles` then merges the elements.
|
||||
const finalConfig = eslintrcArray.extractConfig(filePath);
|
||||
|
||||
// Test the `ignorePattern` properties of the final config.
|
||||
return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath);
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
return flatArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the `env` section of an ESLintRC-style config.
|
||||
* @param {Object} envConfig The `env` section of an ESLintRC config.
|
||||
* @returns {Object} A flag-config object representing the environments.
|
||||
*/
|
||||
env(envConfig) {
|
||||
return this.config({
|
||||
env: envConfig
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the `extends` section of an ESLintRC-style config.
|
||||
* @param {...string} configsToExtend The names of the configs to load.
|
||||
* @returns {Object} A flag-config object representing the config.
|
||||
*/
|
||||
extends(...configsToExtend) {
|
||||
return this.config({
|
||||
extends: configsToExtend
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the `plugins` section of an ESLintRC-style config.
|
||||
* @param {...string} plugins The names of the plugins to load.
|
||||
* @returns {Object} A flag-config object representing the plugins.
|
||||
*/
|
||||
plugins(...plugins) {
|
||||
return this.config({
|
||||
plugins
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.FlatCompat = FlatCompat;
|
54
app_vue/node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
Normal file
54
app_vue/node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @fileoverview Package exports for @eslint/eslintrc
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const {
|
||||
ConfigArrayFactory,
|
||||
createContext: createConfigArrayFactoryContext
|
||||
} = require("./config-array-factory");
|
||||
|
||||
const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory");
|
||||
const ModuleResolver = require("./shared/relative-module-resolver");
|
||||
const { ConfigArray, getUsedExtractedConfigs } = require("./config-array");
|
||||
const { ConfigDependency } = require("./config-array/config-dependency");
|
||||
const { ExtractedConfig } = require("./config-array/extracted-config");
|
||||
const { IgnorePattern } = require("./config-array/ignore-pattern");
|
||||
const { OverrideTester } = require("./config-array/override-tester");
|
||||
const ConfigOps = require("./shared/config-ops");
|
||||
const ConfigValidator = require("./shared/config-validator");
|
||||
const naming = require("./shared/naming");
|
||||
const { FlatCompat } = require("./flat-compat");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
|
||||
Legacy: {
|
||||
ConfigArray,
|
||||
createConfigArrayFactoryContext,
|
||||
CascadingConfigArrayFactory,
|
||||
ConfigArrayFactory,
|
||||
ConfigDependency,
|
||||
ExtractedConfig,
|
||||
IgnorePattern,
|
||||
OverrideTester,
|
||||
getUsedExtractedConfigs,
|
||||
|
||||
// shared
|
||||
ConfigOps,
|
||||
ConfigValidator,
|
||||
ModuleResolver,
|
||||
naming
|
||||
},
|
||||
|
||||
FlatCompat
|
||||
|
||||
};
|
34
app_vue/node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
Normal file
34
app_vue/node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @fileoverview The instance of Ajv validator.
|
||||
* @author Evgeny Poberezkin
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const Ajv = require("ajv"),
|
||||
metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = (additionalOptions = {}) => {
|
||||
const ajv = new Ajv({
|
||||
meta: false,
|
||||
useDefaults: true,
|
||||
validateSchema: false,
|
||||
missingRefs: "ignore",
|
||||
verbose: true,
|
||||
schemaId: "auto",
|
||||
...additionalOptions
|
||||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
};
|
130
app_vue/node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
Normal file
130
app_vue/node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
/**
|
||||
* @fileoverview Config file operations. This file must be usable in the browser,
|
||||
* so no Node-specific code can be here.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
||||
RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {
|
||||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Normalizes the severity value of a rule's configuration to a number
|
||||
* @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally
|
||||
* received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0),
|
||||
* the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array
|
||||
* whose first element is one of the above values. Strings are matched case-insensitively.
|
||||
* @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.
|
||||
*/
|
||||
getRuleSeverity(ruleConfig) {
|
||||
const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||
|
||||
if (severityValue === 0 || severityValue === 1 || severityValue === 2) {
|
||||
return severityValue;
|
||||
}
|
||||
|
||||
if (typeof severityValue === "string") {
|
||||
return RULE_SEVERITY[severityValue.toLowerCase()] || 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts old-style severity settings (0, 1, 2) into new-style
|
||||
* severity settings (off, warn, error) for all rules. Assumption is that severity
|
||||
* values have already been validated as correct.
|
||||
* @param {Object} config The config object to normalize.
|
||||
* @returns {void}
|
||||
*/
|
||||
normalizeToStrings(config) {
|
||||
|
||||
if (config.rules) {
|
||||
Object.keys(config.rules).forEach(ruleId => {
|
||||
const ruleConfig = config.rules[ruleId];
|
||||
|
||||
if (typeof ruleConfig === "number") {
|
||||
config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];
|
||||
} else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") {
|
||||
ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines if the severity for the given rule configuration represents an error.
|
||||
* @param {int|string|Array} ruleConfig The configuration for an individual rule.
|
||||
* @returns {boolean} True if the rule represents an error, false if not.
|
||||
*/
|
||||
isErrorSeverity(ruleConfig) {
|
||||
return module.exports.getRuleSeverity(ruleConfig) === 2;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether a given config has valid severity or not.
|
||||
* @param {number|string|Array} ruleConfig The configuration for an individual rule.
|
||||
* @returns {boolean} `true` if the configuration has valid severity.
|
||||
*/
|
||||
isValidSeverity(ruleConfig) {
|
||||
let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||
|
||||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether every rule of a given config has valid severity or not.
|
||||
* @param {Object} config The configuration for rules.
|
||||
* @returns {boolean} `true` if the configuration has valid severity.
|
||||
*/
|
||||
isEverySeverityValid(config) {
|
||||
return Object.keys(config).every(ruleId => this.isValidSeverity(config[ruleId]));
|
||||
},
|
||||
|
||||
/**
|
||||
* Normalizes a value for a global in a config
|
||||
* @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in
|
||||
* a global directive comment
|
||||
* @returns {("readable"|"writeable"|"off")} The value normalized as a string
|
||||
* @throws Error if global value is invalid
|
||||
*/
|
||||
normalizeConfigGlobal(configuredValue) {
|
||||
switch (configuredValue) {
|
||||
case "off":
|
||||
return "off";
|
||||
|
||||
case true:
|
||||
case "true":
|
||||
case "writeable":
|
||||
case "writable":
|
||||
return "writable";
|
||||
|
||||
case null:
|
||||
case false:
|
||||
case "false":
|
||||
case "readable":
|
||||
case "readonly":
|
||||
return "readonly";
|
||||
|
||||
default:
|
||||
throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);
|
||||
}
|
||||
}
|
||||
};
|
326
app_vue/node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
Normal file
326
app_vue/node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
Normal file
@ -0,0 +1,326 @@
|
||||
/**
|
||||
* @fileoverview Validates configs.
|
||||
* @author Brandon Mills
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/* eslint class-methods-use-this: "off" */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const
|
||||
util = require("util"),
|
||||
configSchema = require("../../conf/config-schema"),
|
||||
BuiltInEnvironments = require("../../conf/environments"),
|
||||
ConfigOps = require("./config-ops"),
|
||||
{ emitDeprecationWarning } = require("./deprecation-warnings");
|
||||
|
||||
const ajv = require("./ajv")();
|
||||
const ruleValidators = new WeakMap();
|
||||
const noop = Function.prototype;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
//------------------------------------------------------------------------------
|
||||
let validateSchema;
|
||||
const severityMap = {
|
||||
error: 2,
|
||||
warn: 1,
|
||||
off: 0
|
||||
};
|
||||
|
||||
const validated = new WeakSet();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
module.exports = class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a complete options schema for a rule.
|
||||
* @param {{create: Function, schema: (Array|null)}} rule A new-style rule object
|
||||
* @returns {Object} JSON Schema for the rule's options.
|
||||
*/
|
||||
getRuleOptionsSchema(rule) {
|
||||
if (!rule) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const schema = rule.schema || rule.meta && rule.meta.schema;
|
||||
|
||||
// Given a tuple of schemas, insert warning level at the beginning
|
||||
if (Array.isArray(schema)) {
|
||||
if (schema.length) {
|
||||
return {
|
||||
type: "array",
|
||||
items: schema,
|
||||
minItems: 0,
|
||||
maxItems: schema.length
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "array",
|
||||
minItems: 0,
|
||||
maxItems: 0
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Given a full schema, leave it alone
|
||||
return schema || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
||||
* @param {options} options The given options for the rule.
|
||||
* @returns {number|string} The rule's severity value
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity;
|
||||
|
||||
if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {
|
||||
return normSeverity;
|
||||
}
|
||||
|
||||
throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the non-severity options passed to a rule, based on its schema.
|
||||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
const schema = this.getRuleOptionsSchema(rule);
|
||||
|
||||
if (schema) {
|
||||
ruleValidators.set(rule, ajv.compile(schema));
|
||||
}
|
||||
}
|
||||
|
||||
const validateRule = ruleValidators.get(rule);
|
||||
|
||||
if (validateRule) {
|
||||
validateRule(localOptions);
|
||||
if (validateRule.errors) {
|
||||
throw new Error(validateRule.errors.map(
|
||||
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
||||
).join(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a rule's options against its schema.
|
||||
* @param {{create: Function}|null} rule The rule that the config is being validated for
|
||||
* @param {string} ruleId The rule's unique name.
|
||||
* @param {Array|number} options The given options for the rule.
|
||||
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
||||
* no source is prepended to the message.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
const severity = this.validateRuleSeverity(options);
|
||||
|
||||
if (severity !== 0) {
|
||||
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
||||
}
|
||||
} catch (err) {
|
||||
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||
|
||||
if (typeof source === "string") {
|
||||
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
||||
} else {
|
||||
throw new Error(enhancedMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an environment object
|
||||
* @param {Object} environment The environment config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
source,
|
||||
getAdditionalEnv = noop
|
||||
) {
|
||||
|
||||
// not having an environment is ok
|
||||
if (!environment) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(environment).forEach(id => {
|
||||
const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;
|
||||
|
||||
if (!env) {
|
||||
const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`;
|
||||
|
||||
throw new Error(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a rules config object
|
||||
* @param {Object} rulesConfig The rules config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
rulesConfig,
|
||||
source,
|
||||
getAdditionalRule = noop
|
||||
) {
|
||||
if (!rulesConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(rulesConfig).forEach(id => {
|
||||
const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;
|
||||
|
||||
this.validateRuleOptions(rule, id, rulesConfig[id], source);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a `globals` section of a config file
|
||||
* @param {Object} globalsConfig The `globals` section
|
||||
* @param {string|null} source The name of the configuration source to report in the event of an error.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateGlobals(globalsConfig, source = null) {
|
||||
if (!globalsConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.entries(globalsConfig)
|
||||
.forEach(([configuredGlobal, configuredValue]) => {
|
||||
try {
|
||||
ConfigOps.normalizeConfigGlobal(configuredValue);
|
||||
} catch (err) {
|
||||
throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats an array of schema validation errors.
|
||||
* @param {Array} errors An array of error messages to format.
|
||||
* @returns {string} Formatted error message
|
||||
*/
|
||||
formatErrors(errors) {
|
||||
return errors.map(error => {
|
||||
if (error.keyword === "additionalProperties") {
|
||||
const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;
|
||||
|
||||
return `Unexpected top-level property "${formattedPropertyPath}"`;
|
||||
}
|
||||
if (error.keyword === "type") {
|
||||
const formattedField = error.dataPath.slice(1);
|
||||
const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema;
|
||||
const formattedValue = JSON.stringify(error.data);
|
||||
|
||||
return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
|
||||
}
|
||||
|
||||
const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath;
|
||||
|
||||
return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
|
||||
}).map(message => `\t- ${message}.\n`).join("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the top level properties of the config object.
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
|
||||
if (!validateSchema(config)) {
|
||||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an entire config object.
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @returns {void}
|
||||
*/
|
||||
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
||||
this.validateConfigSchema(config, source);
|
||||
this.validateRules(config.rules, source, getAdditionalRule);
|
||||
this.validateEnvironment(config.env, source, getAdditionalEnv);
|
||||
this.validateGlobals(config.globals, source);
|
||||
|
||||
for (const override of config.overrides || []) {
|
||||
this.validateRules(override.rules, source, getAdditionalRule);
|
||||
this.validateEnvironment(override.env, source, getAdditionalEnv);
|
||||
this.validateGlobals(config.globals, source);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate config array object.
|
||||
* @param {ConfigArray} configArray The config array to validate.
|
||||
* @returns {void}
|
||||
*/
|
||||
validateConfigArray(configArray) {
|
||||
const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);
|
||||
const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);
|
||||
const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);
|
||||
|
||||
// Validate.
|
||||
for (const element of configArray) {
|
||||
if (validated.has(element)) {
|
||||
continue;
|
||||
}
|
||||
validated.add(element);
|
||||
|
||||
this.validateEnvironment(element.env, element.name, getPluginEnv);
|
||||
this.validateGlobals(element.globals, element.name);
|
||||
this.validateProcessor(element.processor, element.name, getPluginProcessor);
|
||||
this.validateRules(element.rules, element.name, getPluginRule);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
64
app_vue/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
Normal file
64
app_vue/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @fileoverview Provide the function that emits deprecation warnings.
|
||||
* @author Toru Nagashima <http://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const path = require("path");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Defitions for deprecation warnings.
|
||||
const deprecationWarningMessages = {
|
||||
ESLINT_LEGACY_ECMAFEATURES:
|
||||
"The 'ecmaFeatures' config file property is deprecated and has no effect.",
|
||||
ESLINT_PERSONAL_CONFIG_LOAD:
|
||||
"'~/.eslintrc.*' config files have been deprecated. " +
|
||||
"Please use a config file per project or the '--config' option.",
|
||||
ESLINT_PERSONAL_CONFIG_SUPPRESS:
|
||||
"'~/.eslintrc.*' config files have been deprecated. " +
|
||||
"Please remove it or add 'root:true' to the config files in your " +
|
||||
"projects in order to avoid loading '~/.eslintrc.*' accidentally."
|
||||
};
|
||||
|
||||
const sourceFileErrorCache = new Set();
|
||||
|
||||
/**
|
||||
* Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
|
||||
* for each unique file path, but repeated invocations with the same file path have no effect.
|
||||
* No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
|
||||
* @param {string} source The name of the configuration source to report the warning for.
|
||||
* @param {string} errorCode The warning message to show.
|
||||
* @returns {void}
|
||||
*/
|
||||
function emitDeprecationWarning(source, errorCode) {
|
||||
const cacheKey = JSON.stringify({ source, errorCode });
|
||||
|
||||
if (sourceFileErrorCache.has(cacheKey)) {
|
||||
return;
|
||||
}
|
||||
sourceFileErrorCache.add(cacheKey);
|
||||
|
||||
const rel = path.relative(process.cwd(), source);
|
||||
const message = deprecationWarningMessages[errorCode];
|
||||
|
||||
process.emitWarning(
|
||||
`${message} (found in "${rel}")`,
|
||||
"DeprecationWarning",
|
||||
errorCode
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
emitDeprecationWarning
|
||||
};
|
97
app_vue/node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
Normal file
97
app_vue/node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @fileoverview Common helpers for naming of plugins, formatters and configs
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const NAMESPACE_REGEX = /^@.*\//iu;
|
||||
|
||||
/**
|
||||
* Brings package name to correct format based on prefix
|
||||
* @param {string} name The name of the package.
|
||||
* @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter"
|
||||
* @returns {string} Normalized name of the package
|
||||
* @private
|
||||
*/
|
||||
function normalizePackageName(name, prefix) {
|
||||
let normalizedName = name;
|
||||
|
||||
/**
|
||||
* On Windows, name can come in with Windows slashes instead of Unix slashes.
|
||||
* Normalize to Unix first to avoid errors later on.
|
||||
* https://github.com/eslint/eslint/issues/5644
|
||||
*/
|
||||
if (normalizedName.includes("\\")) {
|
||||
normalizedName = normalizedName.replace(/\\/gu, "/");
|
||||
}
|
||||
|
||||
if (normalizedName.charAt(0) === "@") {
|
||||
|
||||
/**
|
||||
* it's a scoped package
|
||||
* package name is the prefix, or just a username
|
||||
*/
|
||||
const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"),
|
||||
scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u");
|
||||
|
||||
if (scopedPackageShortcutRegex.test(normalizedName)) {
|
||||
normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);
|
||||
} else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
|
||||
|
||||
/**
|
||||
* for scoped packages, insert the prefix after the first / unless
|
||||
* the path is already @scope/eslint or @scope/eslint-xxx-yyy
|
||||
*/
|
||||
normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`);
|
||||
}
|
||||
} else if (!normalizedName.startsWith(`${prefix}-`)) {
|
||||
normalizedName = `${prefix}-${normalizedName}`;
|
||||
}
|
||||
|
||||
return normalizedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the prefix from a fullname.
|
||||
* @param {string} fullname The term which may have the prefix.
|
||||
* @param {string} prefix The prefix to remove.
|
||||
* @returns {string} The term without prefix.
|
||||
*/
|
||||
function getShorthandName(fullname, prefix) {
|
||||
if (fullname[0] === "@") {
|
||||
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
|
||||
|
||||
if (matchResult) {
|
||||
return matchResult[1];
|
||||
}
|
||||
|
||||
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
|
||||
if (matchResult) {
|
||||
return `${matchResult[1]}/${matchResult[2]}`;
|
||||
}
|
||||
} else if (fullname.startsWith(`${prefix}-`)) {
|
||||
return fullname.slice(prefix.length + 1);
|
||||
}
|
||||
|
||||
return fullname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scope (namespace) of a term.
|
||||
* @param {string} term The term which may have the namespace.
|
||||
* @returns {string} The namespace of the term if it has one.
|
||||
*/
|
||||
function getNamespaceFromTerm(term) {
|
||||
const match = term.match(NAMESPACE_REGEX);
|
||||
|
||||
return match ? match[0] : "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
normalizePackageName,
|
||||
getShorthandName,
|
||||
getNamespaceFromTerm
|
||||
};
|
44
app_vue/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
Normal file
44
app_vue/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Utility for resolving a module relative to another module
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const Module = require("module");
|
||||
|
||||
/*
|
||||
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
|
||||
* We only support the case where the argument is a filepath, not a URL.
|
||||
*/
|
||||
// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api
|
||||
const createRequire = Module.createRequire || Module.createRequireFromPath;
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Resolves a Node module relative to another module
|
||||
* @param {string} moduleName The name of a Node module, or a path to a Node module.
|
||||
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
|
||||
* a file rather than a directory, but the file need not actually exist.
|
||||
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
|
||||
*/
|
||||
resolve(moduleName, relativeToPath) {
|
||||
try {
|
||||
return createRequire(relativeToPath).resolve(moduleName);
|
||||
} catch (error) {
|
||||
|
||||
// This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.
|
||||
if (
|
||||
typeof error === "object" &&
|
||||
error !== null &&
|
||||
error.code === "MODULE_NOT_FOUND" &&
|
||||
!error.requireStack &&
|
||||
error.message.includes(moduleName)
|
||||
) {
|
||||
error.message += `\nRequire stack:\n- ${relativeToPath}`;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
150
app_vue/node_modules/@eslint/eslintrc/lib/shared/types.js
generated
vendored
Normal file
150
app_vue/node_modules/@eslint/eslintrc/lib/shared/types.js
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @fileoverview Define common types for input completion.
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/** @type {any} */
|
||||
module.exports = {};
|
||||
|
||||
/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */
|
||||
/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */
|
||||
/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */
|
||||
|
||||
/**
|
||||
* @typedef {Object} EcmaFeatures
|
||||
* @property {boolean} [globalReturn] Enabling `return` statements at the top-level.
|
||||
* @property {boolean} [jsx] Enabling JSX syntax.
|
||||
* @property {boolean} [impliedStrict] Enabling strict mode always.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ParserOptions
|
||||
* @property {EcmaFeatures} [ecmaFeatures] The optional features.
|
||||
* @property {3|5|6|7|8|9|10|11|12|2015|2016|2017|2018|2019|2020|2021} [ecmaVersion] The ECMAScript version (or revision number).
|
||||
* @property {"script"|"module"} [sourceType] The source code type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ConfigData
|
||||
* @property {Record<string, boolean>} [env] The environment settings.
|
||||
* @property {string | string[]} [extends] The path to other config files or the package name of shareable configs.
|
||||
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
|
||||
* @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint.
|
||||
* @property {boolean} [noInlineConfig] The flag that disables directive comments.
|
||||
* @property {OverrideConfigData[]} [overrides] The override settings per kind of files.
|
||||
* @property {string} [parser] The path to a parser or the package name of a parser.
|
||||
* @property {ParserOptions} [parserOptions] The parser options.
|
||||
* @property {string[]} [plugins] The plugin specifiers.
|
||||
* @property {string} [processor] The processor specifier.
|
||||
* @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments.
|
||||
* @property {boolean} [root] The root flag.
|
||||
* @property {Record<string, RuleConf>} [rules] The rule settings.
|
||||
* @property {Object} [settings] The shared settings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} OverrideConfigData
|
||||
* @property {Record<string, boolean>} [env] The environment settings.
|
||||
* @property {string | string[]} [excludedFiles] The glob pattarns for excluded files.
|
||||
* @property {string | string[]} [extends] The path to other config files or the package name of shareable configs.
|
||||
* @property {string | string[]} files The glob patterns for target files.
|
||||
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
|
||||
* @property {boolean} [noInlineConfig] The flag that disables directive comments.
|
||||
* @property {OverrideConfigData[]} [overrides] The override settings per kind of files.
|
||||
* @property {string} [parser] The path to a parser or the package name of a parser.
|
||||
* @property {ParserOptions} [parserOptions] The parser options.
|
||||
* @property {string[]} [plugins] The plugin specifiers.
|
||||
* @property {string} [processor] The processor specifier.
|
||||
* @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments.
|
||||
* @property {Record<string, RuleConf>} [rules] The rule settings.
|
||||
* @property {Object} [settings] The shared settings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ParseResult
|
||||
* @property {Object} ast The AST.
|
||||
* @property {ScopeManager} [scopeManager] The scope manager of the AST.
|
||||
* @property {Record<string, any>} [services] The services that the parser provides.
|
||||
* @property {Record<string, string[]>} [visitorKeys] The visitor keys of the AST.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Parser
|
||||
* @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables.
|
||||
* @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Environment
|
||||
* @property {Record<string, GlobalConf>} [globals] The definition of global variables.
|
||||
* @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} LintMessage
|
||||
* @property {number} column The 1-based column number.
|
||||
* @property {number} [endColumn] The 1-based column number of the end location.
|
||||
* @property {number} [endLine] The 1-based line number of the end location.
|
||||
* @property {boolean} fatal If `true` then this is a fatal error.
|
||||
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
|
||||
* @property {number} line The 1-based line number.
|
||||
* @property {string} message The error message.
|
||||
* @property {string|null} ruleId The ID of the rule which makes this message.
|
||||
* @property {0|1|2} severity The severity of this message.
|
||||
* @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} SuggestionResult
|
||||
* @property {string} desc A short description.
|
||||
* @property {string} [messageId] Id referencing a message for the description.
|
||||
* @property {{ text: string, range: number[] }} fix fix result info
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Processor
|
||||
* @property {(text:string, filename:string) => Array<string | { text:string, filename:string }>} [preprocess] The function to extract code blocks.
|
||||
* @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages.
|
||||
* @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} RuleMetaDocs
|
||||
* @property {string} category The category of the rule.
|
||||
* @property {string} description The description of the rule.
|
||||
* @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset.
|
||||
* @property {string} url The URL of the rule documentation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} RuleMeta
|
||||
* @property {boolean} [deprecated] If `true` then the rule has been deprecated.
|
||||
* @property {RuleMetaDocs} docs The document information of the rule.
|
||||
* @property {"code"|"whitespace"} [fixable] The autofix type.
|
||||
* @property {Record<string,string>} [messages] The messages the rule reports.
|
||||
* @property {string[]} [replacedBy] The IDs of the alternative rules.
|
||||
* @property {Array|Object} schema The option schema of the rule.
|
||||
* @property {"problem"|"suggestion"|"layout"} type The rule type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Rule
|
||||
* @property {Function} create The factory of the rule.
|
||||
* @property {RuleMeta} meta The meta data of the rule.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Plugin
|
||||
* @property {Record<string, ConfigData>} [configs] The definition of plugin configs.
|
||||
* @property {Record<string, Environment>} [environments] The definition of plugin environments.
|
||||
* @property {Record<string, Processor>} [processors] The definition of plugin processors.
|
||||
* @property {Record<string, Function | Rule>} [rules] The definition of plugin rules.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Information of deprecated rules.
|
||||
* @typedef {Object} DeprecatedRuleInfo
|
||||
* @property {string} ruleId The rule ID.
|
||||
* @property {string[]} replacedBy The rule IDs that replace this deprecated rule.
|
||||
*/
|
1998
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/globals.json
generated
vendored
Normal file
1998
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/globals.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/index.d.ts
generated
vendored
Normal file
6
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import {ReadonlyDeep} from 'type-fest';
|
||||
import globalsJson = require('./globals.json');
|
||||
|
||||
declare const globals: ReadonlyDeep<typeof globalsJson>;
|
||||
|
||||
export = globals;
|
2
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/index.js
generated
vendored
Normal file
2
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = require('./globals.json');
|
9
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/license
generated
vendored
Normal file
9
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/package.json
generated
vendored
Normal file
56
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/package.json
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "globals",
|
||||
"version": "13.24.0",
|
||||
"description": "Global identifiers from different JavaScript environments",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/globals",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"globals.json"
|
||||
],
|
||||
"keywords": [
|
||||
"globals",
|
||||
"global",
|
||||
"identifiers",
|
||||
"variables",
|
||||
"vars",
|
||||
"jshint",
|
||||
"eslint",
|
||||
"environments"
|
||||
],
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.36.1"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"get-browser-globals.js"
|
||||
],
|
||||
"rules": {
|
||||
"node/no-unsupported-features/es-syntax": "off"
|
||||
}
|
||||
},
|
||||
"tsd": {
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
||||
}
|
44
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/readme.md
generated
vendored
Normal file
44
app_vue/node_modules/@eslint/eslintrc/node_modules/globals/readme.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# globals
|
||||
|
||||
> Global identifiers from different JavaScript environments
|
||||
|
||||
It's just a [JSON file](globals.json), so use it in any environment.
|
||||
|
||||
This package is used by ESLint.
|
||||
|
||||
**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install globals
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const globals = require('globals');
|
||||
|
||||
console.log(globals.browser);
|
||||
/*
|
||||
{
|
||||
addEventListener: false,
|
||||
applicationCache: false,
|
||||
ArrayBuffer: false,
|
||||
atob: false,
|
||||
…
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise.
|
||||
|
||||
For Node.js this package provides two sets of globals:
|
||||
|
||||
- `globals.nodeBuiltin`: Globals available to all code running in Node.js.
|
||||
These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
|
||||
See: https://nodejs.org/api/globals.html
|
||||
- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope").
|
||||
See: https://nodejs.org/api/modules.html#modules_the_module_scope
|
||||
|
||||
When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references.
|
38
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/base.d.ts
generated
vendored
Normal file
38
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/base.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Types that are compatible with all supported TypeScript versions.
|
||||
// It's shared between all TypeScript version-specific definitions.
|
||||
|
||||
// Basic
|
||||
export * from './source/basic';
|
||||
|
||||
// Utilities
|
||||
export {Except} from './source/except';
|
||||
export {Mutable} from './source/mutable';
|
||||
export {Merge} from './source/merge';
|
||||
export {MergeExclusive} from './source/merge-exclusive';
|
||||
export {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export {RequireExactlyOne} from './source/require-exactly-one';
|
||||
export {PartialDeep} from './source/partial-deep';
|
||||
export {ReadonlyDeep} from './source/readonly-deep';
|
||||
export {LiteralUnion} from './source/literal-union';
|
||||
export {Promisable} from './source/promisable';
|
||||
export {Opaque} from './source/opaque';
|
||||
export {SetOptional} from './source/set-optional';
|
||||
export {SetRequired} from './source/set-required';
|
||||
export {ValueOf} from './source/value-of';
|
||||
export {PromiseValue} from './source/promise-value';
|
||||
export {AsyncReturnType} from './source/async-return-type';
|
||||
export {ConditionalExcept} from './source/conditional-except';
|
||||
export {ConditionalKeys} from './source/conditional-keys';
|
||||
export {ConditionalPick} from './source/conditional-pick';
|
||||
export {UnionToIntersection} from './source/union-to-intersection';
|
||||
export {Stringified} from './source/stringified';
|
||||
export {FixedLengthArray} from './source/fixed-length-array';
|
||||
export {IterableElement} from './source/iterable-element';
|
||||
export {Entry} from './source/entry';
|
||||
export {Entries} from './source/entries';
|
||||
export {SetReturnType} from './source/set-return-type';
|
||||
export {Asyncify} from './source/asyncify';
|
||||
|
||||
// Miscellaneous
|
||||
export {PackageJson} from './source/package-json';
|
||||
export {TsConfigJson} from './source/tsconfig-json';
|
2
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
2
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// These are all the basic types that's compatible with all supported TypeScript versions.
|
||||
export * from './base';
|
9
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/license
generated
vendored
Normal file
9
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https:/sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
58
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/package.json
generated
vendored
Normal file
58
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "type-fest",
|
||||
"version": "0.20.2",
|
||||
"description": "A collection of essential TypeScript types",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"repository": "sindresorhus/type-fest",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"//test": "xo && tsd && tsc",
|
||||
"test": "xo && tsc"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"base.d.ts",
|
||||
"source",
|
||||
"ts41"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ts",
|
||||
"types",
|
||||
"utility",
|
||||
"util",
|
||||
"utilities",
|
||||
"omit",
|
||||
"merge",
|
||||
"json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "~0.7.0",
|
||||
"tsd": "^0.13.1",
|
||||
"typescript": "^4.1.2",
|
||||
"xo": "^0.35.0"
|
||||
},
|
||||
"types": "./index.d.ts",
|
||||
"typesVersions": {
|
||||
">=4.1": {
|
||||
"*": [
|
||||
"ts41/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/indent": "off",
|
||||
"node/no-unsupported-features/es-builtins": "off"
|
||||
}
|
||||
}
|
||||
}
|
658
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/readme.md
generated
vendored
Normal file
658
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/readme.md
generated
vendored
Normal file
@ -0,0 +1,658 @@
|
||||
<div align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img src="media/logo.svg" alt="type-fest" height="300">
|
||||
<br>
|
||||
<br>
|
||||
<b>A collection of essential TypeScript types</b>
|
||||
<br>
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)
|
||||
<!-- Commented out until they actually show anything
|
||||
[](https://www.npmjs.com/package/type-fest?activeTab=dependents) [](https://www.npmjs.com/package/type-fest)
|
||||
-->
|
||||
|
||||
Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
|
||||
|
||||
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install type-fest
|
||||
```
|
||||
|
||||
*Requires TypeScript >=3.4*
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
unicorn: string;
|
||||
rainbow: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutRainbow = Except<Foo, 'rainbow'>;
|
||||
//=> {unicorn: string}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Click the type names for complete docs.
|
||||
|
||||
### Basic
|
||||
|
||||
- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
- [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
|
||||
- [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
|
||||
- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
|
||||
- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
|
||||
### Utilities
|
||||
|
||||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type).
|
||||
- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly<T>`.
|
||||
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
|
||||
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
|
||||
- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
|
||||
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep.
|
||||
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep.
|
||||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
|
||||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
|
||||
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
|
||||
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
|
||||
- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.
|
||||
- [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`.
|
||||
- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
|
||||
- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
|
||||
- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
|
||||
- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
|
||||
- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
|
||||
- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
|
||||
- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
|
||||
- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
|
||||
- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
|
||||
- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
|
||||
- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.
|
||||
- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
|
||||
|
||||
### Template literal types
|
||||
|
||||
*Note:* These require [TypeScript 4.1 or newer](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types).
|
||||
|
||||
- [`CamelCase`](ts41/camel-case.d.ts) – Convert a string literal to camel-case (`fooBar`).
|
||||
- [`KebabCase`](ts41/kebab-case.d.ts) – Convert a string literal to kebab-case (`foo-bar`).
|
||||
- [`PascalCase`](ts41/pascal-case.d.ts) – Converts a string literal to pascal-case (`FooBar`)
|
||||
- [`SnakeCase`](ts41/snake-case.d.ts) – Convert a string literal to snake-case (`foo_bar`).
|
||||
- [`DelimiterCase`](ts41/delimiter-case.d.ts) – Convert a string literal to a custom string delimiter casing.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
|
||||
- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
|
||||
|
||||
## Declined types
|
||||
|
||||
*If we decline a type addition, we will make sure to document the better solution here.*
|
||||
|
||||
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
|
||||
- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
|
||||
- [`SubType`](https://github.com/sindresorhus/type-fest/issues/22) - The type is powerful, but lacks good use-cases and is prone to misuse.
|
||||
- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.
|
||||
|
||||
## Tips
|
||||
|
||||
### Built-in types
|
||||
|
||||
There are many advanced types most users don't know about.
|
||||
|
||||
- [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)
|
||||
|
||||
```ts
|
||||
interface NodeConfig {
|
||||
appName: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
class NodeAppBuilder {
|
||||
private configuration: NodeConfig = {
|
||||
appName: 'NodeApp',
|
||||
port: 3000
|
||||
};
|
||||
|
||||
private updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {
|
||||
this.configuration[key] = value;
|
||||
}
|
||||
|
||||
config(config: Partial<NodeConfig>) {
|
||||
type NodeConfigKey = keyof NodeConfig;
|
||||
|
||||
for (const key of Object.keys(config) as NodeConfigKey[]) {
|
||||
const updateValue = config[key];
|
||||
|
||||
if (updateValue === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.updateConfig(key, updateValue);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// `Partial<NodeConfig>`` allows us to provide only a part of the
|
||||
// NodeConfig interface.
|
||||
new NodeAppBuilder().config({appName: 'ToDoApp'});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Required<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)
|
||||
|
||||
```ts
|
||||
interface ContactForm {
|
||||
email?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
function submitContactForm(formData: Required<ContactForm>) {
|
||||
// Send the form data to the server.
|
||||
}
|
||||
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
message: 'Hi! Could you tell me more about…',
|
||||
});
|
||||
|
||||
// TypeScript error: missing property 'message'
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)
|
||||
|
||||
```ts
|
||||
enum LogLevel {
|
||||
Off,
|
||||
Debug,
|
||||
Error,
|
||||
Fatal
|
||||
};
|
||||
|
||||
interface LoggerConfig {
|
||||
name: string;
|
||||
level: LogLevel;
|
||||
}
|
||||
|
||||
class Logger {
|
||||
config: Readonly<LoggerConfig>;
|
||||
|
||||
constructor({name, level}: LoggerConfig) {
|
||||
this.config = {name, level};
|
||||
Object.freeze(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
const config: LoggerConfig = {
|
||||
name: 'MyApp',
|
||||
level: LogLevel.Debug
|
||||
};
|
||||
|
||||
const logger = new Logger(config);
|
||||
|
||||
// TypeScript Error: cannot assign to read-only property.
|
||||
logger.config.level = LogLevel.Error;
|
||||
|
||||
// We are able to edit config variable as we please.
|
||||
config.level = LogLevel.Error;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Pick<T, K>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)
|
||||
|
||||
```ts
|
||||
interface Article {
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Creates new type out of the `Article` interface composed
|
||||
// from the Articles' two properties: `title` and `thumbnail`.
|
||||
// `ArticlePreview = {title: string; thumbnail: string}`
|
||||
type ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;
|
||||
|
||||
// Render a list of articles using only title and description.
|
||||
function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {
|
||||
const articles = document.createElement('div');
|
||||
|
||||
for (const preview of previews) {
|
||||
// Append preview to the articles.
|
||||
}
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
const articles = renderArticlePreviews([
|
||||
{
|
||||
title: 'TypeScript tutorial!',
|
||||
thumbnail: '/assets/ts.jpg'
|
||||
}
|
||||
]);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Record<K, T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)
|
||||
|
||||
```ts
|
||||
// Positions of employees in our company.
|
||||
type MemberPosition = 'intern' | 'developer' | 'tech-lead';
|
||||
|
||||
// Interface describing properties of a single employee.
|
||||
interface Employee {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
yearsOfExperience: number;
|
||||
}
|
||||
|
||||
// Create an object that has all possible `MemberPosition` values set as keys.
|
||||
// Those keys will store a collection of Employees of the same position.
|
||||
const team: Record<MemberPosition, Employee[]> = {
|
||||
intern: [],
|
||||
developer: [],
|
||||
'tech-lead': [],
|
||||
};
|
||||
|
||||
// Our team has decided to help John with his dream of becoming Software Developer.
|
||||
team.intern.push({
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
yearsOfExperience: 0
|
||||
});
|
||||
|
||||
// `Record` forces you to initialize all of the property keys.
|
||||
// TypeScript Error: "tech-lead" property is missing
|
||||
const teamEmpty: Record<MemberPosition, null> = {
|
||||
intern: null,
|
||||
developer: null,
|
||||
};
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Exclude<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)
|
||||
|
||||
```ts
|
||||
interface ServerConfig {
|
||||
port: null | string | number;
|
||||
}
|
||||
|
||||
type RequestHandler = (request: Request, response: Response) => void;
|
||||
|
||||
// Exclude `null` type from `null | string | number`.
|
||||
// In case the port is equal to `null`, we will use default value.
|
||||
function getPortValue(port: Exclude<ServerConfig['port'], null>): number {
|
||||
if (typeof port === 'string') {
|
||||
return parseInt(port, 10);
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
function startServer(handler: RequestHandler, config: ServerConfig): void {
|
||||
const server = require('http').createServer(handler);
|
||||
|
||||
const port = config.port === null ? 3000 : getPortValue(config.port);
|
||||
server.listen(port);
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Extract<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)
|
||||
|
||||
```ts
|
||||
declare function uniqueId(): number;
|
||||
|
||||
const ID = Symbol('ID');
|
||||
|
||||
interface Person {
|
||||
[ID]: number;
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
// Allows changing the person data as long as the property key is of string type.
|
||||
function changePersonData<
|
||||
Obj extends Person,
|
||||
Key extends Extract<keyof Person, string>,
|
||||
Value extends Obj[Key]
|
||||
> (obj: Obj, key: Key, value: Value): void {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
// Tiny Andrew was born.
|
||||
const andrew = {
|
||||
[ID]: uniqueId(),
|
||||
name: 'Andrew',
|
||||
age: 0,
|
||||
};
|
||||
|
||||
// Cool, we're fine with that.
|
||||
changePersonData(andrew, 'name', 'Pony');
|
||||
|
||||
// Goverment didn't like the fact that you wanted to change your identity.
|
||||
changePersonData(andrew, ID, uniqueId());
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`NonNullable<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
Works with <code>strictNullChecks</code> set to <code>true</code>. (Read more <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html">here</a>)
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)
|
||||
|
||||
```ts
|
||||
type PortNumber = string | number | null;
|
||||
|
||||
/** Part of a class definition that is used to build a server */
|
||||
class ServerBuilder {
|
||||
portNumber!: NonNullable<PortNumber>;
|
||||
|
||||
port(this: ServerBuilder, port: PortNumber): ServerBuilder {
|
||||
if (port == null) {
|
||||
this.portNumber = 8000;
|
||||
} else {
|
||||
this.portNumber = port;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
const serverBuilder = new ServerBuilder();
|
||||
|
||||
serverBuilder
|
||||
.port('8000') // portNumber = '8000'
|
||||
.port(null) // portNumber = 8000
|
||||
.port(3000); // portNumber = 3000
|
||||
|
||||
// TypeScript error
|
||||
serverBuilder.portNumber = null;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Parameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)
|
||||
|
||||
```ts
|
||||
function shuffle(input: any[]): void {
|
||||
// Mutate array randomly changing its' elements indexes.
|
||||
}
|
||||
|
||||
function callNTimes<Fn extends (...args: any[]) => any> (func: Fn, callCount: number) {
|
||||
// Type that represents the type of the received function parameters.
|
||||
type FunctionParameters = Parameters<Fn>;
|
||||
|
||||
return function (...args: FunctionParameters) {
|
||||
for (let i = 0; i < callCount; i++) {
|
||||
func(...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const shuffleTwice = callNTimes(shuffle, 2);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ConstructorParameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)
|
||||
|
||||
```ts
|
||||
class ArticleModel {
|
||||
title: string;
|
||||
content?: string;
|
||||
|
||||
constructor(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
class InstanceCache<T extends (new (...args: any[]) => any)> {
|
||||
private ClassConstructor: T;
|
||||
private cache: Map<string, InstanceType<T>> = new Map();
|
||||
|
||||
constructor (ctr: T) {
|
||||
this.ClassConstructor = ctr;
|
||||
}
|
||||
|
||||
getInstance (...args: ConstructorParameters<T>): InstanceType<T> {
|
||||
const hash = this.calculateArgumentsHash(...args);
|
||||
|
||||
const existingInstance = this.cache.get(hash);
|
||||
if (existingInstance !== undefined) {
|
||||
return existingInstance;
|
||||
}
|
||||
|
||||
return new this.ClassConstructor(...args);
|
||||
}
|
||||
|
||||
private calculateArgumentsHash(...args: any[]): string {
|
||||
// Calculate hash.
|
||||
return 'hash';
|
||||
}
|
||||
}
|
||||
|
||||
const articleCache = new InstanceCache(ArticleModel);
|
||||
const amazonArticle = articleCache.getInstance('Amazon forests burining!');
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ReturnType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */
|
||||
function mapIter<
|
||||
Elem,
|
||||
Func extends (elem: Elem) => any,
|
||||
Ret extends ReturnType<Func>
|
||||
>(iter: Iterable<Elem>, callback: Func): Ret[] {
|
||||
const mapped: Ret[] = [];
|
||||
|
||||
for (const elem of iter) {
|
||||
mapped.push(callback(elem));
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
const setObject: Set<string> = new Set();
|
||||
const mapObject: Map<number, string> = new Map();
|
||||
|
||||
mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]
|
||||
|
||||
mapIter(mapObject, ([key, value]: [number, string]) => {
|
||||
return key % 2 === 0 ? value : 'Odd';
|
||||
}); // string[]
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`InstanceType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
class IdleService {
|
||||
doNothing (): void {}
|
||||
}
|
||||
|
||||
class News {
|
||||
title: string;
|
||||
content: string;
|
||||
|
||||
constructor(title: string, content: string) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
const instanceCounter: Map<Function, number> = new Map();
|
||||
|
||||
interface Constructor {
|
||||
new(...args: any[]): any;
|
||||
}
|
||||
|
||||
// Keep track how many instances of `Constr` constructor have been created.
|
||||
function getInstance<
|
||||
Constr extends Constructor,
|
||||
Args extends ConstructorParameters<Constr>
|
||||
>(constructor: Constr, ...args: Args): InstanceType<Constr> {
|
||||
let count = instanceCounter.get(constructor) || 0;
|
||||
|
||||
const instance = new constructor(...args);
|
||||
|
||||
instanceCounter.set(constructor, count + 1);
|
||||
|
||||
console.log(`Created ${count + 1} instances of ${Constr.name} class`);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
const idleService = getInstance(IdleService);
|
||||
// Will log: `Created 1 instances of IdleService class`
|
||||
const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');
|
||||
// Will log: `Created 1 instances of News class`
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Omit<T, K>`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)
|
||||
|
||||
```ts
|
||||
interface Animal {
|
||||
imageUrl: string;
|
||||
species: string;
|
||||
images: string[];
|
||||
paragraphs: string[];
|
||||
}
|
||||
|
||||
// Creates new type with all properties of the `Animal` interface
|
||||
// except 'images' and 'paragraphs' properties. We can use this
|
||||
// type to render small hover tooltip for a wiki entry list.
|
||||
type AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;
|
||||
|
||||
function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {
|
||||
const container = document.createElement('div');
|
||||
// Internal implementation.
|
||||
return container;
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Jarek Radosz](https://github.com/CvX)
|
||||
- [Dimitri Benin](https://github.com/BendingBender)
|
||||
- [Pelle Wessman](https://github.com/voxpelli)
|
||||
|
||||
## License
|
||||
|
||||
(MIT OR CC0-1.0)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-type-fest?utm_source=npm-type-fest&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
23
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
23
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import {PromiseValue} from './promise-value';
|
||||
|
||||
type AsyncFunction = (...args: any[]) => Promise<unknown>;
|
||||
|
||||
/**
|
||||
Unwrap the return type of a function that returns a `Promise`.
|
||||
|
||||
There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
|
||||
|
||||
@example
|
||||
```ts
|
||||
import {AsyncReturnType} from 'type-fest';
|
||||
import {asyncFunction} from 'api';
|
||||
|
||||
// This type resolves to the unwrapped return type of `asyncFunction`.
|
||||
type Value = AsyncReturnType<typeof asyncFunction>;
|
||||
|
||||
async function doSomething(value: Value) {}
|
||||
|
||||
asyncFunction().then(value => doSomething(value));
|
||||
```
|
||||
*/
|
||||
export type AsyncReturnType<Target extends AsyncFunction> = PromiseValue<ReturnType<Target>>;
|
31
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/asyncify.d.ts
generated
vendored
Normal file
31
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/asyncify.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import {PromiseValue} from './promise-value';
|
||||
import {SetReturnType} from './set-return-type';
|
||||
|
||||
/**
|
||||
Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.
|
||||
|
||||
Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Asyncify} from 'type-fest';
|
||||
|
||||
// Synchronous function.
|
||||
function getFooSync(someArg: SomeType): Foo {
|
||||
// …
|
||||
}
|
||||
|
||||
type AsyncifiedFooGetter = Asyncify<typeof getFooSync>;
|
||||
//=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise<Foo>;
|
||||
|
||||
// Same as `getFooSync` but asynchronous.
|
||||
const getFooAsync: AsyncifiedFooGetter = (someArg) => {
|
||||
// TypeScript now knows that `someArg` is `SomeType` automatically.
|
||||
// It also knows that this function must return `Promise<Foo>`.
|
||||
// If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.".
|
||||
|
||||
// …
|
||||
}
|
||||
```
|
||||
*/
|
||||
export type Asyncify<Fn extends (...args: any[]) => any> = SetReturnType<Fn, Promise<PromiseValue<ReturnType<Fn>>>>;
|
67
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
67
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
/// <reference lib="esnext"/>
|
||||
|
||||
// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
|
||||
/**
|
||||
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
*/
|
||||
export type Primitive =
|
||||
| null
|
||||
| undefined
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| symbol
|
||||
| bigint;
|
||||
|
||||
// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
|
||||
/**
|
||||
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
*/
|
||||
export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
|
||||
|
||||
/**
|
||||
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
*/
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
|
||||
/**
|
||||
Matches a JSON object.
|
||||
|
||||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
||||
*/
|
||||
export type JsonObject = {[Key in string]?: JsonValue};
|
||||
|
||||
/**
|
||||
Matches a JSON array.
|
||||
*/
|
||||
export interface JsonArray extends Array<JsonValue> {}
|
||||
|
||||
/**
|
||||
Matches any valid JSON value.
|
||||
*/
|
||||
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
||||
|
||||
declare global {
|
||||
interface SymbolConstructor {
|
||||
readonly observable: symbol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
*/
|
||||
export interface ObservableLike {
|
||||
subscribe(observer: (value: unknown) => void): void;
|
||||
[Symbol.observable](): ObservableLike;
|
||||
}
|
43
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
43
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
import {Except} from './except';
|
||||
import {ConditionalKeys} from './conditional-keys';
|
||||
|
||||
/**
|
||||
Exclude keys from a shape that matches the given `Condition`.
|
||||
|
||||
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Primitive, ConditionalExcept} from 'type-fest';
|
||||
|
||||
class Awesome {
|
||||
name: string;
|
||||
successes: number;
|
||||
failures: bigint;
|
||||
|
||||
run() {}
|
||||
}
|
||||
|
||||
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
||||
//=> {run: () => void}
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalExcept} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c: () => void;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
||||
//=> {b: string | number; c: () => void; d: {}}
|
||||
```
|
||||
*/
|
||||
export type ConditionalExcept<Base, Condition> = Except<
|
||||
Base,
|
||||
ConditionalKeys<Base, Condition>
|
||||
>;
|
43
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-keys.d.ts
generated
vendored
Normal file
43
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-keys.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
||||
|
||||
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalKeys} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c?: string;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type StringKeysOnly = ConditionalKeys<Example, string>;
|
||||
//=> 'a'
|
||||
```
|
||||
|
||||
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
||||
|
||||
@example
|
||||
```
|
||||
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
||||
//=> 'a' | 'c'
|
||||
```
|
||||
*/
|
||||
export type ConditionalKeys<Base, Condition> = NonNullable<
|
||||
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
||||
{
|
||||
// Map through all the keys of the given base type.
|
||||
[Key in keyof Base]:
|
||||
// Pick only keys with types extending the given `Condition` type.
|
||||
Base[Key] extends Condition
|
||||
// Retain this key since the condition passes.
|
||||
? Key
|
||||
// Discard this key since the condition fails.
|
||||
: never;
|
||||
|
||||
// Convert the produced object into a union type of the keys which passed the conditional test.
|
||||
}[keyof Base]
|
||||
>;
|
42
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-pick.d.ts
generated
vendored
Normal file
42
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/conditional-pick.d.ts
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
import {ConditionalKeys} from './conditional-keys';
|
||||
|
||||
/**
|
||||
Pick keys from the shape that matches the given `Condition`.
|
||||
|
||||
This is useful when you want to create a new type from a specific subset of an existing type. For example, you might want to pick all the primitive properties from a class and form a new automatically derived type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Primitive, ConditionalPick} from 'type-fest';
|
||||
|
||||
class Awesome {
|
||||
name: string;
|
||||
successes: number;
|
||||
failures: bigint;
|
||||
|
||||
run() {}
|
||||
}
|
||||
|
||||
type PickPrimitivesFromAwesome = ConditionalPick<Awesome, Primitive>;
|
||||
//=> {name: string; successes: number; failures: bigint}
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalPick} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c: () => void;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type StringKeysOnly = ConditionalPick<Example, string>;
|
||||
//=> {a: string}
|
||||
```
|
||||
*/
|
||||
export type ConditionalPick<Base, Condition> = Pick<
|
||||
Base,
|
||||
ConditionalKeys<Base, Condition>
|
||||
>;
|
57
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/entries.d.ts
generated
vendored
Normal file
57
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/entries.d.ts
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
import {ArrayEntry, MapEntry, ObjectEntry, SetEntry} from './entry';
|
||||
|
||||
type ArrayEntries<BaseType extends readonly unknown[]> = Array<ArrayEntry<BaseType>>;
|
||||
type MapEntries<BaseType> = Array<MapEntry<BaseType>>;
|
||||
type ObjectEntries<BaseType> = Array<ObjectEntry<BaseType>>;
|
||||
type SetEntries<BaseType extends Set<unknown>> = Array<SetEntry<BaseType>>;
|
||||
|
||||
/**
|
||||
Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entries` type will return the type of that collection's entries.
|
||||
|
||||
For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable.
|
||||
|
||||
@see `Entry` if you want to just access the type of a single entry.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Entries} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
someKey: number;
|
||||
}
|
||||
|
||||
const manipulatesEntries = (examples: Entries<Example>) => examples.map(example => [
|
||||
// Does some arbitrary processing on the key (with type information available)
|
||||
example[0].toUpperCase(),
|
||||
|
||||
// Does some arbitrary processing on the value (with type information available)
|
||||
example[1].toFixed()
|
||||
]);
|
||||
|
||||
const example: Example = {someKey: 1};
|
||||
const entries = Object.entries(example) as Entries<Example>;
|
||||
const output = manipulatesEntries(entries);
|
||||
|
||||
// Objects
|
||||
const objectExample = {a: 1};
|
||||
const objectEntries: Entries<typeof objectExample> = [['a', 1]];
|
||||
|
||||
// Arrays
|
||||
const arrayExample = ['a', 1];
|
||||
const arrayEntries: Entries<typeof arrayExample> = [[0, 'a'], [1, 1]];
|
||||
|
||||
// Maps
|
||||
const mapExample = new Map([['a', 1]]);
|
||||
const mapEntries: Entries<typeof map> = [['a', 1]];
|
||||
|
||||
// Sets
|
||||
const setExample = new Set(['a', 1]);
|
||||
const setEntries: Entries<typeof setExample> = [['a', 'a'], [1, 1]];
|
||||
```
|
||||
*/
|
||||
export type Entries<BaseType> =
|
||||
BaseType extends Map<unknown, unknown> ? MapEntries<BaseType>
|
||||
: BaseType extends Set<unknown> ? SetEntries<BaseType>
|
||||
: BaseType extends unknown[] ? ArrayEntries<BaseType>
|
||||
: BaseType extends object ? ObjectEntries<BaseType>
|
||||
: never;
|
60
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/entry.d.ts
generated
vendored
Normal file
60
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/entry.d.ts
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
type MapKey<BaseType> = BaseType extends Map<infer KeyType, unknown> ? KeyType : never;
|
||||
type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
|
||||
|
||||
export type ArrayEntry<BaseType extends readonly unknown[]> = [number, BaseType[number]];
|
||||
export type MapEntry<BaseType> = [MapKey<BaseType>, MapValue<BaseType>];
|
||||
export type ObjectEntry<BaseType> = [keyof BaseType, BaseType[keyof BaseType]];
|
||||
export type SetEntry<BaseType> = BaseType extends Set<infer ItemType> ? [ItemType, ItemType] : never;
|
||||
|
||||
/**
|
||||
Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry.
|
||||
|
||||
For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable.
|
||||
|
||||
@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Entry} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
someKey: number;
|
||||
}
|
||||
|
||||
const manipulatesEntry = (example: Entry<Example>) => [
|
||||
// Does some arbitrary processing on the key (with type information available)
|
||||
example[0].toUpperCase(),
|
||||
|
||||
// Does some arbitrary processing on the value (with type information available)
|
||||
example[1].toFixed(),
|
||||
];
|
||||
|
||||
const example: Example = {someKey: 1};
|
||||
const entry = Object.entries(example)[0] as Entry<Example>;
|
||||
const output = manipulatesEntry(entry);
|
||||
|
||||
// Objects
|
||||
const objectExample = {a: 1};
|
||||
const objectEntry: Entry<typeof objectExample> = ['a', 1];
|
||||
|
||||
// Arrays
|
||||
const arrayExample = ['a', 1];
|
||||
const arrayEntryString: Entry<typeof arrayExample> = [0, 'a'];
|
||||
const arrayEntryNumber: Entry<typeof arrayExample> = [1, 1];
|
||||
|
||||
// Maps
|
||||
const mapExample = new Map([['a', 1]]);
|
||||
const mapEntry: Entry<typeof map> = ['a', 1];
|
||||
|
||||
// Sets
|
||||
const setExample = new Set(['a', 1]);
|
||||
const setEntryString: Entry<typeof setExample> = ['a', 'a'];
|
||||
const setEntryNumber: Entry<typeof setExample> = [1, 1];
|
||||
```
|
||||
*/
|
||||
export type Entry<BaseType> =
|
||||
BaseType extends Map<unknown, unknown> ? MapEntry<BaseType>
|
||||
: BaseType extends Set<unknown> ? SetEntry<BaseType>
|
||||
: BaseType extends unknown[] ? ArrayEntry<BaseType>
|
||||
: BaseType extends object ? ObjectEntry<BaseType>
|
||||
: never;
|
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
Create a type from an object type without certain keys.
|
||||
|
||||
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutA = Except<Foo, 'a' | 'c'>;
|
||||
//=> {b: string};
|
||||
```
|
||||
*/
|
||||
export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
|
38
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/fixed-length-array.d.ts
generated
vendored
Normal file
38
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/fixed-length-array.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
Methods to exclude.
|
||||
*/
|
||||
type ArrayLengthMutationKeys = 'splice' | 'push' | 'pop' | 'shift' | 'unshift';
|
||||
|
||||
/**
|
||||
Create a type that represents an array of the given type and length. The array's length and the `Array` prototype methods that manipulate its length are excluded in the resulting type.
|
||||
|
||||
Please participate in [this issue](https://github.com/microsoft/TypeScript/issues/26223) if you want to have a similiar type built into TypeScript.
|
||||
|
||||
Use-cases:
|
||||
- Declaring fixed-length tuples or arrays with a large number of items.
|
||||
- Creating a range union (for example, `0 | 1 | 2 | 3 | 4` from the keys of such a type) without having to resort to recursive types.
|
||||
- Creating an array of coordinates with a static length, for example, length of 3 for a 3D vector.
|
||||
|
||||
@example
|
||||
```
|
||||
import {FixedLengthArray} from 'type-fest';
|
||||
|
||||
type FencingTeam = FixedLengthArray<string, 3>;
|
||||
|
||||
const guestFencingTeam: FencingTeam = ['Josh', 'Michael', 'Robert'];
|
||||
|
||||
const homeFencingTeam: FencingTeam = ['George', 'John'];
|
||||
//=> error TS2322: Type string[] is not assignable to type 'FencingTeam'
|
||||
|
||||
guestFencingTeam.push('Sam');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'FencingTeam'
|
||||
```
|
||||
*/
|
||||
export type FixedLengthArray<Element, Length extends number, ArrayPrototype = [Element, ...Element[]]> = Pick<
|
||||
ArrayPrototype,
|
||||
Exclude<keyof ArrayPrototype, ArrayLengthMutationKeys>
|
||||
> & {
|
||||
[index: number]: Element;
|
||||
[Symbol.iterator]: () => IterableIterator<Element>;
|
||||
readonly length: Length;
|
||||
};
|
46
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/iterable-element.d.ts
generated
vendored
Normal file
46
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/iterable-element.d.ts
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
|
||||
|
||||
This can be useful, for example, if you want to get the type that is yielded in a generator function. Often the return type of those functions are not specified.
|
||||
|
||||
This type works with both `Iterable`s and `AsyncIterable`s, so it can be use with synchronous and asynchronous generators.
|
||||
|
||||
Here is an example of `IterableElement` in action with a generator function:
|
||||
|
||||
@example
|
||||
```
|
||||
function * iAmGenerator() {
|
||||
yield 1;
|
||||
yield 2;
|
||||
}
|
||||
|
||||
type MeNumber = IterableElement<ReturnType<typeof iAmGenerator>>
|
||||
```
|
||||
|
||||
And here is an example with an async generator:
|
||||
|
||||
@example
|
||||
```
|
||||
async function * iAmGeneratorAsync() {
|
||||
yield 'hi';
|
||||
yield true;
|
||||
}
|
||||
|
||||
type MeStringOrBoolean = IterableElement<ReturnType<typeof iAmGeneratorAsync>>
|
||||
```
|
||||
|
||||
Many types in JavaScript/TypeScript are iterables. This type works on all types that implement those interfaces. For example, `Array`, `Set`, `Map`, `stream.Readable`, etc.
|
||||
|
||||
An example with an array of strings:
|
||||
|
||||
@example
|
||||
```
|
||||
type MeString = IterableElement<string[]>
|
||||
```
|
||||
*/
|
||||
export type IterableElement<TargetIterable> =
|
||||
TargetIterable extends Iterable<infer ElementType> ?
|
||||
ElementType :
|
||||
TargetIterable extends AsyncIterable<infer ElementType> ?
|
||||
ElementType :
|
||||
never;
|
33
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
33
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
||||
|
||||
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
||||
|
||||
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
||||
|
||||
@example
|
||||
```
|
||||
import {LiteralUnion} from 'type-fest';
|
||||
|
||||
// Before
|
||||
|
||||
type Pet = 'dog' | 'cat' | string;
|
||||
|
||||
const pet: Pet = '';
|
||||
// Start typing in your TypeScript-enabled IDE.
|
||||
// You **will not** get auto-completion for `dog` and `cat` literals.
|
||||
|
||||
// After
|
||||
|
||||
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
||||
|
||||
const pet: Pet2 = '';
|
||||
// You **will** get auto-completion for `dog` and `cat` literals.
|
||||
```
|
||||
*/
|
||||
export type LiteralUnion<
|
||||
LiteralType,
|
||||
BaseType extends Primitive
|
||||
> = LiteralType | (BaseType & {_?: never});
|
39
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
39
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Helper type. Not useful on its own.
|
||||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};
|
||||
|
||||
/**
|
||||
Create a type that has mutually exclusive keys.
|
||||
|
||||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).
|
||||
|
||||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.
|
||||
|
||||
@example
|
||||
```
|
||||
import {MergeExclusive} from 'type-fest';
|
||||
|
||||
interface ExclusiveVariation1 {
|
||||
exclusive1: boolean;
|
||||
}
|
||||
|
||||
interface ExclusiveVariation2 {
|
||||
exclusive2: string;
|
||||
}
|
||||
|
||||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
|
||||
|
||||
let exclusiveOptions: ExclusiveOptions;
|
||||
|
||||
exclusiveOptions = {exclusive1: true};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive2: 'hi'};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
|
||||
//=> Error
|
||||
```
|
||||
*/
|
||||
export type MergeExclusive<FirstType, SecondType> =
|
||||
(FirstType | SecondType) extends object ?
|
||||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :
|
||||
FirstType | SecondType;
|
||||
|
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Merge} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
};
|
||||
|
||||
type Bar = {
|
||||
b: number;
|
||||
};
|
||||
|
||||
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
|
||||
```
|
||||
*/
|
||||
export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
22
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly<T>`.
|
||||
|
||||
This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Mutable} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
readonly a: number;
|
||||
readonly b: string;
|
||||
};
|
||||
|
||||
const mutableFoo: Mutable<Foo> = {a: 1, b: '2'};
|
||||
mutableFoo.a = 3;
|
||||
```
|
||||
*/
|
||||
export type Mutable<ObjectType> = {
|
||||
// For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key.
|
||||
-readonly [KeyType in keyof ObjectType]: ObjectType[KeyType];
|
||||
};
|
65
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
65
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly.
|
||||
|
||||
The generic type parameter can be anything. It doesn't have to be an object.
|
||||
|
||||
[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/)
|
||||
|
||||
There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward:
|
||||
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
||||
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
||||
|
||||
@example
|
||||
```
|
||||
import {Opaque} from 'type-fest';
|
||||
|
||||
type AccountNumber = Opaque<number, 'AccountNumber'>;
|
||||
type AccountBalance = Opaque<number, 'AccountBalance'>;
|
||||
|
||||
// The Token parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
||||
type ThingOne = Opaque<string>;
|
||||
type ThingTwo = Opaque<string>;
|
||||
|
||||
// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
|
||||
// To avoid this behaviour, you would instead pass the "Token" parameter, like so.
|
||||
type NewThingOne = Opaque<string, 'ThingOne'>;
|
||||
type NewThingTwo = Opaque<string, 'ThingTwo'>;
|
||||
|
||||
// Now they're completely separate types, so the following will fail to compile.
|
||||
function createNewThingOne (): NewThingOne {
|
||||
// As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
|
||||
return 'new thing one' as NewThingOne;
|
||||
}
|
||||
|
||||
// This will fail to compile, as they are fundamentally different types.
|
||||
const thingTwo = createNewThingOne() as NewThingTwo;
|
||||
|
||||
// Here's another example of opaque typing.
|
||||
function createAccountNumber(): AccountNumber {
|
||||
return 2 as AccountNumber;
|
||||
}
|
||||
|
||||
function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance {
|
||||
return 4 as AccountBalance;
|
||||
}
|
||||
|
||||
// This will compile successfully.
|
||||
getMoneyForAccount(createAccountNumber());
|
||||
|
||||
// But this won't, because it has to be explicitly passed as an `AccountNumber` type.
|
||||
getMoneyForAccount(2);
|
||||
|
||||
// You can use opaque values like they aren't opaque too.
|
||||
const accountNumber = createAccountNumber();
|
||||
|
||||
// This will not compile successfully.
|
||||
const newAccountNumber = accountNumber + 2;
|
||||
|
||||
// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
|
||||
type Person = {
|
||||
id: Opaque<number, Person>;
|
||||
name: string;
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type Opaque<Type, Token = unknown> = Type & {readonly __opaque__: Token};
|
611
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
611
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
@ -0,0 +1,611 @@
|
||||
import {LiteralUnion} from './literal-union';
|
||||
|
||||
declare namespace PackageJson {
|
||||
/**
|
||||
A person who has been involved in creating or maintaining the package.
|
||||
*/
|
||||
export type Person =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
url?: string;
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export type BugsLocation =
|
||||
| string
|
||||
| {
|
||||
/**
|
||||
The URL to the package's issue tracker.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
The email address to which issues should be reported.
|
||||
*/
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export interface DirectoryLocations {
|
||||
[directoryType: string]: unknown;
|
||||
|
||||
/**
|
||||
Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
|
||||
*/
|
||||
bin?: string;
|
||||
|
||||
/**
|
||||
Location for Markdown files.
|
||||
*/
|
||||
doc?: string;
|
||||
|
||||
/**
|
||||
Location for example scripts.
|
||||
*/
|
||||
example?: string;
|
||||
|
||||
/**
|
||||
Location for the bulk of the library.
|
||||
*/
|
||||
lib?: string;
|
||||
|
||||
/**
|
||||
Location for man pages. Sugar to generate a `man` array by walking the folder.
|
||||
*/
|
||||
man?: string;
|
||||
|
||||
/**
|
||||
Location for test files.
|
||||
*/
|
||||
test?: string;
|
||||
}
|
||||
|
||||
export type Scripts = {
|
||||
/**
|
||||
Run **before** the package is published (Also run on local `npm install` without any arguments).
|
||||
*/
|
||||
prepublish?: string;
|
||||
|
||||
/**
|
||||
Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
|
||||
*/
|
||||
prepare?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
||||
*/
|
||||
prepublishOnly?: string;
|
||||
|
||||
/**
|
||||
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
||||
*/
|
||||
prepack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the tarball has been generated and moved to its final destination.
|
||||
*/
|
||||
postpack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
publish?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
postpublish?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is installed.
|
||||
*/
|
||||
preinstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed.
|
||||
*/
|
||||
install?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed and after `install`.
|
||||
*/
|
||||
postinstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled and before `uninstall`.
|
||||
*/
|
||||
preuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled.
|
||||
*/
|
||||
uninstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is uninstalled.
|
||||
*/
|
||||
postuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version and before `version`.
|
||||
*/
|
||||
preversion?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version.
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Run **after** bump the package version.
|
||||
*/
|
||||
postversion?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, before `test`.
|
||||
*/
|
||||
pretest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, after `test`.
|
||||
*/
|
||||
posttest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, before `stop`.
|
||||
*/
|
||||
prestop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command.
|
||||
*/
|
||||
stop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, after `stop`.
|
||||
*/
|
||||
poststop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, before `start`.
|
||||
*/
|
||||
prestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command.
|
||||
*/
|
||||
start?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, after `start`.
|
||||
*/
|
||||
poststart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
prerestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
restart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
postrestart?: string;
|
||||
} & Record<string, string>;
|
||||
|
||||
/**
|
||||
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
||||
*/
|
||||
export type Dependency = Record<string, string>;
|
||||
|
||||
/**
|
||||
Conditions which provide a way to resolve a package entry point based on the environment.
|
||||
*/
|
||||
export type ExportCondition = LiteralUnion<
|
||||
| 'import'
|
||||
| 'require'
|
||||
| 'node'
|
||||
| 'deno'
|
||||
| 'browser'
|
||||
| 'electron'
|
||||
| 'react-native'
|
||||
| 'default',
|
||||
string
|
||||
>;
|
||||
|
||||
/**
|
||||
Entry points of a module, optionally with conditions and subpath exports.
|
||||
*/
|
||||
export type Exports =
|
||||
| string
|
||||
| {[key in ExportCondition]: Exports}
|
||||
| {[key: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
|
||||
|
||||
export interface NonStandardEntryPoints {
|
||||
/**
|
||||
An ECMAScript module ID that is the primary entry point to the program.
|
||||
*/
|
||||
module?: string;
|
||||
|
||||
/**
|
||||
A module ID with untranspiled code that is the primary entry point to the program.
|
||||
*/
|
||||
esnext?:
|
||||
| string
|
||||
| {
|
||||
[moduleName: string]: string | undefined;
|
||||
main?: string;
|
||||
browser?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
||||
*/
|
||||
browser?:
|
||||
| string
|
||||
| Record<string, string | false>;
|
||||
|
||||
/**
|
||||
Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
|
||||
|
||||
[Read more.](https://webpack.js.org/guides/tree-shaking/)
|
||||
*/
|
||||
sideEffects?: boolean | string[];
|
||||
}
|
||||
|
||||
export interface TypeScriptConfiguration {
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file.
|
||||
*/
|
||||
types?: string;
|
||||
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file. Alias of `types`.
|
||||
*/
|
||||
typings?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
An alternative configuration for Yarn workspaces.
|
||||
*/
|
||||
export interface WorkspaceConfig {
|
||||
/**
|
||||
An array of workspace pattern strings which contain the workspace packages.
|
||||
*/
|
||||
packages?: WorkspacePattern[];
|
||||
|
||||
/**
|
||||
Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
|
||||
|
||||
[Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
|
||||
*/
|
||||
nohoist?: WorkspacePattern[];
|
||||
}
|
||||
|
||||
/**
|
||||
A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
|
||||
|
||||
The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
|
||||
|
||||
@example
|
||||
`docs` → Include the docs directory and install its dependencies.
|
||||
`packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
|
||||
*/
|
||||
type WorkspacePattern = string;
|
||||
|
||||
export interface YarnConfiguration {
|
||||
/**
|
||||
Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
|
||||
|
||||
Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
|
||||
|
||||
Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
|
||||
*/
|
||||
workspaces?: WorkspacePattern[] | WorkspaceConfig;
|
||||
|
||||
/**
|
||||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
|
||||
|
||||
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
||||
*/
|
||||
flat?: boolean;
|
||||
|
||||
/**
|
||||
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
||||
*/
|
||||
resolutions?: Dependency;
|
||||
}
|
||||
|
||||
export interface JSPMConfiguration {
|
||||
/**
|
||||
JSPM configuration.
|
||||
*/
|
||||
jspm?: PackageJson;
|
||||
}
|
||||
|
||||
/**
|
||||
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
|
||||
*/
|
||||
export interface PackageJsonStandard {
|
||||
/**
|
||||
The name of the package.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Package description, listed in `npm search`.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
Keywords associated with package, listed in `npm search`.
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
The URL to the package's homepage.
|
||||
*/
|
||||
homepage?: LiteralUnion<'.', string>;
|
||||
|
||||
/**
|
||||
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
||||
*/
|
||||
bugs?: BugsLocation;
|
||||
|
||||
/**
|
||||
The license for the package.
|
||||
*/
|
||||
license?: string;
|
||||
|
||||
/**
|
||||
The licenses for the package.
|
||||
*/
|
||||
licenses?: Array<{
|
||||
type?: string;
|
||||
url?: string;
|
||||
}>;
|
||||
|
||||
author?: Person;
|
||||
|
||||
/**
|
||||
A list of people who contributed to the package.
|
||||
*/
|
||||
contributors?: Person[];
|
||||
|
||||
/**
|
||||
A list of people who maintain the package.
|
||||
*/
|
||||
maintainers?: Person[];
|
||||
|
||||
/**
|
||||
The files included in the package.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
Resolution algorithm for importing ".js" files from the package's scope.
|
||||
|
||||
[Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
|
||||
*/
|
||||
type?: 'module' | 'commonjs';
|
||||
|
||||
/**
|
||||
The module ID that is the primary entry point to the program.
|
||||
*/
|
||||
main?: string;
|
||||
|
||||
/**
|
||||
Standard entry points of the package, with enhanced support for ECMAScript Modules.
|
||||
|
||||
[Read more.](https://nodejs.org/api/esm.html#esm_package_entry_points)
|
||||
*/
|
||||
exports?: Exports;
|
||||
|
||||
/**
|
||||
The executable files that should be installed into the `PATH`.
|
||||
*/
|
||||
bin?:
|
||||
| string
|
||||
| Record<string, string>;
|
||||
|
||||
/**
|
||||
Filenames to put in place for the `man` program to find.
|
||||
*/
|
||||
man?: string | string[];
|
||||
|
||||
/**
|
||||
Indicates the structure of the package.
|
||||
*/
|
||||
directories?: DirectoryLocations;
|
||||
|
||||
/**
|
||||
Location for the code repository.
|
||||
*/
|
||||
repository?:
|
||||
| string
|
||||
| {
|
||||
type: string;
|
||||
url: string;
|
||||
|
||||
/**
|
||||
Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
|
||||
|
||||
[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
|
||||
*/
|
||||
directory?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
||||
*/
|
||||
scripts?: Scripts;
|
||||
|
||||
/**
|
||||
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
||||
*/
|
||||
config?: Record<string, unknown>;
|
||||
|
||||
/**
|
||||
The dependencies of the package.
|
||||
*/
|
||||
dependencies?: Dependency;
|
||||
|
||||
/**
|
||||
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
||||
*/
|
||||
devDependencies?: Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that are skipped if they fail to install.
|
||||
*/
|
||||
optionalDependencies?: Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that will usually be required by the package user directly or via another dependency.
|
||||
*/
|
||||
peerDependencies?: Dependency;
|
||||
|
||||
/**
|
||||
Indicate peer dependencies that are optional.
|
||||
*/
|
||||
peerDependenciesMeta?: Record<string, {optional: true}>;
|
||||
|
||||
/**
|
||||
Package names that are bundled when the package is published.
|
||||
*/
|
||||
bundledDependencies?: string[];
|
||||
|
||||
/**
|
||||
Alias of `bundledDependencies`.
|
||||
*/
|
||||
bundleDependencies?: string[];
|
||||
|
||||
/**
|
||||
Engines that this package runs on.
|
||||
*/
|
||||
engines?: {
|
||||
[EngineName in 'npm' | 'node' | string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@deprecated
|
||||
*/
|
||||
engineStrict?: boolean;
|
||||
|
||||
/**
|
||||
Operating systems the module runs on.
|
||||
*/
|
||||
os?: Array<LiteralUnion<
|
||||
| 'aix'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| '!aix'
|
||||
| '!darwin'
|
||||
| '!freebsd'
|
||||
| '!linux'
|
||||
| '!openbsd'
|
||||
| '!sunos'
|
||||
| '!win32',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
CPU architectures the module runs on.
|
||||
*/
|
||||
cpu?: Array<LiteralUnion<
|
||||
| 'arm'
|
||||
| 'arm64'
|
||||
| 'ia32'
|
||||
| 'mips'
|
||||
| 'mipsel'
|
||||
| 'ppc'
|
||||
| 'ppc64'
|
||||
| 's390'
|
||||
| 's390x'
|
||||
| 'x32'
|
||||
| 'x64'
|
||||
| '!arm'
|
||||
| '!arm64'
|
||||
| '!ia32'
|
||||
| '!mips'
|
||||
| '!mipsel'
|
||||
| '!ppc'
|
||||
| '!ppc64'
|
||||
| '!s390'
|
||||
| '!s390x'
|
||||
| '!x32'
|
||||
| '!x64',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
|
||||
|
||||
@deprecated
|
||||
*/
|
||||
preferGlobal?: boolean;
|
||||
|
||||
/**
|
||||
If set to `true`, then npm will refuse to publish it.
|
||||
*/
|
||||
private?: boolean;
|
||||
|
||||
/**
|
||||
A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
|
||||
*/
|
||||
publishConfig?: Record<string, unknown>;
|
||||
|
||||
/**
|
||||
Describes and notifies consumers of a package's monetary support information.
|
||||
|
||||
[Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
|
||||
*/
|
||||
funding?: string | {
|
||||
/**
|
||||
The type of funding.
|
||||
*/
|
||||
type?: LiteralUnion<
|
||||
| 'github'
|
||||
| 'opencollective'
|
||||
| 'patreon'
|
||||
| 'individual'
|
||||
| 'foundation'
|
||||
| 'corporation',
|
||||
string
|
||||
>;
|
||||
|
||||
/**
|
||||
The URL to the funding page.
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
||||
*/
|
||||
export type PackageJson =
|
||||
PackageJson.PackageJsonStandard &
|
||||
PackageJson.NonStandardEntryPoints &
|
||||
PackageJson.TypeScriptConfiguration &
|
||||
PackageJson.YarnConfiguration &
|
||||
PackageJson.JSPMConfiguration;
|
72
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
72
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Create a type from another type with all keys and nested keys set to optional.
|
||||
|
||||
Use-cases:
|
||||
- Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
|
||||
- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PartialDeep} from 'type-fest';
|
||||
|
||||
const settings: Settings = {
|
||||
textEditor: {
|
||||
fontSize: 14;
|
||||
fontColor: '#000000';
|
||||
fontWeight: 400;
|
||||
}
|
||||
autocomplete: false;
|
||||
autosave: true;
|
||||
};
|
||||
|
||||
const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
|
||||
return {...settings, ...savedSettings};
|
||||
}
|
||||
|
||||
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
||||
```
|
||||
*/
|
||||
export type PartialDeep<T> = T extends Primitive
|
||||
? Partial<T>
|
||||
: T extends Map<infer KeyType, infer ValueType>
|
||||
? PartialMapDeep<KeyType, ValueType>
|
||||
: T extends Set<infer ItemType>
|
||||
? PartialSetDeep<ItemType>
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? PartialReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? PartialReadonlySetDeep<ItemType>
|
||||
: T extends ((...arguments: any[]) => unknown)
|
||||
? T | undefined
|
||||
: T extends object
|
||||
? PartialObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialMapDeep<KeyType, ValueType> extends Map<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialSetDeep<T> extends Set<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlyMapDeep<KeyType, ValueType> extends ReadonlyMap<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlySetDeep<T> extends ReadonlySet<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
type PartialObjectDeep<ObjectType extends object> = {
|
||||
[KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType]>
|
||||
};
|
23
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
23
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
|
||||
Use-cases:
|
||||
- A function accepts a callback that may either return a value synchronously or may return a promised value.
|
||||
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Promisable} from 'type-fest';
|
||||
|
||||
async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
|
||||
const entry = await getLogEntry();
|
||||
console.log(entry);
|
||||
}
|
||||
|
||||
logger(() => 'foo');
|
||||
logger(() => Promise.resolve('bar'));
|
||||
```
|
||||
*/
|
||||
export type Promisable<T> = T | PromiseLike<T>;
|
27
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/promise-value.d.ts
generated
vendored
Normal file
27
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/promise-value.d.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
Returns the type that is wrapped inside a `Promise` type.
|
||||
If the type is a nested Promise, it is unwrapped recursively until a non-Promise type is obtained.
|
||||
If the type is not a `Promise`, the type itself is returned.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PromiseValue} from 'type-fest';
|
||||
|
||||
type AsyncData = Promise<string>;
|
||||
let asyncData: PromiseValue<AsyncData> = Promise.resolve('ABC');
|
||||
|
||||
type Data = PromiseValue<AsyncData>;
|
||||
let data: Data = await asyncData;
|
||||
|
||||
// Here's an example that shows how this type reacts to non-Promise types.
|
||||
type SyncData = PromiseValue<string>;
|
||||
let syncData: SyncData = getSyncData();
|
||||
|
||||
// Here's an example that shows how this type reacts to recursive Promise types.
|
||||
type RecursiveAsyncData = Promise<Promise<string> >;
|
||||
let recursiveAsyncData: PromiseValue<RecursiveAsyncData> = Promise.resolve(Promise.resolve('ABC'));
|
||||
```
|
||||
*/
|
||||
export type PromiseValue<PromiseType, Otherwise = PromiseType> = PromiseType extends Promise<infer Value>
|
||||
? { 0: PromiseValue<Value>; 1: Value }[PromiseType extends Promise<unknown> ? 0 : 1]
|
||||
: Otherwise;
|
59
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
59
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively.
|
||||
|
||||
This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
// data.json
|
||||
{
|
||||
"foo": ["bar"]
|
||||
}
|
||||
|
||||
// main.ts
|
||||
import {ReadonlyDeep} from 'type-fest';
|
||||
import dataJson = require('./data.json');
|
||||
|
||||
const data: ReadonlyDeep<typeof dataJson> = dataJson;
|
||||
|
||||
export default data;
|
||||
|
||||
// test.ts
|
||||
import data from './main';
|
||||
|
||||
data.foo.push('bar');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
|
||||
```
|
||||
*/
|
||||
export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
|
||||
? T
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? ReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? ReadonlySetDeep<ItemType>
|
||||
: T extends object
|
||||
? ReadonlyObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlyMapDeep<KeyType, ValueType>
|
||||
extends ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlySetDeep<ItemType>
|
||||
extends ReadonlySet<ReadonlyDeep<ItemType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
type ReadonlyObjectDeep<ObjectType extends object> = {
|
||||
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>
|
||||
};
|
33
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
33
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireAtLeastOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text?: () => string;
|
||||
json?: () => string;
|
||||
|
||||
secure?: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireAtLeastOne<
|
||||
ObjectType,
|
||||
KeysType extends keyof ObjectType = keyof ObjectType
|
||||
> = {
|
||||
// For each `Key` in `KeysType` make a mapped type:
|
||||
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> & // 1. Make `Key`'s type required
|
||||
// 2. Make all other keys in `KeysType` optional
|
||||
Partial<Pick<ObjectType, Exclude<KeysType, Key>>>;
|
||||
}[KeysType] &
|
||||
// 3. Add the remaining keys not in `KeysType`
|
||||
Except<ObjectType, KeysType>;
|
35
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
35
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// TODO: Remove this when we target TypeScript >=3.5.
|
||||
type _Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
/**
|
||||
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
|
||||
|
||||
Use-cases:
|
||||
- Creating interfaces for components that only need one of the keys to display properly.
|
||||
- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`.
|
||||
|
||||
The caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireExactlyOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text: () => string;
|
||||
json: () => string;
|
||||
secure: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
|
||||
// Adding a `text` key here would cause a compile error.
|
||||
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{[Key in KeysType]: (
|
||||
Required<Pick<ObjectType, Key>> &
|
||||
Partial<Record<Exclude<KeysType, Key>, never>>
|
||||
)}[KeysType] & _Omit<ObjectType, KeysType>;
|
34
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
34
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetOptional} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b?: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
||||
// type SomeOptional = {
|
||||
// a: number;
|
||||
// b?: string; // Was already optional and still is.
|
||||
// c?: boolean; // Is now optional.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetOptional<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not optional from the base type.
|
||||
Except<BaseType, Keys> &
|
||||
// Pick the keys that should be optional from the base type and make them optional.
|
||||
Partial<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
34
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
34
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetRequired} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a?: number;
|
||||
b: string;
|
||||
c?: boolean;
|
||||
}
|
||||
|
||||
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
||||
// type SomeRequired = {
|
||||
// a?: number;
|
||||
// b: string; // Was already required and still is.
|
||||
// c: boolean; // Is now required.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetRequired<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not required from the base type.
|
||||
Except<BaseType, Keys> &
|
||||
// Pick the keys that should be required from the base type and make them required.
|
||||
Required<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
29
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-return-type.d.ts
generated
vendored
Normal file
29
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/set-return-type.d.ts
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
type IsAny<T> = 0 extends (1 & T) ? true : false; // https://stackoverflow.com/a/49928360/3406963
|
||||
type IsNever<T> = [T] extends [never] ? true : false;
|
||||
type IsUnknown<T> = IsNever<T> extends false ? T extends unknown ? unknown extends T ? IsAny<T> extends false ? true : false : false : false : false;
|
||||
|
||||
/**
|
||||
Create a function type with a return type of your choice and the same parameters as the given function type.
|
||||
|
||||
Use-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetReturnType} from 'type-fest';
|
||||
|
||||
type MyFunctionThatCanThrow = (foo: SomeType, bar: unknown) => SomeOtherType;
|
||||
|
||||
type MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, SomeOtherType | undefined>;
|
||||
//=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined;
|
||||
```
|
||||
*/
|
||||
export type SetReturnType<Fn extends (...args: any[]) => any, TypeToReturn> =
|
||||
// Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.
|
||||
Fn extends (this: infer ThisArg, ...args: infer Arguments) => any ? (
|
||||
// If a function did not specify the `this` fake parameter, it will be inferred to `unknown`.
|
||||
// We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE.
|
||||
IsUnknown<ThisArg> extends true ? (...args: Arguments) => TypeToReturn : (this: ThisArg, ...args: Arguments) => TypeToReturn
|
||||
) : (
|
||||
// This part should be unreachable, but we make it meaningful just in case…
|
||||
(...args: Parameters<Fn>) => TypeToReturn
|
||||
);
|
21
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/stringified.d.ts
generated
vendored
Normal file
21
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/stringified.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
Create a type with the keys of the given type changed to `string` type.
|
||||
|
||||
Use-case: Changing interface values to strings in order to use them in a form model.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Stringified} from 'type-fest';
|
||||
|
||||
type Car {
|
||||
model: string;
|
||||
speed: number;
|
||||
}
|
||||
|
||||
const carForm: Stringified<Car> = {
|
||||
model: 'Foo',
|
||||
speed: '101'
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type Stringified<ObjectType> = {[KeyType in keyof ObjectType]: string};
|
870
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/tsconfig-json.d.ts
generated
vendored
Normal file
870
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/tsconfig-json.d.ts
generated
vendored
Normal file
@ -0,0 +1,870 @@
|
||||
declare namespace TsConfigJson {
|
||||
namespace CompilerOptions {
|
||||
export type JSX =
|
||||
| 'preserve'
|
||||
| 'react'
|
||||
| 'react-native';
|
||||
|
||||
export type Module =
|
||||
| 'CommonJS'
|
||||
| 'AMD'
|
||||
| 'System'
|
||||
| 'UMD'
|
||||
| 'ES6'
|
||||
| 'ES2015'
|
||||
| 'ESNext'
|
||||
| 'None'
|
||||
// Lowercase alternatives
|
||||
| 'commonjs'
|
||||
| 'amd'
|
||||
| 'system'
|
||||
| 'umd'
|
||||
| 'es6'
|
||||
| 'es2015'
|
||||
| 'esnext'
|
||||
| 'none';
|
||||
|
||||
export type NewLine =
|
||||
| 'CRLF'
|
||||
| 'LF'
|
||||
// Lowercase alternatives
|
||||
| 'crlf'
|
||||
| 'lf';
|
||||
|
||||
export type Target =
|
||||
| 'ES3'
|
||||
| 'ES5'
|
||||
| 'ES6'
|
||||
| 'ES2015'
|
||||
| 'ES2016'
|
||||
| 'ES2017'
|
||||
| 'ES2018'
|
||||
| 'ES2019'
|
||||
| 'ES2020'
|
||||
| 'ESNext'
|
||||
// Lowercase alternatives
|
||||
| 'es3'
|
||||
| 'es5'
|
||||
| 'es6'
|
||||
| 'es2015'
|
||||
| 'es2016'
|
||||
| 'es2017'
|
||||
| 'es2018'
|
||||
| 'es2019'
|
||||
| 'es2020'
|
||||
| 'esnext';
|
||||
|
||||
export type Lib =
|
||||
| 'ES5'
|
||||
| 'ES6'
|
||||
| 'ES7'
|
||||
| 'ES2015'
|
||||
| 'ES2015.Collection'
|
||||
| 'ES2015.Core'
|
||||
| 'ES2015.Generator'
|
||||
| 'ES2015.Iterable'
|
||||
| 'ES2015.Promise'
|
||||
| 'ES2015.Proxy'
|
||||
| 'ES2015.Reflect'
|
||||
| 'ES2015.Symbol.WellKnown'
|
||||
| 'ES2015.Symbol'
|
||||
| 'ES2016'
|
||||
| 'ES2016.Array.Include'
|
||||
| 'ES2017'
|
||||
| 'ES2017.Intl'
|
||||
| 'ES2017.Object'
|
||||
| 'ES2017.SharedMemory'
|
||||
| 'ES2017.String'
|
||||
| 'ES2017.TypedArrays'
|
||||
| 'ES2018'
|
||||
| 'ES2018.AsyncIterable'
|
||||
| 'ES2018.Intl'
|
||||
| 'ES2018.Promise'
|
||||
| 'ES2018.Regexp'
|
||||
| 'ES2019'
|
||||
| 'ES2019.Array'
|
||||
| 'ES2019.Object'
|
||||
| 'ES2019.String'
|
||||
| 'ES2019.Symbol'
|
||||
| 'ES2020'
|
||||
| 'ES2020.String'
|
||||
| 'ES2020.Symbol.WellKnown'
|
||||
| 'ESNext'
|
||||
| 'ESNext.Array'
|
||||
| 'ESNext.AsyncIterable'
|
||||
| 'ESNext.BigInt'
|
||||
| 'ESNext.Intl'
|
||||
| 'ESNext.Symbol'
|
||||
| 'DOM'
|
||||
| 'DOM.Iterable'
|
||||
| 'ScriptHost'
|
||||
| 'WebWorker'
|
||||
| 'WebWorker.ImportScripts'
|
||||
// Lowercase alternatives
|
||||
| 'es5'
|
||||
| 'es6'
|
||||
| 'es7'
|
||||
| 'es2015'
|
||||
| 'es2015.collection'
|
||||
| 'es2015.core'
|
||||
| 'es2015.generator'
|
||||
| 'es2015.iterable'
|
||||
| 'es2015.promise'
|
||||
| 'es2015.proxy'
|
||||
| 'es2015.reflect'
|
||||
| 'es2015.symbol.wellknown'
|
||||
| 'es2015.symbol'
|
||||
| 'es2016'
|
||||
| 'es2016.array.include'
|
||||
| 'es2017'
|
||||
| 'es2017.intl'
|
||||
| 'es2017.object'
|
||||
| 'es2017.sharedmemory'
|
||||
| 'es2017.string'
|
||||
| 'es2017.typedarrays'
|
||||
| 'es2018'
|
||||
| 'es2018.asynciterable'
|
||||
| 'es2018.intl'
|
||||
| 'es2018.promise'
|
||||
| 'es2018.regexp'
|
||||
| 'es2019'
|
||||
| 'es2019.array'
|
||||
| 'es2019.object'
|
||||
| 'es2019.string'
|
||||
| 'es2019.symbol'
|
||||
| 'es2020'
|
||||
| 'es2020.string'
|
||||
| 'es2020.symbol.wellknown'
|
||||
| 'esnext'
|
||||
| 'esnext.array'
|
||||
| 'esnext.asynciterable'
|
||||
| 'esnext.bigint'
|
||||
| 'esnext.intl'
|
||||
| 'esnext.symbol'
|
||||
| 'dom'
|
||||
| 'dom.iterable'
|
||||
| 'scripthost'
|
||||
| 'webworker'
|
||||
| 'webworker.importscripts';
|
||||
|
||||
export interface Plugin {
|
||||
[key: string]: unknown;
|
||||
/**
|
||||
Plugin name.
|
||||
*/
|
||||
name?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CompilerOptions {
|
||||
/**
|
||||
The character set of the input files.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
charset?: string;
|
||||
|
||||
/**
|
||||
Enables building for project references.
|
||||
|
||||
@default true
|
||||
*/
|
||||
composite?: boolean;
|
||||
|
||||
/**
|
||||
Generates corresponding d.ts files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
declaration?: boolean;
|
||||
|
||||
/**
|
||||
Specify output directory for generated declaration files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
declarationDir?: string;
|
||||
|
||||
/**
|
||||
Show diagnostic information.
|
||||
|
||||
@default false
|
||||
*/
|
||||
diagnostics?: boolean;
|
||||
|
||||
/**
|
||||
Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitBOM?: boolean;
|
||||
|
||||
/**
|
||||
Only emit `.d.ts` declaration files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitDeclarationOnly?: boolean;
|
||||
|
||||
/**
|
||||
Enable incremental compilation.
|
||||
|
||||
@default `composite`
|
||||
*/
|
||||
incremental?: boolean;
|
||||
|
||||
/**
|
||||
Specify file to store incremental compilation information.
|
||||
|
||||
@default '.tsbuildinfo'
|
||||
*/
|
||||
tsBuildInfoFile?: string;
|
||||
|
||||
/**
|
||||
Emit a single file with source maps instead of having a separate file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
inlineSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
Emit the source alongside the sourcemaps within a single file.
|
||||
|
||||
Requires `--inlineSourceMap` to be set.
|
||||
|
||||
@default false
|
||||
*/
|
||||
inlineSources?: boolean;
|
||||
|
||||
/**
|
||||
Specify JSX code generation: `'preserve'`, `'react'`, or `'react-native'`.
|
||||
|
||||
@default 'preserve'
|
||||
*/
|
||||
jsx?: CompilerOptions.JSX;
|
||||
|
||||
/**
|
||||
Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.
|
||||
|
||||
@default 'React'
|
||||
*/
|
||||
reactNamespace?: string;
|
||||
|
||||
/**
|
||||
Print names of files part of the compilation.
|
||||
|
||||
@default false
|
||||
*/
|
||||
listFiles?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the location where debugger should locate map files instead of generated locations.
|
||||
*/
|
||||
mapRoot?: string;
|
||||
|
||||
/**
|
||||
Specify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with `--outFile`. 'ES6' and 'ES2015' values may be used when targeting 'ES5' or lower.
|
||||
|
||||
@default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'
|
||||
*/
|
||||
module?: CompilerOptions.Module;
|
||||
|
||||
/**
|
||||
Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
|
||||
|
||||
Default: Platform specific
|
||||
*/
|
||||
newLine?: CompilerOptions.NewLine;
|
||||
|
||||
/**
|
||||
Do not emit output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmit?: boolean;
|
||||
|
||||
/**
|
||||
Do not generate custom helper functions like `__extends` in compiled output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmitHelpers?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit outputs if any type checking errors were reported.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmitOnError?: boolean;
|
||||
|
||||
/**
|
||||
Warn on expressions and declarations with an implied 'any' type.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitAny?: boolean;
|
||||
|
||||
/**
|
||||
Raise error on 'this' expressions with an implied any type.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitThis?: boolean;
|
||||
|
||||
/**
|
||||
Report errors on unused locals.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noUnusedLocals?: boolean;
|
||||
|
||||
/**
|
||||
Report errors on unused parameters.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noUnusedParameters?: boolean;
|
||||
|
||||
/**
|
||||
Do not include the default library file (lib.d.ts).
|
||||
|
||||
@default false
|
||||
*/
|
||||
noLib?: boolean;
|
||||
|
||||
/**
|
||||
Do not add triple-slash references or module import targets to the list of compiled files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noResolve?: boolean;
|
||||
|
||||
/**
|
||||
Disable strict checking of generic signatures in function types.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noStrictGenericChecks?: boolean;
|
||||
|
||||
/**
|
||||
@deprecated use `skipLibCheck` instead.
|
||||
*/
|
||||
skipDefaultLibCheck?: boolean;
|
||||
|
||||
/**
|
||||
Skip type checking of declaration files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
skipLibCheck?: boolean;
|
||||
|
||||
/**
|
||||
Concatenate and emit output to single file.
|
||||
*/
|
||||
outFile?: string;
|
||||
|
||||
/**
|
||||
Redirect output structure to the directory.
|
||||
*/
|
||||
outDir?: string;
|
||||
|
||||
/**
|
||||
Do not erase const enum declarations in generated code.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveConstEnums?: boolean;
|
||||
|
||||
/**
|
||||
Do not resolve symlinks to their real path; treat a symlinked file like a real one.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveSymlinks?: boolean;
|
||||
|
||||
/**
|
||||
Keep outdated console output in watch mode instead of clearing the screen.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveWatchOutput?: boolean;
|
||||
|
||||
/**
|
||||
Stylize errors and messages using color and context (experimental).
|
||||
|
||||
@default true // Unless piping to another program or redirecting output to a file.
|
||||
*/
|
||||
pretty?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit comments to output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
removeComments?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the root directory of input files.
|
||||
|
||||
Use to control the output directory structure with `--outDir`.
|
||||
*/
|
||||
rootDir?: string;
|
||||
|
||||
/**
|
||||
Unconditionally emit imports for unresolved files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
isolatedModules?: boolean;
|
||||
|
||||
/**
|
||||
Generates corresponding '.map' file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the location where debugger should locate TypeScript files instead of source locations.
|
||||
*/
|
||||
sourceRoot?: string;
|
||||
|
||||
/**
|
||||
Suppress excess property checks for object literals.
|
||||
|
||||
@default false
|
||||
*/
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
|
||||
/**
|
||||
Suppress noImplicitAny errors for indexing objects lacking index signatures.
|
||||
|
||||
@default false
|
||||
*/
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit declarations for code that has an `@internal` annotation.
|
||||
*/
|
||||
stripInternal?: boolean;
|
||||
|
||||
/**
|
||||
Specify ECMAScript target version.
|
||||
|
||||
@default 'es3'
|
||||
*/
|
||||
target?: CompilerOptions.Target;
|
||||
|
||||
/**
|
||||
Watch input files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
watch?: boolean;
|
||||
|
||||
/**
|
||||
Enables experimental support for ES7 decorators.
|
||||
|
||||
@default false
|
||||
*/
|
||||
experimentalDecorators?: boolean;
|
||||
|
||||
/**
|
||||
Emit design-type metadata for decorated declarations in source.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitDecoratorMetadata?: boolean;
|
||||
|
||||
/**
|
||||
Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).
|
||||
|
||||
@default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
|
||||
*/
|
||||
moduleResolution?: 'classic' | 'node';
|
||||
|
||||
/**
|
||||
Do not report errors on unused labels.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUnusedLabels?: boolean;
|
||||
|
||||
/**
|
||||
Report error when not all code paths in function return a value.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitReturns?: boolean;
|
||||
|
||||
/**
|
||||
Report errors for fallthrough cases in switch statement.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
|
||||
/**
|
||||
Do not report errors on unreachable code.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUnreachableCode?: boolean;
|
||||
|
||||
/**
|
||||
Disallow inconsistently-cased references to the same file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
|
||||
/**
|
||||
Base directory to resolve non-relative module names.
|
||||
*/
|
||||
baseUrl?: string;
|
||||
|
||||
/**
|
||||
Specify path mapping to be computed relative to baseUrl option.
|
||||
*/
|
||||
paths?: Record<string, string[]>;
|
||||
|
||||
/**
|
||||
List of TypeScript language server plugins to load.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
*/
|
||||
plugins?: CompilerOptions.Plugin[];
|
||||
|
||||
/**
|
||||
Specify list of root directories to be used when resolving modules.
|
||||
*/
|
||||
rootDirs?: string[];
|
||||
|
||||
/**
|
||||
Specify list of directories for type definition files to be included.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
typeRoots?: string[];
|
||||
|
||||
/**
|
||||
Type declaration files to be included in compilation.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
types?: string[];
|
||||
|
||||
/**
|
||||
Enable tracing of the name resolution process.
|
||||
|
||||
@default false
|
||||
*/
|
||||
traceResolution?: boolean;
|
||||
|
||||
/**
|
||||
Allow javascript files to be compiled.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowJs?: boolean;
|
||||
|
||||
/**
|
||||
Do not truncate error messages.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noErrorTruncation?: boolean;
|
||||
|
||||
/**
|
||||
Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
|
||||
|
||||
@default module === 'system' || esModuleInterop
|
||||
*/
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit `'use strict'` directives in module output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitUseStrict?: boolean;
|
||||
|
||||
/**
|
||||
Enable to list all emitted files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
listEmittedFiles?: boolean;
|
||||
|
||||
/**
|
||||
Disable size limit for JavaScript project.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
disableSizeLimit?: boolean;
|
||||
|
||||
/**
|
||||
List of library files to be included in the compilation.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
lib?: CompilerOptions.Lib[];
|
||||
|
||||
/**
|
||||
Enable strict null checks.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictNullChecks?: boolean;
|
||||
|
||||
/**
|
||||
The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
maxNodeModuleJsDepth?: number;
|
||||
|
||||
/**
|
||||
Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
importHelpers?: boolean;
|
||||
|
||||
/**
|
||||
Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
|
||||
@default 'React.createElement'
|
||||
*/
|
||||
jsxFactory?: string;
|
||||
|
||||
/**
|
||||
Parse in strict mode and emit `'use strict'` for each source file.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
alwaysStrict?: boolean;
|
||||
|
||||
/**
|
||||
Enable all strict type checking options.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictBindCallApply?: boolean;
|
||||
|
||||
/**
|
||||
Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
downlevelIteration?: boolean;
|
||||
|
||||
/**
|
||||
Report errors in `.js` files.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
checkJs?: boolean;
|
||||
|
||||
/**
|
||||
Disable bivariant parameter checking for function types.
|
||||
|
||||
Requires TypeScript version 2.6 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictFunctionTypes?: boolean;
|
||||
|
||||
/**
|
||||
Ensure non-undefined class properties are initialized in the constructor.
|
||||
|
||||
Requires TypeScript version 2.7 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictPropertyInitialization?: boolean;
|
||||
|
||||
/**
|
||||
Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
|
||||
|
||||
Requires TypeScript version 2.7 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
esModuleInterop?: boolean;
|
||||
|
||||
/**
|
||||
Allow accessing UMD globals from modules.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUmdGlobalAccess?: boolean;
|
||||
|
||||
/**
|
||||
Resolve `keyof` to string valued property names only (no numbers or symbols).
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
keyofStringsOnly?: boolean;
|
||||
|
||||
/**
|
||||
Emit ECMAScript standard class fields.
|
||||
|
||||
Requires TypeScript version 3.7 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
useDefineForClassFields?: boolean;
|
||||
|
||||
/**
|
||||
Generates a sourcemap for each corresponding `.d.ts` file.
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
declarationMap?: boolean;
|
||||
|
||||
/**
|
||||
Include modules imported with `.json` extension.
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
resolveJsonModule?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Auto type (.d.ts) acquisition options for this project.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
export interface TypeAcquisition {
|
||||
/**
|
||||
Enable auto type acquisition.
|
||||
*/
|
||||
enable?: boolean;
|
||||
|
||||
/**
|
||||
Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.
|
||||
*/
|
||||
include?: string[];
|
||||
|
||||
/**
|
||||
Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.
|
||||
*/
|
||||
exclude?: string[];
|
||||
}
|
||||
|
||||
export interface References {
|
||||
/**
|
||||
A normalized path on disk.
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
The path as the user originally wrote it.
|
||||
*/
|
||||
originalPath?: string;
|
||||
|
||||
/**
|
||||
True if the output of this reference should be prepended to the output of this project.
|
||||
|
||||
Only valid for `--outFile` compilations.
|
||||
*/
|
||||
prepend?: boolean;
|
||||
|
||||
/**
|
||||
True if it is intended that this reference form a circularity.
|
||||
*/
|
||||
circular?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export interface TsConfigJson {
|
||||
/**
|
||||
Instructs the TypeScript compiler how to compile `.ts` files.
|
||||
*/
|
||||
compilerOptions?: TsConfigJson.CompilerOptions;
|
||||
|
||||
/**
|
||||
Auto type (.d.ts) acquisition options for this project.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
typeAcquisition?: TsConfigJson.TypeAcquisition;
|
||||
|
||||
/**
|
||||
Enable Compile-on-Save for this project.
|
||||
*/
|
||||
compileOnSave?: boolean;
|
||||
|
||||
/**
|
||||
Path to base configuration file to inherit from.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
extends?: string;
|
||||
|
||||
/**
|
||||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
Specifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property.
|
||||
|
||||
Glob patterns require TypeScript version 2.0 or later.
|
||||
*/
|
||||
exclude?: string[];
|
||||
|
||||
/**
|
||||
Specifies a list of glob patterns that match files to be included in compilation.
|
||||
|
||||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
include?: string[];
|
||||
|
||||
/**
|
||||
Referenced projects.
|
||||
|
||||
Requires TypeScript version 3.0 or later.
|
||||
*/
|
||||
references?: TsConfigJson.References[];
|
||||
}
|
58
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/union-to-intersection.d.ts
generated
vendored
Normal file
58
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/union-to-intersection.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
||||
|
||||
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
||||
|
||||
@example
|
||||
```
|
||||
import {UnionToIntersection} from 'type-fest';
|
||||
|
||||
type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
|
||||
|
||||
type Intersection = UnionToIntersection<Union>;
|
||||
//=> {the(): void; great(arg: string): void; escape: boolean};
|
||||
```
|
||||
|
||||
A more applicable example which could make its way into your library code follows.
|
||||
|
||||
@example
|
||||
```
|
||||
import {UnionToIntersection} from 'type-fest';
|
||||
|
||||
class CommandOne {
|
||||
commands: {
|
||||
a1: () => undefined,
|
||||
b1: () => undefined,
|
||||
}
|
||||
}
|
||||
|
||||
class CommandTwo {
|
||||
commands: {
|
||||
a2: (argA: string) => undefined,
|
||||
b2: (argB: string) => undefined,
|
||||
}
|
||||
}
|
||||
|
||||
const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
|
||||
type Union = typeof union;
|
||||
//=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
|
||||
|
||||
type Intersection = UnionToIntersection<Union>;
|
||||
//=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
|
||||
```
|
||||
*/
|
||||
export type UnionToIntersection<Union> = (
|
||||
// `extends unknown` is always going to be the case and is used to convert the
|
||||
// `Union` into a [distributive conditional
|
||||
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
||||
Union extends unknown
|
||||
// The union type is used as the only argument to a function since the union
|
||||
// of function arguments is an intersection.
|
||||
? (distributedUnion: Union) => void
|
||||
// This won't happen.
|
||||
: never
|
||||
// Infer the `Intersection` type since TypeScript represents the positional
|
||||
// arguments of unions of functions as an intersection of the union.
|
||||
) extends ((mergedIntersection: infer Intersection) => void)
|
||||
? Intersection
|
||||
: never;
|
3
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/utilities.d.ts
generated
vendored
Normal file
3
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/utilities.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export type UpperCaseCharacters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
|
||||
|
||||
export type WordSeparators = '-' | '_' | ' ';
|
40
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/value-of.d.ts
generated
vendored
Normal file
40
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/source/value-of.d.ts
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
Create a union of the given object's values, and optionally specify which keys to get the values from.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31438) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
// data.json
|
||||
{
|
||||
'foo': 1,
|
||||
'bar': 2,
|
||||
'biz': 3
|
||||
}
|
||||
|
||||
// main.ts
|
||||
import {ValueOf} from 'type-fest';
|
||||
import data = require('./data.json');
|
||||
|
||||
export function getData(name: string): ValueOf<typeof data> {
|
||||
return data[name];
|
||||
}
|
||||
|
||||
export function onlyBar(name: string): ValueOf<typeof data, 'bar'> {
|
||||
return data[name];
|
||||
}
|
||||
|
||||
// file.ts
|
||||
import {getData, onlyBar} from './main';
|
||||
|
||||
getData('foo');
|
||||
//=> 1
|
||||
|
||||
onlyBar('foo');
|
||||
//=> TypeError ...
|
||||
|
||||
onlyBar('bar');
|
||||
//=> 2
|
||||
```
|
||||
*/
|
||||
export type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
72
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/camel-case.d.ts
generated
vendored
Normal file
72
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/camel-case.d.ts
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
import {WordSeparators} from '../source/utilities';
|
||||
|
||||
/**
|
||||
Recursively split a string literal into two parts on the first occurence of the given string, returning an array literal of all the separate parts.
|
||||
*/
|
||||
export type Split<S extends string, D extends string> =
|
||||
string extends S ? string[] :
|
||||
S extends '' ? [] :
|
||||
S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] :
|
||||
[S];
|
||||
|
||||
/**
|
||||
Step by step takes the first item in an array literal, formats it and adds it to a string literal, and then recursively appends the remainder.
|
||||
|
||||
Only to be used by `CamelCaseStringArray<>`.
|
||||
|
||||
@see CamelCaseStringArray
|
||||
*/
|
||||
type InnerCamelCaseStringArray<Parts extends any[], PreviousPart> =
|
||||
Parts extends [`${infer FirstPart}`, ...infer RemainingParts]
|
||||
? FirstPart extends undefined
|
||||
? ''
|
||||
: FirstPart extends ''
|
||||
? InnerCamelCaseStringArray<RemainingParts, PreviousPart>
|
||||
: `${PreviousPart extends '' ? FirstPart : Capitalize<FirstPart>}${InnerCamelCaseStringArray<RemainingParts, FirstPart>}`
|
||||
: '';
|
||||
|
||||
/**
|
||||
Starts fusing the output of `Split<>`, an array literal of strings, into a camel-cased string literal.
|
||||
|
||||
It's separate from `InnerCamelCaseStringArray<>` to keep a clean API outwards to the rest of the code.
|
||||
|
||||
@see Split
|
||||
*/
|
||||
type CamelCaseStringArray<Parts extends string[]> =
|
||||
Parts extends [`${infer FirstPart}`, ...infer RemainingParts]
|
||||
? Uncapitalize<`${FirstPart}${InnerCamelCaseStringArray<RemainingParts, FirstPart>}`>
|
||||
: never;
|
||||
|
||||
/**
|
||||
Convert a string literal to camel-case.
|
||||
|
||||
This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.
|
||||
|
||||
@example
|
||||
```
|
||||
import {CamelCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: CamelCase<'foo-bar'> = 'fooBar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type CamelCasedProps<T> = {
|
||||
[K in keyof T as CamelCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface RawOptions {
|
||||
'dry-run': boolean;
|
||||
'full_family_name': string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: CamelCasedProps<ModelProps> = {
|
||||
dryRun: true,
|
||||
fullFamilyName: 'bar.js',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type CamelCase<K> = K extends string ? CamelCaseStringArray<Split<K, WordSeparators>> : K;
|
85
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/delimiter-case.d.ts
generated
vendored
Normal file
85
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/delimiter-case.d.ts
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
import {UpperCaseCharacters, WordSeparators} from '../source/utilities';
|
||||
|
||||
/**
|
||||
Unlike a simpler split, this one includes the delimiter splitted on in the resulting array literal. This is to enable splitting on, for example, upper-case characters.
|
||||
*/
|
||||
export type SplitIncludingDelimiters<Source extends string, Delimiter extends string> =
|
||||
Source extends '' ? [] :
|
||||
Source extends `${infer FirstPart}${Delimiter}${infer SecondPart}` ?
|
||||
(
|
||||
Source extends `${FirstPart}${infer UsedDelimiter}${SecondPart}`
|
||||
? UsedDelimiter extends Delimiter
|
||||
? Source extends `${infer FirstPart}${UsedDelimiter}${infer SecondPart}`
|
||||
? [...SplitIncludingDelimiters<FirstPart, Delimiter>, UsedDelimiter, ...SplitIncludingDelimiters<SecondPart, Delimiter>]
|
||||
: never
|
||||
: never
|
||||
: never
|
||||
) :
|
||||
[Source];
|
||||
|
||||
/**
|
||||
Format a specific part of the splitted string literal that `StringArrayToDelimiterCase<>` fuses together, ensuring desired casing.
|
||||
|
||||
@see StringArrayToDelimiterCase
|
||||
*/
|
||||
type StringPartToDelimiterCase<StringPart extends string, UsedWordSeparators extends string, UsedUpperCaseCharacters extends string, Delimiter extends string> =
|
||||
StringPart extends UsedWordSeparators ? Delimiter :
|
||||
StringPart extends UsedUpperCaseCharacters ? `${Delimiter}${Lowercase<StringPart>}` :
|
||||
StringPart;
|
||||
|
||||
/**
|
||||
Takes the result of a splitted string literal and recursively concatenates it together into the desired casing.
|
||||
|
||||
It receives `UsedWordSeparators` and `UsedUpperCaseCharacters` as input to ensure it's fully encapsulated.
|
||||
|
||||
@see SplitIncludingDelimiters
|
||||
*/
|
||||
type StringArrayToDelimiterCase<Parts extends any[], UsedWordSeparators extends string, UsedUpperCaseCharacters extends string, Delimiter extends string> =
|
||||
Parts extends [`${infer FirstPart}`, ...infer RemainingParts]
|
||||
? `${StringPartToDelimiterCase<FirstPart, UsedWordSeparators, UsedUpperCaseCharacters, Delimiter>}${StringArrayToDelimiterCase<RemainingParts, UsedWordSeparators, UsedUpperCaseCharacters, Delimiter>}`
|
||||
: '';
|
||||
|
||||
/**
|
||||
Convert a string literal to a custom string delimiter casing.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to an oddly cased one.
|
||||
|
||||
@see KebabCase
|
||||
@see SnakeCase
|
||||
|
||||
@example
|
||||
```
|
||||
import {DelimiterCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type OddlyCasedProps<T> = {
|
||||
[K in keyof T as DelimiterCase<K, '#'>]: T[K]
|
||||
};
|
||||
|
||||
interface SomeOptions {
|
||||
dryRun: boolean;
|
||||
includeFile: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const rawCliOptions: OddlyCasedProps<SomeOptions> = {
|
||||
'dry#run': true,
|
||||
'include#file': 'bar.js',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
|
||||
export type DelimiterCase<Value, Delimiter extends string> = Value extends string
|
||||
? StringArrayToDelimiterCase<
|
||||
SplitIncludingDelimiters<Value, WordSeparators | UpperCaseCharacters>,
|
||||
WordSeparators,
|
||||
UpperCaseCharacters,
|
||||
Delimiter
|
||||
>
|
||||
: Value;
|
9
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/index.d.ts
generated
vendored
Normal file
9
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// These are all the basic types that's compatible with all supported TypeScript versions.
|
||||
export * from '../base';
|
||||
|
||||
// These are special types that require at least TypeScript 4.1.
|
||||
export {CamelCase} from './camel-case';
|
||||
export {KebabCase} from './kebab-case';
|
||||
export {PascalCase} from './pascal-case';
|
||||
export {SnakeCase} from './snake-case';
|
||||
export {DelimiterCase} from './delimiter-case';
|
36
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/kebab-case.d.ts
generated
vendored
Normal file
36
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/kebab-case.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
import {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert a string literal to kebab-case.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.
|
||||
|
||||
@example
|
||||
```
|
||||
import {KebabCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: KebabCase<'fooBar'> = 'foo-bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type KebabCasedProps<T> = {
|
||||
[K in keyof T as KebabCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface CliOptions {
|
||||
dryRun: boolean;
|
||||
includeFile: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const rawCliOptions: KebabCasedProps<CliOptions> = {
|
||||
'dry-run': true,
|
||||
'include-file': 'bar.js',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
|
||||
export type KebabCase<Value> = DelimiterCase<Value, '-'>;
|
36
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/pascal-case.d.ts
generated
vendored
Normal file
36
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/pascal-case.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
import {CamelCase} from './camel-case';
|
||||
|
||||
/**
|
||||
Converts a string literal to pascal-case.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PascalCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: PascalCase<'foo-bar'> = 'FooBar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type PascalCaseProps<T> = {
|
||||
[K in keyof T as PascalCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface RawOptions {
|
||||
'dry-run': boolean;
|
||||
'full_family_name': string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: CamelCasedProps<ModelProps> = {
|
||||
DryRun: true,
|
||||
FullFamilyName: 'bar.js',
|
||||
Foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
|
||||
export type PascalCase<Value> = CamelCase<Value> extends string
|
||||
? Capitalize<CamelCase<Value>>
|
||||
: CamelCase<Value>;
|
35
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/snake-case.d.ts
generated
vendored
Normal file
35
app_vue/node_modules/@eslint/eslintrc/node_modules/type-fest/ts41/snake-case.d.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert a string literal to snake-case.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SnakeCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: SnakeCase<'fooBar'> = 'foo_bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type SnakeCasedProps<T> = {
|
||||
[K in keyof T as SnakeCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface ModelProps {
|
||||
isHappy: boolean;
|
||||
fullFamilyName: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: SnakeCasedProps<ModelProps> = {
|
||||
'is_happy': true,
|
||||
'full_family_name': 'Carla Smith',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type SnakeCase<Value> = DelimiterCase<Value, '_'>;
|
63
app_vue/node_modules/@eslint/eslintrc/package.json
generated
vendored
Normal file
63
app_vue/node_modules/@eslint/eslintrc/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@eslint/eslintrc",
|
||||
"version": "0.4.3",
|
||||
"description": "The legacy ESLintRC config file format for ESLint",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"conf",
|
||||
"LICENSE"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint . --report-unused-disable-directives",
|
||||
"fix": "npm run lint -- --fix",
|
||||
"test": "mocha -R progress -c 'tests/lib/**/*.js'",
|
||||
"generate-release": "eslint-generate-release",
|
||||
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
||||
"generate-betarelease": "eslint-generate-prerelease beta",
|
||||
"generate-rcrelease": "eslint-generate-prerelease rc",
|
||||
"publish-release": "eslint-publish-release"
|
||||
},
|
||||
"repository": "eslint/eslintrc",
|
||||
"keywords": [
|
||||
"ESLint",
|
||||
"ESLintRC",
|
||||
"Configuration"
|
||||
],
|
||||
"author": "Nicholas C. Zakas",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/eslintrc/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/eslintrc#readme",
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^7.21.0",
|
||||
"eslint-config-eslint": "^7.0.0",
|
||||
"eslint-plugin-jsdoc": "^32.2.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-release": "^3.1.2",
|
||||
"fs-teardown": "0.1.1",
|
||||
"mocha": "^8.1.1",
|
||||
"shelljs": "^0.8.4",
|
||||
"sinon": "^9.2.0",
|
||||
"temp-dir": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
"debug": "^4.1.1",
|
||||
"espree": "^7.3.0",
|
||||
"globals": "^13.9.0",
|
||||
"ignore": "^4.0.6",
|
||||
"import-fresh": "^3.2.1",
|
||||
"js-yaml": "^3.13.1",
|
||||
"minimatch": "^3.0.4",
|
||||
"strip-json-comments": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10.12.0 || >=12.0.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user