From 525624961e3f9bbbca5cf40570e6baf59d9b65f4 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Tue, 26 Feb 2019 08:06:58 -0800 Subject: [PATCH 1/6] feat(eslint-plugin): member-accessibility adding config and overrides Adds configuration object to match options defined in #214 Adds implementation for the no public option at the root of the config object Adds implement for the overrides object --- .../rules/explicit-member-accessibility.ts | 214 +++++++++++++-- .../explicit-member-accessibility.test.ts | 259 ++++++++++++++++++ 2 files changed, 445 insertions(+), 28 deletions(-) diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 9b50aa023a4b..97d4920352e9 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -1,12 +1,57 @@ /** - * @fileoverview Enforces explicit accessibility modifier for class members + * @fileoverview Enforces accessibility modifier rules for class members * @author Danny Fritz + * @author Gavin Barron */ import { TSESTree } from '@typescript-eslint/typescript-estree'; import * as util from '../util'; -export default util.createRule({ +enum Check { + Yes, + No, + NoPublic, +} + +interface NoPublic { + noPublic?: boolean; +} + +type Override = boolean | NoPublic; + +/** + * Type guard to ease checking on which kind of override is being supplied + * + * @param {Override} [option] + * @returns {option is NoPublic} + */ +function isNoPublic(option?: Override): option is NoPublic { + return typeof option !== 'boolean'; +} + +interface Config { + noPublic?: boolean; + overrides?: { + accessors?: Override; + constructors?: Override; + methods?: Override; + properties?: Override; + }; +} +type Options = [Config]; + +type MessageIds = 'unwantedPublicAccessibility' | 'missingAccessibility'; + +const override = { + type: ['object', 'boolean'], + properties: { + noPublic: { + type: 'boolean', + }, + }, +}; + +export default util.createRule({ name: 'explicit-member-accessibility', meta: { type: 'problem', @@ -20,11 +65,102 @@ export default util.createRule({ messages: { missingAccessibility: 'Missing accessibility modifier on {{type}} {{name}}.', + unwantedPublicAccessibility: + 'Public accessibility modifier on {{type}} {{name}}.', }, - schema: [], + schema: [ + { + type: 'object', + properties: { + noPublic: { + type: 'boolean', + }, + overrides: { + type: 'object', + properties: { + accessors: override, + constructors: override, + methods: override, + parameterProperties: override, + }, + }, + }, + additionalProperties: false, + }, + ], }, - defaultOptions: [], + defaultOptions: [ + // technically there is a default, but the overrides mean + // that if we apply them here, it will break the no override case. + {}, + ], create(context) { + const option: Config = util.applyDefault([{}], context.options)[0]; + + /** + * @param defaultCheck + * @param overrideToCheck + */ + + /** + * Reads the value set on the Override and returns a Check value + * Check value is used to control what, if any accessiblity modifiers are required or banned + * @param {Check} defaultCheck + * @param {Override} [overrideToCheck] + * @returns {Check} + */ + function parseOverride( + defaultCheck: Check, + overrideToCheck?: Override, + ): Check { + let result: Check = defaultCheck; + if (typeof overrideToCheck !== 'undefined') { + if (isNoPublic(overrideToCheck) && overrideToCheck.noPublic) { + result = Check.NoPublic; + } else if (!overrideToCheck) { + result = Check.No; + } + } + return result; + } + + let baseCheck = Check.Yes; + if (option.noPublic) { + baseCheck = Check.NoPublic; + } + let ctorCheck: Check = baseCheck; + let accessorCheck: Check = baseCheck; + let methodCheck: Check = baseCheck; + let propCheck: Check = baseCheck; + if (option.overrides) { + ctorCheck = parseOverride(baseCheck, option.overrides.constructors); + accessorCheck = parseOverride(baseCheck, option.overrides.accessors); + methodCheck = parseOverride(baseCheck, option.overrides.methods); + propCheck = parseOverride(baseCheck, option.overrides.properties); + } + + /** + *Generates the report for rule violations + * + * @param {MessageIds} messageId + * @param {string} nodeType + * @param {(TSESTree.MethodDefinition | TSESTree.ClassProperty)} node + */ + function reportIssue( + messageId: MessageIds, + nodeType: string, + node: TSESTree.MethodDefinition | TSESTree.ClassProperty, + ) { + context.report({ + node: node, + messageId: messageId, + data: { + type: nodeType, + name: util.getNameFromPropertyName(node.key), + }, + }); + } + /** * Checks if a method declaration has an accessibility modifier. * @param methodDefinition The node representing a MethodDefinition. @@ -32,18 +168,41 @@ export default util.createRule({ function checkMethodAccessibilityModifier( methodDefinition: TSESTree.MethodDefinition, ): void { - if ( - !methodDefinition.accessibility && - util.isTypeScriptFile(context.getFilename()) - ) { - context.report({ - node: methodDefinition, - messageId: 'missingAccessibility', - data: { - type: 'method definition', - name: util.getNameFromPropertyName(methodDefinition.key), - }, - }); + let nodeType = 'method definition'; + let check: Check = baseCheck; + switch (methodDefinition.kind) { + case 'method': + check = methodCheck; + break; + case 'constructor': + check = ctorCheck; + break; + case 'get': + case 'set': + check = accessorCheck; + nodeType = `${methodDefinition.kind} property accessor`; + break; + default: + check = baseCheck; + break; + } + if (check == Check.No) { + return; + } + + if (util.isTypeScriptFile(context.getFilename())) { + if ( + check === Check.NoPublic && + methodDefinition.accessibility === 'public' + ) { + reportIssue( + 'unwantedPublicAccessibility', + nodeType, + methodDefinition, + ); + } else if (check === Check.Yes && !methodDefinition.accessibility) { + reportIssue('missingAccessibility', nodeType, methodDefinition); + } } } @@ -54,18 +213,17 @@ export default util.createRule({ function checkPropertyAccessibilityModifier( classProperty: TSESTree.ClassProperty, ): void { - if ( - !classProperty.accessibility && - util.isTypeScriptFile(context.getFilename()) - ) { - context.report({ - node: classProperty, - messageId: 'missingAccessibility', - data: { - type: 'class property', - name: util.getNameFromPropertyName(classProperty.key), - }, - }); + const nodeType = 'class property'; + + if (util.isTypeScriptFile(context.getFilename())) { + if ( + propCheck === Check.NoPublic && + classProperty.accessibility === 'public' + ) { + reportIssue('unwantedPublicAccessibility', nodeType, classProperty); + } else if (propCheck === Check.Yes && !classProperty.accessibility) { + reportIssue('missingAccessibility', nodeType, classProperty); + } } } diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index e630450689ce..bf657682a6f3 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -39,6 +39,93 @@ class Test { } `, }, + { + filename: 'test.ts', + code: ` +class Test { + protected name: string + protected foo?: string + public getX () { + return this.x + } +} + `, + options: [{ noPublic: false }], + }, + { + filename: 'test.ts', + code: ` +class Test { + protected name: string + protected foo?: string + getX () { + return this.x + } +} + `, + options: [{ noPublic: true }], + }, + { + filename: 'test.ts', + code: ` +class Test { + name: string + foo?: string + getX () { + return this.x + } + get fooName(): string { + return this.foo + ' ' + this.name + } +} + `, + options: [{ noPublic: true }], + }, + { + filename: 'test.ts', + code: ` +class Test { + private x: number; + constructor (x: number) { + this.x = x; + } + get internalValue() { + return this.x; + } + private set internalValue(value: number) { + this.x = value; + } + public square (): number { + return this.x * this.x; + } +} + `, + options: [{ overrides: { constructors: false, accessors: false } }], + }, + { + filename: 'test.ts', + code: ` +class Test { + private x: number; + public constructor (x: number) { + this.x = x; + } + public get internalValue() { + return this.x; + } + public set internalValue(value: number) { + this.x = value; + } + public square (): number { + return this.x * this.x; + } + half (): number { + return this.x / 2; + } +} + `, + options: [{ overrides: { methods: false } }], + }, ], invalid: [ { @@ -116,5 +203,177 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: ` +class Test { + protected name: string + protected foo?: string + public getX () { + return this.x + } +} + `, + options: [{ noPublic: true }], + errors: [ + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'method definition', + name: 'getX', + }, + line: 5, + column: 3, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + protected name: string + public foo?: string + getX () { + return this.x + } +} + `, + options: [{ noPublic: true }], + errors: [ + { + messageId: 'unwantedPublicAccessibility', + data: { + type: 'class property', + name: 'foo', + }, + line: 4, + column: 3, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public x: number + public getX () { + return this.x + } +} + `, + errors: [ + { + messageId: 'unwantedPublicAccessibility', + line: 3, + column: 3, + }, + { + messageId: 'unwantedPublicAccessibility', + line: 4, + column: 3, + }, + ], + options: [{ noPublic: true }], + }, + { + filename: 'test.ts', + code: ` +class Test { + private x: number; + constructor (x: number) { + this.x = x; + } + get internalValue() { + return this.x; + } + set internalValue(value: number) { + this.x = value; + } +} + `, + errors: [ + { + messageId: 'missingAccessibility', + line: 7, + column: 3, + }, + { + messageId: 'missingAccessibility', + line: 10, + column: 3, + }, + ], + options: [{ overrides: { constructors: { noPublic: true } } }], + }, + { + filename: 'test.ts', + code: ` +class Test { + private x: number; + constructor (x: number) { + this.x = x; + } + get internalValue() { + return this.x; + } + set internalValue(value: number) { + this.x = value; + } +} + `, + errors: [ + { + messageId: 'missingAccessibility', + line: 4, + column: 3, + }, + { + messageId: 'missingAccessibility', + line: 7, + column: 3, + }, + { + messageId: 'missingAccessibility', + line: 10, + column: 3, + }, + ], + options: [{ overrides: { constructors: { noPublic: false } } }], + }, + { + filename: 'test.ts', + code: ` +class Test { + private x: number; + constructor (x: number) { + this.x = x; + } + get internalValue() { + return this.x; + } + set internalValue(value: number) { + this.x = value; + } +} + `, + errors: [ + { + messageId: 'missingAccessibility', + line: 4, + column: 3, + }, + { + messageId: 'missingAccessibility', + line: 7, + column: 3, + }, + { + messageId: 'missingAccessibility', + line: 10, + column: 3, + }, + ], + options: [{ overrides: { constructors: true } }], + }, ], }); From 6f601d4053209d14357f58335996bb916ad02c31 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Tue, 5 Mar 2019 22:40:54 -0800 Subject: [PATCH 2/6] feat(eslint-plugin): member-accessibility Adds option for parameterProperty validation Updates documentation to cover the new options --- .../rules/explicit-member-accessibility.md | 228 +++++++++++++++++- .../rules/explicit-member-accessibility.ts | 87 ++++++- .../explicit-member-accessibility.test.ts | 104 ++++++++ 3 files changed, 400 insertions(+), 19 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index ac3e8b1d7fcc..3b4f9acf7ff5 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -10,28 +10,240 @@ be easier to use. This rule aims to make code more readable and explicit about who can use which properties. -The following patterns are considered warnings: +## Options + +This rule in it's default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options: + +- `noPublic`: optional boolean value to prevent the use of the public accessibility modifier +- `overrides`: configuration object allowing for granular application of the noPublic option or simply disabling the rule for these kinds of class members: + - `accessors` + - `constructors` + - `methods` + - `properties` + - `parameterProperties` + +Default options are: `[{}]` + +A possible, but not useful configuration could be + +```ts +[{ + noPublic: false, + overrides { + accessors: { + noPublic: false + }, + constructors: false, + methods: { + noPublic: true + }, + properties: true, + parameterProperties: { + noPublic: true + } + } +}] +``` + +The following patterns are considered incorrect code if no options are provided: + +```ts +class Animal { + constructor(name) { + // No accessibility modifier + this.animalName = name; + } + animalName: string; // No accessibility modifier + get name(): string { + // No accessibility modifier + return this.animalName; + } + set name(value: string) { + // No accessibility modifier + this.animalName = value; + } + walk() { + // method + } +} +``` + +The following patterns are considered correct with the default options `[{}]`: + +```ts +class Animal { + constructor(public breed, animalName) { + // Parameter property and constructor + this.animalName = name; + } + private animalName: string; // Property + get name(): string { + // get accessor + return this.animalName; + } + set name(value: string) { + // set accessor + this.animalName = value; + } + public walk() { + // method + } +} +``` + +The following patterns are considered incorrect with the root noPublic flag set `[{ noPublic: true }]`: + +```ts +class Animal { + public constructor(public breed, animalName) { + // Parameter property and constructor + this.animalName = name; + } + public animalName: string; // Property + public get name(): string { + // get accessor + return this.animalName; + } + public set name(value: string) { + // set accessor + this.animalName = value; + } + public walk() { + // method + } +} +``` + +The following patterns are considered correct with the root noPublic flag set `[{ noPublic: true }]`: + +```ts +class Animal { + constructor(protected breed, animalName) { + // Parameter property and constructor + this.name = name; + } + private animalName: string; // Property + get name(): string { + // get accessor + return this.animalName; + } + private set name(value: string) { + // set accessor + this.animalName = value; + } + protected walk() { + // method + } +} +``` + +### Overrides + +There are three ways in which an override can be used. + +- To disallow the use of public on a given member. +- To enforce explicit member accessibility when the root has allowed implicit public accessibility +- To disable any checks on given member type + +#### Disallow the use of public on a given member + +e.g. `[ { overrides: { constructor: { noPublic: true } } } ]` + +The following patterns are considered incorrect with the example override + +```ts +class Animal { + public constructor(protected animalName) {} + public get name() { + return this.animalName; + } +} +``` + +The following patterns are considered correct with the example override + +```ts +class Animal { + constructor(protected animalName) {} + public get name() { + return this.animalName; + } +} +``` + +#### Require explicit accessibility for a given member + +e.g. `[ { noPublic: true, overrides: { properties: { noPublic: false } } } ]` + +The following patterns are considered incorrect with the example override + +```ts +class Animal { + constructor(protected animalName) {} + get name() { + return this.animalName; + } + protected set name(value: string) { + this.animalName = value; + } + legs: number; + private hasFleas: boolean; +} +``` + +The following patterns are considered correct with the example override + +```ts +class Animal { + constructor(protected animalName) {} + get name() { + return this.animalName; + } + protected set name(value: string) { + this.animalName = value; + } + public legs: number; + private hasFleas: boolean; +} +``` + +#### Disable any checks on given member type + +e.g. `[{ overrides: { accessors : false } } ]` + +As no checks on the overridden member type are performed all permutations of visibility are permitted for that member type + +The follow pattern is considered incorrect for the given configuration ```ts class Animal { - name: string; // No accessibility modifier - getName(): string {} // No accessibility modifier + constructor(protected animalName) {} + public get name() { + return this.animalName; + } + get legs() { + return this.legCount; + } } ``` -The following patterns are not warnings: +The following patterns are considered correct with the example override ```ts class Animal { - private name: string; // explicit accessibility modifier - public getName(): string {} // explicit accessibility modifier + public constructor(protected animalName) {} + public get name() { + return this.animalName; + } + get legs() { + return this.legCount; + } } ``` ## When Not To Use It -If you think defaulting to public is a good default, then you will not need -this rule. +If you think defaulting to public is a good default, then you should consider using the `noPublic` option. If you don't want to mix implicit and explicit public members then disable this rule. ## Further Reading diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 87b6a9e2cb4e..2d96d3541d2f 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -1,4 +1,4 @@ -import { TSESTree } from '@typescript-eslint/typescript-estree'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; import * as util from '../util'; enum Check { @@ -30,6 +30,7 @@ interface Config { constructors?: Override; methods?: Override; properties?: Override; + parameterProperties?: Override; }; } type Options = [Config]; @@ -75,6 +76,7 @@ export default util.createRule({ accessors: override, constructors: override, methods: override, + properties: override, parameterProperties: override, }, }, @@ -109,8 +111,12 @@ export default util.createRule({ ): Check { let result: Check = defaultCheck; if (typeof overrideToCheck !== 'undefined') { - if (isNoPublic(overrideToCheck) && overrideToCheck.noPublic) { - result = Check.NoPublic; + if (isNoPublic(overrideToCheck)) { + if (overrideToCheck.noPublic) { + result = Check.NoPublic; + } else { + result = Check.Yes; + } } else if (!overrideToCheck) { result = Check.No; } @@ -126,11 +132,16 @@ export default util.createRule({ let accessorCheck: Check = baseCheck; let methodCheck: Check = baseCheck; let propCheck: Check = baseCheck; + let paramPropCheck: Check = baseCheck; if (option.overrides) { ctorCheck = parseOverride(baseCheck, option.overrides.constructors); accessorCheck = parseOverride(baseCheck, option.overrides.accessors); methodCheck = parseOverride(baseCheck, option.overrides.methods); propCheck = parseOverride(baseCheck, option.overrides.properties); + paramPropCheck = parseOverride( + baseCheck, + option.overrides.parameterProperties, + ); } /** @@ -143,14 +154,18 @@ export default util.createRule({ function reportIssue( messageId: MessageIds, nodeType: string, - node: TSESTree.MethodDefinition | TSESTree.ClassProperty, + node: + | TSESTree.MethodDefinition + | TSESTree.ClassProperty + | TSESTree.TSParameterProperty, + nodeName: string, ) { context.report({ node: node, messageId: messageId, data: { type: nodeType, - name: util.getNameFromPropertyName(node.key), + name: nodeName, }, }); } @@ -176,15 +191,13 @@ export default util.createRule({ check = accessorCheck; nodeType = `${methodDefinition.kind} property accessor`; break; - default: - check = baseCheck; - break; } if (check == Check.No) { return; } if (util.isTypeScriptFile(context.getFilename())) { + const methodName = util.getNameFromPropertyName(methodDefinition.key); if ( check === Check.NoPublic && methodDefinition.accessibility === 'public' @@ -193,9 +206,15 @@ export default util.createRule({ 'unwantedPublicAccessibility', nodeType, methodDefinition, + methodName, ); } else if (check === Check.Yes && !methodDefinition.accessibility) { - reportIssue('missingAccessibility', nodeType, methodDefinition); + reportIssue( + 'missingAccessibility', + nodeType, + methodDefinition, + methodName, + ); } } } @@ -210,18 +229,64 @@ export default util.createRule({ const nodeType = 'class property'; if (util.isTypeScriptFile(context.getFilename())) { + const propertyName = util.getNameFromPropertyName(classProperty.key); if ( propCheck === Check.NoPublic && classProperty.accessibility === 'public' ) { - reportIssue('unwantedPublicAccessibility', nodeType, classProperty); + reportIssue( + 'unwantedPublicAccessibility', + nodeType, + classProperty, + propertyName, + ); } else if (propCheck === Check.Yes && !classProperty.accessibility) { - reportIssue('missingAccessibility', nodeType, classProperty); + reportIssue( + 'missingAccessibility', + nodeType, + classProperty, + propertyName, + ); + } + } + } + + /** + * Checks that the parameter property has accessiblity modifiers set. + * + * @param {TSESTree.TSParameterProperty} node + * @returns + */ + function checkParameterPropertyAccessibilityModifier( + node: TSESTree.TSParameterProperty, + ) { + const nodeType = 'parameter property'; + if (util.isTypeScriptFile(context.getFilename())) { + // HAS to be an identifier or assignment or TSC will throw + if ( + node.parameter.type !== AST_NODE_TYPES.Identifier && + node.parameter.type !== AST_NODE_TYPES.AssignmentPattern + ) { + return; + } + + const nodeName = + node.parameter.type === AST_NODE_TYPES.Identifier + ? node.parameter.name + : // has to be an Identifier or TSC will throw an error + (node.parameter.left as TSESTree.Identifier).name; + + if ( + paramPropCheck === Check.NoPublic && + node.accessibility === 'public' + ) { + reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName); } } } return { + TSParameterProperty: checkParameterPropertyAccessibilityModifier, ClassProperty: checkPropertyAccessibilityModifier, MethodDefinition: checkMethodAccessibilityModifier, }; diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index bf657682a6f3..23d0e1344db4 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -126,6 +126,42 @@ class Test { `, options: [{ overrides: { methods: false } }], }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(private x: number){} +} + `, + options: [{ noPublic: true }], + }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public x: number){} +} + `, + options: [ + { + noPublic: true, + overrides: { parameterProperties: { noPublic: false } }, + }, + ], + }, + { + filename: 'test.js', + code: ` +class Test { + constructor(public x: number){} +} + `, + options: [ + { + noPublic: true, + }, + ], + }, ], invalid: [ { @@ -375,5 +411,73 @@ class Test { ], options: [{ overrides: { constructors: true } }], }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public x: number){} +} + `, + errors: [ + { + messageId: 'unwantedPublicAccessibility', + line: 3, + column: 15, + }, + ], + options: [ + { + noPublic: true, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public x: number){} + public foo(): string { + return 'foo'; + } +} + `, + errors: [ + { + messageId: 'missingAccessibility', + line: 3, + column: 3, + }, + { + messageId: 'unwantedPublicAccessibility', + line: 3, + column: 15, + }, + ], + options: [ + { + overrides: { parameterProperties: { noPublic: true } }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public x: number){} +} + `, + errors: [ + { + messageId: 'missingAccessibility', + line: 3, + column: 3, + }, + ], + options: [ + { + overrides: { parameterProperties: { noPublic: false } }, + }, + ], + }, ], }); From 1d5f9139f1133efcd1b8e91efa4bceb75f177508 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Thu, 7 Mar 2019 09:23:14 -0800 Subject: [PATCH 3/6] feat(eslint-plugin): member-accessibility Simplified options and cleaned up comments --- .../rules/explicit-member-accessibility.md | 73 +++++---- .../rules/explicit-member-accessibility.ts | 148 ++++++------------ .../explicit-member-accessibility.test.ts | 71 ++------- 3 files changed, 100 insertions(+), 192 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 3b4f9acf7ff5..a672b766c6c9 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -12,37 +12,44 @@ which properties. ## Options -This rule in it's default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options: +```ts +type AccessibilityLevel = + | 'explicit' // require an accessor (including public) + | 'no-public' // don't require public + | 'off'; // don't check + +interface Config { + accessibility?: AccessibilityLevel; + overrides?: { + accessors?: AccessibilityLevel; + constructors?: AccessibilityLevel; + methods?: AccessibilityLevel; + properties?: AccessibilityLevel; + parameterProperties?: AccessibilityLevel; + }; +} +``` -- `noPublic`: optional boolean value to prevent the use of the public accessibility modifier -- `overrides`: configuration object allowing for granular application of the noPublic option or simply disabling the rule for these kinds of class members: - - `accessors` - - `constructors` - - `methods` - - `properties` - - `parameterProperties` +Default config: -Default options are: `[{}]` +```JSON +{ "accessibility": "explicit" } +``` -A possible, but not useful configuration could be +This rule in it's default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options: +A possible configuration could be: ```ts -[{ - noPublic: false, +{ + accessibility: 'explicit', overrides { - accessors: { - noPublic: false - }, - constructors: false, - methods: { - noPublic: true - }, - properties: true, - parameterProperties: { - noPublic: true - } - } -}] + accessors: 'explicit', + constructors: 'no-public', + methods: 'explicit', + properties: 'off', + parameterProperties: 'explicit' + } +} ``` The following patterns are considered incorrect code if no options are provided: @@ -68,11 +75,11 @@ class Animal { } ``` -The following patterns are considered correct with the default options `[{}]`: +The following patterns are considered correct with the default options `{ accessibility: 'explicit' }`: ```ts class Animal { - constructor(public breed, animalName) { + public constructor(public breed, animalName) { // Parameter property and constructor this.animalName = name; } @@ -91,7 +98,7 @@ class Animal { } ``` -The following patterns are considered incorrect with the root noPublic flag set `[{ noPublic: true }]`: +The following patterns are considered incorrect with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`: ```ts class Animal { @@ -114,7 +121,7 @@ class Animal { } ``` -The following patterns are considered correct with the root noPublic flag set `[{ noPublic: true }]`: +The following patterns are considered correct with the accessibility set to **no-public** `[{ accessibility: 'no-public' }]`: ```ts class Animal { @@ -147,7 +154,7 @@ There are three ways in which an override can be used. #### Disallow the use of public on a given member -e.g. `[ { overrides: { constructor: { noPublic: true } } } ]` +e.g. `[ { overrides: { constructor: 'no-public' } } ]` The following patterns are considered incorrect with the example override @@ -173,7 +180,7 @@ class Animal { #### Require explicit accessibility for a given member -e.g. `[ { noPublic: true, overrides: { properties: { noPublic: false } } } ]` +e.g. `[ { accessibility: 'no-public', overrides: { properties: 'explicit' } } ]` The following patterns are considered incorrect with the example override @@ -209,7 +216,7 @@ class Animal { #### Disable any checks on given member type -e.g. `[{ overrides: { accessors : false } } ]` +e.g. `[{ overrides: { accessors : 'off' } } ]` As no checks on the overridden member type are performed all permutations of visibility are permitted for that member type @@ -243,7 +250,7 @@ class Animal { ## When Not To Use It -If you think defaulting to public is a good default, then you should consider using the `noPublic` option. If you don't want to mix implicit and explicit public members then disable this rule. +If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule. ## Further Reading diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 2d96d3541d2f..c671bce4c5ee 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -1,50 +1,27 @@ import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; import * as util from '../util'; -enum Check { - Yes, - No, - NoPublic, -} - -interface NoPublic { - noPublic?: boolean; -} - -type Override = boolean | NoPublic; - -/** - * Type guard to ease checking on which kind of override is being supplied - * - * @param {Override} [option] - * @returns {option is NoPublic} - */ -function isNoPublic(option?: Override): option is NoPublic { - return typeof option !== 'boolean'; -} +type AccessibilityLevel = + | 'explicit' // require an accessor (including public) + | 'no-public' // don't require public + | 'off'; // don't check interface Config { - noPublic?: boolean; + accessibility?: AccessibilityLevel; overrides?: { - accessors?: Override; - constructors?: Override; - methods?: Override; - properties?: Override; - parameterProperties?: Override; + accessors?: AccessibilityLevel; + constructors?: AccessibilityLevel; + methods?: AccessibilityLevel; + properties?: AccessibilityLevel; + parameterProperties?: AccessibilityLevel; }; } + type Options = [Config]; type MessageIds = 'unwantedPublicAccessibility' | 'missingAccessibility'; -const override = { - type: ['object', 'boolean'], - properties: { - noPublic: { - type: 'boolean', - }, - }, -}; +const accessibilityLevel = { enum: ['explicit', 'no-public', 'off'] }; export default util.createRule({ name: 'explicit-member-accessibility', @@ -67,17 +44,15 @@ export default util.createRule({ { type: 'object', properties: { - noPublic: { - type: 'boolean', - }, + accessibility: accessibilityLevel, overrides: { type: 'object', properties: { - accessors: override, - constructors: override, - methods: override, - properties: override, - parameterProperties: override, + accessors: accessibilityLevel, + constructors: accessibilityLevel, + methods: accessibilityLevel, + properties: accessibilityLevel, + parameterProperties: accessibilityLevel, }, }, }, @@ -85,54 +60,30 @@ export default util.createRule({ }, ], }, - defaultOptions: [ - // technically there is a default, but the overrides mean - // that if we apply them here, it will break the no override case. - {}, - ], - create(context) { - const option: Config = util.applyDefault([{}], context.options)[0]; - - /** - * @param defaultCheck - * @param overrideToCheck - */ - + defaultOptions: [{ accessibility: 'explicit' }], + create(context, [option]) { /** * Reads the value set on the Override and returns a Check value - * Check value is used to control what, if any accessiblity modifiers are required or banned - * @param {Check} defaultCheck - * @param {Override} [overrideToCheck] - * @returns {Check} + * Check value is used to control what, if any accessibility modifiers are required or banned */ function parseOverride( - defaultCheck: Check, - overrideToCheck?: Override, - ): Check { - let result: Check = defaultCheck; - if (typeof overrideToCheck !== 'undefined') { - if (isNoPublic(overrideToCheck)) { - if (overrideToCheck.noPublic) { - result = Check.NoPublic; - } else { - result = Check.Yes; - } - } else if (!overrideToCheck) { - result = Check.No; - } - } - return result; + defaultCheck: AccessibilityLevel, + overrideToCheck?: AccessibilityLevel, + ): AccessibilityLevel { + return typeof overrideToCheck === 'undefined' + ? defaultCheck + : overrideToCheck; } - let baseCheck = Check.Yes; - if (option.noPublic) { - baseCheck = Check.NoPublic; + let baseCheck: AccessibilityLevel = 'explicit'; + if (option.accessibility) { + baseCheck = option.accessibility; } - let ctorCheck: Check = baseCheck; - let accessorCheck: Check = baseCheck; - let methodCheck: Check = baseCheck; - let propCheck: Check = baseCheck; - let paramPropCheck: Check = baseCheck; + let ctorCheck = baseCheck; + let accessorCheck = baseCheck; + let methodCheck = baseCheck; + let propCheck = baseCheck; + let paramPropCheck = baseCheck; if (option.overrides) { ctorCheck = parseOverride(baseCheck, option.overrides.constructors); accessorCheck = parseOverride(baseCheck, option.overrides.accessors); @@ -145,11 +96,7 @@ export default util.createRule({ } /** - *Generates the report for rule violations - * - * @param {MessageIds} messageId - * @param {string} nodeType - * @param {(TSESTree.MethodDefinition | TSESTree.ClassProperty)} node + * Generates the report for rule violations */ function reportIssue( messageId: MessageIds, @@ -178,7 +125,7 @@ export default util.createRule({ methodDefinition: TSESTree.MethodDefinition, ): void { let nodeType = 'method definition'; - let check: Check = baseCheck; + let check = baseCheck; switch (methodDefinition.kind) { case 'method': check = methodCheck; @@ -192,14 +139,14 @@ export default util.createRule({ nodeType = `${methodDefinition.kind} property accessor`; break; } - if (check == Check.No) { + if (check === 'off') { return; } if (util.isTypeScriptFile(context.getFilename())) { const methodName = util.getNameFromPropertyName(methodDefinition.key); if ( - check === Check.NoPublic && + check === 'no-public' && methodDefinition.accessibility === 'public' ) { reportIssue( @@ -208,7 +155,7 @@ export default util.createRule({ methodDefinition, methodName, ); - } else if (check === Check.Yes && !methodDefinition.accessibility) { + } else if (check === 'explicit' && !methodDefinition.accessibility) { reportIssue( 'missingAccessibility', nodeType, @@ -231,7 +178,7 @@ export default util.createRule({ if (util.isTypeScriptFile(context.getFilename())) { const propertyName = util.getNameFromPropertyName(classProperty.key); if ( - propCheck === Check.NoPublic && + propCheck === 'no-public' && classProperty.accessibility === 'public' ) { reportIssue( @@ -240,7 +187,7 @@ export default util.createRule({ classProperty, propertyName, ); - } else if (propCheck === Check.Yes && !classProperty.accessibility) { + } else if (propCheck === 'explicit' && !classProperty.accessibility) { reportIssue( 'missingAccessibility', nodeType, @@ -252,10 +199,8 @@ export default util.createRule({ } /** - * Checks that the parameter property has accessiblity modifiers set. - * - * @param {TSESTree.TSParameterProperty} node - * @returns + * Checks that the parameter property has the desired accessibility modifiers set. + * @param {TSESTree.TSParameterProperty} node The node representing a Parameter Property */ function checkParameterPropertyAccessibilityModifier( node: TSESTree.TSParameterProperty, @@ -276,10 +221,7 @@ export default util.createRule({ : // has to be an Identifier or TSC will throw an error (node.parameter.left as TSESTree.Identifier).name; - if ( - paramPropCheck === Check.NoPublic && - node.accessibility === 'public' - ) { + if (paramPropCheck === 'no-public' && node.accessibility === 'public') { reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName); } } diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index 23d0e1344db4..51a94a19de20 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -50,7 +50,7 @@ class Test { } } `, - options: [{ noPublic: false }], + options: [{ accessibility: 'explicit' }], }, { filename: 'test.ts', @@ -63,7 +63,7 @@ class Test { } } `, - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], }, { filename: 'test.ts', @@ -79,7 +79,7 @@ class Test { } } `, - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], }, { filename: 'test.ts', @@ -100,7 +100,7 @@ class Test { } } `, - options: [{ overrides: { constructors: false, accessors: false } }], + options: [{ overrides: { constructors: 'off', accessors: 'off' } }], }, { filename: 'test.ts', @@ -124,7 +124,7 @@ class Test { } } `, - options: [{ overrides: { methods: false } }], + options: [{ overrides: { methods: 'off' } }], }, { filename: 'test.ts', @@ -133,7 +133,7 @@ class Test { constructor(private x: number){} } `, - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], }, { filename: 'test.ts', @@ -144,8 +144,8 @@ class Test { `, options: [ { - noPublic: true, - overrides: { parameterProperties: { noPublic: false } }, + accessibility: 'no-public', + overrides: { parameterProperties: 'off' }, }, ], }, @@ -158,7 +158,7 @@ class Test { `, options: [ { - noPublic: true, + accessibility: 'no-public', }, ], }, @@ -250,7 +250,7 @@ class Test { } } `, - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], errors: [ { messageId: 'unwantedPublicAccessibility', @@ -274,7 +274,7 @@ class Test { } } `, - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], errors: [ { messageId: 'unwantedPublicAccessibility', @@ -309,7 +309,7 @@ class Test { column: 3, }, ], - options: [{ noPublic: true }], + options: [{ accessibility: 'no-public' }], }, { filename: 'test.ts', @@ -339,7 +339,7 @@ class Test { column: 3, }, ], - options: [{ overrides: { constructors: { noPublic: true } } }], + options: [{ overrides: { constructors: 'no-public' } }], }, { filename: 'test.ts', @@ -374,42 +374,6 @@ class Test { column: 3, }, ], - options: [{ overrides: { constructors: { noPublic: false } } }], - }, - { - filename: 'test.ts', - code: ` -class Test { - private x: number; - constructor (x: number) { - this.x = x; - } - get internalValue() { - return this.x; - } - set internalValue(value: number) { - this.x = value; - } -} - `, - errors: [ - { - messageId: 'missingAccessibility', - line: 4, - column: 3, - }, - { - messageId: 'missingAccessibility', - line: 7, - column: 3, - }, - { - messageId: 'missingAccessibility', - line: 10, - column: 3, - }, - ], - options: [{ overrides: { constructors: true } }], }, { filename: 'test.ts', @@ -427,7 +391,7 @@ class Test { ], options: [ { - noPublic: true, + accessibility: 'no-public', }, ], }, @@ -455,7 +419,7 @@ class Test { ], options: [ { - overrides: { parameterProperties: { noPublic: true } }, + overrides: { parameterProperties: 'no-public' }, }, ], }, @@ -473,11 +437,6 @@ class Test { column: 3, }, ], - options: [ - { - overrides: { parameterProperties: { noPublic: false } }, - }, - ], }, ], }); From c635bc1dddda228192b44b426fbdb898fd88eee7 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Thu, 7 Mar 2019 10:23:19 -0800 Subject: [PATCH 4/6] fix: tests - jest version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e2eff52b004..57a5e6124b04 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "glob": "7.1.2", "husky": "^1.3.1", "isomorphic-fetch": "^2.2.1", - "jest": "24.1.0", + "jest": "24.3.0", "lerna": "^3.10.5", "lint-staged": "8.1.0", "lodash.isplainobject": "4.0.6", From 55f73651d633b5b33d931d248f3ff4503ccce7fc Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Thu, 7 Mar 2019 10:28:12 -0800 Subject: [PATCH 5/6] chore: update yarn.lock --- yarn.lock | 841 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 489 insertions(+), 352 deletions(-) diff --git a/yarn.lock b/yarn.lock index fe9efe6c836e..40864e48b496 100644 --- a/yarn.lock +++ b/yarn.lock @@ -96,6 +96,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.3.tgz#092d450db02bdb6ccb1ca8ffd47d8774a91aef87" integrity sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg== +"@babel/parser@^7.1.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.4.tgz#a43357e4bbf4b92a437fb9e465c192848287f27c" + integrity sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ== + "@babel/plugin-syntax-object-rest-spread@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" @@ -143,6 +148,14 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + "@commitlint/cli@^7.1.2", "@commitlint/cli@^7.5.2": version "7.5.2" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-7.5.2.tgz#2475cd8f7ed3b2f9c2ab96c06bc24d61d23f8716" @@ -297,6 +310,143 @@ log-update "^2.3.0" strip-ansi "^3.0.1" +"@jest/console@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.3.0.tgz#7bd920d250988ba0bf1352c4493a48e1cb97671e" + integrity sha512-NaCty/OOei6rSDcbPdMiCbYCI0KGFGPgGO6B09lwWt5QTxnkuhKYET9El5u5z1GAcSxkQmSMtM63e24YabCWqA== + dependencies: + "@jest/source-map" "^24.3.0" + "@types/node" "*" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.3.0.tgz#ae5732af96567205d79ed97dc0b9b9033acea298" + integrity sha512-kGnyXAEjFPK4SfikxyrugXZ/SpWYmA09jMOvZRxeRfarVy+yIE6NkilRA85MRqR2qOcQhWgZ48T3KXEVPZC1zw== + dependencies: + "@jest/console" "^24.3.0" + "@jest/reporters" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.3.0" + jest-config "^24.3.0" + jest-haste-map "^24.3.0" + jest-message-util "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve-dependencies "^24.3.0" + jest-runner "^24.3.0" + jest-runtime "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" + jest-watcher "^24.3.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + pirates "^4.0.1" + realpath-native "^1.1.0" + rimraf "^2.5.4" + strip-ansi "^5.0.0" + +"@jest/environment@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.3.0.tgz#45e7c5cc996cb8f2287a30f8de08b152fa226fe2" + integrity sha512-rPrnhX3cBvGqODfd6aUsCruUijVp2tmBC0YfeXIku0MciQSR9ek5tjdEk31iBvxE9WlGQus+E/slRLqJmCRZTw== + dependencies: + "@jest/fake-timers" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" + jest-mock "^24.3.0" + +"@jest/fake-timers@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.3.0.tgz#0a7f8b877b78780c3fa5c3f8683cc0aaf9488331" + integrity sha512-rHwVI17dGMHxHzfAhnZ04+wFznjFfZ246QugeBnbiYr7/bDosPD2P1qeNjWnJUUcfl0HpS6kkr+OB/mqSJxQFg== + dependencies: + "@jest/types" "^24.3.0" + "@types/node" "*" + jest-message-util "^24.3.0" + jest-mock "^24.3.0" + +"@jest/reporters@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.3.0.tgz#beaa8b7d0148db8438a12102daf4d36268a150f5" + integrity sha512-/Gwdcej9x4QuhFIWTKyiiMLAMzfCtIIvuk2AnreqmuxLRAyUbkR5BoUoPvwowKVyZn20ZdCG5Qf7/KaoHhCG8Q== + dependencies: + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-api "^2.1.1" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-source-maps "^3.0.1" + jest-haste-map "^24.3.0" + jest-resolve "^24.3.0" + jest-runtime "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" + node-notifier "^5.2.1" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" + integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.3.0.tgz#4c0b1c9716212111920f7cf8c4329c69bc81924a" + integrity sha512-j7UZ49T8C4CVipEY99nLttnczVTtLyVzFfN20OiBVn7awOs0U3endXSTq7ouPrLR5y4YjI5GDcbcvDUjgeamzg== + dependencies: + "@jest/console" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/istanbul-lib-coverage" "^1.1.0" + +"@jest/transform@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.3.0.tgz#a18bfd18f25ca28566f5bc398551c047199f4c75" + integrity sha512-qrOIa34c+C5kqABGslBz7Lcwi9qbksO9/XcoCcYWD6AnrOmVUBRZSFHzo7Enk5iHUXRGnVnXvb8AyBXKlwpdGQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.3.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.3.0" + jest-regex-util "^24.3.0" + jest-util "^24.3.0" + micromatch "^3.1.10" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.3.0.tgz#3f6e117e47248a9a6b5f1357ec645bd364f7ad23" + integrity sha512-VoO1F5tU2n/93QN/zaZ7Q8SeV/Rj+9JJOgbvKbBwy4lenvmdj1iDaQEPXGTKrO6OSvDeb2drTFipZJYxgo6kIQ== + dependencies: + "@types/istanbul-lib-coverage" "^1.1.0" + "@types/yargs" "^12.0.9" + "@lerna/add@3.13.0": version "3.13.0" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.13.0.tgz#e971a17c1f85cba40f22c816a2bb9d855b62d07d" @@ -991,6 +1141,39 @@ resolved "https://registry.yarnpkg.com/@types/babel-code-frame/-/babel-code-frame-6.20.2.tgz#d923c88d94e66b864fd3693f07b18ad78489a222" integrity sha512-HAdhFeYOZKIkrR2jbonCJxp3I/o2G/kxY+CIx7qX9Kmv5jY+9D7OgmgSLdRqeHacB5RlqE5efj2WIDFL9NXCyg== +"@types/babel__core@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" + integrity sha512-wJTeJRt7BToFx3USrCDs2BhEi4ijBInTQjOIukj6a/5tEkwpFMVZ+1ppgmE+Q/FQyc5P/VWUbx7I9NELrKruHA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" + integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" + integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + dependencies: + "@babel/types" "^7.3.0" + "@types/eslint-visitor-keys@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" @@ -1023,6 +1206,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/istanbul-lib-coverage@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" + integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== + "@types/jest-diff@*": version "20.0.1" resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" @@ -1086,6 +1274,16 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ== +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": + version "12.0.9" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" + integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1389,13 +1587,16 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-jest@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.1.0.tgz#441e23ef75ded3bd547e300ac3194cef87b55190" - integrity sha512-MLcagnVrO9ybQGLEfZUqnOzv36iQzU7Bj4elm39vCukumLVSfoX+tRy3/jW7lUKc7XdpRmB/jech6L/UCsSZjw== +babel-jest@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.3.0.tgz#4f484d1a13e1be1b349e715cc41ad34fbe770ad7" + integrity sha512-YH62Flana1vImnB3Q59R9t7PzMUbFTlhI4KR/Ri/5hshm+WgxCTuFS8N2uSvEhQXcvzkhrvjBBciJWzOb+4rOA== dependencies: + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.1.0" + babel-preset-jest "^24.3.0" chalk "^2.4.2" slash "^2.0.0" @@ -1408,10 +1609,12 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.0.0" test-exclude "^5.0.0" -babel-plugin-jest-hoist@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.1.0.tgz#dfecc491fb15e2668abbd690a697a8fd1411a7f8" - integrity sha512-gljYrZz8w1b6fJzKcsfKsipSru2DU2DmQ39aB6nV3xQ0DDv3zpIzKGortA5gknrhNnPN8DweaEgrnZdmbGmhnw== +babel-plugin-jest-hoist@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.3.0.tgz#f2e82952946f6e40bb0a75d266a3790d854c8b5b" + integrity sha512-nWh4N1mVH55Tzhx2isvUN5ebM5CDUvIpXPZYMRazQughie/EqGnbR+czzoQlhUmJG9pPJmYDRhvocotb2THl1w== + dependencies: + "@types/babel__traverse" "^7.0.6" babel-polyfill@6.26.0: version "6.26.0" @@ -1422,13 +1625,13 @@ babel-polyfill@6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-preset-jest@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.1.0.tgz#83bc564fdcd4903641af65ec63f2f5de6b04132e" - integrity sha512-FfNLDxFWsNX9lUmtwY7NheGlANnagvxq8LZdl5PKnVG3umP+S/g0XbVBfwtA4Ai3Ri/IMkWabBz3Tyk9wdspcw== +babel-preset-jest@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.3.0.tgz#db88497e18869f15b24d9c0e547d8e0ab950796d" + integrity sha512-VGTV2QYBa/Kn3WCOKdfS31j9qomaXSgJqi65B6o05/1GsJyj9LVhSljM9ro4S+IBGj/ENhNBuH9bpqzztKAQSw== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.1.0" + babel-plugin-jest-hoist "^24.3.0" babel-runtime@6.26.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" @@ -2143,7 +2346,7 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: +debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -2192,11 +2395,6 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2277,11 +2475,6 @@ detect-indent@^5.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -2295,10 +2488,10 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" -diff-sequences@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.0.0.tgz#cdf8e27ed20d8b8d3caccb4e0c0d8fe31a173013" - integrity sha512-46OkIuVGBBnrC0soO/4LHu5LHGHx0uhP65OVz8XOrAJpqiCB2aVIuESvjI1F9oqebuvY8lekS1pt6TN7vt7qsw== +diff-sequences@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" + integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== diff@^3.1.0, diff@^3.2.0, diff@^3.5.0: version "3.5.0" @@ -2575,12 +2768,10 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= -exec-sh@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" - integrity sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw== - dependencies: - merge "^1.2.0" +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== execa@0.9.0: version "0.9.0" @@ -2639,16 +2830,17 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.1.0.tgz#88e73301c4c785cde5f16da130ab407bdaf8c0f2" - integrity sha512-lVcAPhaYkQcIyMS+F8RVwzbm1jro20IG8OkvxQ6f1JfqhVZyyudCwYogQ7wnktlf14iF3ii7ArIUO/mqvrW9Gw== +expect@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.3.0.tgz#84c2bff9d3eaf4ffe088ec13e84a7d7a8d014945" + integrity sha512-maPswEFJ1mJaa3Hx0aeyiqlf/FhJnvTyCzeksmqHGgWyM8m+cIhf1t5Gz8qIRdJPm0m4XPiin/0wxdru2l+hCw== dependencies: + "@jest/types" "^24.3.0" ansi-styles "^3.2.0" - jest-get-type "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" + jest-get-type "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-regex-util "^24.3.0" extend-shallow@^2.0.1: version "2.0.1" @@ -2896,14 +3088,6 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^1.2.3: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.7.tgz#4851b664a3783e52003b3c66eb0eee1074933aa4" - integrity sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw== - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - fstream@^1.0.0, fstream@^1.0.2: version "1.0.11" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" @@ -3309,7 +3493,7 @@ husky@^1.3.1: run-node "^1.0.0" slash "^2.0.0" -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3400,7 +3584,7 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -3748,7 +3932,7 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-api@^2.0.8: +istanbul-api@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-2.1.1.tgz#194b773f6d9cbc99a9258446848b0f988951c4d0" integrity sha512-kVmYrehiwyeBAk/wE71tW6emzLiHGjYIiDrc8sfyty4F8M02/lrgXSm+R1kXysmF20zArvmZXjlE/mg24TVPJw== @@ -3819,299 +4003,308 @@ istanbul-reports@^2.1.1: dependencies: handlebars "^4.1.0" -jest-changed-files@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.0.0.tgz#c02c09a8cc9ca93f513166bc773741bd39898ff7" - integrity sha512-nnuU510R9U+UX0WNb5XFEcsrMqriSiRLeO9KWDFgPrpToaQm60prfQYpxsXigdClpvNot5bekDY440x9dNGnsQ== +jest-changed-files@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.3.0.tgz#7050ae29aaf1d59437c80f21d5b3cd354e88a499" + integrity sha512-fTq0YAUR6644fgsqLC7Zi2gXA/bAplMRvfXQdutmkwgrCKK6upkj+sgXqsUfUZRm15CVr3YSojr/GRNn71IMvg== dependencies: + "@jest/types" "^24.3.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.1.0.tgz#f7cc98995f36e7210cce3cbb12974cbf60940843" - integrity sha512-U/iyWPwOI0T1CIxVLtk/2uviOTJ/OiSWJSe8qt6X1VkbbgP+nrtLJlmT9lPBe4lK78VNFJtrJ7pttcNv/s7yCw== +jest-cli@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.3.0.tgz#b180ac1d3d0188d38d528268d99413e21baa8f64" + integrity sha512-FNGfJItAiXuJJBSZIQzaLCb63/BIAUEyucGf892Vg2n/dyk1M7O+o6YPFtwWOHMwVXX873MLsINBUbFNt1ugLQ== dependencies: - ansi-escapes "^3.0.0" + "@jest/core" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.1.15" import-local "^2.0.0" is-ci "^2.0.0" - istanbul-api "^2.0.8" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-source-maps "^3.0.1" - jest-changed-files "^24.0.0" - jest-config "^24.1.0" - jest-environment-jsdom "^24.0.0" - jest-get-type "^24.0.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve-dependencies "^24.1.0" - jest-runner "^24.1.0" - jest-runtime "^24.1.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - jest-watcher "^24.0.0" - jest-worker "^24.0.0" - micromatch "^3.1.10" - node-notifier "^5.2.1" - p-each-series "^1.0.0" - pirates "^4.0.0" + jest-config "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" prompts "^2.0.1" - realpath-native "^1.0.0" - rimraf "^2.5.4" - slash "^2.0.0" - string-length "^2.0.0" - strip-ansi "^5.0.0" - which "^1.2.12" + realpath-native "^1.1.0" yargs "^12.0.2" -jest-config@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.1.0.tgz#6ea6881cfdd299bc86cc144ee36d937c97c3850c" - integrity sha512-FbbRzRqtFC6eGjG5VwsbW4E5dW3zqJKLWYiZWhB0/4E5fgsMw8GODLbGSrY5t17kKOtCWb/Z7nsIThRoDpuVyg== +jest-config@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.3.0.tgz#d12296b5a8f700b13fb31eaea7c30f5473aab1a5" + integrity sha512-GrPEBZ1nIQ6KnHHNiQYN30ekJG+w7l2IWRctCQUDKbmV5IE5bnirz8tHpMzkTHyClZH2g1NcvW2tUX0Glqgp4A== dependencies: "@babel/core" "^7.1.0" - babel-jest "^24.1.0" + "@jest/types" "^24.3.0" + babel-jest "^24.3.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.0.0" - jest-environment-node "^24.0.0" - jest-get-type "^24.0.0" - jest-jasmine2 "^24.1.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" + jest-environment-jsdom "^24.3.0" + jest-environment-node "^24.3.0" + jest-get-type "^24.3.0" + jest-jasmine2 "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" micromatch "^3.1.10" - pretty-format "^24.0.0" - realpath-native "^1.0.2" + pretty-format "^24.3.0" + realpath-native "^1.1.0" -jest-diff@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.0.0.tgz#a3e5f573dbac482f7d9513ac9cfa21644d3d6b34" - integrity sha512-XY5wMpRaTsuMoU+1/B2zQSKQ9RdE9gsLkGydx3nvApeyPijLA8GtEvIcPwISRCer+VDf9W1mStTYYq6fPt8ryA== +jest-diff@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.3.0.tgz#38a76ccc52130e6d273ef952e4bac358924be8a6" + integrity sha512-B3FHbTaQObcew5H639Ok6Yv8MMkU4BZqwyt1TQgJXlOiR9TdSfjoViYmb0iWucOPMT3xvz3lN6n2phymdQRyEQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" + diff-sequences "^24.3.0" + jest-get-type "^24.3.0" + pretty-format "^24.3.0" -jest-docblock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.0.0.tgz#54d77a188743e37f62181a91a01eb9222289f94e" - integrity sha512-KfAKZ4SN7CFOZpWg4i7g7MSlY0M+mq7K0aMqENaG2vHuhC9fc3vkpU/iNN9sOus7v3h3Y48uEjqz3+Gdn2iptA== +jest-docblock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" + integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== dependencies: detect-newline "^2.1.0" -jest-each@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.0.0.tgz#10987a06b21c7ffbfb7706c89d24c52ed864be55" - integrity sha512-gFcbY4Cu55yxExXMkjrnLXov3bWO3dbPAW7HXb31h/DNWdNc/6X8MtxGff8nh3/MjkF9DpVqnj0KsPKuPK0cpA== +jest-each@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.3.0.tgz#83ae8c6368791bf6ad6c5bf3f67ace0724e9d13e" + integrity sha512-FuAhGgS1k6MpOG9vHsEVYH7mwiHheRIH9vFf8xKxmM5vnuCMhoZqExojmw5vAglkEPJPVH9rjZakOD5kqWV0UA== dependencies: + "@jest/types" "^24.3.0" chalk "^2.0.1" - jest-get-type "^24.0.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" - -jest-environment-jsdom@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.0.0.tgz#5affa0654d6e44cd798003daa1a8701dbd6e4d11" - integrity sha512-1YNp7xtxajTRaxbylDc2pWvFnfDTH5BJJGyVzyGAKNt/lEULohwEV9zFqTgG4bXRcq7xzdd+sGFws+LxThXXOw== - dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + jest-get-type "^24.3.0" + jest-util "^24.3.0" + pretty-format "^24.3.0" + +jest-environment-jsdom@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.3.0.tgz#974d4293bd9d714eeeb1376c7235a8ab9d736db7" + integrity sha512-Cor5RiE8WMoDErKZSXDfh6KAEOP8lrz04PgNLczEV7IkB2++0U4NC+gTyrO0PenfIlKbCZ6g0sRubEJOgjiXUA== + dependencies: + "@jest/environment" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/types" "^24.3.0" + jest-mock "^24.3.0" + jest-util "^24.3.0" jsdom "^11.5.1" -jest-environment-node@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.0.0.tgz#330948980656ed8773ce2e04eb597ed91e3c7190" - integrity sha512-62fOFcaEdU0VLaq8JL90TqwI7hLn0cOKOl8vY2n477vRkCJRojiRRtJVRzzCcgFvs6gqU97DNqX5R0BrBP6Rxg== +jest-environment-node@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.3.0.tgz#127e214e4ebad9639f81d3c82ac5fb3d482024ad" + integrity sha512-VKJ1qE0Xn2IYNXusxce2M7IhHz4uARYDXO3JxkyQnFhLPE33e5UUx2MQHVpst2Qy98IFpO06WZtrHb5H06GGfQ== dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" + "@jest/environment" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/types" "^24.3.0" + jest-mock "^24.3.0" + jest-util "^24.3.0" jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" integrity sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w== -jest-get-type@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.0.0.tgz#36e72930b78e33da59a4f63d44d332188278940b" - integrity sha512-z6/Eyf6s9ZDGz7eOvl+fzpuJmN9i0KyTt1no37/dHu8galssxz5ZEgnc1KaV8R31q1khxyhB4ui/X5ZjjPk77w== +jest-get-type@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.3.0.tgz#582cfd1a4f91b5cdad1d43d2932f816d543c65da" + integrity sha512-HYF6pry72YUlVcvUx3sEpMRwXEWGEPlJ0bSPVnB3b3n++j4phUEoSPcS6GC0pPJ9rpyPSe4cb5muFo6D39cXow== -jest-haste-map@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0.tgz#e9ef51b2c9257384b4d6beb83bd48c65b37b5e6e" - integrity sha512-CcViJyUo41IQqttLxXVdI41YErkzBKbE6cS6dRAploCeutePYfUimWd3C9rQEWhX0YBOQzvNsC0O9nYxK2nnxQ== +jest-haste-map@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.3.0.tgz#8fc0530c25b0705e9e908d9da8f1904cbec39058" + integrity sha512-LJCFLYZ9zgaZluzgyaum7HzApSYt2fFv39DoGwcLlWSDbjeI1tZuNOIWp5qHCHe7WXc99EgqLidpzsauA3HBBg== dependencies: + "@jest/types" "^24.3.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.0.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" + jest-serializer "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" micromatch "^3.1.10" - sane "^3.0.0" + sane "^4.0.3" -jest-jasmine2@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.1.0.tgz#8377324b967037c440f0a549ee0bbd9912055db6" - integrity sha512-H+o76SdSNyCh9fM5K8upK45YTo/DiFx5w2YAzblQebSQmukDcoVBVeXynyr7DDnxh+0NTHYRCLwJVf3tC518wg== +jest-jasmine2@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.3.0.tgz#60814a23992891b955cbfe453947320e2e66076b" + integrity sha512-X0bseienL6wLdgHIrTyBbn3+llmEiXkMTJKFmJvQf4yP84bYdy1HaQYfchOWw5H9JllROM0kEBhRz8OS3p6FEA== dependencies: "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.1.0" + expect "^24.3.0" is-generator-fn "^2.0.0" - jest-each "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - pretty-format "^24.0.0" + jest-each "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-runtime "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + pretty-format "^24.3.0" throat "^4.0.0" -jest-leak-detector@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.0.0.tgz#78280119fd05ee98317daee62cddb3aa537a31c6" - integrity sha512-ZYHJYFeibxfsDSKowjDP332pStuiFT2xfc5R67Rjm/l+HFJWJgNIOCOlQGeXLCtyUn3A23+VVDdiCcnB6dTTrg== +jest-leak-detector@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.3.0.tgz#20216c2fb94a67d90b19c34e18880974bcd901f2" + integrity sha512-NUwLCYPVMnSo7mHaXY8ahKbzmPNBlRTPvmvoHK70Y2K17COFNfVz30wKhsa3Dpv3rmcnk2XaPq77DKjUAsyVGQ== dependencies: - pretty-format "^24.0.0" + pretty-format "^24.3.0" -jest-matcher-utils@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.0.0.tgz#fc9c41cfc49b2c3ec14e576f53d519c37729d579" - integrity sha512-LQTDmO+aWRz1Tf9HJg+HlPHhDh1E1c65kVwRFo5mwCVp5aQDzlkz4+vCvXhOKFjitV2f0kMdHxnODrXVoi+rlA== +jest-matcher-utils@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.3.0.tgz#c3277ee6d93583293f270e8d0ea864cfe17d2d1c" + integrity sha512-9imAV7r7dD1KGbGln2331RHAYfNQsZGYx1uLc45Fn+KuffFAqv5NS+8t9KaFZIo4rjBu/KNM3hBlu6l2/mRdqw== dependencies: chalk "^2.0.1" - jest-diff "^24.0.0" - jest-get-type "^24.0.0" - pretty-format "^24.0.0" + jest-diff "^24.3.0" + jest-get-type "^24.3.0" + pretty-format "^24.3.0" -jest-message-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.0.0.tgz#a07a141433b2c992dbaec68d4cbfe470ba289619" - integrity sha512-J9ROJIwz/IeC+eV1XSwnRK4oAwPuhmxEyYx1+K5UI+pIYwFZDSrfZaiWTdq0d2xYFw4Xiu+0KQWsdsQpgJMf3Q== +jest-message-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.3.0.tgz#e8f64b63ebc75b1a9c67ee35553752596e70d4a9" + integrity sha512-lXM0YgKYGqN5/eH1NGw4Ix+Pk2I9Y77beyRas7xM24n+XTTK3TbT0VkT3L/qiyS7WkW0YwyxoXnnAaGw4hsEDA== dependencies: "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.0.0.tgz#9a4b53e01d66a0e780f7d857462d063e024c617d" - integrity sha512-sQp0Hu5fcf5NZEh1U9eIW2qD0BwJZjb63Yqd98PQJFvf/zzUTBoUAwv/Dc/HFeNHIw1f3hl/48vNn+j3STaI7A== +jest-mock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.3.0.tgz#95a86b6ad474e3e33227e6dd7c4ff6b07e18d3cb" + integrity sha512-AhAo0qjbVWWGvcbW5nChFjR0ObQImvGtU6DodprNziDOt+pP0CBdht/sYcNIOXeim8083QUi9bC8QdKB8PTK4Q== + dependencies: + "@jest/types" "^24.3.0" -jest-regex-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.0.0.tgz#4feee8ec4a358f5bee0a654e94eb26163cb9089a" - integrity sha512-Jv/uOTCuC+PY7WpJl2mpoI+WbY2ut73qwwO9ByJJNwOCwr1qWhEW2Lyi2S9ZewUdJqeVpEBisdEVZSI+Zxo58Q== +jest-regex-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" + integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== -jest-resolve-dependencies@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.1.0.tgz#78f738a2ec59ff4d00751d9da56f176e3f589f6c" - integrity sha512-2VwPsjd3kRPu7qe2cpytAgowCObk5AKeizfXuuiwgm1a9sijJDZe8Kh1sFj6FKvSaNEfCPlBVkZEJa2482m/Uw== +jest-resolve-dependencies@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.3.0.tgz#fd364c149fcd9d330f1f3adce1ba2d6937eb9ed7" + integrity sha512-z4s8t+EM67sbsRG5j0VzW0a4cv3Fj4+oQWisUOJXOtPHaBVP5OySsQq9E+BSSwaS8YgNC1m0+PdfUZEp3DkDOw== dependencies: - jest-regex-util "^24.0.0" - jest-snapshot "^24.1.0" + "@jest/types" "^24.3.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.3.0" -jest-resolve@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.1.0.tgz#42ff0169b0ea47bfdbd0c52a0067ca7d022c7688" - integrity sha512-TPiAIVp3TG6zAxH28u/6eogbwrvZjBMWroSLBDkwkHKrqxB/RIdwkWDye4uqPlZIXWIaHtifY3L0/eO5Z0f2wg== +jest-resolve@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.3.0.tgz#484268892ceb25cc90694adc78aa99026907322b" + integrity sha512-lgU2nE475eZrB/KwrEdVwNhFKvHqgSB3G+yaJ6bpK3cOYt35uInteNu1BL5008F5AQsJKdmg3mIWwwizdgb/uA== dependencies: + "@jest/types" "^24.3.0" browser-resolve "^1.11.3" chalk "^2.0.1" - realpath-native "^1.0.0" + realpath-native "^1.1.0" -jest-runner@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.1.0.tgz#3686a2bb89ce62800da23d7fdc3da2c32792943b" - integrity sha512-CDGOkT3AIFl16BLL/OdbtYgYvbAprwJ+ExKuLZmGSCSldwsuU2dEGauqkpvd9nphVdAnJUcP12e/EIlnTX0QXg== +jest-runner@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.3.0.tgz#5bdc0378992b60f7b14f9d198c9cc1481883a27e" + integrity sha512-oAWdXY74DwXViSrczs6q8FSi2RdFEejM2q9KasgjI+b8+usOnxXpEpo6FEMUvSXzkjpPz4XND7jusUNhShu9jQ== dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.1.0" - jest-docblock "^24.0.0" - jest-haste-map "^24.0.0" - jest-jasmine2 "^24.1.0" - jest-leak-detector "^24.0.0" - jest-message-util "^24.0.0" - jest-runtime "^24.1.0" - jest-util "^24.0.0" - jest-worker "^24.0.0" + jest-config "^24.3.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.3.0" + jest-jasmine2 "^24.3.0" + jest-leak-detector "^24.3.0" + jest-message-util "^24.3.0" + jest-resolve "^24.3.0" + jest-runtime "^24.3.0" + jest-util "^24.3.0" + jest-worker "^24.3.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.1.0.tgz#7c157a2e776609e8cf552f956a5a19ec9c985214" - integrity sha512-59/BY6OCuTXxGeDhEMU7+N33dpMQyXq7MLK07cNSIY/QYt2QZgJ7Tjx+rykBI0skAoigFl0A5tmT8UdwX92YuQ== - dependencies: - "@babel/core" "^7.1.0" - babel-plugin-istanbul "^5.1.0" +jest-runtime@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.3.0.tgz#6ed1ba1260ad90c906a55fb4989021cfc7c967c4" + integrity sha512-ARqHo8nPQ0/QlTN9ZuE8ebIjleBVqJhdEcuoy7mEWNyOqEpuEMAVIp3asO+giAmwh5ih9NlbhWsx97DIt5N6KA== + dependencies: + "@jest/console" "^24.3.0" + "@jest/environment" "^24.3.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/yargs" "^12.0.2" chalk "^2.0.1" - convert-source-map "^1.4.0" exit "^0.1.2" - fast-json-stable-stringify "^2.0.0" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.1.0" - jest-haste-map "^24.0.0" - jest-message-util "^24.0.0" - jest-regex-util "^24.0.0" - jest-resolve "^24.1.0" - jest-snapshot "^24.1.0" - jest-util "^24.0.0" - jest-validate "^24.0.0" - micromatch "^3.1.10" - realpath-native "^1.0.0" + jest-config "^24.3.0" + jest-haste-map "^24.3.0" + jest-message-util "^24.3.0" + jest-mock "^24.3.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.3.0" + jest-snapshot "^24.3.0" + jest-util "^24.3.0" + jest-validate "^24.3.0" + realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - write-file-atomic "2.4.1" yargs "^12.0.2" -jest-serializer@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0.tgz#522c44a332cdd194d8c0531eb06a1ee5afb4256b" - integrity sha512-9FKxQyrFgHtx3ozU+1a8v938ILBE7S8Ko3uiAVjT8Yfi2o91j/fj81jacCQZ/Ihjiff/VsUCXVgQ+iF1XdImOw== +jest-serializer@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.3.0.tgz#074e307300d1451617cf2630d11543ee4f74a1c8" + integrity sha512-RiSpqo2OFbVLJN/PgAOwQIUeHDfss6NBUDTLhjiJM8Bb5rMrwRqHfkaqahIsOf9cXXB5UjcqDCzbQ7AIoMqWkg== -jest-snapshot@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.1.0.tgz#85e22f810357aa5994ab61f236617dc2205f2f5b" - integrity sha512-th6TDfFqEmXvuViacU1ikD7xFb7lQsPn2rJl7OEmnfIVpnrx3QNY2t3PE88meeg0u/mQ0nkyvmC05PBqO4USFA== +jest-snapshot@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.3.0.tgz#00baac770e25df9a6217108dc8a4df59d80aa4aa" + integrity sha512-0zxK7KBX35vwbnQbxdO0tVzIyliWfU5WoE4nU2tMajLH0lSg8+5mgr/6TKHzDB5fWVggXgOI/iMTgsaChEq9tQ== dependencies: "@babel/types" "^7.0.0" + "@jest/types" "^24.3.0" chalk "^2.0.1" - jest-diff "^24.0.0" - jest-matcher-utils "^24.0.0" - jest-message-util "^24.0.0" - jest-resolve "^24.1.0" + expect "^24.3.0" + jest-diff "^24.3.0" + jest-matcher-utils "^24.3.0" + jest-message-util "^24.3.0" + jest-resolve "^24.3.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.0.0" + pretty-format "^24.3.0" semver "^5.5.0" -jest-util@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.0.0.tgz#fd38fcafd6dedbd0af2944d7a227c0d91b68f7d6" - integrity sha512-QxsALc4wguYS7cfjdQSOr5HTkmjzkHgmZvIDkcmPfl1ib8PNV8QUWLwbKefCudWS0PRKioV+VbQ0oCUPC691fQ== +jest-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.3.0.tgz#a549ae9910fedbd4c5912b204bb1bcc122ea0057" + integrity sha512-eKIAC+MTKWZthUUVOwZ3Tc5a0cKMnxalQHr6qZ4kPzKn6k09sKvsmjCygqZ1SxVVfUKoa8Sfn6XDv9uTJ1iXTg== dependencies: + "@jest/console" "^24.3.0" + "@jest/fake-timers" "^24.3.0" + "@jest/source-map" "^24.3.0" + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" is-ci "^2.0.0" - jest-message-util "^24.0.0" mkdirp "^0.5.1" slash "^2.0.0" source-map "^0.6.0" @@ -4126,42 +4319,48 @@ jest-validate@^23.5.0: leven "^2.1.0" pretty-format "^23.6.0" -jest-validate@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.0.0.tgz#aa8571a46983a6538328fef20406b4a496b6c020" - integrity sha512-vMrKrTOP4BBFIeOWsjpsDgVXATxCspC9S1gqvbJ3Tnn/b9ACsJmteYeVx9830UMV28Cob1RX55x96Qq3Tfad4g== +jest-validate@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.3.0.tgz#1701990cba3ca8193ec987fea768811e9448cd9f" + integrity sha512-K4p5QrCA6MYacPupnWHrrYiMkeBWD+tXjiO9zoR4+/H1ApjQzYrhdsTzGltlTE0KKdKbpZhxnIJkPVJQ4Z3CkA== dependencies: + "@jest/types" "^24.3.0" camelcase "^5.0.0" chalk "^2.0.1" - jest-get-type "^24.0.0" + jest-get-type "^24.3.0" leven "^2.1.0" - pretty-format "^24.0.0" + pretty-format "^24.3.0" -jest-watcher@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.0.0.tgz#20d44244d10b0b7312410aefd256c1c1eef68890" - integrity sha512-GxkW2QrZ4YxmW1GUWER05McjVDunBlKMFfExu+VsGmXJmpej1saTEKvONdx5RJBlVdpPI5x6E3+EDQSIGgl53g== +jest-watcher@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.3.0.tgz#ee51c6afbe4b35a12fcf1107556db6756d7b9290" + integrity sha512-EpJS/aUG8D3DMuy9XNA4fnkKWy3DQdoWhY92ZUdlETIeEn1xya4Np/96MBSh4II5YvxwKe6JKwbu3Bnzfwa7vA== dependencies: + "@jest/test-result" "^24.3.0" + "@jest/types" "^24.3.0" + "@types/node" "*" + "@types/yargs" "^12.0.9" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.0.0" + jest-util "^24.3.0" string-length "^2.0.0" -jest-worker@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0.tgz#3d3483b077bf04f412f47654a27bba7e947f8b6d" - integrity sha512-s64/OThpfQvoCeHG963MiEZOAAxu8kHsaL/rCMF7lpdzo7vgF0CtPml9hfguOMgykgH/eOm4jFP4ibfHLruytg== +jest-worker@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.3.0.tgz#2e02eea58f8e43d32e5d82e42aa411dee127dc2d" + integrity sha512-gJ5eGnHt73cCpwKGbx0drrVCypgUVINZ5nUAvzD57EUCFc1kzqA0wpPmn4LVWi7mkNeOE36daBbAyWPEmEf+CQ== dependencies: + "@types/node" "*" merge-stream "^1.0.1" supports-color "^6.1.0" -jest@24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.1.0.tgz#b1e1135caefcf2397950ecf7f90e395fde866fd2" - integrity sha512-+q91L65kypqklvlRFfXfdzUKyngQLOcwGhXQaLmVHv+d09LkNXuBuGxlofTFW42XMzu3giIcChchTsCNUjQ78A== +jest@24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.3.0.tgz#e16620880d9ce36b3f9341cd4d2808f85b8f16fd" + integrity sha512-c1EFvnRkTClSj9qcAF3r0UHCf5bpxdGs4+cKJwp53tct6S/ZhSk3NGjjMGBHxm41+6wnJSBl48u6nzIFxoNs9g== dependencies: import-local "^2.0.0" - jest-cli "^24.1.0" + jest-cli "^24.3.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -4763,11 +4962,6 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -merge@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" - integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== - micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -4936,11 +5130,6 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.9.2: - version "2.12.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" - integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== - nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -4963,15 +5152,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" - integrity sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA== - dependencies: - debug "^2.1.2" - iconv-lite "^0.4.4" - sax "^1.2.4" - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5038,22 +5218,6 @@ node-notifier@^5.2.1: shellwords "^0.1.1" which "^1.3.0" -node-pre-gyp@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" - integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4" - "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -5061,14 +5225,6 @@ node-pre-gyp@^0.10.0: dependencies: abbrev "1" -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= - dependencies: - abbrev "1" - osenv "^0.1.4" - normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.4.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -5120,7 +5276,7 @@ npm-lifecycle@^2.1.0: semver "^5.5.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.12, npm-packlist@^1.1.6: +npm-packlist@^1.1.12: version "1.3.0" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.3.0.tgz#7f01e8e44408341379ca98cfd756e7b29bd2626c" integrity sha512-qPBc6CnxEzpOcc4bjoIBJbYdy0D/LFFPUdxvfwor4/w3vxeE0h6TiOVurCEPpQ6trjN77u/ShyfeJGsbAfB3dA== @@ -5172,7 +5328,7 @@ npm-which@^3.0.1: npm-path "^2.0.2" which "^1.2.10" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.2, npmlog@^4.1.2: +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -5316,7 +5472,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@0, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -5600,7 +5756,7 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pirates@^4.0.0: +pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== @@ -5656,11 +5812,12 @@ pretty-format@^23.6.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -pretty-format@^24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.0.0.tgz#cb6599fd73ac088e37ed682f61291e4678f48591" - integrity sha512-LszZaKG665djUcqg5ZQq+XzezHLKrxsA86ZABTozp+oNhkdqa+tG2dX4qa6ERl5c/sRDrAa3lHmwnvKoP+OG/g== +pretty-format@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.3.0.tgz#e7eaefecd28d714fc6425dc2d5f9ed30e1188b26" + integrity sha512-oz+EQc2uda3ql4JluWTWEQgegTo9cMkVcqXxBieSV1opZ4SE1TKuFBDoSk7jGOb08UgwQVHMkVSINB8jQyUFQg== dependencies: + "@jest/types" "^24.3.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" @@ -5779,16 +5936,6 @@ quick-lru@^1.0.0: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - read-cmd-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" @@ -5900,7 +6047,7 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -realpath-native@^1.0.0, realpath-native@^1.0.2: +realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== @@ -6099,7 +6246,7 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -6154,22 +6301,20 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sane@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-3.1.0.tgz#995193b7dc1445ef1fe41ddfca2faf9f111854c6" - integrity sha512-G5GClRRxT1cELXfdAq7UKtUsv8q/ZC5k8lQGmjEm4HcAl3HzBy68iglyNCmw4+0tiXPCBZntslHlRhbnsSws+Q== +sane@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.0.3.tgz#e878c3f19e25cc57fbb734602f48f8a97818b181" + integrity sha512-hSLkC+cPHiBQs7LSyXkotC3UUtyn8C4FMn50TNaacRyvBlI+3ebcxMpqckmTdtXVtel87YS7GXN3UIOj7NiGVQ== dependencies: + "@cnakazawa/watch" "^1.0.3" anymatch "^2.0.0" capture-exit "^1.2.0" - exec-sh "^0.2.0" + exec-sh "^0.3.2" execa "^1.0.0" fb-watchman "^2.0.0" micromatch "^3.1.4" minimist "^1.1.1" walker "~1.0.5" - watch "~0.18.0" - optionalDependencies: - fsevents "^1.2.3" sax@^1.2.4: version "1.2.4" @@ -6591,7 +6736,7 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -6653,7 +6798,7 @@ tar@^2.0.0: fstream "^1.0.2" inherits "2" -tar@^4, tar@^4.4.8: +tar@^4.4.8: version "4.4.8" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== @@ -7052,14 +7197,6 @@ walker@~1.0.5: dependencies: makeerror "1.0.x" -watch@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" - integrity sha1-KAlUdsbffJDJYxOJkMClQj60uYY= - dependencies: - exec-sh "^0.2.0" - minimist "^1.2.0" - wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -7112,7 +7249,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.10, which@^1.2.12, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.10, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== From 8c6c961318b33f6bce65205d0609c56330609256 Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Sun, 10 Mar 2019 10:53:25 -0700 Subject: [PATCH 6/6] fix: restoring accidental revert --- .../src/rules/adjacent-overload-signatures.ts | 4 ++- .../rules/explicit-member-accessibility.ts | 7 ++++- .../eslint-plugin/src/rules/member-naming.ts | 4 ++- .../src/rules/member-ordering.ts | 4 ++- packages/eslint-plugin/src/util/misc.ts | 29 +++++++++++++++++++ .../adjacent-overload-signatures.test.ts | 5 ++++ packages/eslint-plugin/typings/ts-eslint.d.ts | 1 + .../src/ts-estree/ts-estree.ts | 2 +- 8 files changed, 51 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 7007b1c3bdf0..8e864c9c4a2a 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -26,6 +26,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { + const sourceCode = context.getSourceCode(); + /** * Gets the name of the member being processed. * @param member the member being processed. @@ -57,7 +59,7 @@ export default util.createRule({ case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'new'; case AST_NODE_TYPES.MethodDefinition: - return util.getNameFromPropertyName(member.key); + return util.getNameFromClassMember(member, sourceCode); } return null; diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index bf24c1d2870d..be79d684a690 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -63,6 +63,7 @@ export default util.createRule({ }, defaultOptions: [{ accessibility: 'explicit' }], create(context, [option]) { + const sourceCode = context.getSourceCode(); const baseCheck: AccessibilityLevel = option.accessibility || 'explicit'; const overrides = option.overrides || {}; const ctorCheck = overrides.constructors || baseCheck; @@ -117,7 +118,11 @@ export default util.createRule({ } if (util.isTypeScriptFile(context.getFilename())) { - const methodName = util.getNameFromPropertyName(methodDefinition.key); + // const methodName = util.getNameFromPropertyName(methodDefinition.key); + const methodName = util.getNameFromClassMember( + methodDefinition, + sourceCode, + ); if ( check === 'no-public' && methodDefinition.accessibility === 'public' diff --git a/packages/eslint-plugin/src/rules/member-naming.ts b/packages/eslint-plugin/src/rules/member-naming.ts index 23c14c8b39c5..2efdf6ea3079 100644 --- a/packages/eslint-plugin/src/rules/member-naming.ts +++ b/packages/eslint-plugin/src/rules/member-naming.ts @@ -51,6 +51,8 @@ export default util.createRule({ }, defaultOptions: [{}], create(context, [config]) { + const sourceCode = context.getSourceCode(); + const conventions = (Object.keys(config) as Modifiers[]).reduce< Config >((acc, accessibility) => { @@ -69,7 +71,7 @@ export default util.createRule({ function validateName( node: TSESTree.MethodDefinition | TSESTree.ClassProperty, ): void { - const name = util.getNameFromPropertyName(node.key); + const name = util.getNameFromClassMember(node, sourceCode); const accessibility: Modifiers = node.accessibility || 'public'; const convention = conventions[accessibility]; diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index dff4752bab45..f3ae6a439bd6 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -164,6 +164,8 @@ export default util.createRule({ }, ], create(context, [options]) { + const sourceCode = context.getSourceCode(); + const functionExpressions = [ AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression, @@ -213,7 +215,7 @@ export default util.createRule({ case AST_NODE_TYPES.MethodDefinition: return node.kind === 'constructor' ? 'constructor' - : util.getNameFromPropertyName(node.key); + : util.getNameFromClassMember(node, sourceCode); case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'new'; default: diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index dbaaebc3f7ae..ab56cd4e694e 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -4,6 +4,7 @@ import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; import RuleModule from 'ts-eslint'; +import { SourceCode } from 'ts-eslint'; /** * Check if the context file name is *.ts or *.tsx @@ -63,3 +64,31 @@ export function getNameFromPropertyName( } return `${propertyName.value}`; } + +/** + * Gets a string name representation of the name of the given MethodDefinition + * or ClassProperty node, with handling for computed property names. + */ +export function getNameFromClassMember( + methodDefinition: TSESTree.MethodDefinition | TSESTree.ClassProperty, + sourceCode: SourceCode, +): string { + if (keyCanBeReadAsPropertyName(methodDefinition.key)) { + return getNameFromPropertyName(methodDefinition.key); + } + + return sourceCode.text.slice(...methodDefinition.key.range); +} + +/** + * This covers both actual property names, as well as computed properties that are either + * an identifier or a literal at the top level. + */ +function keyCanBeReadAsPropertyName( + node: TSESTree.Expression, +): node is TSESTree.PropertyName { + return ( + node.type === AST_NODE_TYPES.Literal || + node.type === AST_NODE_TYPES.Identifier + ); +} diff --git a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts index 01680fef838e..c040362a1286 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -217,6 +217,11 @@ class Test { // examples from https://github.com/nzakas/eslint-plugin-typescript/issues/138 'export default function(foo : T) {}', 'export default function named(foo : T) {}', + ` +interface Foo { + [Symbol.toStringTag](): void; + [Symbol.iterator](): void; +}`, ], invalid: [ { diff --git a/packages/eslint-plugin/typings/ts-eslint.d.ts b/packages/eslint-plugin/typings/ts-eslint.d.ts index 998c69583428..b757a1b59820 100644 --- a/packages/eslint-plugin/typings/ts-eslint.d.ts +++ b/packages/eslint-plugin/typings/ts-eslint.d.ts @@ -683,6 +683,7 @@ declare module 'ts-eslint' { RuleMetaData, RuleMetaDataDocs, Scope, + SourceCode, }; export default RuleModule; } diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 4a9c7b91ae10..f15f50abca36 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -500,7 +500,7 @@ interface LiteralBase extends BaseNode { } interface MethodDefinitionBase extends BaseNode { - key: PropertyName; + key: Expression; value: FunctionExpression | TSEmptyBodyFunctionExpression; computed: boolean; static: boolean;