Update checked-in dependencies
This commit is contained in:
parent
79817eb679
commit
9c3b394d7f
402 changed files with 12598 additions and 2912 deletions
2
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
|
|
@ -52,6 +52,8 @@ module.exports = {
|
|||
'@typescript-eslint/lines-around-comment': 'error',
|
||||
'lines-between-class-members': 'off',
|
||||
'@typescript-eslint/lines-between-class-members': 'error',
|
||||
'max-params': 'off',
|
||||
'@typescript-eslint/max-params': 'error',
|
||||
'@typescript-eslint/member-delimiter-style': 'error',
|
||||
'@typescript-eslint/member-ordering': 'error',
|
||||
'@typescript-eslint/method-signature-style': 'error',
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../src/configs/all.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,mDAAmD;AACnD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAEtD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,+BAA+B,EAAE,OAAO;QACxC,mCAAmC,EAAE,OAAO;QAC5C,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,8BAA8B,EAAE,OAAO;QACvC,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,aAAa,EAAE,KAAK;QACpB,gCAAgC,EAAE,OAAO;QACzC,iDAAiD,EAAE,OAAO;QAC1D,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,cAAc,EAAE,KAAK;QACrB,iCAAiC,EAAE,OAAO;QAC1C,eAAe,EAAE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E,KAAK;QACb,2BAA2B,EAAE,OAAO;QACpC,+CAA+C,EAAE,OAAO;QACxD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE,OAAO;QAC1C,IAAI,EAAE,KAAK;QACX,yBAAyB,EAAE,OAAO;QAClC,2CAA2C,EAAE,OAAO;QACpD,qBAAqB,EAAE,KAAK;QAC5B,wCAAwC,EAAE,OAAO;QACjD,6BAA6B,EAAE,KAAK;QACpC,gDAAgD,EAAE,OAAO;QACzD,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,2CAA2C,EAAE,OAAO;QACpD,4CAA4C,EAAE,OAAO;QACrD,4BAA4B,EAAE,OAAO;QACrC,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;KACjD;CACF,CAAC"}
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
|
|
@ -23,7 +23,7 @@ exports.default = (0, util_1.createRule)({
|
|||
* @private
|
||||
*/
|
||||
function isOptionalParam(node) {
|
||||
return 'optional' in node && node.optional === true;
|
||||
return 'optional' in node && node.optional;
|
||||
}
|
||||
/**
|
||||
* checks if node is plain parameter
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"default-param-last.js","sourceRoot":"","sources":["../../src/rules/default-param-last.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAqC;AAErC,kBAAe,IAAA,iBAA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AAiB,CAAC,EAClD;oBACA,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;iBAC9D;aACF;QACH,CAAC;QAED,OAAO;YACL,uBAAuB,EAAE,qBAAqB;YAC9C,mBAAmB,EAAE,qBAAqB;YAC1C,kBAAkB,EAAE,qBAAqB;SAC1C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"default-param-last.js","sourceRoot":"","sources":["../../src/rules/default-param-last.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAqC;AAErC,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;YACpD,eAAe,EAAE,IAAI;SACtB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,YAAY,EAAE,oCAAoC;SACnD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ;;;;WAIG;QACH,SAAS,eAAe,CAAC,IAAwB;YAC/C,OAAO,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC;QAC7C,CAAC;QAED;;;;WAIG;QACH,SAAS,YAAY,CAAC,IAAwB;YAC5C,OAAO,CAAC,CACN,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,iBAAiB;gBAC9C,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,WAAW;gBACxC,eAAe,CAAC,IAAI,CAAC,CACtB,CAAC;QACJ,CAAC;QAED,SAAS,qBAAqB,CAC5B,IAG+B;YAE/B,IAAI,iBAAiB,GAAG,KAAK,CAAC;YAC9B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;gBAChD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC/B,MAAM,KAAK,GACT,OAAO,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;oBACjD,CAAC,CAAC,OAAO,CAAC,SAAS;oBACnB,CAAC,CAAC,OAAO,CAAC;gBAEd,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;oBACvB,iBAAiB,GAAG,IAAI,CAAC;oBACzB,SAAS;iBACV;gBAED,IACE,iBAAiB;oBACjB,CAAC,eAAe,CAAC,KAAK,CAAC;wBACrB,KAAK,CAAC,IAAI,KAAK,sBAAc,CAAC,iBAAiB,CAAC,EAClD;oBACA,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;iBAC9D;aACF;QACH,CAAC;QAED,OAAO;YACL,uBAAuB,EAAE,qBAAqB;YAC9C,mBAAmB,EAAE,qBAAqB;YAC1C,kBAAkB,EAAE,qBAAqB;SAC1C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
61
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
61
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
|
|
@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEnumTypes = void 0;
|
||||
exports.getEnumKeyForLiteral = exports.getEnumTypes = exports.getEnumLiterals = void 0;
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../../util");
|
||||
|
|
@ -42,6 +42,21 @@ function getBaseEnumType(typeChecker, type) {
|
|||
}
|
||||
return typeChecker.getTypeAtLocation(symbol.valueDeclaration.parent);
|
||||
}
|
||||
/**
|
||||
* Retrieve only the Enum literals from a type. for example:
|
||||
* - 123 --> []
|
||||
* - {} --> []
|
||||
* - Fruit.Apple --> [Fruit.Apple]
|
||||
* - Fruit.Apple | Vegetable.Lettuce --> [Fruit.Apple, Vegetable.Lettuce]
|
||||
* - Fruit.Apple | Vegetable.Lettuce | 123 --> [Fruit.Apple, Vegetable.Lettuce]
|
||||
* - T extends Fruit --> [Fruit]
|
||||
*/
|
||||
function getEnumLiterals(type) {
|
||||
return tsutils
|
||||
.unionTypeParts(type)
|
||||
.filter((subType) => (0, util_1.isTypeFlagSet)(subType, ts.TypeFlags.EnumLiteral));
|
||||
}
|
||||
exports.getEnumLiterals = getEnumLiterals;
|
||||
/**
|
||||
* A type can have 0 or more enum types. For example:
|
||||
* - 123 --> []
|
||||
|
|
@ -52,10 +67,46 @@ function getBaseEnumType(typeChecker, type) {
|
|||
* - T extends Fruit --> [Fruit]
|
||||
*/
|
||||
function getEnumTypes(typeChecker, type) {
|
||||
return tsutils
|
||||
.unionTypeParts(type)
|
||||
.filter(subType => (0, util_1.isTypeFlagSet)(subType, ts.TypeFlags.EnumLiteral))
|
||||
.map(type => getBaseEnumType(typeChecker, type));
|
||||
return getEnumLiterals(type).map(type => getBaseEnumType(typeChecker, type));
|
||||
}
|
||||
exports.getEnumTypes = getEnumTypes;
|
||||
/**
|
||||
* Returns the enum key that matches the given literal node, or null if none
|
||||
* match. For example:
|
||||
* ```ts
|
||||
* enum Fruit {
|
||||
* Apple = 'apple',
|
||||
* Banana = 'banana',
|
||||
* }
|
||||
*
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'apple') --> 'Fruit.Apple'
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'banana') --> 'Fruit.Banana'
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'cherry') --> null
|
||||
* ```
|
||||
*/
|
||||
function getEnumKeyForLiteral(enumLiterals, literal) {
|
||||
for (const enumLiteral of enumLiterals) {
|
||||
if (enumLiteral.value === literal) {
|
||||
const { symbol } = enumLiteral;
|
||||
const memberDeclaration = symbol.valueDeclaration;
|
||||
const enumDeclaration = memberDeclaration.parent;
|
||||
const memberNameIdentifier = memberDeclaration.name;
|
||||
const enumName = enumDeclaration.name.text;
|
||||
switch (memberNameIdentifier.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return `${enumName}.${memberNameIdentifier.text}`;
|
||||
case ts.SyntaxKind.StringLiteral: {
|
||||
const memberName = memberNameIdentifier.text.replace(/'/g, "\\'");
|
||||
return `${enumName}['${memberName}']`;
|
||||
}
|
||||
case ts.SyntaxKind.ComputedPropertyName:
|
||||
return `${enumName}[${memberNameIdentifier.expression.getText()}]`;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.getEnumKeyForLiteral = getEnumKeyForLiteral;
|
||||
//# sourceMappingURL=shared.js.map
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/rules/enum-utils/shared.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,+CAAiC;AAEjC,qCAA2C;AAE3C;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,WAA2B,EAAE,IAAa;IACjE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAG,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,gBAAiB,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1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;AAC/E,CAAC;AALD,oCAKC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,oBAAoB,CAClC,YAA8B,EAC9B,OAAgB;IAEhB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACtC,IAAI,WAAW,CAAC,KAAK,KAAK,OAAO,EAAE;YACjC,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;YAE/B,MAAM,iBAAiB,GAAG,MAAM,CAAC,gBAAiC,CAAC;YACnE,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC;YAEjD,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC;YACpD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;YAE3C,QAAQ,oBAAoB,CAAC,IAAI,EAAE;gBACjC,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU;oBAC3B,OAAO,GAAG,QAAQ,IAAI,oBAAoB,CAAC,IAAI,EAAE,CAAC;gBAEpD,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;oBAChC,MAAM,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;oBAElE,OAAO,GAAG,QAAQ,KAAK,UAAU,IAAI,CAAC;iBACvC;gBAED,KAAK,EAAE,CAAC,UAAU,CAAC,oBAAoB;oBACrC,OAAO,GAAG,QAAQ,IAAI,oBAAoB,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC;gBAErE;oBACE,MAAM;aACT;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAlCD,oDAkCC"}
|
||||
|
|
@ -100,7 +100,7 @@ exports.default = (0, util_1.createRule)({
|
|||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.Property: {
|
||||
if (parent.key.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
parent.computed === false) {
|
||||
!parent.computed) {
|
||||
funcName = parent.key.name;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"explicit-function-return-type.js","sourceRoot":"","sources":["../../src/rules/explicit-function-return-type.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAqC;AACrC,6EAIyC;AAgBzC,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8DAA8D;SACjE;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,kCAAkC;SACtD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,oDAAoD,EAAE;wBACpD,WAAW,EACT,sEAAsE;wBACxE,IAAI,EAAE,SAAS;qBAChB;oBACD,gBAAgB,EAAE;wBAChB,WAAW,EACT,yFAAyF;wBAC3F,IAAI,EAAE,SAAS;qBAChB;oBACD,yBAAyB,EAAE;wBACzB,WAAW,EACT,gFAAgF;wBAClF,IAAI,EAAE,SAAS;qBAChB;oBACD,6BAA6B,EAAE;wBAC7B,WAAW,EACT,6EAA6E;wBAC/E,IAAI,EAAE,SAAS;qBAChB;oBACD,yCAAyC,EAAE;wBACzC,WAAW,EACT,6EAA6E;wBAC/E,IAAI,EAAE,SAAS;qBAChB;oBACD,mCAAmC,EAAE;wBACnC,WAAW,EACT,sEAAsE;wBACxE,IAAI,EAAE,SAAS;qBAChB;oBACD,YAAY,EAAE;wBACZ,WAAW,EACT,gGAAgG;wBAClG,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;wBACD,IAAI,EAAE,OAAO;qBACd;oBACD,UAAU,EAAE;wBACV,WAAW,EACT,qEAAqE;wBACvE,IAAI,EAAE,SAAS;qBAChB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;IACD,cAAc,EAAE;QACd;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ED,IACE,OAAO,CAAC,6BAA6B;oBACrC,CAAC,IAAA,6DAAmC,EAAC,IAAI,EAAE,OAAO,CAAC;wBACjD,IAAA,+CAAqB,EAAC,IAAI,CAAC,CAAC,EAC9B;oBACA,OAAO;iBACR;gBAED,IAAA,iDAAuB,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CACvD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,GAAG;oBACH,SAAS,EAAE,mBAAmB;iBAC/B,CAAC,CACH,CAAC;YACJ,CAAC;YACD,mBAAmB,CAAC,IAAI;gBACtB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE;oBAC3B,OAAO;iBACR;gBACD,IAAI,OAAO,CAAC,6BAA6B,IAAI,IAAI,CAAC,UAAU,EAAE;oBAC5D,OAAO;iBACR;gBAED,IAAA,iDAAuB,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CACvD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,GAAG;oBACH,SAAS,EAAE,mBAAmB;iBAC/B,CAAC,CACH,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"explicit-function-return-type.js","sourceRoot":"","sources":["../../src/rules/explicit-function-return-type.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAqC;AACrC,6EAIyC;AAgBzC,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8DAA8D;SACjE;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,kCAAkC;SACtD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,oDAAoD,EAAE;wBACpD,WAAW,EACT,sEAAsE;wBACxE,IAA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iDAAuB,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CACvD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,GAAG;oBACH,SAAS,EAAE,mBAAmB;iBAC/B,CAAC,CACH,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
|
|
@ -33,6 +33,7 @@ const key_spacing_1 = __importDefault(require("./key-spacing"));
|
|||
const keyword_spacing_1 = __importDefault(require("./keyword-spacing"));
|
||||
const lines_around_comment_1 = __importDefault(require("./lines-around-comment"));
|
||||
const lines_between_class_members_1 = __importDefault(require("./lines-between-class-members"));
|
||||
const max_params_1 = __importDefault(require("./max-params"));
|
||||
const member_delimiter_style_1 = __importDefault(require("./member-delimiter-style"));
|
||||
const member_ordering_1 = __importDefault(require("./member-ordering"));
|
||||
const method_signature_style_1 = __importDefault(require("./method-signature-style"));
|
||||
|
|
@ -168,6 +169,7 @@ exports.default = {
|
|||
'keyword-spacing': keyword_spacing_1.default,
|
||||
'lines-around-comment': lines_around_comment_1.default,
|
||||
'lines-between-class-members': lines_between_class_members_1.default,
|
||||
'max-params': max_params_1.default,
|
||||
'member-delimiter-style': member_delimiter_style_1.default,
|
||||
'member-ordering': member_ordering_1.default,
|
||||
'method-signature-style': method_signature_style_1.default,
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
67
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js
generated
vendored
Normal file
67
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('max-params');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'max-params',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce a maximum number of parameters in function definitions',
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
maximum: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
max: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
countVoidThis: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: [{ max: 3, countVoidThis: false }],
|
||||
create(context, [{ countVoidThis }]) {
|
||||
const baseRules = baseRule.create(context);
|
||||
if (countVoidThis === true) {
|
||||
return baseRules;
|
||||
}
|
||||
const removeVoidThisParam = (node) => {
|
||||
if (node.params.length === 0 ||
|
||||
node.params[0].type !== utils_1.AST_NODE_TYPES.Identifier ||
|
||||
node.params[0].name !== 'this' ||
|
||||
node.params[0].typeAnnotation?.typeAnnotation.type !==
|
||||
utils_1.AST_NODE_TYPES.TSVoidKeyword) {
|
||||
return node;
|
||||
}
|
||||
return {
|
||||
...node,
|
||||
params: node.params.slice(1),
|
||||
};
|
||||
};
|
||||
const wrapListener = (listener) => {
|
||||
return (node) => {
|
||||
listener(removeVoidThisParam(node));
|
||||
};
|
||||
};
|
||||
return {
|
||||
ArrowFunctionExpression: wrapListener(baseRules.ArrowFunctionExpression),
|
||||
FunctionDeclaration: wrapListener(baseRules.FunctionDeclaration),
|
||||
FunctionExpression: wrapListener(baseRules.FunctionExpression),
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=max-params.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"max-params.js","sourceRoot":"","sources":["../../src/rules/max-params.ts"],"names":[],"mappings":";;AAAA,oDAAyE;AAMzE,kCAAqC;AACrC,iEAA8D;AAS9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,YAAY,CAAC,CAAC;AAKjD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,eAAe,EAAE,IAAI;SACtB;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,CAAC;qBACX;oBACD,GAAG,EAAE;wBACH,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,CAAC;qBACX;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,SAAS;qBAChB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;KACjC;IACD,cAAc,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAElD,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,aAAa,KAAK,IAAI,EAAE;YAC1B,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,mBAAmB,GAAG,CAAyB,IAAO,EAAK,EAAE;YACjE,IACE,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;gBACxB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;gBACjD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM;gBAC9B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,IAAI;oBAChD,sBAAc,CAAC,aAAa,EAC9B;gBACA,OAAO,IAAI,CAAC;aACb;YAED,OAAO;gBACL,GAAG,IAAI;gBACP,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aAC7B,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,YAAY,GAAG,CACnB,QAAiC,EACR,EAAE;YAC3B,OAAO,CAAC,IAAO,EAAQ,EAAE;gBACvB,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO;YACL,uBAAuB,EAAE,YAAY,CAAC,SAAS,CAAC,uBAAuB,CAAC;YACxE,mBAAmB,EAAE,YAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC;YAChE,kBAAkB,EAAE,YAAY,CAAC,SAAS,CAAC,kBAAkB,CAAC;SAC/D,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
|
|
@ -42,15 +42,19 @@ var Selectors;
|
|||
Selectors[Selectors["typeAlias"] = 16384] = "typeAlias";
|
||||
Selectors[Selectors["enum"] = 32768] = "enum";
|
||||
Selectors[Selectors["typeParameter"] = 131072] = "typeParameter";
|
||||
// other
|
||||
Selectors[Selectors["import"] = 262144] = "import";
|
||||
})(Selectors || (exports.Selectors = Selectors = {}));
|
||||
var MetaSelectors;
|
||||
(function (MetaSelectors) {
|
||||
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
|
||||
MetaSelectors[MetaSelectors["default"] = -1] = "default";
|
||||
MetaSelectors[MetaSelectors["variableLike"] = 7] = "variableLike";
|
||||
MetaSelectors[MetaSelectors["memberLike"] = 4088] = "memberLike";
|
||||
MetaSelectors[MetaSelectors["typeLike"] = 192512] = "typeLike";
|
||||
MetaSelectors[MetaSelectors["method"] = 448] = "method";
|
||||
MetaSelectors[MetaSelectors["property"] = 3584] = "property";
|
||||
/* eslint-enable @typescript-eslint/prefer-literal-enum-member */
|
||||
})(MetaSelectors || (exports.MetaSelectors = MetaSelectors = {}));
|
||||
var Modifiers;
|
||||
(function (Modifiers) {
|
||||
|
|
@ -80,14 +84,18 @@ var Modifiers;
|
|||
Modifiers[Modifiers["override"] = 8192] = "override";
|
||||
// class methods, object function properties, or functions that are async via the `async` keyword
|
||||
Modifiers[Modifiers["async"] = 16384] = "async";
|
||||
// default imports
|
||||
Modifiers[Modifiers["default"] = 32768] = "default";
|
||||
// namespace imports
|
||||
Modifiers[Modifiers["namespace"] = 65536] = "namespace";
|
||||
// make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work
|
||||
})(Modifiers || (exports.Modifiers = Modifiers = {}));
|
||||
var TypeModifiers;
|
||||
(function (TypeModifiers) {
|
||||
TypeModifiers[TypeModifiers["boolean"] = 32768] = "boolean";
|
||||
TypeModifiers[TypeModifiers["string"] = 65536] = "string";
|
||||
TypeModifiers[TypeModifiers["number"] = 131072] = "number";
|
||||
TypeModifiers[TypeModifiers["function"] = 262144] = "function";
|
||||
TypeModifiers[TypeModifiers["array"] = 524288] = "array";
|
||||
TypeModifiers[TypeModifiers["boolean"] = 131072] = "boolean";
|
||||
TypeModifiers[TypeModifiers["string"] = 262144] = "string";
|
||||
TypeModifiers[TypeModifiers["number"] = 524288] = "number";
|
||||
TypeModifiers[TypeModifiers["function"] = 1048576] = "function";
|
||||
TypeModifiers[TypeModifiers["array"] = 2097152] = "array";
|
||||
})(TypeModifiers || (exports.TypeModifiers = TypeModifiers = {}));
|
||||
//# sourceMappingURL=enums.js.map
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/enums.ts"],"names":[],"mappings":";;;AAAA,IAAK,iBAOJ;AAPD,WAAK,iBAAiB;IACpB,mEAAa,CAAA;IACb,+EAAe,CAAA;IACf,qEAAU,CAAA;IACV,iFAAgB,CAAA;IAChB,qEAAU,CAAA;IACV,qEAAU,CAAA;AACZ,CAAC,EAPI,iBAAiB,iCAAjB,iBAAiB,QAOrB;AAGD,IAAK,iBASJ;AATD,WAAK,iBAAiB;IACpB,6DAAU,CAAA;IACV,2DAAK,CAAA;IACL,+DAAO,CAAA;IAEP,iEAAiE;IACjE,2EAAa,CAAA;IACb,uEAAW,CAAA;IACX,uFAAmB,CAAA;AACrB,CAAC,EATI,iBAAiB,iCAAjB,iBAAiB,QASrB;AAGD,IAAK,SAuBJ;AAvBD,WAAK,SAAS;IACZ,eAAe;IACf,iDAAiB,CAAA;IACjB,iDAAiB,CAAA;IACjB,mDAAkB,CAAA;IAElB,aAAa;IACb,mEAA0B,CAAA;IAC1B,kDAAiB,CAAA;IACjB,sDAAmB,CAAA;IACnB,wDAAoB,CAAA;IACpB,yEAA4B,CAAA;IAC5B,uDAAmB,CAAA;IACnB,6DAAsB,CAAA;IACtB,8EAA+B,CAAA;IAC/B,4DAAsB,CAAA;IAEtB,WAAW;IACX,8CAAe,CAAA;IACf,sDAAmB,CAAA;IACnB,uDAAmB,CAAA;IACnB,6CAAc,CAAA;IACd,gEAAuB,CAAA;AACzB,CAAC,EAvBI,SAAS,yBAAT,SAAS,QAuBb;AAGD,IAAK,aA8BJ;AA9BD,WAAK,aAAa;IAChB,wDAAY,CAAA;IACZ,iEAGqB,CAAA;IACrB,gEASoB,CAAA;IACpB,8DAKyB,CAAA;IACzB,uDAGsB,CAAA;IACtB,4DAGwB,CAAA;AAC1B,CAAC,EA9BI,aAAa,6BAAb,aAAa,QA8BjB;AAID,IAAK,SA6BJ;AA7BD,WAAK,SAAS;IACZ,iBAAiB;IACjB,2CAAc,CAAA;IACd,mBAAmB;IACnB,iDAAiB,CAAA;IACjB,iBAAiB;IACjB,6CAAe,CAAA;IACf,uBAAuB;IACvB,6CAAe,CAAA;IACf,oDAAkB,CAAA;IAClB,gDAAgB,CAAA;IAChB,kDAAmB,CAAA;IACnB,mDAAiB,CAAA;IACjB,wBAAwB;IACxB,2DAAqB,CAAA;IACrB,4CAA4C;IAC5C,+CAAe,CAAA;IACf,2BAA2B;IAC3B,oDAAkB,CAAA;IAClB,yBAAyB;IACzB,gDAAgB,CAAA;IAChB,kCAAkC;IAClC,gEAAwB,CAAA;IACxB,oCAAoC;IACpC,oDAAkB,CAAA;IAClB,iGAAiG;IACjG,+CAAe,CAAA;IAEf,6EAA6E;AAC/E,CAAC,EA7BI,SAAS,yBAAT,SAAS,QA6Bb;AAGD,IAAK,aAMJ;AAND,WAAK,aAAa;IAChB,2DAAiB,CAAA;IACjB,yDAAgB,CAAA;IAChB,0DAAgB,CAAA;IAChB,8DAAkB,CAAA;IAClB,wDAAe,CAAA;AACjB,CAAC,EANI,aAAa,6BAAb,aAAa,QAMjB"}
|
||||
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/enums.ts"],"names":[],"mappings":";;;AAAA,IAAK,iBAOJ;AAPD,WAAK,iBAAiB;IACpB,mEAAa,CAAA;IACb,+EAAe,CAAA;IACf,qEAAU,CAAA;IACV,iFAAgB,CAAA;IAChB,qEAAU,CAAA;IACV,qEAAU,CAAA;AACZ,CAAC,EAPI,iBAAiB,iCAAjB,iBAAiB,QAOrB;AAGD,IAAK,iBASJ;AATD,WAAK,iBAAiB;IACpB,6DAAU,CAAA;IACV,2DAAK,CAAA;IACL,+DAAO,CAAA;IAEP,iEAAiE;IACjE,2EAAa,CAAA;IACb,uEAAW,CAAA;IACX,uFAAmB,CAAA;AACrB,CAAC,EATI,iBAAiB,iCAAjB,iBAAiB,QASrB;AAGD,IAAK,S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IAClB,mDAAiB,CAAA;IACjB,oBAAoB;IACpB,uDAAmB,CAAA;IAEnB,6EAA6E;AAC/E,CAAC,EAjCI,SAAS,yBAAT,SAAS,QAiCb;AAGD,IAAK,aAMJ;AAND,WAAK,aAAa;IAChB,4DAAiB,CAAA;IACjB,0DAAgB,CAAA;IAChB,0DAAgB,CAAA;IAChB,+DAAkB,CAAA;IAClB,yDAAe,CAAA;AACjB,CAAC,EANI,aAAa,6BAAb,aAAa,QAMjB"}
|
||||
|
|
@ -67,6 +67,7 @@ function parseOptions(context) {
|
|||
const result = (0, util_1.getEnumNames)(enums_1.Selectors).reduce((acc, k) => {
|
||||
acc[k] = (0, validator_1.createValidator)(k, context, normalizedOptions);
|
||||
return acc;
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter
|
||||
}, {});
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"parse-options.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/parse-options.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,mCAOiB;AACjB,qCAA0C;AAO1C,2CAA8C;AAE9C,SAAS,eAAe,CAAC,MAAgB;IACvC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9B,MAAM,IAAI,iBAAS,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC1B,MAAM,IAAI,qBAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,sDAAsD;IACtD,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;KACnB;IAED,MAAM,gBAAgB,GAAG;QACvB,iBAAiB;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,CA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AAA,2BAAe,EAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAmB,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC;AAEQ,oCAAY"}
|
||||
{"version":3,"file":"parse-options.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/parse-options.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,mCAOiB;AACjB,qCAA0C;AAO1C,2CAA8C;AAE9C,SAAS,eAAe,CAAC,MAAgB;IACvC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9B,MAAM,IAAI,iBAAS,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC1B,MAAM,IAAI,qBAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,sDAAsD;IACtD,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;KACnB;IAED,MAAM,gBAAgB,GAAG;QACvB,iBAAiB;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,yBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3E,MAAM,EAAE,MAAM,CAAC,MAAM;YACnB,CAAC,CAAC;gBACE,KAAK,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;gBAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;aAC3B;YACH,CAAC,CAAC,IAAI;QACR,iBAAiB,EACf,MAAM,CAAC,iBAAiB,K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AM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC9C,CAAC,CAAC,MAAM,CAAC,QAAQ;QACjB,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEtB,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChC,QAAQ,EAAE,IAAA,uBAAc,EAAC,QAAQ,CAAC;YAChC,CAAC,CAAC,qBAAa,CAAC,QAAQ,CAAC;YACzB,CAAC,CAAC,iBAAS,CAAC,QAAQ,CAAC;QACvB,GAAG,gBAAgB;KACpB,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB;IACpC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO;SACtC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;SAChC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAE7C,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC,iBAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACvD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAA,2BAAe,EAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;QACX,2EAA2E;IAC7E,CAAC,EAAE,EAAmB,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC;AAEQ,oCAAY"}
|
||||
|
|
@ -282,6 +282,7 @@ const SCHEMA = {
|
|||
...selectorSchema('typeAlias', false, ['exported', 'unused']),
|
||||
...selectorSchema('enum', false, ['exported', 'unused']),
|
||||
...selectorSchema('typeParameter', false, ['unused']),
|
||||
...selectorSchema('import', false, ['default', 'namespace']),
|
||||
],
|
||||
},
|
||||
additionalItems: false,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
24
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js
generated
vendored
24
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js
generated
vendored
|
|
@ -132,6 +132,30 @@ exports.default = (0, util_1.createRule)({
|
|||
id.parent.init.async)));
|
||||
}
|
||||
const selectors = {
|
||||
// #region import
|
||||
'ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier': {
|
||||
validator: validators.import,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.ImportDefaultSpecifier:
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.default);
|
||||
break;
|
||||
case utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier:
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.namespace);
|
||||
break;
|
||||
case utils_1.AST_NODE_TYPES.ImportSpecifier:
|
||||
// Handle `import { default as Foo }`
|
||||
if (node.imported.name !== 'default') {
|
||||
return;
|
||||
}
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.default);
|
||||
break;
|
||||
}
|
||||
validator(node.local, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion
|
||||
// #region variable
|
||||
VariableDeclarator: {
|
||||
validator: validators.variable,
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map
generated
vendored
File diff suppressed because one or more lines are too long
14
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-confusing-void-expression.js
generated
vendored
14
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-confusing-void-expression.js
generated
vendored
|
|
@ -104,6 +104,9 @@ exports.default = (0, util_1.createRule)({
|
|||
node,
|
||||
messageId: 'invalidVoidExprArrow',
|
||||
fix(fixer) {
|
||||
if (!canFix(arrowFunction)) {
|
||||
return null;
|
||||
}
|
||||
const arrowBody = arrowFunction.body;
|
||||
const arrowBodyText = sourceCode.getText(arrowBody);
|
||||
const newArrowBodyText = `{ ${arrowBodyText}; }`;
|
||||
|
|
@ -133,6 +136,9 @@ exports.default = (0, util_1.createRule)({
|
|||
node,
|
||||
messageId: 'invalidVoidExprReturnLast',
|
||||
fix(fixer) {
|
||||
if (!canFix(returnStmt)) {
|
||||
return null;
|
||||
}
|
||||
const returnValue = returnStmt.argument;
|
||||
const returnValueText = sourceCode.getText(returnValue);
|
||||
let newReturnStmtText = `${returnValueText};`;
|
||||
|
|
@ -273,6 +279,14 @@ exports.default = (0, util_1.createRule)({
|
|||
const startToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('first token', node.type));
|
||||
return ['(', '[', '`'].includes(startToken.value);
|
||||
}
|
||||
function canFix(node) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const targetNode = node.type === utils_1.AST_NODE_TYPES.ReturnStatement
|
||||
? node.argument
|
||||
: node.body;
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, targetNode);
|
||||
return tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike);
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=no-confusing-void-expression.js.map
|
||||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-function.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-function.js
generated
vendored
|
|
@ -114,7 +114,7 @@ exports.default = (0, util_1.createRule)({
|
|||
return (isAllowedOverrideMethods &&
|
||||
isBodyEmpty(node) &&
|
||||
node.parent?.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
node.parent.override === true);
|
||||
node.parent.override);
|
||||
}
|
||||
return {
|
||||
...rules,
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-function.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-function.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"no-empty-function.js","sourceRoot":"","sources":["../../src/rules/no-empty-function.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAO1D,kCAAgD;AAChD,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,mBAAmB,CAAC,CAAC;AAKxD,MAAM,MAAM,GAAG,IAAA,gBAAS;AACtB,yHAAyH;AACzH,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IACjC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EACxB;IACE,UAAU,EAAE;QACV,KAAK,EAAE;YACL,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,WAAW;oBACX,gBAAgB;oBAChB,oBAAoB;oBACpB,SAAS;oBACT,kBAAkB;oBAClB,SAAS;oBACT,SAAS;oBACT,cAAc;oBACd,sBAAsB;oBACtB,wBAAwB;oBACxB,gBAAgB;oBAChB,cAAc;oBACd,oBAAoB;oBACpB,iBAAiB;iBAClB;aACF;SACF;KACF;CACF,CACwB,CAAC;AAE5B,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,0BAA0B;YACvC,WAAW,EAAE,WAAW;YACxB,eAAe,EAAE,IAAI;SACtB;QACD,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc;QAC5C,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;KACjC;IACD,cAAc,EAAE;QACd;YACE,KAAK,EAAE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oBAC7D,qDAAqD;oBACrD,sBAAsB,CAAC,IAAI,CAAC,CAC7B,CAAC;aACH;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAED;;;;WAIG;QACH,SAAS,gCAAgC,CACvC,IAAgE;YAEhE,IAAI,2BAA2B,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;gBACpD,MAAM,UAAU,GACd,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,sBAAc,CAAC,gBAAgB;oBACnD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;oBACxB,CAAC,CAAC,SAAS,CAAC;gBAChB,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;aAC5C;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAED,SAAS,4BAA4B,CACnC,IAAiC;YAEjC,OAAO,CACL,wBAAwB;gBACxB,WAAW,CAAC,IAAI,CAAC;gBACjB,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,sBAAc,CAAC,gBAAgB;gBACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAC9B,CAAC;QACJ,CAAC;QAED,OAAO;YACL,GAAG,KAAK;YACR,kBAAkB,CAAC,IAAI;gBACrB,IACE,yBAAyB,CAAC,IAAI,CAAC;oBAC/B,gCAAgC,CAAC,IAAI,CAAC;oBACtC,4BAA4B,CAAC,IAAI,CAAC,EAClC;oBACA,OAAO;iBACR;gBAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"no-empty-function.js","sourceRoot":"","sources":["../../src/rules/no-empty-function.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAO1D,kCAAgD;AAChD,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,mBAAmB,CAAC,CAAC;AAKxD,MAAM,MAAM,GAAG,IAAA,gBAAS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,CAAC,MAAM,CAAC,UAAU;oBACxB,CAAC,CAAC,SAAS,CAAC;gBAChB,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;aAC5C;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAED,SAAS,4BAA4B,CACnC,IAAiC;YAEjC,OAAO,CACL,wBAAwB;gBACxB,WAAW,CAAC,IAAI,CAAC;gBACjB,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,sBAAc,CAAC,gBAAgB;gBACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CACrB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,GAAG,KAAK;YACR,kBAAkB,CAAC,IAAI;gBACrB,IACE,yBAAyB,CAAC,IAAI,CAAC;oBAC/B,gCAAgC,CAAC,IAAI,CAAC;oBACtC,4BAA4B,CAAC,IAAI,CAAC,EAClC;oBACA,OAAO;iBACR;gBAED,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js
generated
vendored
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js
generated
vendored
|
|
@ -39,8 +39,7 @@ exports.default = (0, util_1.createRule)({
|
|||
create(context, [{ allowDeclarations, allowDefinitionFiles }]) {
|
||||
const filename = context.getFilename();
|
||||
function isDeclaration(node) {
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
|
||||
node.declare === true) {
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration && node.declare) {
|
||||
return true;
|
||||
}
|
||||
return node.parent != null && isDeclaration(node.parent);
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"no-namespace.js","sourceRoot":"","sources":["../../src/rules/no-namespace.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAuD;AAUvD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,gCAAgC;YAC7C,WAAW,EAAE,aAAa;SAC3B;QACD,QAAQ,EAAE;YACR,uBAAuB,EACrB,oDAAoD;SACvD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,iBAAiB,EAAE;wBACjB,WAAW,EACT,+DAA+D;wBACjE,IAAI,EAAE,SAAS;qBAChB;oBACD,oBAAoB,EAAE;wBACpB,WAAW,EACT,uFAAuF;wBACzF,IAAI,EAAE,SAAS;qBAChB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;IACD,cAAc,EAAE;QACd;YACE,iBAAiB,EAAE,KAAK;YACxB,oBAAoB,EAAE,IAAI;SAC3B;KACF;IACD,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAEvC,SAAS,aAAa,CAAC,IAAmB;YACxC,IACE,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;gBAChD,IAAI,CAAC,OAAO,KAAK,IAAI,EACrB;gBACA,OAAO,IAAI,CAAC;aACb;YAED,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,uDAAuD,CACrD,IAAkC;gBAElC,IACE,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;oBACvD,CAAC,oBAAoB,IAAI,IAAA,uBAAgB,EAAC,QAAQ,CAAC,CAAC;oBACpD,CAAC,iBAAiB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,EAC1C;oBACA,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,yBAAyB;iBACrC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"no-namespace.js","sourceRoot":"","sources":["../../src/rules/no-namespace.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAuD;AAUvD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,gCAAgC;YAC7C,WAAW,EAAE,aAAa;SAC3B;QACD,QAAQ,EAAE;YACR,uBAAuB,EACrB,oDAAoD;SACvD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,iBAAiB,EAAE;wBACjB,WAAW,EACT,+DAA+D;wBACjE,IAAI,EAAE,SAAS;qBAChB;oBACD,oBAAoB,EAAE;wBACpB,WAAW,EACT,uFAAuF;wBACzF,IAAI,EAAE,SAAS;qBAChB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;IACD,cAAc,EAAE;QACd;YACE,iBAAiB,EAAE,KAAK;YACxB,oBAAoB,EAAE,IAAI;SAC3B;KACF;IACD,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAEvC,SAAS,aAAa,CAAC,IAAmB;YACxC,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB,IAAI,IAAI,CAAC,OAAO,EAAE;gBACpE,OAAO,IAAI,CAAC;aACb;YAED,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,uDAAuD,CACrD,IAAkC;gBAElC,IACE,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;oBACvD,CAAC,oBAAoB,IAAI,IAAA,uBAAgB,EAAC,QAAQ,CAAC,CAAC;oBACpD,CAAC,iBAAiB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,EAC1C;oBACA,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,yBAAyB;iBACrC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
|
|
@ -12,7 +12,7 @@ function isDefinitionWithAssignment(definition) {
|
|||
return false;
|
||||
}
|
||||
const variableDeclarator = definition.node;
|
||||
return (variableDeclarator.definite === true || variableDeclarator.init != null);
|
||||
return variableDeclarator.definite || variableDeclarator.init != null;
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-non-null-asserted-nullish-coalescing',
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"no-non-null-asserted-nullish-coalescing.js","sourceRoot":"","sources":["../../src/rules/no-non-null-asserted-nullish-coalescing.ts"],"names":[],"mappings":";;AACA,oEAAkE;AAElE,oDAA8D;AAE9D,kCAAoE;AAEpE,SAAS,uBAAuB,CAC9B,QAAiC,EACjC,IAAmB;IAEnB,OAAO,CACL,QAAQ,CAAC,UAAU,CAAC,IAAI,CACtB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAChE;QACD,QAAQ,CAAC,IAAI,CAAC,I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EAAE;wBACxD,OAAO;qBACR;iBACF;gBAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;gBAE3C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,oCAAoC;oBAC/C;;;;;;;;;;;;sBAYE;oBACF,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,wBAAwB;4BACnC,GAAG,CAAC,KAAK;gCACP,MAAM,eAAe,GAAG,IAAA,iBAAU,EAChC,UAAU,CAAC,YAAY,CACrB,IAAI,EACJ,gBAAQ,CAAC,4BAA4B,CACtC,EACD,wBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAC1D,CAAC;gCACF,OAAO,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;4BACvC,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"no-non-null-asserted-nullish-coalescing.js","sourceRoot":"","sources":["../../src/rules/no-non-null-asserted-nullish-coalescing.ts"],"names":[],"mappings":";;AACA,oEAAkE;AAElE,oDAA8D;AAE9D,kCAAoE;AAEpE,SAAS,uBAAuB,CAC9B,QAAiC,EACjC,IAAmB;IAEnB,OAAO,CACL,QAAQ,CAAC,UAAU,CAAC,IAAI,CACtB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAChE;QACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAChB,GAAG,CAAC,EAAE,CACJ,0BAA0B,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACvE,CACF,CAAC;AACJ,CAAC;AAED,SAAS,0BA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AAE,wBAAwB;4BACnC,GAAG,CAAC,KAAK;gCACP,MAAM,eAAe,GAAG,IAAA,iBAAU,EAChC,UAAU,CAAC,YAAY,CACrB,IAAI,EACJ,gBAAQ,CAAC,4BAA4B,CACtC,EACD,wBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAC1D,CAAC;gCACF,OAAO,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;4BACvC,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-redeclare.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-redeclare.js.map
generated
vendored
File diff suppressed because one or more lines are too long
48
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js
generated
vendored
48
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js
generated
vendored
|
|
@ -168,22 +168,44 @@ exports.default = (0, util_1.createRule)({
|
|||
// As long as there's one matching pattern that allows type import
|
||||
allowedImportTypeMatchers.some(matcher => matcher.ignores(importSource)));
|
||||
}
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
if (node.importKind === 'type' ||
|
||||
(node.specifiers.length > 0 &&
|
||||
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
|
||||
specifier.importKind === 'type'))) {
|
||||
const importSource = node.source.value.trim();
|
||||
if (!isAllowedTypeImportPath(importSource) &&
|
||||
!isAllowedTypeImportPattern(importSource)) {
|
||||
return rules.ImportDeclaration(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
function checkImportNode(node) {
|
||||
if (node.importKind === 'type' ||
|
||||
(node.specifiers.length > 0 &&
|
||||
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
|
||||
specifier.importKind === 'type'))) {
|
||||
const importSource = node.source.value.trim();
|
||||
if (!isAllowedTypeImportPath(importSource) &&
|
||||
!isAllowedTypeImportPattern(importSource)) {
|
||||
return rules.ImportDeclaration(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return rules.ImportDeclaration(node);
|
||||
}
|
||||
}
|
||||
return {
|
||||
TSImportEqualsDeclaration(node) {
|
||||
if (node.moduleReference.type ===
|
||||
utils_1.AST_NODE_TYPES.TSExternalModuleReference &&
|
||||
node.moduleReference.expression.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
typeof node.moduleReference.expression.value === 'string') {
|
||||
const synthesizedImport = {
|
||||
...node,
|
||||
type: utils_1.AST_NODE_TYPES.ImportDeclaration,
|
||||
source: node.moduleReference.expression,
|
||||
assertions: [],
|
||||
specifiers: [
|
||||
{
|
||||
...node.id,
|
||||
type: utils_1.AST_NODE_TYPES.ImportDefaultSpecifier,
|
||||
local: node.id,
|
||||
},
|
||||
],
|
||||
};
|
||||
return checkImportNode(synthesizedImport);
|
||||
}
|
||||
},
|
||||
ImportDeclaration: checkImportNode,
|
||||
'ExportNamedDeclaration[source]'(node) {
|
||||
if (node.exportKind === 'type' ||
|
||||
(node.specifiers.length > 0 &&
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js
generated
vendored
|
|
@ -192,7 +192,7 @@ exports.default = (0, util_1.createRule)({
|
|||
* @returns Whether or not the variable name is allowed.
|
||||
*/
|
||||
function isAllowed(variable) {
|
||||
return options.allow.indexOf(variable.name) !== -1;
|
||||
return options.allow.includes(variable.name);
|
||||
}
|
||||
/**
|
||||
* Checks if a variable of the class name in the class scope of ClassDeclaration.
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-assignment.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-assignment.js
generated
vendored
|
|
@ -136,7 +136,7 @@ exports.default = (0, util_1.createRule)({
|
|||
continue;
|
||||
}
|
||||
let key;
|
||||
if (receiverProperty.computed === false) {
|
||||
if (!receiverProperty.computed) {
|
||||
key =
|
||||
receiverProperty.key.type === utils_1.AST_NODE_TYPES.Identifier
|
||||
? receiverProperty.key.name
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-assignment.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-assignment.js.map
generated
vendored
File diff suppressed because one or more lines are too long
29
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-enum-comparison.js
generated
vendored
29
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-enum-comparison.js
generated
vendored
|
|
@ -50,6 +50,7 @@ function getEnumValueType(type) {
|
|||
exports.default = (0, util_1.createRule)({
|
||||
name: 'no-unsafe-enum-comparison',
|
||||
meta: {
|
||||
hasSuggestions: true,
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallow comparing an enum value with a non-enum value',
|
||||
|
|
@ -58,6 +59,7 @@ exports.default = (0, util_1.createRule)({
|
|||
},
|
||||
messages: {
|
||||
mismatched: 'The two values in this comparison do not have a shared enum type.',
|
||||
replaceValueWithEnum: 'Replace with an enum value comparison.',
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
|
|
@ -107,6 +109,33 @@ exports.default = (0, util_1.createRule)({
|
|||
context.report({
|
||||
messageId: 'mismatched',
|
||||
node,
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'replaceValueWithEnum',
|
||||
fix(fixer) {
|
||||
// Replace the right side with an enum key if possible:
|
||||
//
|
||||
// ```ts
|
||||
// Fruit.Apple === 'apple'; // Fruit.Apple === Fruit.Apple
|
||||
// ```
|
||||
const leftEnumKey = (0, shared_1.getEnumKeyForLiteral)((0, shared_1.getEnumLiterals)(left), (0, util_1.getStaticValue)(node.right)?.value);
|
||||
if (leftEnumKey) {
|
||||
return fixer.replaceText(node.right, leftEnumKey);
|
||||
}
|
||||
// Replace the left side with an enum key if possible:
|
||||
//
|
||||
// ```ts
|
||||
// declare const fruit: Fruit;
|
||||
// 'apple' === Fruit.Apple; // Fruit.Apple === Fruit.Apple
|
||||
// ```
|
||||
const rightEnumKey = (0, shared_1.getEnumKeyForLiteral)((0, shared_1.getEnumLiterals)(right), (0, util_1.getStaticValue)(node.left)?.value);
|
||||
if (rightEnumKey) {
|
||||
return fixer.replaceText(node.left, rightEnumKey);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"no-unsafe-enum-comparison.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-enum-comparison.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AACxC,+CAAiC;AAEjC,kCAAwD;AACxD,gDAAmD;AAEnD;;GAEG;AACH,SAAS,YAAY,CAAC,aAAwB,EAAE,KAAc;IAC5D,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEpE,OAAO,CACL,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;QACtC,OAAO,CAAC,aAAa,CACnB,KAAK,EACL,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAC9C,CAAC;QACJ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;YACtC,OAAO,CAAC,aAAa,CACnB,KAAK,EACL,EAAE,C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AAE,IAAI,CAAC,CAAC;gBACtD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,IAAA,qBAAY,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;gBACjE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,CAAC,EAAE;oBAC3D,OAAO;iBACR;gBAED,6CAA6C;gBAC7C,EAAE;gBACF,QAAQ;gBACR,gCAAgC;gBAChC,MAAM;gBACN,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;oBACxC,IAAI,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;wBACpC,OAAO;qBACR;iBACF;gBAED,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBACnD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBAErD,oEAAoE;gBACpE,EAAE;gBACF,QAAQ;gBACR,wCAAwC;gBACxC,eAAe;gBACf,MAAM;gBACN,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;oBACxC,IAAI,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;wBACzC,OAAO;qBACR;iBACF;gBAED,IACE,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC;oBAClC,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,EAClC;oBACA,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,YAAY;wBACvB,IAAI;qBACL,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
{"version":3,"file":"no-unsafe-enum-comparison.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-enum-comparison.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AACxC,+CAAiC;AAEjC,kCAAwE;AACxE,gDAI6B;AAE7B;;GAEG;AACH,SAAS,YAAY,CAAC,aAAwB,EAA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R;iBACF;gBAED,IACE,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC;oBAClC,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,EAClC;oBACA,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,YAAY;wBACvB,IAAI;wBACJ,OAAO,EAAE;4BACP;gCACE,SAAS,EAAE,sBAAsB;gCACjC,GAAG,CAAC,KAAK;oCACP,uDAAuD;oCACvD,EAAE;oCACF,QAAQ;oCACR,0DAA0D;oCAC1D,MAAM;oCACN,MAAM,WAAW,GAAG,IAAA,6BAAoB,EACtC,IAAA,wBAAe,EAAC,IAAI,CAAC,EACrB,IAAA,qBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,CAClC,CAAC;oCAEF,IAAI,WAAW,EAAE;wCACf,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;qCACnD;oCAED,sDAAsD;oCACtD,EAAE;oCACF,QAAQ;oCACR,8BAA8B;oCAC9B,0DAA0D;oCAC1D,MAAM;oCACN,MAAM,YAAY,GAAG,IAAA,6BAAoB,EACvC,IAAA,wBAAe,EAAC,KAAK,CAAC,EACtB,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CACjC,CAAC;oCAEF,IAAI,YAAY,EAAE;wCAChB,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;qCACnD;oCAED,OAAO,IAAI,CAAC;gCACd,CAAC;6BACF;yBACF;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js
generated
vendored
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js
generated
vendored
|
|
@ -91,7 +91,8 @@ exports.default = (0, util_1.createRule)({
|
|||
// function return type, we shouldn't complain (it's intentional, even if unsafe)
|
||||
if (functionTSNode.type) {
|
||||
for (const signature of functionType.getCallSignatures()) {
|
||||
if (returnNodeType === signature.getReturnType()) {
|
||||
if (returnNodeType === signature.getReturnType() ||
|
||||
(0, util_1.isTypeFlagSet)(signature.getReturnType(), ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"no-unsafe-return.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-return.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,sDAAwC;AACxC,+CAAiC;AAEjC,kCAYiB;AAEjB,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;YACzE,WAAW,EAAE,aAAa;YAC1B,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,6CAA6C;YAC3D,gBAAgB,EAAE;gBAChB,uEAAuE;gBACvE,2HAA2H;aAC5H,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,sBAAsB,EACpB,mFAAmF;SACtF;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC9D,MA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EAAE,aAAa;oBACnB,SAAS,EAAE,wBAAwB;oBACnC,IAAI,EAAE;wBACJ,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;wBACpC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC;qBACzC;iBACF,CAAC,CAAC;aACJ;QACH,CAAC;QAED,OAAO;YACL,eAAe,CAAC,IAAI;gBAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC/B,IAAI,CAAC,QAAQ,EAAE;oBACb,OAAO;iBACR;gBAED,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC9B,CAAC;YACD,qDAAqD,EAAE,WAAW;SACnE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js
generated
vendored
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js
generated
vendored
|
|
@ -201,7 +201,8 @@ class ClassScope {
|
|||
}
|
||||
}
|
||||
addDeclaredVariable(node) {
|
||||
if (!tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
||||
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
||||
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
|
||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Readonly) ||
|
||||
ts.isComputedPropertyName(node.name)) {
|
||||
return;
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-regexp-exec.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-regexp-exec.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"prefer-regex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AAG,QAAQ,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBAC9D,MAAM,aAAa,GAAG,oBAAoB,CACxC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CACrC,CAAC;gBACF,QAAQ,aAAa,EAAE;oBACrB,KAAK,YAAY,CAAC,MAAM;wBACtB,OAAO,OAAO,CAAC,MAAM,CAAC;4BACpB,IAAI,EAAE,UAAU,CAAC,QAAQ;4BACzB,SAAS,EAAE,2BAA2B;4BACtC,GAAG,EAAE,IAAA,uBAAgB,EAAC;gCACpB,UAAU;gCACV,IAAI,EAAE,QAAQ;gCACd,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;gCACrC,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,CACjC,GAAG,YAAY,SAAS,UAAU,GAAG;6BACxC,CAAC;yBACH,CAAC,CAAC;oBAEL,KAAK,YAAY,CAAC,MAAM;wBACtB,OAAO,OAAO,CAAC,MAAM,CAAC;4BACpB,IAAI,EAAE,UAAU,CAAC,QAAQ;4BACzB,SAAS,EAAE,2BAA2B;4BACtC,GAAG,EAAE,IAAA,uBAAgB,EAAC;gCACpB,UAAU;gCACV,IAAI,EAAE,QAAQ;gCACd,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;gCACrC,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,CACjC,UAAU,YAAY,UAAU,UAAU,GAAG;6BAChD,CAAC;yBACH,CAAC,CAAC;iBACN;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/collectUnusedVariables.js
generated
vendored
|
|
@ -224,7 +224,7 @@ class UnusedVarsVisitor extends scope_manager_1.Visitor {
|
|||
}
|
||||
TSModuleDeclaration(node) {
|
||||
// -- global augmentation can be in any file, and they do not need exports
|
||||
if (node.global === true) {
|
||||
if (node.global) {
|
||||
this.markVariableAsUsed('global', node.parent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/getESLintCoreRule.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/getESLintCoreRule.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"getESLintCoreRule.js","sourceRoot":"","sources":["../../src/util/getESLintCoreRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuD;AACvD,sDAA8C;AAC9C,+CAAiC;AAEjC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,sBAAO,CAAC,IAAI,CAAC,CAAC;AA2CjC,QAAA,iBAAiB,GAC5B,UAAU;IACR,CAAC,CAAC,CAAmB,MAAS,EAAc,EAAE,CAC1C,mBAAW,CAAC,UAAU;IACpB,yGAAyG;IACzG,OAAO,CAAC,6BAA6B,CAAC,CAAC,YAAY,CAAC,GAAG,CACrD,MAAM,CACO,EACf,uBAAuB,MAAM,cAAc,CAC5C;IACL,CAAC,CAAC,CAAmB,MAAS,EAAc,EAAE,CAC1C,OAAO,CAAC,oBAAoB,MAAM,EAAE,CAAe,CAAC;AAE5D,SAAgB,sBAAsB,CACpC,MAAS;IAET,IAAI;QACF,OAAO,IAAA,yBAAiB,EAAI,MAAM,CAAC,CAAC;KACrC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AARD,wDAQC"}
|
||||
{"version":3,"file":"getESLintCoreRule.js","sourceRoot":"","sources":["../../src/util/getESLintCoreRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuD;AACvD,sDAA8C;AAC9C,+CAAiC;AAEjC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,sBAAO,CAAC,IAAI,CAAC,CAAC;AA4CjC,QAAA,iBAAiB,GAC5B,UAAU;IACR,CAAC,CAAC,CAAmB,MAAS,EAAc,EAAE,CAC1C,mBAAW,CAAC,UAAU;IACpB,yGAAyG;IACzG,OAAO,CAAC,6BAA6B,CAAC,CAAC,YAAY,CAAC,GAAG,CACrD,MAAM,CACO,EACf,uBAAuB,MAAM,cAAc,CAC5C;IACL,CAAC,CAAC,CAAmB,MAAS,EAAc,EAAE,CAC1C,OAAO,CAAC,oBAAoB,MAAM,EAAE,CAAe,CAAC;AAE5D,SAAgB,sBAAsB,CACpC,MAAS;IAET,IAAI;QACF,OAAO,IAAA,yBAAiB,EAAI,MAAM,CAAC,CAAC;KACrC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AARD,wDAQC"}
|
||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/getOperatorPrecedence.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/util/getOperatorPrecedence.js.map
generated
vendored
File diff suppressed because one or more lines are too long
51
node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md
generated
vendored
51
node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md
generated
vendored
|
|
@ -6,18 +6,55 @@ pagination_prev: null
|
|||
slug: /
|
||||
---
|
||||
|
||||
`@typescript-eslint/eslint-plugin` includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code.
|
||||
See [Configs](/linting/configs) for how to enable recommended rules using configs.
|
||||
`@typescript-eslint/eslint-plugin` includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. All of our rules are listed below.
|
||||
|
||||
## Supported Rules
|
||||
:::tip
|
||||
Instead of enabling rules one by one, we recommend using one of [our pre-defined configs](/linting/configs) to enable a large set of recommended rules.
|
||||
:::
|
||||
|
||||
## Rules
|
||||
|
||||
The rules are listed in alphabetical order. You can optionally filter them based on these categories:
|
||||
|
||||
import RulesTable from "@site/src/components/RulesTable";
|
||||
|
||||
<RulesTable ruleset="supported-rules" />
|
||||
<RulesTable />
|
||||
|
||||
## Filtering
|
||||
|
||||
### Config Group (⚙️)
|
||||
|
||||
"Config Group" refers to the [pre-defined config](/linting/configs) that includes the rule. Extending from a configuration preset allow for enabling a large set of recommended rules all at once.
|
||||
|
||||
### Metadata
|
||||
|
||||
- `🔧 fixable` refers to whether the rule contains an [ESLint `--fix` auto-fixer](https://eslint.org/docs/latest/use/command-line-interface#--fix).
|
||||
- `💡 has suggestions` refers to whether the rule contains an ESLint suggestion fixer.
|
||||
- Sometimes, it is not safe to automatically fix the code with an auto-fixer. But in these cases, we often have a good guess of what the correct fix should be, and we can provide it as a suggestion to the developer.
|
||||
- `💭 requires type information` refers to whether the rule requires [typed linting](/linting/typed-linting).
|
||||
- `🧱 extension rule` means that the rule is an extension of an [core ESLint rule](https://eslint.org/docs/latest/rules) (see [Extension Rules](#extension-rules)).
|
||||
- `📐 formatting rule` means that the rule has to do with formatting.
|
||||
- We [strongly recommend against using ESLint for formatting](/linting/troubleshooting/formatting).
|
||||
- Soon, formatting rules will be moved to the [ESLint stylistic plugin](https://eslint.style).
|
||||
- `💀 deprecated rule` means that the rule should no longer be used and will be removed from the plugin in a future version.
|
||||
|
||||
## Extension Rules
|
||||
|
||||
In some cases, ESLint provides a rule itself, but it doesn't support TypeScript syntax; either it crashes, or it ignores the syntax, or it falsely reports against it.
|
||||
In these cases, we create what we call an extension rule; a rule within our plugin that has the same functionality, but also supports TypeScript.
|
||||
Some core ESLint rules do not support TypeScript syntax: either they crash, ignore the syntax, or falsely report against it.
|
||||
In these cases, we create what we call an "extension rule": a rule within our plugin that has the same functionality, but also supports TypeScript.
|
||||
|
||||
<RulesTable ruleset="extension-rules" />
|
||||
Extension rules generally completely replace the base rule from ESLint core.
|
||||
If the base rule is enabled in a config you extend from, you'll need to disable the base rule:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
extends: ['eslint:recommended'],
|
||||
rules: {
|
||||
// Note: you must disable the base rule as it can report incorrect errors
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
[Search for `🧱 extension rule`s](?=extension#rules) in this page to see all extension rules.
|
||||
|
|
|
|||
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md
generated
vendored
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md
generated
vendored
|
|
@ -22,14 +22,14 @@ Always use `T[]` or `readonly T[]` for all array types.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "array" }'
|
||||
const x: Array<string> = ['a', 'b'];
|
||||
const y: ReadonlyArray<string> = ['a', 'b'];
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "array" }'
|
||||
const x: string[] = ['a', 'b'];
|
||||
const y: readonly string[] = ['a', 'b'];
|
||||
```
|
||||
|
|
@ -42,14 +42,14 @@ Always use `Array<T>` or `ReadonlyArray<T>` for all array types.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "generic" }'
|
||||
const x: string[] = ['a', 'b'];
|
||||
const y: readonly string[] = ['a', 'b'];
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "generic" }'
|
||||
const x: Array<string> = ['a', 'b'];
|
||||
const y: ReadonlyArray<string> = ['a', 'b'];
|
||||
```
|
||||
|
|
@ -63,7 +63,7 @@ Use `Array<T>` or `ReadonlyArray<T>` for all other types (union types, intersect
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "array-simple" }'
|
||||
const a: (string | number)[] = ['a', 'b'];
|
||||
const b: { prop: string }[] = [{ prop: 'a' }];
|
||||
const c: (() => void)[] = [() => {}];
|
||||
|
|
@ -74,7 +74,7 @@ const f: ReadonlyArray<string> = ['a', 'b'];
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": "array-simple" }'
|
||||
const a: Array<string | number> = ['a', 'b'];
|
||||
const b: Array<{ prop: string }> = [{ prop: 'a' }];
|
||||
const c: Array<() => void> = [() => {}];
|
||||
|
|
|
|||
18
node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md
generated
vendored
18
node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md
generated
vendored
|
|
@ -33,7 +33,7 @@ A value of `true` for a particular directive means that this rule will report if
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-ignore": true }'
|
||||
if (false) {
|
||||
// @ts-ignore: Unreachable code error
|
||||
console.log('hello');
|
||||
|
|
@ -48,7 +48,7 @@ if (false) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-ignore": true }'
|
||||
if (false) {
|
||||
// Compiler warns about unreachable code error
|
||||
console.log('hello');
|
||||
|
|
@ -65,7 +65,7 @@ For example, with `{ 'ts-expect-error': 'allow-with-description' }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-expect-error": "allow-with-description" }'
|
||||
if (false) {
|
||||
// @ts-expect-error
|
||||
console.log('hello');
|
||||
|
|
@ -78,7 +78,7 @@ if (false) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-expect-error": "allow-with-description" }'
|
||||
if (false) {
|
||||
// @ts-expect-error: Unreachable code error
|
||||
console.log('hello');
|
||||
|
|
@ -101,14 +101,16 @@ For example, with `{ 'ts-expect-error': { descriptionFormat: '^: TS\\d+ because
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
<!-- prettier-ignore -->
|
||||
```ts option='{ "ts-expect-error": { "descriptionFormat": "^: TS\\\\d+ because .+$" } }'
|
||||
// @ts-expect-error: the library definition is wrong
|
||||
const a = doSomething('hello');
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
<!-- prettier-ignore -->
|
||||
```ts option='{ "ts-expect-error": { "descriptionFormat": "^: TS\\\\d+ because .+$" } }'
|
||||
// @ts-expect-error: TS1234 because the library definition is wrong
|
||||
const a = doSomething('hello');
|
||||
```
|
||||
|
|
@ -123,7 +125,7 @@ For example, with `{ 'ts-expect-error': 'allow-with-description', minimumDescrip
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-expect-error": "allow-with-description", "minimumDescriptionLength": 10 }'
|
||||
if (false) {
|
||||
// @ts-expect-error: TODO
|
||||
console.log('hello');
|
||||
|
|
@ -132,7 +134,7 @@ if (false) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "ts-expect-error": "allow-with-description", "minimumDescriptionLength": 10 }'
|
||||
if (false) {
|
||||
// @ts-expect-error The rationale for this override is described in issue #1337 on GitLab
|
||||
console.log('hello');
|
||||
|
|
|
|||
58
node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md
generated
vendored
58
node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md
generated
vendored
|
|
@ -75,63 +75,7 @@ The default options provide a set of "best practices", intended to provide safet
|
|||
<details>
|
||||
<summary>Default Options</summary>
|
||||
|
||||
```ts
|
||||
const defaultTypes = {
|
||||
String: {
|
||||
message: 'Use string instead',
|
||||
fixWith: 'string',
|
||||
},
|
||||
Boolean: {
|
||||
message: 'Use boolean instead',
|
||||
fixWith: 'boolean',
|
||||
},
|
||||
Number: {
|
||||
message: 'Use number instead',
|
||||
fixWith: 'number',
|
||||
},
|
||||
Symbol: {
|
||||
message: 'Use symbol instead',
|
||||
fixWith: 'symbol',
|
||||
},
|
||||
BigInt: {
|
||||
message: 'Use bigint instead',
|
||||
fixWith: 'bigint',
|
||||
},
|
||||
Function: {
|
||||
message: [
|
||||
'The `Function` type accepts any function-like value.',
|
||||
'It provides no type safety when calling the function, which can be a common source of bugs.',
|
||||
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
|
||||
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.',
|
||||
].join('\n'),
|
||||
},
|
||||
// object typing
|
||||
Object: {
|
||||
message: [
|
||||
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
|
||||
'- If you want a type meaning "any object", you probably want `object` instead.',
|
||||
'- If you want a type meaning "any value", you probably want `unknown` instead.',
|
||||
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
|
||||
].join('\n'),
|
||||
suggest: ['object', 'unknown', 'NonNullable<unknown>'],
|
||||
},
|
||||
'{}': {
|
||||
message: [
|
||||
'`{}` actually means "any non-nullish value".',
|
||||
'- If you want a type meaning "any object", you probably want `object` instead.',
|
||||
'- If you want a type meaning "any value", you probably want `unknown` instead.',
|
||||
'- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.',
|
||||
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
|
||||
].join('\n'),
|
||||
suggest: [
|
||||
'object',
|
||||
'unknown',
|
||||
'Record<string, never>',
|
||||
'NonNullable<unknown>',
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
<!-- Inject default options -->
|
||||
|
||||
</details>
|
||||
|
||||
|
|
|
|||
7
node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md
generated
vendored
7
node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md
generated
vendored
|
|
@ -5,6 +5,9 @@ This rule has been deprecated in favour of the [`naming-convention`](./naming-co
|
|||
:::
|
||||
|
||||
<!--
|
||||
This doc file has been left on purpose because `camelcase` is a core ESLint rule.
|
||||
This exists to help direct people to the replacement rule.
|
||||
This doc file has been left on purpose because `camelcase` is a core ESLint
|
||||
rule. This exists to help direct people to the replacement rule.
|
||||
|
||||
Note that there is no actual way to get to this page in the normal navigation,
|
||||
so end-users will only be able to get to this page from the search bar.
|
||||
-->
|
||||
|
|
|
|||
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md
generated
vendored
|
|
@ -31,9 +31,7 @@ Examples of code with the `fields` style:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/class-literal-property-style: ["error", "fields"] */
|
||||
|
||||
```ts option='"fields"'
|
||||
class Mx {
|
||||
public static get myField1() {
|
||||
return 1;
|
||||
|
|
@ -47,9 +45,7 @@ class Mx {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/class-literal-property-style: ["error", "fields"] */
|
||||
|
||||
```ts option='"fields"'
|
||||
class Mx {
|
||||
public readonly myField1 = 1;
|
||||
|
||||
|
|
@ -76,9 +72,7 @@ Examples of code with the `getters` style:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/class-literal-property-style: ["error", "getters"] */
|
||||
|
||||
```ts option='"getters"'
|
||||
class Mx {
|
||||
readonly myField1 = 1;
|
||||
readonly myField2 = `hello world`;
|
||||
|
|
@ -88,9 +82,7 @@ class Mx {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/class-literal-property-style: ["error", "getters"] */
|
||||
|
||||
```ts option='"getters"'
|
||||
class Mx {
|
||||
// no readonly modifier
|
||||
public myField1 = 'hello';
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-methods-use-this.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-methods-use-this.md
generated
vendored
|
|
@ -32,7 +32,7 @@ Makes the rule to ignores any class member explicitly marked with `override`.
|
|||
|
||||
Example of a correct code when `ignoreOverrideMethods` is set to `true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreOverrideMethods": true }' showPlaygroundButton
|
||||
class X {
|
||||
override method() {}
|
||||
override property = () => {};
|
||||
|
|
@ -47,7 +47,7 @@ It's important to note that this option does not only apply to members defined i
|
|||
|
||||
Example of a correct code when `ignoreClassesThatImplementAnInterface` is set to `true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreClassesThatImplementAnInterface": true }' showPlaygroundButton
|
||||
class X implements Y {
|
||||
method() {}
|
||||
property = () => {};
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ Keeping to one side consistently improve code readability.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='"constructor"'
|
||||
const map: Map<string, number> = new Map();
|
||||
const set: Set<string> = new Set();
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='"constructor"'
|
||||
const map = new Map<string, number>();
|
||||
const map: Map<string, number> = new MyMap();
|
||||
const set = new Set<string>();
|
||||
|
|
@ -54,14 +54,14 @@ const set: Set<string> = new Set<string>();
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='"type-annotation"'
|
||||
const map = new Map<string, number>();
|
||||
const set = new Set<string>();
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='"type-annotation"'
|
||||
const map: Map<string, number> = new Map();
|
||||
const set: Set<string> = new Set();
|
||||
const set = new Set();
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ Keeping to one declaration form consistently improve code readability.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-indexed-object-style: ["error", "record"] */
|
||||
|
||||
```ts option='"record"'
|
||||
interface Foo {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
|
@ -47,9 +45,7 @@ type Foo = {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-indexed-object-style: ["error", "record"] */
|
||||
|
||||
```ts option='"record"'
|
||||
type Foo = Record<string, unknown>;
|
||||
```
|
||||
|
||||
|
|
@ -59,17 +55,13 @@ type Foo = Record<string, unknown>;
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-indexed-object-style: ["error", "index-signature"] */
|
||||
|
||||
```ts option='"index-signature"'
|
||||
type Foo = Record<string, unknown>;
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-indexed-object-style: ["error", "index-signature"] */
|
||||
|
||||
```ts option='"index-signature"'
|
||||
interface Foo {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ Examples of code for `{ assertionStyle: 'as', objectLiteralTypeAssertions: 'neve
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }'
|
||||
const x = { ... } as T;
|
||||
|
||||
function foo() {
|
||||
|
|
@ -63,7 +63,7 @@ function foo() {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }'
|
||||
const x: T = { ... };
|
||||
const y = { ... } as any;
|
||||
const z = { ... } as unknown;
|
||||
|
|
@ -81,7 +81,7 @@ Examples of code for `{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allo
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter" }'
|
||||
const x = { ... } as T;
|
||||
|
||||
function foo() {
|
||||
|
|
@ -91,7 +91,7 @@ function foo() {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```tsx
|
||||
```tsx option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter" }'
|
||||
const x: T = { ... };
|
||||
const y = { ... } as any;
|
||||
const z = { ... } as unknown;
|
||||
|
|
|
|||
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md
generated
vendored
|
|
@ -36,17 +36,13 @@ Using the same type declaration style consistently helps with code readability.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-type-definitions: ["error", "interface"] */
|
||||
|
||||
```ts option='"interface"'
|
||||
type T = { x: number };
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-type-definitions: ["error", "interface"] */
|
||||
|
||||
```ts option='"interface"'
|
||||
type T = string;
|
||||
type Foo = string | {};
|
||||
|
||||
|
|
@ -61,9 +57,7 @@ interface T {
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-type-definitions: ["error", "type"] */
|
||||
|
||||
```ts option='"type"'
|
||||
interface T {
|
||||
x: number;
|
||||
}
|
||||
|
|
@ -71,9 +65,7 @@ interface T {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/* eslint @typescript-eslint/consistent-type-definitions: ["error", "type"] */
|
||||
|
||||
```ts option='"type"'
|
||||
type T = { x: number };
|
||||
```
|
||||
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md
generated
vendored
|
|
@ -83,14 +83,14 @@ export { x };
|
|||
|
||||
### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "fixMixedExportsWithInlineTypeSpecifier": true }'
|
||||
export { Button } from 'some-library';
|
||||
export type { ButtonProps } from 'some-library';
|
||||
```
|
||||
|
||||
### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "fixMixedExportsWithInlineTypeSpecifier": true }'
|
||||
export { Button, type ButtonProps } from 'some-library';
|
||||
```
|
||||
|
||||
|
|
|
|||
10
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md
generated
vendored
10
node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md
generated
vendored
|
|
@ -22,7 +22,7 @@ This option defines the expected import kind for type-only imports. Valid values
|
|||
|
||||
Examples of **correct** code with `{prefer: 'type-imports'}`, and **incorrect** code with `{prefer: 'no-type-imports'}`.
|
||||
|
||||
```ts
|
||||
```ts option='{ "prefer": "type-imports" }' showPlaygroundButton
|
||||
import type { Foo } from 'Foo';
|
||||
import type Bar from 'Bar';
|
||||
type T = Foo;
|
||||
|
|
@ -31,7 +31,7 @@ const x: Bar = 1;
|
|||
|
||||
Examples of **incorrect** code with `{prefer: 'type-imports'}`, and **correct** code with `{prefer: 'no-type-imports'}`.
|
||||
|
||||
```ts
|
||||
```ts option='{ "prefer": "type-imports" }' showPlaygroundButton
|
||||
import { Foo } from 'Foo';
|
||||
import Bar from 'Bar';
|
||||
type T = Foo;
|
||||
|
|
@ -58,7 +58,7 @@ const x: Bar = 1;
|
|||
|
||||
#### ✅ With `separate-type-imports`
|
||||
|
||||
```ts
|
||||
```ts option='{ "fixStyle": "separate-type-imports" }'
|
||||
import type { Foo } from 'Foo';
|
||||
import type Bar from 'Bar';
|
||||
type T = Foo;
|
||||
|
|
@ -67,7 +67,7 @@ const x: Bar = 1;
|
|||
|
||||
#### ✅ With `inline-type-imports`
|
||||
|
||||
```ts
|
||||
```ts option='{ "fixStyle": "inline-type-imports" }'
|
||||
import { type Foo } from 'Foo';
|
||||
import type Bar from 'Bar';
|
||||
type T = Foo;
|
||||
|
|
@ -83,7 +83,7 @@ Default is `true`.
|
|||
|
||||
Examples of **incorrect** code with `{disallowTypeAnnotations: true}`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "disallowTypeAnnotations": true }' showPlaygroundButton
|
||||
type T = import('Foo').Foo;
|
||||
const x: import('Bar') = 1;
|
||||
```
|
||||
|
|
|
|||
20
node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md
generated
vendored
20
node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md
generated
vendored
|
|
@ -20,10 +20,16 @@ function f(a = 0, b: number) {}
|
|||
function f(a: number, b = 0, c: number) {}
|
||||
function f(a: number, b?: number, c: number) {}
|
||||
class Foo {
|
||||
constructor(public a = 10, private b: number) {}
|
||||
constructor(
|
||||
public a = 10,
|
||||
private b: number,
|
||||
) {}
|
||||
}
|
||||
class Foo {
|
||||
constructor(public a?: number, private b: number) {}
|
||||
constructor(
|
||||
public a?: number,
|
||||
private b: number,
|
||||
) {}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -38,9 +44,15 @@ function f(a: number, b?: number) {}
|
|||
function f(a: number, b?: number, c = 0) {}
|
||||
function f(a: number, b = 0, c?: number) {}
|
||||
class Foo {
|
||||
constructor(public a, private b = 0) {}
|
||||
constructor(
|
||||
public a,
|
||||
private b = 0,
|
||||
) {}
|
||||
}
|
||||
class Foo {
|
||||
constructor(public a, private b?: number) {}
|
||||
constructor(
|
||||
public a,
|
||||
private b?: number,
|
||||
) {}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
6
node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md
generated
vendored
6
node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md
generated
vendored
|
|
@ -37,7 +37,7 @@ If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to
|
|||
|
||||
Example of a correct code when `allowPrivateClassPropertyAccess` is set to `true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowPrivateClassPropertyAccess": true }' showPlaygroundButton
|
||||
class X {
|
||||
private priv_prop = 123;
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ x['priv_prop'] = 123;
|
|||
|
||||
Example of a correct code when `allowProtectedClassPropertyAccess` is set to `true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowProtectedClassPropertyAccess": true }' showPlaygroundButton
|
||||
class X {
|
||||
protected protected_prop = 123;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ x['protected_prop'] = 123;
|
|||
|
||||
Example of correct code when `allowIndexSignaturePropertyAccess` is set to `true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowIndexSignaturePropertyAccess": true }' showPlaygroundButton
|
||||
class X {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ Examples of code for this rule with `{ allowExpressions: true }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowExpressions": true }'
|
||||
function test() {}
|
||||
|
||||
const fn = () => {};
|
||||
|
|
@ -108,7 +108,7 @@ export default () => {};
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowExpressions": true }'
|
||||
node.addEventListener('click', () => {});
|
||||
|
||||
node.addEventListener('click', function () {});
|
||||
|
|
@ -124,7 +124,7 @@ Examples of code for this rule with `{ allowTypedFunctionExpressions: true }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTypedFunctionExpressions": true }'
|
||||
let arrowFn = () => 'test';
|
||||
|
||||
let funcExpr = function () {
|
||||
|
|
@ -138,7 +138,7 @@ let objectProp = {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTypedFunctionExpressions": true }'
|
||||
type FuncType = () => string;
|
||||
|
||||
let arrowFn: FuncType = () => 'test';
|
||||
|
|
@ -182,7 +182,7 @@ Examples of code for this rule with `{ allowHigherOrderFunctions: true }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowHigherOrderFunctions": true }'
|
||||
var arrowFn = () => () => {};
|
||||
|
||||
function fn() {
|
||||
|
|
@ -192,7 +192,7 @@ function fn() {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowHigherOrderFunctions": true }'
|
||||
var arrowFn = () => (): void => {};
|
||||
|
||||
function fn() {
|
||||
|
|
@ -208,15 +208,15 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
const func = (value: number) => ({ type: 'X', value } as any);
|
||||
const func = (value: number) => ({ type: 'X', value } as Action);
|
||||
```ts option='{ "allowDirectConstAssertionInArrowFunctions": true }'
|
||||
const func = (value: number) => ({ type: 'X', value }) as any;
|
||||
const func = (value: number) => ({ type: 'X', value }) as Action;
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
const func = (value: number) => ({ foo: 'bar', value } as const);
|
||||
```ts option='{ "allowDirectConstAssertionInArrowFunctions": true }'
|
||||
const func = (value: number) => ({ foo: 'bar', value }) as const;
|
||||
const func = () => x as const;
|
||||
```
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ Examples of code for this rule with `{ allowConciseArrowFunctionExpressionsStart
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConciseArrowFunctionExpressionsStartingWithVoid": true }'
|
||||
var join = (a: string, b: string) => `${a}${b}`;
|
||||
|
||||
const log = (message: string) => {
|
||||
|
|
@ -238,7 +238,7 @@ const log = (message: string) => {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConciseArrowFunctionExpressionsStartingWithVoid": true }'
|
||||
var log = (message: string) => void console.log(message);
|
||||
```
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ Examples of code for this rule with `{ allowFunctionsWithoutTypeParameters: true
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowFunctionsWithoutTypeParameters": true }'
|
||||
function foo<T>(t: T) {
|
||||
return t;
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ const bar = <T>(t: T) => t;
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowFunctionsWithoutTypeParameters": true }'
|
||||
function foo<T>(t: T): T {
|
||||
return t;
|
||||
}
|
||||
|
|
@ -297,13 +297,13 @@ Examples of code for this rule with `{ allowIIFEs: true }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowIIFEs": true }'
|
||||
var func = () => 'foo';
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowIIFEs": true }'
|
||||
var foo = (() => 'foo')();
|
||||
|
||||
var bar = (function () {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Note the above is an example of a possible configuration you could use - it is n
|
|||
|
||||
The following patterns are considered incorrect code if no options are provided:
|
||||
|
||||
```ts
|
||||
```ts showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(name) {
|
||||
// No accessibility modifier
|
||||
|
|
@ -88,9 +88,12 @@ class Animal {
|
|||
|
||||
The following patterns are considered correct with the default options `{ accessibility: 'explicit' }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "explicit" }' showPlaygroundButton
|
||||
class Animal {
|
||||
public constructor(public breed, name) {
|
||||
public constructor(
|
||||
public breed,
|
||||
name,
|
||||
) {
|
||||
// Parameter property and constructor
|
||||
this.animalName = name;
|
||||
}
|
||||
|
|
@ -111,9 +114,12 @@ class Animal {
|
|||
|
||||
The following patterns are considered incorrect with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "no-public" }' showPlaygroundButton
|
||||
class Animal {
|
||||
public constructor(public breed, name) {
|
||||
public constructor(
|
||||
public breed,
|
||||
name,
|
||||
) {
|
||||
// Parameter property and constructor
|
||||
this.animalName = name;
|
||||
}
|
||||
|
|
@ -134,9 +140,12 @@ class Animal {
|
|||
|
||||
The following patterns are considered correct with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "no-public" }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(protected breed, name) {
|
||||
constructor(
|
||||
protected breed,
|
||||
name,
|
||||
) {
|
||||
// Parameter property and constructor
|
||||
this.name = name;
|
||||
}
|
||||
|
|
@ -169,7 +178,7 @@ e.g. `[ { overrides: { constructors: 'no-public' } } ]`
|
|||
|
||||
The following patterns are considered incorrect with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "overrides": { "constructors": "no-public" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
public constructor(protected animalName) {}
|
||||
public get name() {
|
||||
|
|
@ -180,7 +189,7 @@ class Animal {
|
|||
|
||||
The following patterns are considered correct with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "overrides": { "constructors": "no-public" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(protected animalName) {}
|
||||
public get name() {
|
||||
|
|
@ -195,7 +204,7 @@ e.g. `[ { accessibility: 'no-public', overrides: { properties: 'explicit' } } ]`
|
|||
|
||||
The following patterns are considered incorrect with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "no-public", "overrides": { "properties": "explicit" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(protected animalName) {}
|
||||
get name() {
|
||||
|
|
@ -211,7 +220,7 @@ class Animal {
|
|||
|
||||
The following patterns are considered correct with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "no-public", "overrides": { "properties": "explicit" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(protected animalName) {}
|
||||
get name() {
|
||||
|
|
@ -229,7 +238,7 @@ e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'explicit' } }
|
|||
|
||||
The following code is considered incorrect with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "explicit" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(readonly animalName: string) {}
|
||||
}
|
||||
|
|
@ -237,7 +246,7 @@ class Animal {
|
|||
|
||||
The following code patterns are considered correct with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "explicit" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(public readonly animalName: string) {}
|
||||
}
|
||||
|
|
@ -255,7 +264,7 @@ e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'no-public' }
|
|||
|
||||
The following code is considered incorrect with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "no-public" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(public readonly animalName: string) {}
|
||||
}
|
||||
|
|
@ -263,7 +272,7 @@ class Animal {
|
|||
|
||||
The following code is considered correct with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "accessibility": "off", "overrides": { "parameterProperties": "no-public" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(public animalName: string) {}
|
||||
}
|
||||
|
|
@ -277,7 +286,7 @@ As no checks on the overridden member type are performed all permutations of vis
|
|||
|
||||
The follow pattern is considered incorrect for the given configuration
|
||||
|
||||
```ts
|
||||
```ts option='{ "overrides": { "accessors" : "off" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
constructor(protected animalName) {}
|
||||
public get name() {
|
||||
|
|
@ -291,7 +300,7 @@ class Animal {
|
|||
|
||||
The following patterns are considered correct with the example override
|
||||
|
||||
```ts
|
||||
```ts option='{ "overrides": { "accessors" : "off" } }' showPlaygroundButton
|
||||
class Animal {
|
||||
public constructor(protected animalName) {}
|
||||
public get name() {
|
||||
|
|
@ -308,7 +317,7 @@ class Animal {
|
|||
If you want to ignore some specific methods, you can do it by specifying method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly.
|
||||
e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]`
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoredMethodNames": ["specificMethod", "whateverMethod"] }' showPlaygroundButton
|
||||
class Animal {
|
||||
get specificMethod() {
|
||||
console.log('No error because you specified this method on option');
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ Examples of code for this rule with `{ allowArgumentsExplicitlyTypedAsAny: false
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
|
||||
export const func = (value: any): number => value + 1;
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
|
||||
export const func = (value: number): number => value + 1;
|
||||
```
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
|
||||
export const func = (value: number) => ({ type: 'X', value });
|
||||
export const foo = () => ({
|
||||
bar: true,
|
||||
|
|
@ -130,12 +130,12 @@ export const bar = () => 1;
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
export const func = (value: number) => ({ type: 'X', value } as const);
|
||||
```ts option='{ "allowArgumentsExplicitlyTypedAsAny": false }'
|
||||
export const func = (value: number) => ({ type: 'X', value }) as const;
|
||||
export const foo = () =>
|
||||
({
|
||||
bar: true,
|
||||
} as const);
|
||||
}) as const;
|
||||
export const bar = () => 1 as const;
|
||||
```
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ Examples of code for this rule with `{ allowHigherOrderFunctions: false }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowHigherOrderFunctions": false }'
|
||||
export const arrowFn = () => () => {};
|
||||
|
||||
export function fn() {
|
||||
|
|
@ -176,7 +176,7 @@ export function foo(outer: string) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowHigherOrderFunctions": false }'
|
||||
export const arrowFn = () => (): void => {};
|
||||
|
||||
export function fn() {
|
||||
|
|
@ -196,7 +196,7 @@ Examples of code for this rule with `{ allowTypedFunctionExpressions: false }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTypedFunctionExpressions": false }'
|
||||
export let arrowFn = () => 'test';
|
||||
|
||||
export let funcExpr = function () {
|
||||
|
|
@ -212,7 +212,7 @@ export const foo = bar => {};
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTypedFunctionExpressions": false }'
|
||||
type FuncType = () => string;
|
||||
|
||||
export let arrowFn: FuncType = () => 'test';
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@ In addition to the options supported by the `lines-between-class-members` rule i
|
|||
|
||||
Examples of **correct** code for the `{ "exceptAfterOverload": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": true }]*/
|
||||
|
||||
```ts option='"always", { "exceptAfterOverload": true }' showPlaygroundButton
|
||||
class foo {
|
||||
bar(a: string): void;
|
||||
bar(a: string, b: string): void;
|
||||
|
|
@ -42,9 +40,7 @@ class foo {
|
|||
|
||||
Examples of **correct** code for the `{ "exceptAfterOverload": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": false }]*/
|
||||
|
||||
```ts option='"always", { "exceptAfterOverload": false }' showPlaygroundButton
|
||||
class foo {
|
||||
bar(a: string): void;
|
||||
|
||||
|
|
|
|||
10
node_modules/@typescript-eslint/eslint-plugin/docs/rules/max-params.md
generated
vendored
Normal file
10
node_modules/@typescript-eslint/eslint-plugin/docs/rules/max-params.md
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
description: 'Enforce a maximum number of parameters in function definitions.'
|
||||
---
|
||||
|
||||
> 🛑 This file is source code, not the primary documentation location! 🛑
|
||||
>
|
||||
> See **https://typescript-eslint.io/rules/max-params** for documentation.
|
||||
|
||||
This rule extends the base [`eslint/max-params`](https://eslint.org/docs/rules/max-params) rule.
|
||||
This version adds support for TypeScript `this` parameters so they won't be counted as a parameter.
|
||||
68
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
68
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
|
|
@ -256,7 +256,7 @@ It also ignores accessibility and scope.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
interface Foo {
|
||||
B: string; // -> field
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ interface Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
type Foo = {
|
||||
B: string; // -> field
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ type Foo = {
|
|||
};
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
class Foo {
|
||||
private C: string; // -> field
|
||||
public D: string; // -> field
|
||||
|
|
@ -295,7 +295,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
const Foo = class {
|
||||
private C: string; // -> field
|
||||
public D: string; // -> field
|
||||
|
|
@ -313,7 +313,7 @@ const Foo = class {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
interface Foo {
|
||||
[Z: string]: any; // -> signature
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ interface Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
type Foo = {
|
||||
// no signature
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ type Foo = {
|
|||
};
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
class Foo {
|
||||
[Z: string]: any; // -> signature
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["signature", "method", "constructor", "field"] }'
|
||||
const Foo = class {
|
||||
[Z: string]: any; // -> signature
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ It doesn't apply to interfaces or type literals as accessibility and scope are n
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-instance-method", "public-static-field"] }'
|
||||
class Foo {
|
||||
private C: string; // (irrelevant)
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-instance-method", "public-static-field"] }'
|
||||
const Foo = class {
|
||||
private C: string; // (irrelevant)
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ const Foo = class {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-instance-method", "public-static-field"] }'
|
||||
class Foo {
|
||||
public B(): void {} // -> public instance method
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-instance-method", "public-static-field"] }'
|
||||
const Foo = class {
|
||||
public B(): void {} // -> public instance method
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ It doesn't apply to interfaces or type literals as accessibility and scope are n
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-static-field", "static-field", "instance-field"] }'
|
||||
class Foo {
|
||||
private E: string; // -> instance field
|
||||
|
||||
|
|
@ -499,7 +499,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-static-field", "static-field", "instance-field"] }'
|
||||
const foo = class {
|
||||
public T(): void {} // method (irrelevant)
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ const foo = class {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-static-field", "static-field", "instance-field"] }'
|
||||
class Foo {
|
||||
public static A: string; // -> public static field
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ class Foo {
|
|||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": ["public-static-field", "static-field", "instance-field"] }'
|
||||
const foo = class {
|
||||
[Z: string]: any; // -> signature (irrelevant)
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ Default settings will be used for class declarations and all other syntax constr
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "classes": ["method", "constructor", "field"] }'
|
||||
class Foo {
|
||||
private C: string; // -> field
|
||||
public D: string; // -> field
|
||||
|
|
@ -589,7 +589,7 @@ class Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "classes": ["method", "constructor", "field"] }'
|
||||
class Foo {
|
||||
public static A(): void {} // -> method
|
||||
public B(): void {} // -> method
|
||||
|
|
@ -624,7 +624,7 @@ Default settings will be used for class declarations and all other syntax constr
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "classExpressions": ["method", "constructor", "field"] }'
|
||||
const foo = class {
|
||||
private C: string; // -> field
|
||||
public D: string; // -> field
|
||||
|
|
@ -639,7 +639,7 @@ const foo = class {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "classExpressions": ["method", "constructor", "field"] }'
|
||||
const foo = class {
|
||||
public static A(): void {} // -> method
|
||||
public B(): void {} // -> method
|
||||
|
|
@ -678,7 +678,7 @@ These member types are the only ones allowed for `interfaces`.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "interfaces": ["signature", "method", "constructor", "field"] }'
|
||||
interface Foo {
|
||||
B: string; // -> field
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ interface Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "interfaces": ["signature", "method", "constructor", "field"] }'
|
||||
interface Foo {
|
||||
[Z: string]: any; // -> signature
|
||||
|
||||
|
|
@ -730,7 +730,7 @@ These member types are the only ones allowed for `typeLiterals`.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "typeLiterals": ["signature", "method", "constructor", "field"] }'
|
||||
type Foo = {
|
||||
B: string; // -> field
|
||||
|
||||
|
|
@ -744,7 +744,7 @@ type Foo = {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "typeLiterals": ["signature", "method", "constructor", "field"] }'
|
||||
type Foo = {
|
||||
[Z: string]: any; // -> signature
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically"}}'
|
||||
interface Foo {
|
||||
a: x;
|
||||
B: x;
|
||||
|
|
@ -800,7 +800,7 @@ interface Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically"}}'
|
||||
interface Foo {
|
||||
B: x;
|
||||
a: x;
|
||||
|
|
@ -840,7 +840,7 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically-case-insensitive"}}'
|
||||
interface Foo {
|
||||
B: x;
|
||||
a: x;
|
||||
|
|
@ -854,7 +854,7 @@ interface Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically-case-insensitive"}}'
|
||||
interface Foo {
|
||||
a: x;
|
||||
B: x;
|
||||
|
|
@ -887,7 +887,7 @@ It ignores any member group types completely by specifying `"never"` for `member
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "memberTypes": "never", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
static c = 0;
|
||||
b(): void;
|
||||
|
|
@ -901,7 +901,7 @@ interface Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "memberTypes": "never", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
a: boolean;
|
||||
b(): void;
|
||||
|
|
@ -940,7 +940,7 @@ This config places all optional members before all required members:
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "optionalityOrder": "optional-first", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
a: boolean;
|
||||
b?: number;
|
||||
|
|
@ -950,7 +950,7 @@ interface Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "optionalityOrder": "optional-first", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
b?: number;
|
||||
a: boolean;
|
||||
|
|
@ -983,7 +983,7 @@ This config places all required members before all optional members:
|
|||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "optionalityOrder": "required-first", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
a: boolean;
|
||||
b?: number;
|
||||
|
|
@ -993,7 +993,7 @@ interface Foo {
|
|||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "default": { "optionalityOrder": "required-first", "order": "alphabetically" } }'
|
||||
interface Foo {
|
||||
a: boolean;
|
||||
c: string;
|
||||
|
|
|
|||
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md
generated
vendored
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md
generated
vendored
|
|
@ -46,7 +46,7 @@ Examples of code with `property` option.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='"property"'
|
||||
interface T1 {
|
||||
func(arg: string): number;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ interface T3 {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='"property"'
|
||||
interface T1 {
|
||||
func: (arg: string) => number;
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ Examples of code with `method` option.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='"method"'
|
||||
interface T1 {
|
||||
func: (arg: string) => number;
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ type T2 = {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='"method"'
|
||||
interface T1 {
|
||||
func(arg: string): number;
|
||||
}
|
||||
|
|
|
|||
3
node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md
generated
vendored
3
node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md
generated
vendored
|
|
@ -216,6 +216,9 @@ Individual Selectors match specific, well-defined sets. There is no overlap betw
|
|||
- `function` - matches any named function declaration or named function expression.
|
||||
- Allowed `modifiers`: `async`, `exported`, `global`, `unused`.
|
||||
- Allowed `types`: none.
|
||||
- `import` - matches namespace imports and default imports (i.e. does not match named imports).
|
||||
- Allowed `modifiers`: `default`, `namespace`.
|
||||
- Allowed `types`: none.
|
||||
- `interface` - matches any interface declaration.
|
||||
- Allowed `modifiers`: `exported`, `unused`.
|
||||
- Allowed `types`: none.
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md
generated
vendored
|
|
@ -14,8 +14,6 @@ It adds support for the generically typed `Array` constructor (`new Array<Foo>()
|
|||
### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/*eslint no-array-constructor: "error"*/
|
||||
|
||||
Array(0, 1, 2);
|
||||
new Array(0, 1, 2);
|
||||
```
|
||||
|
|
@ -23,8 +21,6 @@ new Array(0, 1, 2);
|
|||
### ✅ Correct
|
||||
|
||||
```ts
|
||||
/*eslint no-array-constructor: "error"*/
|
||||
|
||||
Array<number>(0, 1, 2);
|
||||
new Array<Foo>(x, y, z);
|
||||
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md
generated
vendored
|
|
@ -65,7 +65,7 @@ There are some types missing `toString()` in old version TypeScript, like `RegEx
|
|||
|
||||
The following patterns are considered correct with the default options `{ ignoredTypeNames: ["RegExp"] }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoredTypeNames": ["RegExp"] }' showPlaygroundButton
|
||||
`${/regex/}`;
|
||||
'' + /regex/;
|
||||
/regex/.toString();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ Especially when using Prettier formatter, which spreads such code across 3 lines
|
|||
|
||||
Examples of additional **correct** code with this option enabled:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreArrowShorthand": true }' showPlaygroundButton
|
||||
promise.then(value => window.postMessage(value));
|
||||
```
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ It also enables a suggestion fix to wrap the void expression with `void` operato
|
|||
|
||||
Examples of additional **correct** code with this option enabled:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreVoidOperator": true }' showPlaygroundButton
|
||||
// now it's obvious that we don't expect any response
|
||||
promise.then(value => void window.postMessage(value));
|
||||
|
||||
|
|
|
|||
7
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md
generated
vendored
7
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md
generated
vendored
|
|
@ -5,6 +5,9 @@ This rule has been deprecated in favour of the [`import/no-duplicates`](https://
|
|||
:::
|
||||
|
||||
<!--
|
||||
This doc file has been left on purpose because `import/no-duplicates` is commonly requested.
|
||||
This exists to help direct people to the replacement rule.
|
||||
This doc file has been left on purpose because `import/no-duplicates` is
|
||||
commonly requested. This exists to help direct people to the replacement rule.
|
||||
|
||||
Note that there is no actual way to get to this page in the normal navigation,
|
||||
so end-users will only be able to get to this page from the search bar.
|
||||
-->
|
||||
|
|
|
|||
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md
generated
vendored
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md
generated
vendored
|
|
@ -39,7 +39,7 @@ const defaultOptions: Options = {
|
|||
|
||||
Examples of correct code for the `{ "allow": ["private-constructors"] }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["private-constructors"] }' showPlaygroundButton
|
||||
class Foo {
|
||||
private constructor() {}
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ class Foo {
|
|||
|
||||
Examples of correct code for the `{ "allow": ["protected-constructors"] }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["protected-constructors"] }' showPlaygroundButton
|
||||
class Foo {
|
||||
protected constructor() {}
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class Foo {
|
|||
|
||||
Examples of correct code for the `{ "allow": ["decoratedFunctions"] }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["decoratedFunctions"] }' showPlaygroundButton
|
||||
@decorator()
|
||||
function foo() {}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ class Foo {
|
|||
|
||||
Examples of correct code for the `{ "allow": ["overrideMethods"] }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["overrideMethods"] }' showPlaygroundButton
|
||||
abstract class Base {
|
||||
protected greet(): void {
|
||||
console.log('Hello!');
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md
generated
vendored
|
|
@ -100,9 +100,7 @@ A boolean to specify if arrays from the rest operator are considered okay. `fals
|
|||
|
||||
The examples below are **incorrect** when `{ignoreRestArgs: false}`, but **correct** when `{ignoreRestArgs: true}`.
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": false }]*/
|
||||
|
||||
```ts option='{ "ignoreRestArgs": false }' showPlaygroundButton
|
||||
function foo1(...args: any[]): void {}
|
||||
function foo2(...args: readonly any[]): void {}
|
||||
function foo3(...args: Array<any>): void {}
|
||||
|
|
|
|||
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md
generated
vendored
|
|
@ -205,13 +205,13 @@ The rule's options each add an exemption for a specific type of class.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConstructorOnly": true }'
|
||||
class NoFields {}
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConstructorOnly": true }'
|
||||
class NoFields {
|
||||
constructor() {
|
||||
console.log('Hello, world!');
|
||||
|
|
@ -227,7 +227,7 @@ The `allowEmpty` option adds an exemption for classes that are entirely empty.
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowEmpty": true }'
|
||||
class NoFields {
|
||||
constructor() {
|
||||
console.log('Hello, world!');
|
||||
|
|
@ -237,7 +237,7 @@ class NoFields {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowEmpty": true }'
|
||||
class NoFields {}
|
||||
```
|
||||
|
||||
|
|
@ -254,13 +254,13 @@ It works against this rule's primary purpose of discouraging classes used only f
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowStaticOnly": true }'
|
||||
class EmptyClass {}
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowStaticOnly": true }'
|
||||
class NotEmptyClass {
|
||||
static version = 42;
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ The `allowWithDecorator` option adds an exemption for classes that contain a mem
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowWithDecorator": true }'
|
||||
class Constants {
|
||||
static readonly version = 42;
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ class Constants {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowWithDecorator": true }'
|
||||
class Constants {
|
||||
@logOnRead()
|
||||
static readonly version = 42;
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md
generated
vendored
|
|
@ -70,7 +70,7 @@ This can be a good way to explicitly mark a promise as intentionally not awaited
|
|||
|
||||
Examples of **correct** code for this rule with `{ ignoreVoid: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreVoid": true }' showPlaygroundButton
|
||||
async function returnsPromise() {
|
||||
return 'value';
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ This allows you to skip checking of async IIFEs (Immediately Invoked function Ex
|
|||
|
||||
Examples of **correct** code for this rule with `{ ignoreIIFE: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreIIFE": true }' showPlaygroundButton
|
||||
await(async function () {
|
||||
await res(1);
|
||||
})();
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md
generated
vendored
|
|
@ -78,7 +78,7 @@ function fn(a = 5, b = true) {}
|
|||
|
||||
When set to true, the following pattern is considered valid:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreParameters": true }' showPlaygroundButton
|
||||
function foo(a: number = 5, b: boolean = true) {
|
||||
// ...
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ function foo(a: number = 5, b: boolean = true) {
|
|||
|
||||
When set to true, the following pattern is considered valid:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreProperties": true }' showPlaygroundButton
|
||||
class Foo {
|
||||
prop: number = 5;
|
||||
}
|
||||
|
|
|
|||
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md
generated
vendored
8
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md
generated
vendored
|
|
@ -66,7 +66,7 @@ This option is `true` by default.
|
|||
|
||||
The following patterns are considered warnings with `{ allowInGenericTypeArguments: false }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowInGenericTypeArguments": false }' showPlaygroundButton
|
||||
logAndReturn<void>(undefined);
|
||||
|
||||
let voidPromise: Promise<void> = new Promise<void>(() => {});
|
||||
|
|
@ -75,7 +75,7 @@ let voidMap: Map<string, void> = new Map<string, void>();
|
|||
|
||||
The following patterns are considered warnings with `{ allowInGenericTypeArguments: ['Ex.Mx.Tx'] }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowInGenericTypeArguments": ["Ex.Mx.Tx"] }' showPlaygroundButton
|
||||
logAndReturn<void>(undefined);
|
||||
|
||||
type NotAllowedVoid1 = Mx.Tx<void>;
|
||||
|
|
@ -85,7 +85,7 @@ type NotAllowedVoid3 = Promise<void>;
|
|||
|
||||
The following patterns are not considered warnings with `{ allowInGenericTypeArguments: ['Ex.Mx.Tx'] }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowInGenericTypeArguments": ["Ex.Mx.Tx"] }' showPlaygroundButton
|
||||
type AllowedVoid = Ex.Mx.Tx<void>;
|
||||
type AllowedVoidUnion = void | Ex.Mx.Tx<void>;
|
||||
```
|
||||
|
|
@ -99,7 +99,7 @@ This option is `false` by default.
|
|||
|
||||
The following patterns are considered warnings with `{ allowAsThisParameter: false }` but valid with `{ allowAsThisParameter: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAsThisParameter": false }' showPlaygroundButton
|
||||
function doThing(this: void) {}
|
||||
class Example {
|
||||
static helper(this: void) {}
|
||||
|
|
|
|||
32
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md
generated
vendored
32
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md
generated
vendored
|
|
@ -40,9 +40,7 @@ A boolean to specify if enums used in TypeScript are considered okay. `false` by
|
|||
|
||||
Examples of **incorrect** code for the `{ "ignoreEnums": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": false }]*/
|
||||
|
||||
```ts option='{ "ignoreEnums": false }' showPlaygroundButton
|
||||
enum foo {
|
||||
SECOND = 1000,
|
||||
}
|
||||
|
|
@ -50,9 +48,7 @@ enum foo {
|
|||
|
||||
Examples of **correct** code for the `{ "ignoreEnums": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": true }]*/
|
||||
|
||||
```ts option='{ "ignoreEnums": true }' showPlaygroundButton
|
||||
enum foo {
|
||||
SECOND = 1000,
|
||||
}
|
||||
|
|
@ -64,17 +60,13 @@ A boolean to specify if numbers used in TypeScript numeric literal types are con
|
|||
|
||||
Examples of **incorrect** code for the `{ "ignoreNumericLiteralTypes": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreNumericLiteralTypes": false }]*/
|
||||
|
||||
```ts option='{ "ignoreNumericLiteralTypes": false }' showPlaygroundButton
|
||||
type SmallPrimes = 2 | 3 | 5 | 7 | 11;
|
||||
```
|
||||
|
||||
Examples of **correct** code for the `{ "ignoreNumericLiteralTypes": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreNumericLiteralTypes": true }]*/
|
||||
|
||||
```ts option='{ "ignoreNumericLiteralTypes": true }' showPlaygroundButton
|
||||
type SmallPrimes = 2 | 3 | 5 | 7 | 11;
|
||||
```
|
||||
|
||||
|
|
@ -82,9 +74,7 @@ type SmallPrimes = 2 | 3 | 5 | 7 | 11;
|
|||
|
||||
Examples of **incorrect** code for the `{ "ignoreReadonlyClassProperties": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": false }]*/
|
||||
|
||||
```ts option='{ "ignoreReadonlyClassProperties": false }' showPlaygroundButton
|
||||
class Foo {
|
||||
readonly A = 1;
|
||||
readonly B = 2;
|
||||
|
|
@ -95,9 +85,7 @@ class Foo {
|
|||
|
||||
Examples of **correct** code for the `{ "ignoreReadonlyClassProperties": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": true }]*/
|
||||
|
||||
```ts option='{ "ignoreReadonlyClassProperties": true }' showPlaygroundButton
|
||||
class Foo {
|
||||
readonly A = 1;
|
||||
readonly B = 2;
|
||||
|
|
@ -112,18 +100,14 @@ A boolean to specify if numbers used to index types are okay. `false` by default
|
|||
|
||||
Examples of **incorrect** code for the `{ "ignoreTypeIndexes": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreTypeIndexes": false }]*/
|
||||
|
||||
```ts option='{ "ignoreTypeIndexes": false }' showPlaygroundButton
|
||||
type Foo = Bar[0];
|
||||
type Baz = Parameters<Foo>[2];
|
||||
```
|
||||
|
||||
Examples of **correct** code for the `{ "ignoreTypeIndexes": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreTypeIndexes": true }]*/
|
||||
|
||||
```ts option='{ "ignoreTypeIndexes": true }' showPlaygroundButton
|
||||
type Foo = Bar[0];
|
||||
type Baz = Parameters<Foo>[2];
|
||||
```
|
||||
|
|
|
|||
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md
generated
vendored
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md
generated
vendored
|
|
@ -40,7 +40,7 @@ Examples of code for this rule with `checksConditionals: true`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksConditionals": true }'
|
||||
const promise = Promise.resolve('value');
|
||||
|
||||
if (promise) {
|
||||
|
|
@ -56,7 +56,7 @@ while (promise) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksConditionals": true }'
|
||||
const promise = Promise.resolve('value');
|
||||
|
||||
// Always `await` the Promise in a conditional
|
||||
|
|
@ -120,7 +120,7 @@ Examples of code for this rule with `checksVoidReturn: true`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksVoidReturn": true }'
|
||||
[1, 2, 3].forEach(async value => {
|
||||
await doSomething(value);
|
||||
});
|
||||
|
|
@ -140,7 +140,7 @@ eventEmitter.on('some-event', async () => {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksVoidReturn": true }'
|
||||
// for-of puts `await` in outer context
|
||||
for (const value of [1, 2, 3]) {
|
||||
await doSomething(value);
|
||||
|
|
@ -203,7 +203,7 @@ Examples of code for this rule with `checksSpreads: true`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksSpreads": true }'
|
||||
const getData = () => someAsyncOperation({ myArg: 'foo' });
|
||||
|
||||
return { foo: 42, ...getData() };
|
||||
|
|
@ -217,7 +217,7 @@ return { foo: 42, ...getData2() };
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "checksSpreads": true }'
|
||||
const getData = () => someAsyncOperation({ myArg: 'foo' });
|
||||
|
||||
return { foo: 42, ...(await getData()) };
|
||||
|
|
|
|||
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md
generated
vendored
12
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md
generated
vendored
|
|
@ -48,14 +48,14 @@ Examples of code with the `{ "allowDeclarations": true }` option:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDeclarations": true }'
|
||||
module foo {}
|
||||
namespace foo {}
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDeclarations": true }'
|
||||
declare module 'foo' {}
|
||||
declare module foo {}
|
||||
declare namespace foo {}
|
||||
|
|
@ -77,7 +77,7 @@ Examples of code for the `{ "allowDeclarations": false }` option:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDeclarations": false }'
|
||||
module foo {}
|
||||
namespace foo {}
|
||||
declare module foo {}
|
||||
|
|
@ -86,7 +86,7 @@ declare namespace foo {}
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDeclarations": false }'
|
||||
declare module 'foo' {}
|
||||
```
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ Examples of code for the `{ "allowDefinitionFiles": true }` option:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDefinitionFiles": true }'
|
||||
// if outside a d.ts file
|
||||
module foo {}
|
||||
namespace foo {}
|
||||
|
|
@ -112,7 +112,7 @@ declare namespace foo {}
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowDefinitionFiles": true }'
|
||||
declare module 'foo' {}
|
||||
|
||||
// anything inside a d.ts file
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md
generated
vendored
|
|
@ -42,7 +42,7 @@ When set to `true`, the rule will ignore declaration merges between the followin
|
|||
|
||||
Examples of **correct** code with `{ ignoreDeclarationMerge: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreDeclarationMerge": true }' showPlaygroundButton
|
||||
interface A {
|
||||
prop1: 1;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ namespace Baz {}
|
|||
Declaring a variable and a type and a variable the same is usually an accident, and it can lead to hard-to-understand code.
|
||||
If you have a rare case where you're intentionally naming a type the same name as a variable, use a disable comment. For example:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreDeclarationMerge": true }' showPlaygroundButton
|
||||
type something = string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare -- intentionally naming the variable the same as the type
|
||||
const something = 2;
|
||||
|
|
|
|||
38
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md
generated
vendored
38
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md
generated
vendored
|
|
@ -6,7 +6,7 @@ description: 'Disallow specified modules when loaded by `import`.'
|
|||
>
|
||||
> See **https://typescript-eslint.io/rules/no-restricted-imports** for documentation.
|
||||
|
||||
This rule extends the base [`eslint/no-restricted-imports`](https://eslint.org/docs/rules/no-restricted-imports) rule.
|
||||
This rule extends the base [`eslint/no-restricted-imports`](https://eslint.org/docs/rules/no-restricted-imports) rule. It adds support for the type import (`import type X from "..."`, `import { type X } from "..."`) and `import x = require("...")` syntaxes.
|
||||
|
||||
## Options
|
||||
|
||||
|
|
@ -19,17 +19,27 @@ This rule adds the following options:
|
|||
You can specify this option for a specific path or pattern as follows:
|
||||
|
||||
```jsonc
|
||||
"@typescript-eslint/no-restricted-imports": ["error", {
|
||||
"paths": [{
|
||||
"name": "import-foo",
|
||||
"message": "Please use import-bar instead.",
|
||||
"allowTypeImports": true
|
||||
}, {
|
||||
"name": "import-baz",
|
||||
"message": "Please use import-quux instead.",
|
||||
"allowTypeImports": true
|
||||
}]
|
||||
}]
|
||||
{
|
||||
"rules": {
|
||||
"@typescript-eslint/no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
"paths": [
|
||||
{
|
||||
"name": "import-foo",
|
||||
"message": "Please use import-bar instead.",
|
||||
"allowTypeImports": true
|
||||
},
|
||||
{
|
||||
"name": "import-baz",
|
||||
"message": "Please use import-quux instead.",
|
||||
"allowTypeImports": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When set to `true`, the rule will allow [Type-Only Imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export).
|
||||
|
|
@ -40,7 +50,7 @@ Examples of code with the above config:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{"paths":[{"name":"import-foo","message":"Please use import-bar instead.","allowTypeImports":true},{"name":"import-baz","message":"Please use import-quux instead.","allowTypeImports":true}]}'
|
||||
import foo from 'import-foo';
|
||||
export { Foo } from 'import-foo';
|
||||
|
||||
|
|
@ -50,7 +60,7 @@ export { Baz } from 'import-baz';
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{"paths":[{"name":"import-foo","message":"Please use import-bar instead.","allowTypeImports":true},{"name":"import-baz","message":"Please use import-quux instead.","allowTypeImports":true}]}'
|
||||
import { foo } from 'other-module';
|
||||
|
||||
import type foo from 'import-foo';
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md
generated
vendored
|
|
@ -34,7 +34,7 @@ TypeScript allows types and variables to shadow one-another. This is generally s
|
|||
|
||||
Examples of **correct** code with `{ ignoreTypeValueShadow: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreTypeValueShadow": true }' showPlaygroundButton
|
||||
type Foo = number;
|
||||
const Foo = 1;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ If you do not use the `typeof` operator in a function type return type position,
|
|||
|
||||
Examples of **correct** code with `{ ignoreFunctionTypeParameterNameValueShadow: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreFunctionTypeParameterNameValueShadow": true }' showPlaygroundButton
|
||||
const test = 1;
|
||||
type Func = (test: string) => typeof test;
|
||||
```
|
||||
|
|
|
|||
66
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md
generated
vendored
66
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md
generated
vendored
|
|
@ -112,7 +112,7 @@ The setting accepts the following values:
|
|||
|
||||
Examples of **correct** code for the `{ "allowAliases": "always" }` options:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "always" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a';
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ type Foo = Bar & Baz;
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowAliases": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-unions" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a';
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ type Foo = Bar & Baz;
|
|||
|
||||
Examples of **correct** code for the `{ "allowAliases": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-unions" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a' | 'b';
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ type Foo = Bar | Baz;
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowAliases": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-intersections" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a';
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ type Foo = Bar | Baz;
|
|||
|
||||
Examples of **correct** code for the `{ "allowAliases": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-intersections" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = string & string[];
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ type Foo = Bar & Baz;
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowAliases": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a';
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ type Foo = Bar;
|
|||
|
||||
Examples of **correct** code for the `{ "allowAliases": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowAliases": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
// primitives
|
||||
type Foo = 'a' | 'b';
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ The setting accepts the following values:
|
|||
|
||||
Examples of **correct** code for the `{ "allowCallbacks": "always" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowCallbacks": "always" }' showPlaygroundButton
|
||||
type Foo = () => void;
|
||||
|
||||
type Foo = (name: string) => string;
|
||||
|
|
@ -281,7 +281,7 @@ This applies to conditional types.
|
|||
|
||||
Examples of **correct** code for the `{ "allowConditionalTypes": "always" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConditionalTypes": "always" }' showPlaygroundButton
|
||||
type Foo<T> = T extends number ? number : null;
|
||||
```
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ The setting accepts the following values:
|
|||
|
||||
Examples of **correct** code for the `{ "allowConstructors": "always" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConstructors": "always" }' showPlaygroundButton
|
||||
type Foo = new () => void;
|
||||
```
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ The setting accepts the following options:
|
|||
|
||||
Examples of **correct** code for the `{ "allowLiterals": "always" }` options:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "always" }' showPlaygroundButton
|
||||
type Foo = {};
|
||||
|
||||
type Foo = {
|
||||
|
|
@ -333,7 +333,7 @@ type Foo = { name: string } & { age: number };
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowLiterals": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-unions" }' showPlaygroundButton
|
||||
type Foo = {};
|
||||
|
||||
type Foo = {
|
||||
|
|
@ -352,13 +352,13 @@ type Foo = { name: string } & { age: number };
|
|||
|
||||
Examples of **correct** code for the `{ "allowLiterals": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-unions" }' showPlaygroundButton
|
||||
type Foo = { name: string } | { age: number };
|
||||
```
|
||||
|
||||
Examples of **incorrect** code for the `{ "allowLiterals": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-intersections" }' showPlaygroundButton
|
||||
type Foo = {};
|
||||
|
||||
type Foo = {
|
||||
|
|
@ -377,13 +377,13 @@ type Foo = { name: string } | { age: number };
|
|||
|
||||
Examples of **correct** code for the `{ "allowLiterals": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-intersections" }' showPlaygroundButton
|
||||
type Foo = { name: string } & { age: number };
|
||||
```
|
||||
|
||||
Examples of **incorrect** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo = {};
|
||||
|
||||
type Foo = {
|
||||
|
|
@ -400,7 +400,7 @@ type Foo = {
|
|||
|
||||
Examples of **correct** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowLiterals": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo = { name: string } | { age: number };
|
||||
|
||||
type Foo = { name: string } & { age: number };
|
||||
|
|
@ -419,7 +419,7 @@ The setting accepts the following values:
|
|||
|
||||
Examples of **correct** code for the `{ "allowMappedTypes": "always" }` options:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "always" }' showPlaygroundButton
|
||||
type Foo<T> = { readonly [P in keyof T]: T[P] };
|
||||
|
||||
type Foo<T> = { [P in keyof T]?: T[P] };
|
||||
|
|
@ -439,7 +439,7 @@ type Foo<T, U> = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] };
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowMappedTypes": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-unions" }' showPlaygroundButton
|
||||
type Foo<T> = { readonly [P in keyof T]: T[P] };
|
||||
|
||||
type Foo<T> = { [P in keyof T]?: T[P] };
|
||||
|
|
@ -453,7 +453,7 @@ type Foo<T, U> = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] };
|
|||
|
||||
Examples of **correct** code for the `{ "allowMappedTypes": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-unions" }' showPlaygroundButton
|
||||
type Foo<T, U> =
|
||||
| { readonly [P in keyof T]: T[P] }
|
||||
| { readonly [P in keyof U]: U[P] };
|
||||
|
|
@ -463,7 +463,7 @@ type Foo<T, U> = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] };
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowMappedTypes": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-intersections" }' showPlaygroundButton
|
||||
type Foo<T> = { readonly [P in keyof T]: T[P] };
|
||||
|
||||
type Foo<T> = { [P in keyof T]?: T[P] };
|
||||
|
|
@ -477,7 +477,7 @@ type Foo<T, U> = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] };
|
|||
|
||||
Examples of **correct** code for the `{ "allowMappedTypes": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-intersections" }' showPlaygroundButton
|
||||
type Foo<T, U> = { readonly [P in keyof T]: T[P] } & {
|
||||
readonly [P in keyof U]: U[P];
|
||||
};
|
||||
|
|
@ -487,7 +487,7 @@ type Foo<T, U> = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] };
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowMappedTypes": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo<T> = { readonly [P in keyof T]: T[P] };
|
||||
|
||||
type Foo<T> = { [P in keyof T]?: T[P] };
|
||||
|
|
@ -495,7 +495,7 @@ type Foo<T> = { [P in keyof T]?: T[P] };
|
|||
|
||||
Examples of **correct** code for the `{ "allowMappedTypes": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowMappedTypes": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo<T, U> =
|
||||
| { readonly [P in keyof T]: T[P] }
|
||||
| { readonly [P in keyof U]: U[P] };
|
||||
|
|
@ -522,7 +522,7 @@ The setting accepts the following options:
|
|||
|
||||
Examples of **correct** code for the `{ "allowTupleTypes": "always" }` options:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "always" }' showPlaygroundButton
|
||||
type Foo = [number];
|
||||
|
||||
type Foo = [number] | [number, number];
|
||||
|
|
@ -534,7 +534,7 @@ type Foo = [number] | ([number, number] & [string, string]);
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-unions" }' showPlaygroundButton
|
||||
type Foo = [number];
|
||||
|
||||
type Foo = [number] & [number, number];
|
||||
|
|
@ -544,7 +544,7 @@ type Foo = [string] & [number];
|
|||
|
||||
Examples of **correct** code for the `{ "allowTupleTypes": "in-unions" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-unions" }' showPlaygroundButton
|
||||
type Foo = [number] | [number, number];
|
||||
|
||||
type Foo = [string] | [number];
|
||||
|
|
@ -552,7 +552,7 @@ type Foo = [string] | [number];
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowTupleTypes": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-intersections" }' showPlaygroundButton
|
||||
type Foo = [number];
|
||||
|
||||
type Foo = [number] | [number, number];
|
||||
|
|
@ -562,7 +562,7 @@ type Foo = [string] | [number];
|
|||
|
||||
Examples of **correct** code for the `{ "allowTupleTypes": "in-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-intersections" }' showPlaygroundButton
|
||||
type Foo = [number] & [number, number];
|
||||
|
||||
type Foo = [string] & [number];
|
||||
|
|
@ -570,15 +570,15 @@ type Foo = [string] & [number];
|
|||
|
||||
Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo = [number];
|
||||
|
||||
type Foo = [string];
|
||||
```
|
||||
|
||||
Examples of **correct** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option:
|
||||
Examples of **correct** code for the `{ "allowTupleTypes": "in-unions-and-intersections" }` option:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowTupleTypes": "in-unions-and-intersections" }' showPlaygroundButton
|
||||
type Foo = [number] & [number, number];
|
||||
|
||||
type Foo = [string] | [number];
|
||||
|
|
@ -594,7 +594,7 @@ The setting accepts the following options:
|
|||
|
||||
Examples of **correct** code for the `{ "allowGenerics": "always" }` options:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowGenerics": "always" }' showPlaygroundButton
|
||||
type Foo = Bar<string>;
|
||||
|
||||
type Foo = Record<string, number>;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Examples of code for this rule with `{ allowComparingNullableBooleansToTrue: fal
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowComparingNullableBooleansToTrue": false }'
|
||||
declare const someUndefinedCondition: boolean | undefined;
|
||||
if (someUndefinedCondition === true) {
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ if (someNullCondition !== true) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowComparingNullableBooleansToTrue": false }'
|
||||
declare const someUndefinedCondition: boolean | undefined;
|
||||
if (someUndefinedCondition) {
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ Examples of code for this rule with `{ allowComparingNullableBooleansToFalse: fa
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowComparingNullableBooleansToFalse": false }'
|
||||
declare const someUndefinedCondition: boolean | undefined;
|
||||
if (someUndefinedCondition === false) {
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ if (someNullCondition !== false) {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowComparingNullableBooleansToFalse": false }'
|
||||
declare const someUndefinedCondition: boolean | undefined;
|
||||
if (someUndefinedCondition ?? true) {
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md
generated
vendored
|
|
@ -77,7 +77,7 @@ function bar(arg?: string | null) {
|
|||
|
||||
Example of correct code for `{ allowConstantLoopConditions: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowConstantLoopConditions": true }' showPlaygroundButton
|
||||
while (true) {}
|
||||
for (; true; ) {}
|
||||
do {} while (true);
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ function foo(x: number | undefined): number {
|
|||
|
||||
### `typesToIgnore`
|
||||
|
||||
With `@typescript-eslint/no-unnecessary-type-assertion: ["error", { typesToIgnore: ['Foo'] }]`, the following is **correct** code":
|
||||
With `@typescript-eslint/no-unnecessary-type-assertion: ["error", { typesToIgnore: ['Foo'] }]`, the following is **correct** code:
|
||||
|
||||
```ts
|
||||
```ts option='{ "typesToIgnore": ["Foo"] }' showPlaygroundButton
|
||||
type Foo = 3;
|
||||
const foo: Foo = 3;
|
||||
```
|
||||
|
|
|
|||
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md
generated
vendored
|
|
@ -73,8 +73,8 @@ There are cases where the rule allows passing an argument of `any` to `unknown`.
|
|||
|
||||
Example of `any` to `unknown` assignment that are allowed:
|
||||
|
||||
```ts
|
||||
declare function foo(arg1: unknown, arg2: Set<unkown>, arg3: unknown[]): void;
|
||||
```ts showPlaygroundButton
|
||||
declare function foo(arg1: unknown, arg2: Set<unknown>, arg3: unknown[]): void;
|
||||
foo(1 as any, new Set<any>(), [] as any[]);
|
||||
```
|
||||
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md
generated
vendored
|
|
@ -75,7 +75,7 @@ There are cases where the rule allows assignment of `any` to `unknown`.
|
|||
|
||||
Example of `any` to `unknown` assignment that are allowed:
|
||||
|
||||
```ts
|
||||
```ts showPlaygroundButton
|
||||
const x: unknown = y as any;
|
||||
const x: unknown[] = y as any[];
|
||||
const x: Set<unknown> = y as Set<any>;
|
||||
|
|
|
|||
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md
generated
vendored
|
|
@ -88,7 +88,7 @@ There are cases where the rule allows to return `any` to `unknown`.
|
|||
|
||||
Examples of `any` to `unknown` return that are allowed:
|
||||
|
||||
```ts
|
||||
```ts showPlaygroundButton
|
||||
function foo1(): unknown {
|
||||
return JSON.parse(singleObjString); // Return type for JSON.parse is any.
|
||||
}
|
||||
|
|
|
|||
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md
generated
vendored
|
|
@ -39,9 +39,7 @@ Examples of code for the `{ "enums": true }` option:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
/*eslint no-use-before-define: ["error", { "enums": true }]*/
|
||||
|
||||
```ts option='{ "enums": true }'
|
||||
const x = Foo.FOO;
|
||||
|
||||
enum Foo {
|
||||
|
|
@ -51,9 +49,7 @@ enum Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
/*eslint no-use-before-define: ["error", { "enums": false }]*/
|
||||
|
||||
```ts option='{ "enums": false }'
|
||||
function foo() {
|
||||
return Foo.FOO;
|
||||
}
|
||||
|
|
@ -70,9 +66,7 @@ If this is `false`, this rule will ignore references to types.
|
|||
|
||||
Examples of **correct** code for the `{ "typedefs": false }` option:
|
||||
|
||||
```ts
|
||||
/*eslint no-use-before-define: ["error", { "typedefs": false }]*/
|
||||
|
||||
```ts option='{ "typedefs": false }' showPlaygroundButton
|
||||
let myVar: StringOrNumber;
|
||||
type StringOrNumber = string | number;
|
||||
```
|
||||
|
|
@ -84,9 +78,7 @@ If this is `false`, this will will check all type references.
|
|||
|
||||
Examples of **correct** code for the `{ "ignoreTypeReferences": true }` option:
|
||||
|
||||
```ts
|
||||
/*eslint no-use-before-define: ["error", { "ignoreTypeReferences": true }]*/
|
||||
|
||||
```ts option='{ "ignoreTypeReferences": true }' showPlaygroundButton
|
||||
let var1: StringOrNumber;
|
||||
type StringOrNumber = string | number;
|
||||
|
||||
|
|
|
|||
32
node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md
generated
vendored
32
node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md
generated
vendored
|
|
@ -109,7 +109,7 @@ Examples of code for the `{ "allow": ["readonly"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["readonly"] }'
|
||||
class Foo {
|
||||
constructor(private name: string) {}
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["readonly"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ Examples of code for the `{ "allow": ["private"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["private"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["private"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ Examples of code for the `{ "allow": ["protected"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["protected"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["protected"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@ Examples of code for the `{ "allow": ["public"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["public"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["public"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ Examples of code for the `{ "allow": ["private readonly"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["private readonly"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["private readonly"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -339,7 +339,7 @@ Examples of code for the `{ "allow": ["protected readonly"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["protected readonly"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["protected readonly"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ Examples of code for the `{ "allow": ["public readonly"] }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["public readonly"] }'
|
||||
class Foo {
|
||||
constructor(readonly name: string) {}
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allow": ["public readonly"] }'
|
||||
class Foo {
|
||||
constructor(name: string) {}
|
||||
}
|
||||
|
|
@ -431,7 +431,7 @@ Examples of code for the `{ "prefer": "parameter-property" }` option:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "prefer": "parameter-property" }'
|
||||
class Foo {
|
||||
private name: string;
|
||||
constructor(name: string) {
|
||||
|
|
@ -456,7 +456,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "prefer": "parameter-property" }'
|
||||
class Foo {
|
||||
private differentName: string;
|
||||
constructor(name: string) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ Examples of code for the `{ "allowBitwiseExpressions": true }` option:
|
|||
|
||||
### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowBitwiseExpressions": true }'
|
||||
const x = 1;
|
||||
enum Foo {
|
||||
A = x << 0,
|
||||
|
|
@ -84,7 +84,7 @@ enum Foo {
|
|||
|
||||
### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowBitwiseExpressions": true }'
|
||||
enum Foo {
|
||||
A = 1 << 0,
|
||||
B = 1 >> 0,
|
||||
|
|
|
|||
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
generated
vendored
|
|
@ -26,7 +26,7 @@ Setting this option to `true` will cause the rule to ignore any ternary expressi
|
|||
|
||||
Incorrect code for `ignoreTernaryTests: false`, and correct code for `ignoreTernaryTests: true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreTernaryTests": false }' showPlaygroundButton
|
||||
const foo: any = 'bar';
|
||||
foo !== undefined && foo !== null ? foo : 'a string';
|
||||
foo === undefined || foo === null ? 'a string' : foo;
|
||||
|
|
@ -44,7 +44,7 @@ foo === null ? 'a string' : foo;
|
|||
|
||||
Correct code for `ignoreTernaryTests: false`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreTernaryTests": false }' showPlaygroundButton
|
||||
const foo: any = 'bar';
|
||||
foo ?? 'a string';
|
||||
foo ?? 'a string';
|
||||
|
|
@ -70,7 +70,7 @@ If you're looking to enforce stricter conditional tests, you should consider usi
|
|||
|
||||
Incorrect code for `ignoreConditionalTests: false`, and correct code for `ignoreConditionalTests: true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreConditionalTests": false }' showPlaygroundButton
|
||||
declare const a: string | null;
|
||||
declare const b: string | null;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ a || b ? true : false;
|
|||
|
||||
Correct code for `ignoreConditionalTests: false`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreConditionalTests": false }' showPlaygroundButton
|
||||
declare const a: string | null;
|
||||
declare const b: string | null;
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ If you're looking to enforce stricter conditional tests, you should consider usi
|
|||
|
||||
Incorrect code for `ignoreMixedLogicalExpressions: false`, and correct code for `ignoreMixedLogicalExpressions: true`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreMixedLogicalExpressions": false }' showPlaygroundButton
|
||||
declare const a: string | null;
|
||||
declare const b: string | null;
|
||||
declare const c: string | null;
|
||||
|
|
@ -127,7 +127,7 @@ a || (b && c && d);
|
|||
|
||||
Correct code for `ignoreMixedLogicalExpressions: false`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreMixedLogicalExpressions": false }' showPlaygroundButton
|
||||
declare const a: string | null;
|
||||
declare const b: string | null;
|
||||
declare const c: string | null;
|
||||
|
|
@ -153,14 +153,14 @@ If you would like to ignore expressions containing operands of certain primitive
|
|||
|
||||
Incorrect code for `ignorePrimitives: { string: false }`, and correct code for `ignorePrimitives: { string: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignorePrimitives": { "string": true } }' showPlaygroundButton
|
||||
const foo: string | undefined = 'bar';
|
||||
foo || 'a string';
|
||||
```
|
||||
|
||||
Correct code for both `ignorePrimitives: { string: false }` and `ignorePrimitives: { string: true }`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignorePrimitives": { "string": true } }' showPlaygroundButton
|
||||
const foo: string | undefined = 'bar';
|
||||
foo ?? 'a string';
|
||||
```
|
||||
|
|
|
|||
30
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
30
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
|
|
@ -68,7 +68,7 @@ When this option is `true`, the rule will not provide an auto-fixer for cases wh
|
|||
|
||||
In some cases this distinction _may_ matter - which is why these fixers are considered unsafe - they may break the build! For example in the following code:
|
||||
|
||||
```ts
|
||||
```ts option='{ "allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing": true }' showPlaygroundButton
|
||||
declare const foo: { bar: boolean } | null | undefined;
|
||||
declare function acceptsBoolean(arg: boolean): void;
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ When this option is `true` the rule will check operands that are typed as `any`
|
|||
|
||||
#### ❌ Incorrect for `checkAny: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkAny": true }'
|
||||
declare const thing: any;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -99,7 +99,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkAny: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkAny": false }'
|
||||
declare const thing: any;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -115,7 +115,7 @@ When this option is `true` the rule will check operands that are typed as `unkno
|
|||
|
||||
#### ❌ Incorrect for `checkUnknown: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkUnknown": true }'
|
||||
declare const thing: unknown;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -123,7 +123,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkUnknown: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkUnknown": false }'
|
||||
declare const thing: unknown;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -139,7 +139,7 @@ When this option is `true` the rule will check operands that are typed as `strin
|
|||
|
||||
#### ❌ Incorrect for `checkString: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkString": true }'
|
||||
declare const thing: string;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -147,7 +147,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkString: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkString": false }'
|
||||
declare const thing: string;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -163,7 +163,7 @@ When this option is `true` the rule will check operands that are typed as `numbe
|
|||
|
||||
#### ❌ Incorrect for `checkNumber: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkNumber": true }'
|
||||
declare const thing: number;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -171,7 +171,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkNumber: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkNumber": false }'
|
||||
declare const thing: number;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -187,7 +187,7 @@ When this option is `true` the rule will check operands that are typed as `boole
|
|||
|
||||
#### ❌ Incorrect for `checkBoolean: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkBoolean": true }'
|
||||
declare const thing: boolean;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -195,7 +195,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkBoolean: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkBoolean": false }'
|
||||
declare const thing: boolean;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -211,7 +211,7 @@ When this option is `true` the rule will check operands that are typed as `bigin
|
|||
|
||||
#### ❌ Incorrect for `checkBigInt: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkBigInt": true }'
|
||||
declare const thing: bigint;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -219,7 +219,7 @@ thing && thing.toString();
|
|||
|
||||
#### ✅ Correct for `checkBigInt: false`
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkBigInt": false }'
|
||||
declare const thing: bigint;
|
||||
|
||||
thing && thing.toString();
|
||||
|
|
@ -235,14 +235,14 @@ When this option is `true` the rule will skip operands that are not typed with `
|
|||
|
||||
#### ❌ Incorrect for `requireNullish: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "requireNullish": true }'
|
||||
declare const thing1: string | null;
|
||||
thing1 && thing1.toString();
|
||||
```
|
||||
|
||||
#### ✅ Correct for `requireNullish: true`
|
||||
|
||||
```ts
|
||||
```ts option='{ "requireNullish": true }'
|
||||
declare const thing1: string | null;
|
||||
thing1?.toString();
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ Examples of code for this rule with:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
|
||||
interface ThisIsMutable {
|
||||
prop: string;
|
||||
}
|
||||
|
|
@ -172,12 +172,17 @@ interface WrapperWithOther {
|
|||
otherProp: string;
|
||||
}
|
||||
|
||||
function fn1(arg: ThisIsMutable) {} // Incorrect because ThisIsMutable is not readonly
|
||||
function fn2(arg: Wrapper) {} // Incorrect because Wrapper.sub is not readonly
|
||||
function fn3(arg: WrapperWithOther) {} // Incorrect because WrapperWithOther.otherProp is not readonly and not in the allowlist
|
||||
// Incorrect because ThisIsMutable is not readonly
|
||||
function fn1(arg: ThisIsMutable) {}
|
||||
|
||||
// Incorrect because Wrapper.sub is not readonly
|
||||
function fn2(arg: Wrapper) {}
|
||||
|
||||
// Incorrect because WrapperWithOther.otherProp is not readonly and not in the allowlist
|
||||
function fn3(arg: WrapperWithOther) {}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
|
||||
import { Foo } from 'some-lib';
|
||||
import { Bar } from 'incorrect-lib';
|
||||
|
||||
|
|
@ -185,14 +190,19 @@ interface HTMLElement {
|
|||
prop: string;
|
||||
}
|
||||
|
||||
function fn1(arg: Foo) {} // Incorrect because Foo is not a local type
|
||||
function fn2(arg: HTMLElement) {} // Incorrect because HTMLElement is not from the default library
|
||||
function fn3(arg: Bar) {} // Incorrect because Bar is not from "bar-lib"
|
||||
// Incorrect because Foo is not a local type
|
||||
function fn1(arg: Foo) {}
|
||||
|
||||
// Incorrect because HTMLElement is not from the default library
|
||||
function fn2(arg: HTMLElement) {}
|
||||
|
||||
// Incorrect because Bar is not from "bar-lib"
|
||||
function fn3(arg: Bar) {}
|
||||
```
|
||||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
|
||||
interface Foo {
|
||||
prop: string;
|
||||
}
|
||||
|
|
@ -202,26 +212,35 @@ interface Wrapper {
|
|||
readonly otherProp: string;
|
||||
}
|
||||
|
||||
function fn1(arg: Foo) {} // Works because Foo is allowed
|
||||
function fn2(arg: Wrapper) {} // Works even when Foo is nested somewhere in the type, with other properties still being checked
|
||||
// Works because Foo is allowed
|
||||
function fn1(arg: Foo) {}
|
||||
|
||||
// Works even when Foo is nested somewhere in the type, with other properties still being checked
|
||||
function fn2(arg: Wrapper) {}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
|
||||
import { Bar } from 'bar-lib';
|
||||
|
||||
interface Foo {
|
||||
prop: string;
|
||||
}
|
||||
|
||||
function fn1(arg: Foo) {} // Works because Foo is a local type
|
||||
function fn2(arg: HTMLElement) {} // Works because HTMLElement is from the default library
|
||||
function fn3(arg: Bar) {} // Works because Bar is from "bar-lib"
|
||||
// Works because Foo is a local type
|
||||
function fn1(arg: Foo) {}
|
||||
|
||||
// Works because HTMLElement is from the default library
|
||||
function fn2(arg: HTMLElement) {}
|
||||
|
||||
// Works because Bar is from "bar-lib"
|
||||
function fn3(arg: Bar) {}
|
||||
```
|
||||
|
||||
```ts
|
||||
```ts option='{"allow":["$",{"source":"file","name":"Foo"},{"source":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
|
||||
import { Foo } from './foo';
|
||||
|
||||
function fn(arg: Foo) {} // Works because Foo is still a local type - it has to be in the same package
|
||||
// Works because Foo is still a local type - it has to be in the same package
|
||||
function fn(arg: Foo) {}
|
||||
```
|
||||
|
||||
### `checkParameterProperties`
|
||||
|
|
@ -235,7 +254,7 @@ Examples of code for this rule with `{checkParameterProperties: true}`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkParameterProperties": true }'
|
||||
class Foo {
|
||||
constructor(private paramProp: string[]) {}
|
||||
}
|
||||
|
|
@ -243,7 +262,7 @@ class Foo {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkParameterProperties": true }'
|
||||
class Foo {
|
||||
constructor(private paramProp: readonly string[]) {}
|
||||
}
|
||||
|
|
@ -253,7 +272,7 @@ class Foo {
|
|||
|
||||
Examples of **correct** code for this rule with `{checkParameterProperties: false}`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "checkParameterProperties": false }' showPlaygroundButton
|
||||
class Foo {
|
||||
constructor(
|
||||
private paramProp1: string[],
|
||||
|
|
@ -272,7 +291,7 @@ Examples of code for this rule with `{ignoreInferredTypes: true}`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreInferredTypes": true }'
|
||||
import { acceptsCallback, CallbackOptions } from 'external-dependency';
|
||||
|
||||
acceptsCallback((options: CallbackOptions) => {});
|
||||
|
|
@ -281,7 +300,7 @@ acceptsCallback((options: CallbackOptions) => {});
|
|||
<details>
|
||||
<summary>external-dependency.d.ts</summary>
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreInferredTypes": true }'
|
||||
export interface CallbackOptions {
|
||||
prop: string;
|
||||
}
|
||||
|
|
@ -295,7 +314,7 @@ export const acceptsCallback: AcceptsCallback;
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreInferredTypes": true }'
|
||||
import { acceptsCallback } from 'external-dependency';
|
||||
|
||||
acceptsCallback(options => {});
|
||||
|
|
@ -304,7 +323,7 @@ acceptsCallback(options => {});
|
|||
<details>
|
||||
<summary>external-dependency.d.ts</summary>
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreInferredTypes": true }'
|
||||
export interface CallbackOptions {
|
||||
prop: string;
|
||||
}
|
||||
|
|
@ -326,7 +345,7 @@ Examples of code for this rule with `{treatMethodsAsReadonly: false}`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "treatMethodsAsReadonly": false }'
|
||||
type MyType = {
|
||||
readonly prop: string;
|
||||
method(): string; // note: this method is mutable
|
||||
|
|
@ -336,7 +355,7 @@ function foo(arg: MyType) {}
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "treatMethodsAsReadonly": false }'
|
||||
type MyType = Readonly<{
|
||||
prop: string;
|
||||
method(): string;
|
||||
|
|
@ -354,7 +373,7 @@ function bar(arg: MyOtherType) {}
|
|||
|
||||
Examples of **correct** code for this rule with `{treatMethodsAsReadonly: true}`:
|
||||
|
||||
```ts
|
||||
```ts option='{ "treatMethodsAsReadonly": true }' showPlaygroundButton
|
||||
type MyType = {
|
||||
readonly prop: string;
|
||||
method(): string; // note: this method is mutable
|
||||
|
|
|
|||
14
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md
generated
vendored
14
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md
generated
vendored
|
|
@ -6,7 +6,7 @@ description: "Require private members to be marked as `readonly` if they're neve
|
|||
>
|
||||
> See **https://typescript-eslint.io/rules/prefer-readonly** for documentation.
|
||||
|
||||
Member variables with the privacy `private` are never permitted to be modified outside of their declaring class.
|
||||
Private member variables (whether using the `private` modifier or private `#` fields) are never permitted to be modified outside of their declaring class.
|
||||
If that class never modifies their value, they may safely be marked as `readonly`.
|
||||
|
||||
This rule reports on private members are marked as `readonly` if they're never modified outside of the constructor.
|
||||
|
|
@ -22,6 +22,7 @@ class Container {
|
|||
// These member variables could be marked as readonly
|
||||
private neverModifiedMember = true;
|
||||
private onlyModifiedInConstructor: number;
|
||||
#neverModifiedPrivateField = 3;
|
||||
|
||||
public constructor(
|
||||
onlyModifiedInConstructor: number,
|
||||
|
|
@ -49,6 +50,13 @@ class Container {
|
|||
public mutate() {
|
||||
this.modifiedLater = 'mutated';
|
||||
}
|
||||
|
||||
// This is modified later on by the class
|
||||
#modifiedLaterPrivateField = 'unchanged';
|
||||
|
||||
public mutatePrivateField() {
|
||||
this.#modifiedLaterPrivateField = 'mutated';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -70,7 +78,7 @@ Example of code for the `{ "onlyInlineLambdas": true }` options:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "onlyInlineLambdas": true }'
|
||||
class Container {
|
||||
private onClick = () => {
|
||||
/* ... */
|
||||
|
|
@ -80,7 +88,7 @@ class Container {
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "onlyInlineLambdas": true }'
|
||||
class Container {
|
||||
private neverModifiedPrivate = 'unchanged';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Examples of code for this rule with `{ ignoreStringArrays: true }`:
|
|||
|
||||
#### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreStringArrays": true }'
|
||||
const one = 1;
|
||||
const two = 2;
|
||||
const three = 3;
|
||||
|
|
@ -66,7 +66,7 @@ const three = 3;
|
|||
|
||||
#### ✅ Correct
|
||||
|
||||
```ts
|
||||
```ts option='{ "ignoreStringArrays": true }'
|
||||
const one = '1';
|
||||
const two = '2';
|
||||
const three = '3';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue