Bump the npm group with 4 updates (#2015)

* Bump the npm group with 4 updates

Bumps the npm group with 4 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint](https://github.com/eslint/eslint) and [nock](https://github.com/nock/nock).


Updates `@typescript-eslint/eslint-plugin` from 6.13.0 to 6.13.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.13.0 to 6.13.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/parser)

Updates `eslint` from 8.54.0 to 8.55.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.54.0...v8.55.0)

Updates `nock` from 13.3.8 to 13.4.0
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.3.8...v13.4.0)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2023-12-04 19:22:11 +00:00
committed by GitHub
parent a16ac98583
commit bc50092bdb
168 changed files with 813 additions and 330 deletions

112
node_modules/.package-lock.json generated vendored
View File

@@ -425,9 +425,9 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz",
"integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -448,9 +448,9 @@
}
},
"node_modules/@eslint/js": {
"version": "8.54.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz",
"integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==",
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz",
"integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -957,16 +957,16 @@
"integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.0.tgz",
"integrity": "sha512-HTvbSd0JceI2GW5DHS3R9zbarOqjkM9XDR7zL8eCsBUO/eSiHcoNE7kSL5sjGXmVa9fjH5LCfHDXNnH4QLp7tQ==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz",
"integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.13.0",
"@typescript-eslint/type-utils": "6.13.0",
"@typescript-eslint/utils": "6.13.0",
"@typescript-eslint/visitor-keys": "6.13.0",
"@typescript-eslint/scope-manager": "6.13.2",
"@typescript-eslint/type-utils": "6.13.2",
"@typescript-eslint/utils": "6.13.2",
"@typescript-eslint/visitor-keys": "6.13.2",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@@ -992,15 +992,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.0.tgz",
"integrity": "sha512-VpG+M7GNhHLI/aTDctqAV0XbzB16vf+qDX9DXuMZSe/0bahzDA9AKZB15NDbd+D9M4cDsJvfkbGOA7qiZ/bWJw==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz",
"integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.13.0",
"@typescript-eslint/types": "6.13.0",
"@typescript-eslint/typescript-estree": "6.13.0",
"@typescript-eslint/visitor-keys": "6.13.0",
"@typescript-eslint/scope-manager": "6.13.2",
"@typescript-eslint/types": "6.13.2",
"@typescript-eslint/typescript-estree": "6.13.2",
"@typescript-eslint/visitor-keys": "6.13.2",
"debug": "^4.3.4"
},
"engines": {
@@ -1020,13 +1020,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz",
"integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.2.tgz",
"integrity": "sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.13.0",
"@typescript-eslint/visitor-keys": "6.13.0"
"@typescript-eslint/types": "6.13.2",
"@typescript-eslint/visitor-keys": "6.13.2"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -1037,13 +1037,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.0.tgz",
"integrity": "sha512-YHufAmZd/yP2XdoD3YeFEjq+/Tl+myhzv+GJHSOz+ro/NFGS84mIIuLU3pVwUcauSmwlCrVXbBclkn1HfjY0qQ==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.2.tgz",
"integrity": "sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "6.13.0",
"@typescript-eslint/utils": "6.13.0",
"@typescript-eslint/typescript-estree": "6.13.2",
"@typescript-eslint/utils": "6.13.2",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
@@ -1064,9 +1064,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz",
"integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.2.tgz",
"integrity": "sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -1077,13 +1077,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz",
"integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.2.tgz",
"integrity": "sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.13.0",
"@typescript-eslint/visitor-keys": "6.13.0",
"@typescript-eslint/types": "6.13.2",
"@typescript-eslint/visitor-keys": "6.13.2",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1104,17 +1104,17 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.0.tgz",
"integrity": "sha512-V+txaxARI8yznDkcQ6FNRXxG+T37qT3+2NsDTZ/nKLxv6VfGrRhTnuvxPUxpVuWWr+eVeIxU53PioOXbz8ratQ==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.2.tgz",
"integrity": "sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.13.0",
"@typescript-eslint/types": "6.13.0",
"@typescript-eslint/typescript-estree": "6.13.0",
"@typescript-eslint/scope-manager": "6.13.2",
"@typescript-eslint/types": "6.13.2",
"@typescript-eslint/typescript-estree": "6.13.2",
"semver": "^7.5.4"
},
"engines": {
@@ -1129,12 +1129,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz",
"integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==",
"version": "6.13.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.2.tgz",
"integrity": "sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.13.0",
"@typescript-eslint/types": "6.13.2",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
@@ -2494,15 +2494,15 @@
}
},
"node_modules/eslint": {
"version": "8.54.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz",
"integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==",
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz",
"integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.3",
"@eslint/js": "8.54.0",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.55.0",
"@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -4536,9 +4536,9 @@
}
},
"node_modules/nock": {
"version": "13.3.8",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.3.8.tgz",
"integrity": "sha512-96yVFal0c/W1lG7mmfRe7eO+hovrhJYd2obzzOZ90f6fjpeU/XNvd9cYHZKZAQJumDfhXgoTpkpJ9pvMj+hqHw==",
"version": "13.4.0",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.4.0.tgz",
"integrity": "sha512-W8NVHjO/LCTNA64yxAPHV/K47LpGYcVzgKd3Q0n6owhwvD0Dgoterc25R4rnZbckJEb6Loxz1f5QMuJpJnbSyQ==",
"dev": true,
"dependencies": {
"debug": "^4.1.0",

View File

@@ -941,6 +941,7 @@ class ConfigDependency {
* Initialize this instance.
* @param {Object} data The dependency data.
* @param {T} [data.definition] The dependency if the loading succeeded.
* @param {T} [data.original] The original, non-normalized 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.
@@ -949,6 +950,7 @@ class ConfigDependency {
*/
constructor({
definition = null,
original = null,
error = null,
filePath = null,
id,
@@ -962,6 +964,12 @@ class ConfigDependency {
*/
this.definition = definition;
/**
* The original dependency as loaded directly from disk if the loading succeeded.
* @type {T|null}
*/
this.original = original;
/**
* The error object if the loading failed.
* @type {Error|null}
@@ -1014,7 +1022,8 @@ class ConfigDependency {
*/
[util__default["default"].inspect.custom]() {
const {
definition: _ignore, // eslint-disable-line no-unused-vars
definition: _ignore1, // eslint-disable-line no-unused-vars
original: _ignore2, // eslint-disable-line no-unused-vars
...obj
} = this;
@@ -3390,6 +3399,7 @@ class ConfigArrayFactory {
if (plugin) {
return new ConfigDependency({
definition: normalizePlugin(plugin),
original: plugin,
filePath: "", // It's unknown where the plugin came from.
id,
importerName: ctx.name,
@@ -3426,6 +3436,7 @@ class ConfigArrayFactory {
return new ConfigDependency({
definition: normalizePlugin(pluginDefinition),
original: pluginDefinition,
filePath,
id,
importerName: ctx.name,
@@ -4117,7 +4128,7 @@ function translateESLintRC(eslintrcConfig, {
debug(`Translating plugin: ${pluginName}`);
debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);
const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];
const { original: plugin, error } = eslintrcConfig.plugins[pluginName];
if (error) {
throw error;

File diff suppressed because one or more lines are too long

View File

@@ -1053,6 +1053,7 @@ class ConfigArrayFactory {
if (plugin) {
return new ConfigDependency({
definition: normalizePlugin(plugin),
original: plugin,
filePath: "", // It's unknown where the plugin came from.
id,
importerName: ctx.name,
@@ -1089,6 +1090,7 @@ class ConfigArrayFactory {
return new ConfigDependency({
definition: normalizePlugin(pluginDefinition),
original: pluginDefinition,
filePath,
id,
importerName: ctx.name,

View File

@@ -28,6 +28,7 @@ class ConfigDependency {
* Initialize this instance.
* @param {Object} data The dependency data.
* @param {T} [data.definition] The dependency if the loading succeeded.
* @param {T} [data.original] The original, non-normalized 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.
@@ -36,6 +37,7 @@ class ConfigDependency {
*/
constructor({
definition = null,
original = null,
error = null,
filePath = null,
id,
@@ -49,6 +51,12 @@ class ConfigDependency {
*/
this.definition = definition;
/**
* The original dependency as loaded directly from disk if the loading succeeded.
* @type {T|null}
*/
this.original = original;
/**
* The error object if the loading failed.
* @type {Error|null}
@@ -101,7 +109,8 @@ class ConfigDependency {
*/
[util.inspect.custom]() {
const {
definition: _ignore, // eslint-disable-line no-unused-vars
definition: _ignore1, // eslint-disable-line no-unused-vars
original: _ignore2, // eslint-disable-line no-unused-vars
...obj
} = this;

View File

@@ -132,7 +132,7 @@ function translateESLintRC(eslintrcConfig, {
debug(`Translating plugin: ${pluginName}`);
debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);
const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];
const { original: plugin, error } = eslintrcConfig.plugins[pluginName];
if (error) {
throw error;

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint/eslintrc",
"version": "2.1.3",
"version": "2.1.4",
"description": "The legacy ESLintRC config file format for ESLint",
"type": "module",
"main": "./dist/eslintrc.cjs",

View File

@@ -1,6 +1,6 @@
{
"name": "@eslint/js",
"version": "8.54.0",
"version": "8.55.0",
"description": "ESLint JavaScript language implementation",
"main": "./src/index.js",
"scripts": {},

View File

@@ -63,6 +63,7 @@ exports.default = (0, util_1.createRule)({
ExportNamedDeclaration(node) {
// Coerce the source into a string for use as a lookup entry.
const source = getSourceFromExport(node) ?? 'undefined';
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const sourceExports = (sourceExportsMap[source] ||= {
source,
reportValueExports: [],

File diff suppressed because one or more lines are too long

View File

@@ -60,6 +60,7 @@ exports.default = (0, util_1.createRule)({
ImportDeclaration(node) {
const source = node.source.value;
// sourceImports is the object containing all the specifics for a particular import source, type or value
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
sourceImportsMap[source] ??= {
source,
reportValueImports: [], // if there is a mismatch where type importKind but value specifiers

File diff suppressed because one or more lines are too long

View File

@@ -248,6 +248,7 @@ exports.default = (0, util_1.createRule)({
}
},
};
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (rules.ForInStatement && rules.ForOfStatement) {
overrides.ForInStatement = function (node) {
if ((0, util_1.isTypeAssertion)(node.right)) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.getThisExpression = void 0;
const utils_1 = require("@typescript-eslint/utils");
function getThisExpression(node) {
while (node) {
while (true) {
if (node.type === utils_1.AST_NODE_TYPES.CallExpression) {
node = node.callee;
}

View File

@@ -90,4 +90,10 @@ export function foo(sn: string | number): void;
## When Not To Use It
If you don't care about the general structure of the code, then you will not need this rule.
It can sometimes be useful to place overload signatures alongside other meaningful parts of a type.
For example, if each of a function's overloads corresponds to a different property, you might wish to put each overloads next to its corresponding property.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`unified-signatures`](./unified-signatures.md)

View File

@@ -101,3 +101,11 @@ This matrix lists all possible option combinations and their expected results fo
| `generic` | `array` | `Array<number>` | `Array<Foo & Bar>` | `readonly number[]` | `readonly (Foo & Bar)[]` |
| `generic` | `array-simple` | `Array<number>` | `Array<Foo & Bar>` | `readonly number[]` | `ReadonlyArray<Foo & Bar>` |
| `generic` | `generic` | `Array<number>` | `Array<Foo & Bar>` | `ReadonlyArray<number>` | `ReadonlyArray<Foo & Bar>` |
## When Not To Use It
This rule is purely a stylistic rule for maintaining consistency in your project.
You can turn it off if you don't want to keep a consistent style for array types.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -37,4 +37,6 @@ await createValue();
## When Not To Use It
If you want to allow code to `await` non-Promise values.
This is generally not preferred, but can sometimes be useful for visual consistency.
For example, if your framework is in transition from one style of asynchronous code to another, it may be useful to include `await`s unnecessarily.
This is generally not preferred but can sometimes be useful for visual consistency.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -143,7 +143,8 @@ if (false) {
## When Not To Use It
If you want to use all of the TypeScript directives.
If your project or its dependencies were not architected with strong type safety in mind, it can be difficult to always adhere to proper TypeScript semantics.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading

View File

@@ -36,4 +36,4 @@ someCode(); // This is a comment that just happens to mention tslint
## When Not To Use It
If you are still using TSLint.
If you are still using TSLint alongside ESLint.

View File

@@ -125,3 +125,8 @@ Example configuration:
]
}
```
## When Not To Use It
If your project is a rare one that intentionally deals with the class equivalents of primitives, it might not be worthwhile to enable the default `ban-types` options.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -102,5 +102,4 @@ class Mx {
## When Not To Use It
When you have no strong preference, or do not wish to enforce a particular style
for how literal values are exposed by your classes.
When you have no strong preference, or do not wish to enforce a particular style for how literal values are exposed by your classes.

View File

@@ -89,3 +89,8 @@ class X implements Y {
property = () => {};
}
```
## When Not To Use It
If your project dynamically changes `this` scopes around in a way TypeScript has difficulties modeling, this rule may not be viable to use.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -71,3 +71,6 @@ const set: Set<string> = new Set<string>();
## When Not To Use It
You can turn this rule off if you don't want to enforce one kind of generic constructor style over the other.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -70,3 +70,11 @@ type Foo = {
[key: string]: unknown;
};
```
## When Not To Use It
This rule is purely a stylistic rule for maintaining consistency in your project.
You can turn it off if you don't want to keep a consistent style for indexed object types.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -106,3 +106,6 @@ const foo = <Foo props={{ ... } as Bar}/>;
## When Not To Use It
If you do not want to enforce consistent type assertions.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -71,4 +71,11 @@ type T = { x: number };
## When Not To Use It
If you specifically want to use an interface or type literal for stylistic reasons, you can disable this rule.
If you specifically want to use an interface or type literal for stylistic reasons, you can avoid this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.
There are also subtle differences between `Record` and `interface` that can be difficult to catch statically.
For example, if your project is a dependency of another project that relies on a specific type definition style, this rule may be counterproductive.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -96,5 +96,10 @@ export { Button, type ButtonProps } from 'some-library';
## When Not To Use It
- If you specifically want to use both export kinds for stylistic reasons, you can disable this rule.
- If you use `--isolatedModules` the compiler would error if a type is not re-exported using `export type`. If you also don't wish to enforce one style over the other, you can disable this rule.
If you use `--isolatedModules` the compiler would error if a type is not re-exported using `export type`.
This rule may be less useful in those cases.
If you specifically want to use both export kinds for stylistic reasons, or don't wish to enforce one style over the other, you can avoid this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -96,7 +96,10 @@ If you are using [type-aware linting](https://typescript-eslint.io/linting/typed
## When Not To Use It
- If you specifically want to use both import kinds for stylistic reasons, you can disable this rule.
If you specifically want to use both import kinds for stylistic reasons, or don't wish to enforce one style over the other, you can avoid this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.
## Related To

View File

@@ -73,3 +73,10 @@ x['hello'] = 123;
```
If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to `true`, then the above code is always allowed, even if `allowIndexSignaturePropertyAccess` is `false`.
## When Not To Use It
If you specifically want to use both member access kinds for stylistic reasons, or don't wish to enforce one style over the other, you can avoid this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -317,8 +317,7 @@ var bar = (function () {
## When Not To Use It
If you don't wish to prevent calling code from using function return values in unexpected ways, then
you will not need this rule.
If you don't find the added cost of explicitly writing function return types to be worth the visual clarity, or your project is not large enough for it to be a factor in type checking performance, then you will not need this rule.
## Further Reading

View File

@@ -333,7 +333,11 @@ class Animal {
## When Not To Use It
If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule.
If you think defaulting to public is a good default, then you should consider using the `no-public` setting.
If you want to mix implicit and explicit public members then you can disable this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.
## Further Reading

View File

@@ -243,8 +243,12 @@ export const foo: FooType = bar => {};
## When Not To Use It
If you wish to make sure all functions have explicit return types, as opposed to only the module boundaries, you can use [explicit-function-return-type](./explicit-function-return-type.md)
If your project is not used by downstream consumers that are sensitive to API types, you can disable this rule.
## Further Reading
- TypeScript [Functions](https://www.typescriptlang.org/docs/handbook/functions.html#function-types)
## Related To
- [explicit-function-return-type](./explicit-function-return-type.md)

View File

@@ -158,4 +158,7 @@ type FooBar = { name: string; greet(): string }
## When Not To Use It
If you don't care about enforcing a consistent member delimiter in interfaces and type literals, then you will not need this rule.
If you specifically want to use both member delimiter kinds for stylistic reasons, or don't wish to enforce one style over the other, you can avoid this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -108,3 +108,6 @@ type T2 = {
## When Not To Use It
If you don't want to enforce a particular style for object/interface function types, and/or if you don't use `strictFunctionTypes`, then you don't need this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -711,4 +711,11 @@ You can use the `destructured` modifier to match these names, and explicitly set
## When Not To Use It
If you do not want to enforce naming conventions for anything.
This rule can be very strict.
If you don't have strong needs for enforcing naming conventions, we recommend using it only to flag very egregious violations of your naming standards.
Consider documenting your naming conventions and enforcing them in code review if you have processes like that.
If you do not want to enforce naming conventions for anything, you can disable this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend that if you care about naming conventions, pick a single option for this rule that works best for your project.

View File

@@ -76,7 +76,7 @@ let text = `${value}`;
## When Not To Use It
If you don't mind `"[object Object]"` in your strings, then you will not need this rule.
If you don't mind a risk of `"[object Object]"` or incorrect type coercions in your values, then you will not need this rule.
## Related To

View File

@@ -113,4 +113,4 @@ console.log(void alert('Hello, world!'));
The return type of a function can be inspected by going to its definition or hovering over it in an IDE.
If you don't care about being explicit about the void type in actual code then don't use this rule.
Also, if you prefer concise coding style then also don't use it.
Also, if you strongly prefer a concise coding style more strongly than any fear of `void`-related bugs then you can avoid this rule.

View File

@@ -48,3 +48,11 @@ enum E {
B = 'B',
}
```
## When Not To Use It
It can sometimes be useful to include duplicate enum members for very specific use cases.
For example, when renaming an enum member, it can sometimes be useful to keep the old name until a scheduled major breaking change.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
In general, if your project intentionally duplicates enum member values, you can avoid this rule.

View File

@@ -57,3 +57,10 @@ When set to true, duplicate checks on intersection type constituents are ignored
### `ignoreUnions`
When set to true, duplicate checks on union type constituents are ignored.
## When Not To Use It
It can sometimes be useful for the sake of documentation to include aliases for the same type.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
> In some of those cases, [branded types](https://basarat.gitbook.io/typescript/main-1/nominaltyping#using-interfaces) might be a type-safe way to represent the underlying data types.

View File

@@ -47,7 +47,7 @@ delete container['-Infinity'];
## When Not To Use It
When you know your keys are safe to delete, this rule can be unnecessary.
Some environments such as older browsers might not support `Map` and `Set`.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
Do not consider this rule as performance advice before profiling your code's bottlenecks.
Even repeated minor performance slowdowns likely do not significantly affect your application's general perceived speed.

View File

@@ -84,3 +84,12 @@ class Foo extends Base {
protected override greet(): void {}
}
```
## When Not To Use It
If you are working with external APIs that require functions even if they do nothing, then you may want to avoid this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
Test code often violates this rule as well.
If your testing setup doesn't support "mock" or "spy" functions such as [`jest.fn()`](https://jestjs.io/docs/mock-functions), [`sinon.spy()`](https://sinonjs.org/releases/latest/spies), or [`vi.fn()`](https://vitest.dev/guide/mocking.html), you may wish to disable this rule in test files.
Again, if those cases aren't extremely common, you might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule in test files.

View File

@@ -138,6 +138,8 @@ Most commonly:
- If an external package doesn't yet have typings and you want to use `any` pending adding a `.d.ts` for it
- You're working with particularly complex or nuanced code that can't yet be represented in the TypeScript type system
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-unsafe-argument`](./no-unsafe-argument.md)
@@ -148,5 +150,7 @@ Most commonly:
## Further Reading
- TypeScript [`any` type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)
- TypeScript's [`unknown` type](https://www.typescriptlang.org/docs/handbook/2/functions.html#unknown)
- TypeScript [`any` type documentation](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)
- TypeScript [`unknown` type release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#new-unknown-top-type)

View File

@@ -50,3 +50,5 @@ function foo(bar?: { n: number }) {
return bar?.n;
}
```
<!-- Intentionally Omitted: When Not To Use It -->

View File

@@ -291,4 +291,5 @@ class Constants {
## When Not To Use It
You can disable this rule if you are unable -or unwilling- to switch off using classes as namespaces.
If your project was set up before modern class and namespace practices, and you don't have the time to switch over, you might not be practically able to use this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -99,7 +99,9 @@ await(async function () {
## When Not To Use It
If you do not use Promise-like values in your codebase, or want to allow them to remain unhandled.
This rule can be difficult to enable on large existing projects that set up many floating Promises.
Alternately, if you're not worried about crashes from floating or misused Promises -such as if you have global unhandled Promise handlers registered- then in some cases it may be safe to not use this rule.
You might consider using `void`s and/or [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To

View File

@@ -53,4 +53,5 @@ for (const [i, value] of array.entries()) {
## When Not To Use It
If you want to iterate through a loop using the indices in an array as strings, you can turn off this rule.
If your project is a rare one that intentionally loops over string indices of arrays, you can turn off this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -98,4 +98,5 @@ setTimeout(Foo.fn, 100);
## When Not To Use It
If you want to allow `new Function()` or `setTimeout()`, `setInterval()`, `setImmediate()` and `execScript()` with string arguments, then you can safely disable this rule.
If your project is a rare one that needs to allow `new Function()` or `setTimeout()`, `setInterval()`, `setImmediate()` and `execScript()` with string arguments, then you can disable this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -65,8 +65,7 @@ import T, { type U } from 'mod';
## When Not To Use It
- If you want to leave behind side effect imports, then you shouldn't use this rule.
- If you're not using TypeScript 5.0's `verbatimModuleSyntax` option, then you don't need this rule.
If you're not using TypeScript 5.0's `verbatimModuleSyntax` option and your project is built with a bundler that manages import side effects for you, this rule may not be as useful for you.
## Related To

View File

@@ -96,8 +96,8 @@ class Foo {
## When Not To Use It
If you do not want to enforce inferred types.
If you strongly prefer to have explicit types regardless of whether they can be inferred, this rule may not be for you.
## Further Reading
TypeScript [Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)
- [TpeScript Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)

View File

@@ -109,5 +109,4 @@ class Example {
## When Not To Use It
If you don't care about if `void` is used with other types,
or in invalid places, then you don't need this rule.
If you don't care about if `void` is used with other types, or in invalid places, then you don't need this rule.

View File

@@ -111,3 +111,9 @@ Examples of **correct** code for the `{ "ignoreTypeIndexes": true }` option:
type Foo = Bar[0];
type Baz = Parameters<Foo>[2];
```
## When Not To Use It
If your project frequently deals with constant numbers and you don't wish to take up extra space to declare them, this rule might not be for you.
We recommend at least using descriptive comments and/or names to describe constants.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) instead of completely disabling this rule.

View File

@@ -45,3 +45,7 @@ void bar(); // discarding a number
## Options
`checkNever: true` will suggest removing `void` when the argument has type `never`.
## When Not To Use It
If you don't mind extra `void`s in your project, you can avoid this rule.

View File

@@ -43,4 +43,5 @@ interface I {
## When Not To Use It
If you intentionally want a class with a `new` method, and you're confident nobody working in your code will mistake it with a constructor.
If you intentionally want a class with a `new` method, and you're confident nobody working in your code will mistake it with a constructor, you might not want this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -233,8 +233,9 @@ return { foo: 42, ...(await getData2()) };
## When Not To Use It
If you do not use Promises in your codebase or are not concerned with possible
misuses of them outside of what the TypeScript compiler will check.
This rule can be difficult to enable on large existing projects that set up many misused Promises.
Alternately, if you're not worried about crashes from floating or misused Promises -such as if you have global unhandled Promise handlers registered- then in some cases it may be safe to not use this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading

View File

@@ -120,7 +120,9 @@ declare module 'foo' {}
## When Not To Use It
If you are using the ES2015 module syntax, then you will not need this rule.
If your project was architected before modern modules and namespaces, it may be difficult to migrate off of namespaces.
In that case you may not be able to use this rule for parts of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading

View File

@@ -43,6 +43,11 @@ let x: string;
x! ?? '';
```
## When Not To Use It
If your project's types don't yet fully describe whether certain values may be nullable, such as if you're transitioning to `strictNullChecks`, this rule might create many false reports.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading
- [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html)

View File

@@ -29,6 +29,11 @@ foo?.bar;
foo?.bar();
```
## When Not To Use It
If your project's types don't yet fully describe whether certain values may be nullable, such as if you're transitioning to `strictNullChecks`, this rule might create many false reports.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading
- [TypeScript 3.7 Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html)

View File

@@ -38,5 +38,5 @@ const includesBaz = example.property?.includes('baz') ?? false;
## When Not To Use It
If your project does not use the `strictNullChecks` compiler option, this rule is likely useless to you.
If your code is often wildly incorrect with respect to strict null-checking, your code may not yet be ready for this rule.
If your project's types don't yet fully describe whether certain values may be nullable, such as if you're transitioning to `strictNullChecks`, this rule might create many false reports.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -70,6 +70,20 @@ type IntersectionStringLiteral = 'foo';
This rule plays it safe and only works with bottom types, top types, and comparing literal types to primitive types.
## When Not To Use It
Some projects choose to occasionally intentionally include a redundant type constituent for documentation purposes.
For example, the following code includes `string` in a union even though the `unknown` makes it redundant:
```ts
/**
* Normally a string name, but sometimes arbitrary unknown data.
*/
type NameOrOther = string | unknown;
```
If you strongly feel a preference for these unnecessary type constituents, this rule might not be for you.
## Further Reading
- [Union Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)

View File

@@ -30,7 +30,8 @@ import * as lib3 from 'lib3';
## When Not To Use It
If you don't care about using newer module syntax, then you will not need this rule.
If your project frequently uses older CommonJS `require`s, then this rule might not be applicable to you.
If only a subset of your project uses `require`s then you might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To

View File

@@ -35,4 +35,5 @@ setTimeout(() => {
## When Not To Use It
If you need to assign `this` to variables, you shouldnt use this rule.
If your project is structured in a way that it needs to assign `this` to variables, this rule is likely not for you.
If only a subset of your project assigns `this` to variables then you might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -109,3 +109,5 @@ const defaultOptions: Options = {
allowThrowingUnknown: false,
};
```
<!-- Intentionally omitted: When Not To Use It -->

View File

@@ -606,10 +606,7 @@ type Foo = Partial<Bar>;
type Foo = Omit<Bar, 'a' | 'b'>;
```
## When Not To Use It
When you can't express some shape with an interface or you need to use a union, tuple type,
callback, etc. that would cause the code to be unreadable or impractical.
<!-- Intentionally Omitted: When Not To Use It -->
## Further Reading

View File

@@ -126,7 +126,7 @@ if (!(someNullCondition ?? true)) {
| `!(nullableBooleanVar === false)` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
| `!(nullableBooleanVar !== false)` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
## Not To Use It
## When Not To Use It
Do not use this rule when `strictNullChecks` is disabled.
ESLint is not able to distinguish between `false` and `undefined` or `null` values.

View File

@@ -95,7 +95,8 @@ If for some reason you cannot turn on `strictNullChecks`, but still want to use
## When Not To Use It
The main downside to using this rule is the need for type information.
If your project is not accurately typed, such as if it's in the process of being converted to TypeScript or is susceptible to [trade-offs in control flow analysis](https://github.com/Microsoft/TypeScript/issues/9998), it may be difficult to enable this rule for particularly non-type-safe areas of code.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
This rule has a known edge case of triggering on conditions that were modified within function calls (as side effects).
It is due to limitations of TypeScript's type narrowing.

View File

@@ -48,4 +48,4 @@ namespace A {
## When Not To Use It
If you don't care about having unneeded enum or namespace qualifiers, then you don't need to use this rule.
If you explicitly prefer to use fully qualified names, such as for explicitness, then you don't need to use this rule.

View File

@@ -71,3 +71,7 @@ class D extends C<string> {}
interface I<T = number> {}
class Impl implements I<string> {}
```
## When Not To Use It
If you prefer explicitly specifying type parameters even when they are equal to the default, you can skip this rule.

View File

@@ -78,6 +78,16 @@ declare function foo(arg1: unknown, arg2: Set<unknown>, arg3: unknown[]): void;
foo(1 as any, new Set<any>(), [] as any[]);
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
It may be easier to skip the `no-unsafe-*` rules pending increasing type safety in unsafe areas of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-explicit-any`](./no-explicit-any.md)
- [`no-unsafe-assignment`](./no-unsafe-assignment.md)
- [`no-unsafe-call`](./no-unsafe-call.md)
- [`no-unsafe-member-access`](./no-unsafe-member-access.md)
- [`no-unsafe-return`](./no-unsafe-return.md)

View File

@@ -81,6 +81,16 @@ const x: unknown[] = y as any[];
const x: Set<unknown> = y as Set<any>;
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
It may be easier to skip the `no-unsafe-*` rules pending increasing type safety in unsafe areas of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-explicit-any`](./no-explicit-any.md)
- [`no-unsafe-argument`](./no-unsafe-argument.md)
- [`no-unsafe-call`](./no-unsafe-call.md)
- [`no-unsafe-member-access`](./no-unsafe-member-access.md)
- [`no-unsafe-return`](./no-unsafe-return.md)

View File

@@ -53,6 +53,16 @@ new Map();
String.raw`foo`;
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
It may be easier to skip the `no-unsafe-*` rules pending increasing type safety in unsafe areas of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-explicit-any`](./no-explicit-any.md)
- [`no-unsafe-argument`](./no-unsafe-argument.md)
- [`no-unsafe-assignment`](./no-unsafe-assignment.md)
- [`no-unsafe-member-access`](./no-unsafe-member-access.md)
- [`no-unsafe-return`](./no-unsafe-return.md)

View File

@@ -49,6 +49,11 @@ namespace Qux {}
function Qux() {}
```
## When Not To Use It
If your project intentionally defines classes and interfaces with unsafe declaration merging patterns, this rule might not be for you.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading
- [Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)

View File

@@ -77,3 +77,6 @@ vegetable === Vegetable.Asparagus;
## When Not To Use It
If you don't mind number and/or literal string constants being compared against enums, you likely don't need this rule.
Separately, in the rare case of relying on an third party enums that are only imported as `type`s, it may be difficult to adhere to this rule.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -59,6 +59,16 @@ arr[idx];
arr[idx++];
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
It may be easier to skip the `no-unsafe-*` rules pending increasing type safety in unsafe areas of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-explicit-any`](./no-explicit-any.md)
- [`no-unsafe-argument`](./no-unsafe-argument.md)
- [`no-unsafe-assignment`](./no-unsafe-assignment.md)
- [`no-unsafe-call`](./no-unsafe-call.md)
- [`no-unsafe-return`](./no-unsafe-return.md)

View File

@@ -98,6 +98,16 @@ function foo2(): unknown[] {
}
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.
It may be easier to skip the `no-unsafe-*` rules pending increasing type safety in unsafe areas of your project.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To
- [`no-explicit-any`](./no-explicit-any.md)
- [`no-unsafe-argument`](./no-unsafe-argument.md)
- [`no-unsafe-assignment`](./no-unsafe-assignment.md)
- [`no-unsafe-call`](./no-unsafe-call.md)
- [`no-unsafe-member-access`](./no-unsafe-member-access.md)

View File

@@ -48,3 +48,5 @@ declare const d: any;
declare const e: 1 | 2;
-e;
```
<!-- Intentionally Omitted: When Not To Use It -->

View File

@@ -41,3 +41,7 @@ export const value = 'Hello, world!';
```ts
import 'some-other-module';
```
## When Not To Use It
If you don't mind an empty `export {}` at the bottom of files, you likely don't need this rule.

View File

@@ -30,7 +30,8 @@ import foo from 'foo';
## When Not To Use It
If you don't care about using newer module syntax, then you will not need this rule.
If your project frequently uses older CommonJS `require`s, then this rule might not be applicable to you.
If only a subset of your project uses `require`s then you might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Related To

View File

@@ -38,4 +38,4 @@ const alsoDefinitely = maybe!;
## When Not To Use It
If you don't mind having unnecessarily verbose type casts, you can avoid this rule.
If you don't mind having unnecessarily verbose type assertions, you can avoid this rule.

View File

@@ -482,4 +482,7 @@ class Foo {
## When Not To Use It
If you don't care about the using parameter properties in constructors, then you will not need this rule.
If you don't care about which style of parameter properties in constructors is used in your classes, then you will not need this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -41,4 +41,7 @@ let foo = { bar: 'baz' };
## When Not To Use It
If you are using TypeScript < 3.4
If you don't care about which style of literals assertions is used in your code, then you will not need this rule.
However, keep in mind that inconsistent style can harm readability in a project.
We recommend picking a single option for this rule that works best for your project.

View File

@@ -41,6 +41,4 @@ for (let i = 0; i < array.length; i++) {
}
```
## When Not To Use It
If you transpile for browsers that do not support for-of loops, you may wish to use traditional for loops that produce more compact code.
<!-- Intentionally Omitted: When Not To Use It -->

View File

@@ -84,7 +84,7 @@ type Intersection = ((data: string) => number) & ((id: number) => string);
## When Not To Use It
If you specifically want to use an interface or type literal with a single call signature for stylistic reasons, you can disable this rule.
If you specifically want to use an interface or type literal with a single call signature for stylistic reasons, you can avoid this rule.
This rule has a known edge case of sometimes triggering on global augmentations such as `interface Function`.
These edge cases are rare and often symptomatic of odd code.

View File

@@ -72,6 +72,4 @@ declare const mismatchExample: {
mismatchExample.indexOf(value) >= 0;
```
## When Not To Use It
If you don't want to suggest `includes`, you can safely turn this rule off.
<!-- Intentionally Omitted: When Not To Use It -->

View File

@@ -98,4 +98,4 @@ enum Foo {
## When Not To Use It
If you want use anything other than simple literals as an enum value.
If you want use anything other than simple literals as an enum value, this rule might not be for you.

View File

@@ -38,7 +38,7 @@ declare module 'foo' {}
## When Not To Use It
If you are using the ES2015 module syntax, then you will not need this rule.
If you are not using TypeScript's older `module`/`namespace` keywords, then you will not need this rule.
## Further Reading

View File

@@ -254,7 +254,8 @@ thing2 && thing2.toString();
## When Not To Use It
If you don't mind using more explicit `&&`s/`||`s, you don't need this rule.
If your project is not accurately typed, such as if it's in the process of being converted to TypeScript or is susceptible to [trade-offs in control flow analysis](https://github.com/Microsoft/TypeScript/issues/9998), it may be difficult to enable this rule for particularly non-type-safe areas of code.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading

View File

@@ -380,3 +380,7 @@ type MyType = {
};
function foo(arg: MyType) {}
```
## When Not To Use It
If your project does not attempt to enforce strong immutability guarantees of parameters, you can avoid this rule.

View File

@@ -93,3 +93,7 @@ class Container {
private neverModifiedPrivate = 'unchanged';
}
```
## When Not To Use It
If you aren't trying to enforce strong immutability guarantees, this rule may be too restrictive for your project.

View File

@@ -55,4 +55,6 @@ It will suggest instead pass the asserted type to `Array#reduce` as a generic ty
## When Not To Use It
If you don't want to use typechecking in your linting, you can't use this rule.
This rule can sometimes be difficult to work around when creating objects using a `.reduce`.
See [[prefer-reduce-type-parameter] unfixable reporting #3440](https://github.com/typescript-eslint/typescript-eslint/issues/3440) for more details.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.

View File

@@ -54,4 +54,5 @@ foo.endsWith('bar');
## When Not To Use It
If you don't mind that style, you can turn this rule off safely.
If you don't mind which style of string checking is used, you can turn this rule off safely.
However, keep in mind that inconsistent style can harm readability in a project.

View File

@@ -63,6 +63,7 @@ const isOptionEnabled = (key: string): boolean => {
## When Not To Use It
If you are compiling against multiple versions of TypeScript and using `@ts-ignore` to ignore version-specific type errors, this rule might get in your way.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) for those specific situations instead of completely disabling this rule.
## Further Reading

View File

@@ -57,3 +57,8 @@ async function functionReturnsUnionWithPromiseImplicitly(p: boolean) {
return p ? 'value' : Promise.resolve('value');
}
```
## When Not To Use It
This rule can be difficult to enable on projects that use APIs which require functions to always be `async`.
You might consider using [ESLint disable comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) along with filing issues on your dependencies for those specific situations instead of completely disabling this rule.

View File

@@ -75,4 +75,4 @@ const three = '3';
## When Not To Use It
If you understand the language specification enough, and/or only ever sort arrays in a string-like manner, you can turn this rule off safely.
If you intentionally want your arrays to be always sorted in a string-like manner, you can turn this rule off safely.

View File

@@ -196,7 +196,7 @@ bar += 'test';
## When Not To Use It
If you don't mind `"[object Object]"` in your strings, then you will not need this rule.
If you don't mind a risk of `"[object Object]"` or incorrect type coercions in your values, then you will not need this rule.
## Related To

View File

@@ -111,6 +111,10 @@ const arg = 'something';
const msg1 = typeof arg === 'string' ? arg : `arg = ${arg}`;
```
## When Not To Use It
If you're not worried about incorrectly stringifying non-string values in template literals, then you likely don't need this rule.
## Related To
- [`no-base-to-string`](./no-base-to-string.md)

Some files were not shown because too many files have changed in this diff Show More