From 3777b770670440c3e47b451d862e5cb57b79e40d Mon Sep 17 00:00:00 2001 From: Ben Lichtman Date: Sun, 28 Jul 2019 11:15:07 -0700 Subject: [PATCH 01/58] feat(typescript-estree)!: throw error on file not in project when `project` set (#760) BREAKING CHANGE: by default we will now throw when a file is not in the `project` provided --- .prettierignore | 1 + .../tests/fixture-project/1.ts | 1 + .../tests/fixture-project/2.ts | 1 + .../tests/fixture-project/3.ts | 1 + .../tests/fixture-project/4.ts | 1 + .../tests/fixture-project/5.ts | 1 + .../tests/fixture-project/6.ts | 1 + .../tests/fixture-project/tsconfig.json | 1 + .../eslint-plugin-tslint/tests/index.spec.ts | 31 ++++++++---- .../tests/test-project/extra.ts | 1 + packages/eslint-plugin/tests/RuleTester.ts | 25 ++++++++++ packages/eslint-plugin/tests/fixtures/file.ts | 0 .../rules/no-unnecessary-qualifier.test.ts | 1 - packages/parser/README.md | 15 ++++++ packages/parser/tests/lib/parser.ts | 4 +- .../typescript-estree/src/parser-options.ts | 2 + packages/typescript-estree/src/parser.ts | 41 ++++++++++----- .../typescript-estree/src/tsconfig-parser.ts | 10 ++++ .../tests/fixtures/simpleProject/file.ts | 0 .../fixtures/simpleProject/tsconfig.json | 1 + packages/typescript-estree/tests/lib/parse.ts | 26 +++++++--- .../tests/lib/semanticInfo.ts | 50 ++++++++++++------- tests/integration/utils/.eslintrc.js | 5 ++ tests/integration/utils/jsconfig.json | 3 ++ 24 files changed, 173 insertions(+), 50 deletions(-) create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/1.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/2.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/3.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/4.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/5.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/6.ts create mode 100644 packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json create mode 100644 packages/eslint-plugin-tslint/tests/test-project/extra.ts create mode 100644 packages/eslint-plugin/tests/fixtures/file.ts create mode 100644 packages/typescript-estree/tests/fixtures/simpleProject/file.ts create mode 100644 packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json create mode 100644 tests/integration/utils/.eslintrc.js create mode 100644 tests/integration/utils/jsconfig.json diff --git a/.prettierignore b/.prettierignore index 1dd0c3996671..a86a2f04fc90 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ **/tests/fixtures/**/* +**/tests/fixture-project/**/* **/dist **/coverage **/shared-fixtures diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/1.ts b/packages/eslint-plugin-tslint/tests/fixture-project/1.ts new file mode 100644 index 000000000000..0870b5cd2825 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/1.ts @@ -0,0 +1 @@ +var foo = true; diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/2.ts b/packages/eslint-plugin-tslint/tests/fixture-project/2.ts new file mode 100644 index 000000000000..3da535b2cde3 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/2.ts @@ -0,0 +1 @@ +throw 'should be ok because rule is not loaded'; diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/3.ts b/packages/eslint-plugin-tslint/tests/fixture-project/3.ts new file mode 100644 index 000000000000..e71f830c3915 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/3.ts @@ -0,0 +1 @@ +throw 'err'; // no-string-throw diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/4.ts b/packages/eslint-plugin-tslint/tests/fixture-project/4.ts new file mode 100644 index 000000000000..1ca8bbace361 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/4.ts @@ -0,0 +1 @@ +var foo = true // semicolon diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/5.ts b/packages/eslint-plugin-tslint/tests/fixture-project/5.ts new file mode 100644 index 000000000000..2fc07810720c --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/5.ts @@ -0,0 +1 @@ +var foo = true; // fail diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/6.ts b/packages/eslint-plugin-tslint/tests/fixture-project/6.ts new file mode 100644 index 000000000000..e901f01b4874 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/6.ts @@ -0,0 +1 @@ +foo; diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json b/packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts index 88a3a648b076..0de1046ecf3f 100644 --- a/packages/eslint-plugin-tslint/tests/index.spec.ts +++ b/packages/eslint-plugin-tslint/tests/index.spec.ts @@ -12,7 +12,7 @@ const ruleTester = new TSESLint.RuleTester({ * Project is needed to generate the parserServices * within @typescript-eslint/parser */ - project: './tests/tsconfig.json', + project: './tests/fixture-project/tsconfig.json', }, parser: require.resolve('@typescript-eslint/parser'), }); @@ -47,6 +47,7 @@ ruleTester.run('tslint/config', rule, { { code: 'var foo = true;', options: tslintRulesConfig, + filename: './tests/fixture-project/1.ts', }, { filename: './tests/test-project/file-spec.ts', @@ -62,6 +63,7 @@ ruleTester.run('tslint/config', rule, { { code: 'throw "should be ok because rule is not loaded";', options: tslintRulesConfig, + filename: './tests/fixture-project/2.ts', }, ], @@ -69,6 +71,7 @@ ruleTester.run('tslint/config', rule, { { options: [{ lintFile: './tests/test-project/tslint.json' }], code: 'throw "err" // no-string-throw', + filename: './tests/fixture-project/3.ts', errors: [ { messageId: 'failure', @@ -84,6 +87,7 @@ ruleTester.run('tslint/config', rule, { code: 'var foo = true // semicolon', options: tslintRulesConfig, output: 'var foo = true // semicolon', + filename: './tests/fixture-project/4.ts', errors: [ { messageId: 'failure', @@ -100,6 +104,7 @@ ruleTester.run('tslint/config', rule, { code: 'var foo = true // fail', options: tslintRulesDirectoryConfig, output: 'var foo = true // fail', + filename: './tests/fixture-project/5.ts', errors: [ { messageId: 'failure', @@ -174,26 +179,30 @@ describe('tslint/error', () => { }); }); - it('should not crash if there is no tslint rules specified', () => { + it('should not crash if there are no tslint rules specified', () => { const linter = new TSESLint.Linter(); jest.spyOn(console, 'warn').mockImplementation(); linter.defineRule('tslint/config', rule); linter.defineParser('@typescript-eslint/parser', parser); expect(() => - linter.verify('foo;', { - parserOptions: { - project: `${__dirname}/test-project/tsconfig.json`, - }, - rules: { - 'tslint/config': [2, {}], + linter.verify( + 'foo;', + { + parserOptions: { + project: `${__dirname}/test-project/tsconfig.json`, + }, + rules: { + 'tslint/config': [2, {}], + }, + parser: '@typescript-eslint/parser', }, - parser: '@typescript-eslint/parser', - }), + `${__dirname}/test-project/extra.ts`, + ), ).not.toThrow(); expect(console.warn).toHaveBeenCalledWith( expect.stringContaining( - 'Tried to lint but found no valid, enabled rules for this file type and file path in the resolved configuration.', + `Tried to lint ${__dirname}/test-project/extra.ts but found no valid, enabled rules for this file type and file path in the resolved configuration.`, ), ); jest.resetAllMocks(); diff --git a/packages/eslint-plugin-tslint/tests/test-project/extra.ts b/packages/eslint-plugin-tslint/tests/test-project/extra.ts new file mode 100644 index 000000000000..e901f01b4874 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/test-project/extra.ts @@ -0,0 +1 @@ +foo; diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 0733e1887cb2..fe3d06d4fc87 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -7,6 +7,8 @@ type RuleTesterConfig = Omit & { parser: typeof parser; }; class RuleTester extends TSESLint.RuleTester { + private filename: string | undefined = undefined; + // as of eslint 6 you have to provide an absolute path to the parser // but that's not as clean to type, this saves us trying to manually enforce // that contributors require.resolve everything @@ -15,6 +17,10 @@ class RuleTester extends TSESLint.RuleTester { ...options, parser: require.resolve(options.parser), }); + + if (options.parserOptions && options.parserOptions.project) { + this.filename = path.join(getFixturesRootDir(), 'file.ts'); + } } // as of eslint 6 you have to provide an absolute path to the parser @@ -26,17 +32,36 @@ class RuleTester extends TSESLint.RuleTester { tests: TSESLint.RunTests, ): void { const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${parser}`; + + if (this.filename) { + tests.valid = tests.valid.map(test => { + if (typeof test === 'string') { + return { + code: test, + filename: this.filename, + }; + } + return test; + }); + } + tests.valid.forEach(test => { if (typeof test !== 'string') { if (test.parser === parser) { throw new Error(errorMessage); } + if (!test.filename) { + test.filename = this.filename; + } } }); tests.invalid.forEach(test => { if (test.parser === parser) { throw new Error(errorMessage); } + if (!test.filename) { + test.filename = this.filename; + } }); super.run(name, rule, tests); diff --git a/packages/eslint-plugin/tests/fixtures/file.ts b/packages/eslint-plugin/tests/fixtures/file.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts index 53a349e552ee..75236704c853 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts @@ -199,7 +199,6 @@ import * as Foo from './foo'; declare module './foo' { const x: Foo.T = 3; }`, - filename: path.join(rootPath, 'bar.ts'), errors: [ { messageId, diff --git a/packages/parser/README.md b/packages/parser/README.md index 78d17e6388fb..45c620280f15 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -50,8 +50,23 @@ The following additional configuration options are available by specifying them - **`project`** - default `undefined`. This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. You may want to use this setting in tandem with the `tsconfigRootDir` option below. + - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: + + ```ts + { + "extends": "./tsconfig.json", // path to existing tsconfig + "includes": [ + "src/**/*.ts", + "test/**/*.ts", + // etc + ] + } + ``` + - **`tsconfigRootDir`** - default `undefined`. This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. +- **`createDefaultProgram`** - default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. However, this may incur significant performance costs, so this option is primarily included for backwards-compatibility. See the **`project`** section for more information. + - **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file - **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index 0a00ef5ad155..782d474afc36 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -50,12 +50,12 @@ describe('parser', () => { jsx: false, }, // ts-estree specific - filePath: 'test/foo', + filePath: 'tests/fixtures/services/isolated-file.src.ts', project: 'tsconfig.json', useJSXTextNode: false, errorOnUnknownASTType: false, errorOnTypeScriptSyntacticAndSemanticIssues: false, - tsconfigRootDir: './', + tsconfigRootDir: 'tests/fixtures/services', extraFileExtensions: ['foo'], }; parseForESLint(code, config); diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index c224b7da5659..77a649f6f309 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -18,6 +18,7 @@ export interface Extra { tsconfigRootDir: string; extraFileExtensions: string[]; preserveNodeMaps?: boolean; + createDefaultProgram: boolean; } export interface TSESTreeOptions { @@ -35,6 +36,7 @@ export interface TSESTreeOptions { tsconfigRootDir?: string; extraFileExtensions?: string[]; preserveNodeMaps?: boolean; + createDefaultProgram?: boolean; } // This lets us use generics to type the return value, and removes the need to diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index aed8f04b8d27..564114d7ccb7 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -58,6 +58,7 @@ function resetExtra(): void { tsconfigRootDir: process.cwd(), extraFileExtensions: [], preserveNodeMaps: undefined, + createDefaultProgram: false, }; } @@ -66,20 +67,27 @@ function resetExtra(): void { * @param options The config object * @returns If found, returns the source file corresponding to the code and the containing program */ -function getASTFromProject(code: string, options: TSESTreeOptions) { - return firstDefined( - calculateProjectParserOptions( - code, - options.filePath || getFileName(options), - extra, - ), +function getASTFromProject( + code: string, + options: TSESTreeOptions, + createDefaultProgram: boolean, +) { + const filePath = options.filePath || getFileName(options); + const astAndProgram = firstDefined( + calculateProjectParserOptions(code, filePath, extra), currentProgram => { - const ast = currentProgram.getSourceFile( - options.filePath || getFileName(options), - ); + const ast = currentProgram.getSourceFile(filePath); return ast && { ast, program: currentProgram }; }, ); + + if (!astAndProgram && !createDefaultProgram) { + throw new Error( + `If "parserOptions.project" has been set for @typescript-eslint/parser, ${filePath} must be included in at least one of the projects provided.`, + ); + } + + return astAndProgram; } /** @@ -161,10 +169,14 @@ function getProgramAndAST( code: string, options: TSESTreeOptions, shouldProvideParserServices: boolean, + createDefaultProgram: boolean, ) { return ( - (shouldProvideParserServices && getASTFromProject(code, options)) || - (shouldProvideParserServices && getASTAndDefaultProject(code, options)) || + (shouldProvideParserServices && + getASTFromProject(code, options, createDefaultProgram)) || + (shouldProvideParserServices && + createDefaultProgram && + getASTAndDefaultProject(code, options)) || createNewProgram(code) ); } @@ -254,6 +266,10 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { if (options.preserveNodeMaps === undefined && extra.projects.length > 0) { extra.preserveNodeMaps = true; } + + extra.createDefaultProgram = + typeof options.createDefaultProgram === 'boolean' && + options.createDefaultProgram; } function warnAboutTSVersion(): void { @@ -386,6 +402,7 @@ export function parseAndGenerateServices< code, options, shouldProvideParserServices, + extra.createDefaultProgram, ); /** * Determine whether or not two-way maps of converted AST nodes should be preserved diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 855355fe689b..091990533498 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -30,6 +30,16 @@ const watchCallbackTrackingMap = new Map(); const parsedFilesSeen = new Set(); +/** + * Clear tsconfig caches. + * Primarily used for testing. + */ +export function clearCaches() { + knownWatchProgramMap.clear(); + watchCallbackTrackingMap.clear(); + parsedFilesSeen.clear(); +} + /** * Holds information about the file currently being linted */ diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/file.ts b/packages/typescript-estree/tests/fixtures/simpleProject/file.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 3d8dfe222e45..57a4bc057424 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -2,6 +2,9 @@ import * as parser from '../../src/parser'; import * as astConverter from '../../src/ast-converter'; import { TSESTreeOptions } from '../../src/parser-options'; import { createSnapshotTestBlock } from '../../tools/test-utils'; +import { join } from 'path'; + +const FIXTURES_DIR = './tests/fixtures/simpleProject'; describe('parse()', () => { describe('basic functionality', () => { @@ -91,6 +94,7 @@ describe('parse()', () => { tsconfigRootDir: expect.any(String), useJSXTextNode: false, preserveNodeMaps: false, + createDefaultProgram: false, }, false, ); @@ -137,6 +141,12 @@ describe('parse()', () => { tokens: true, range: true, loc: true, + filePath: 'tests/fixtures/simpleProject/file.ts', + }; + const projectConfig: TSESTreeOptions = { + ...baseConfig, + tsconfigRootDir: join(process.cwd(), FIXTURES_DIR), + project: './tsconfig.json', }; it('should not impact the use of parse()', () => { @@ -167,10 +177,10 @@ describe('parse()', () => { expect(noOptionSet.services.esTreeNodeToTSNodeMap).toBeUndefined(); expect(noOptionSet.services.tsNodeToESTreeNodeMap).toBeUndefined(); - const withProjectNoOptionSet = parser.parseAndGenerateServices(code, { - ...baseConfig, - project: './tsconfig.json', - }); + const withProjectNoOptionSet = parser.parseAndGenerateServices( + code, + projectConfig, + ); expect(withProjectNoOptionSet.services.esTreeNodeToTSNodeMap).toEqual( expect.any(WeakMap), @@ -194,9 +204,8 @@ describe('parse()', () => { ); const withProjectOptionSetToTrue = parser.parseAndGenerateServices(code, { - ...baseConfig, + ...projectConfig, preserveNodeMaps: true, - project: './tsconfig.json', }); expect(withProjectOptionSetToTrue.services.esTreeNodeToTSNodeMap).toEqual( @@ -218,7 +227,10 @@ describe('parse()', () => { const withProjectOptionSetToFalse = parser.parseAndGenerateServices( code, - { ...baseConfig, preserveNodeMaps: false, project: './tsconfig.json' }, + { + ...projectConfig, + preserveNodeMaps: false, + }, ); expect( diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 3f0a69b30537..7e5c634db9d3 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -13,6 +13,7 @@ import { ParseAndGenerateServicesResult, } from '../../src/parser'; import { TSESTree } from '../../src/ts-estree'; +import { clearCaches } from '../../src/tsconfig-parser'; const FIXTURES_DIR = './tests/fixtures/semanticInfo'; const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.ts`); @@ -28,11 +29,14 @@ function createOptions(fileName: string): TSESTreeOptions & { cwd?: string } { errorOnUnknownASTType: true, filePath: fileName, tsconfigRootDir: join(process.cwd(), FIXTURES_DIR), - project: './tsconfig.json', + project: `./tsconfig.json`, loggerFn: false, }; } +// ensure tsconfig-parser caches are clean for each test +beforeEach(() => clearCaches()); + describe('semanticInfo', () => { // test all AST snapshots testFiles.forEach(filename => { @@ -193,12 +197,14 @@ describe('semanticInfo', () => { it('non-existent file tests', () => { const parseResult = parseCodeAndGenerateServices( `const x = [parseInt("5")];`, - createOptions(''), + { + ...createOptions(''), + project: undefined, + preserveNodeMaps: true, + }, ); - // get type checker - expect(parseResult).toHaveProperty('services.program.getTypeChecker'); - const checker = parseResult.services.program!.getTypeChecker(); + expect(parseResult.services.program).toBeUndefined(); // get bound name const boundName = (parseResult.ast.body[0] as TSESTree.VariableDeclaration) @@ -210,8 +216,6 @@ describe('semanticInfo', () => { ); expect(tsBoundName).toBeDefined(); - checkNumberArrayType(checker, tsBoundName); - expect(parseResult.services.tsNodeToESTreeNodeMap!.get(tsBoundName)).toBe( boundName, ); @@ -220,18 +224,21 @@ describe('semanticInfo', () => { it('non-existent file should provide parents nodes', () => { const parseResult = parseCodeAndGenerateServices( `function M() { return Base }`, - createOptions(''), + { ...createOptions(''), project: undefined }, ); - // https://github.com/JamesHenry/typescript-estree/issues/77 - expect(parseResult.services.program).toBeDefined(); - expect( - parseResult.services.program!.getSourceFile(''), - ).toBeDefined(); - expect( - parseResult.services.program!.getSourceFile('')!.statements[0] - .parent, - ).toBeDefined(); + expect(parseResult.services.program).toBeUndefined(); + }); + + it(`non-existent file should throw error when project provided`, () => { + expect(() => + parseCodeAndGenerateServices( + `function M() { return Base }`, + createOptions(''), + ), + ).toThrow( + `If "parserOptions.project" has been set for @typescript-eslint/parser, must be included in at least one of the projects provided.`, + ); }); it('non-existent project file', () => { @@ -260,6 +267,15 @@ describe('semanticInfo', () => { parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), ).toThrowErrorMatchingSnapshot(); }); + + it('default program produced with option', () => { + const parseResult = parseCodeAndGenerateServices('var foo = 5;', { + ...createOptions(''), + createDefaultProgram: true, + }); + + expect(parseResult.services.program).toBeDefined(); + }); }); function testIsolatedFile( diff --git a/tests/integration/utils/.eslintrc.js b/tests/integration/utils/.eslintrc.js new file mode 100644 index 000000000000..8ca32766a124 --- /dev/null +++ b/tests/integration/utils/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + parserOptions: { + project: `${__dirname}/jsconfig.json`, + }, +}; diff --git a/tests/integration/utils/jsconfig.json b/tests/integration/utils/jsconfig.json new file mode 100644 index 000000000000..d53d21eadfbb --- /dev/null +++ b/tests/integration/utils/jsconfig.json @@ -0,0 +1,3 @@ +{ + "exclude": [".eslintrc.js"] +} From f953cbdba45c6259664ae0b3ea2d198098d8923d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 28 Jul 2019 15:40:27 -0400 Subject: [PATCH 02/58] test: ensure integration tests can fail, add vue-sfc (#768) --- package.json | 2 +- .../eslint-plugin-tslint/src/rules/config.ts | 2 +- tests/integration/docker-compose.yml | 17 +++++ .../test.js.snap | 1 + .../fixtures/vue-sfc/.eslintrc.yml | 21 +++++++ tests/integration/fixtures/vue-sfc/Dockerfile | 17 +++++ tests/integration/fixtures/vue-sfc/Hello.vue | 36 +++++++++++ .../integration/fixtures/vue-sfc/test.js.snap | 63 +++++++++++++++++++ tests/integration/fixtures/vue-sfc/test.sh | 22 +++++++ .../fixtures/vue-sfc/tsconfig.json | 5 ++ tests/integration/run-all-tests.sh | 11 ++++ 11 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 tests/integration/fixtures/vue-sfc/.eslintrc.yml create mode 100644 tests/integration/fixtures/vue-sfc/Dockerfile create mode 100644 tests/integration/fixtures/vue-sfc/Hello.vue create mode 100644 tests/integration/fixtures/vue-sfc/test.js.snap create mode 100755 tests/integration/fixtures/vue-sfc/test.sh create mode 100644 tests/integration/fixtures/vue-sfc/tsconfig.json create mode 100755 tests/integration/run-all-tests.sh diff --git a/package.json b/package.json index 4e630cb4b1bc..98a6c27fc2df 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "generate-contributors": "yarn ts-node ./tools/generate-contributors.ts && yarn all-contributors generate", "format": "prettier --write \"./**/*.{ts,js,json,md}\"", "format-check": "prettier --list-different \"./**/*.{ts,js,json,md}\"", - "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", + "integration-tests": "./tests/integration/run-all-tests.sh", "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", "lint": "eslint . --ext .js,.ts", "lint-fix": "eslint . --ext .js,.ts --fix", diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index 7152d21f69b6..23ff428111d2 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -69,7 +69,7 @@ export default createRule({ }, type: 'problem', messages: { - failure: '{{message}} (tslint:{{ruleName}})`', + failure: '{{message}} (tslint:{{ruleName}})', }, schema: [ { diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index 086f3e76485d..5d10d7661774 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -19,3 +19,20 @@ services: - /usr/eslint-plugin-tslint/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/typescript-and-tslint-plugins-together:/usr/linked + + vue-sfc: + build: ./fixtures/vue-sfc + container_name: "vue-sfc" + volumes: + # Runtime link to the relevant built @typescript-eslint packages and integration test utils, + # but apply an empty volume for the package tests, we don't need those. + - ../../package.json/:/usr/root-package.json + - ./utils/:/usr/utils + - ../../packages/parser/:/usr/parser + - /usr/parser/tests + - ../../packages/typescript-estree/:/usr/typescript-estree + - /usr/typescript-estree/tests + - ../../packages/eslint-plugin/:/usr/eslint-plugin + - /usr/eslint-plugin/tests + # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. + - ./fixtures/vue-sfc:/usr/linked diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap index a4df7d29fe6d..078ddadc167f 100644 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.js.snap @@ -24,6 +24,7 @@ Array [ "endLine": 1, "line": 1, "message": "Missing semicolon (tslint:semicolon)", + "messageId": "failure", "nodeType": null, "ruleId": "@typescript-eslint/tslint/config", "severity": 2, diff --git a/tests/integration/fixtures/vue-sfc/.eslintrc.yml b/tests/integration/fixtures/vue-sfc/.eslintrc.yml new file mode 100644 index 000000000000..f20f5baf1746 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/.eslintrc.yml @@ -0,0 +1,21 @@ +root: true + +parser: 'vue-eslint-parser' + +env: + es6: true + node: true + +parserOptions: + # Local version of @typescript-eslint/parser + parser: '@typescript-eslint/parser' + project: /usr/linked/tsconfig.json + sourceType: module + extraFileExtensions: ['.vue'] + +plugins: +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' + +rules: + '@typescript-eslint/no-explicit-any': 'error' diff --git a/tests/integration/fixtures/vue-sfc/Dockerfile b/tests/integration/fixtures/vue-sfc/Dockerfile new file mode 100644 index 000000000000..3b281e624c87 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/Dockerfile @@ -0,0 +1,17 @@ +FROM node:carbon + +# Copy the test.sh into the container. Every other file will be linked, rather +# than copied to allow for changes without rebuilds wherever possible +WORKDIR /usr +COPY ./test.sh /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toMatchSnapshot();\n" \ + "});\n" > test.js + +# Run the integration test +CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/vue-sfc/Hello.vue b/tests/integration/fixtures/vue-sfc/Hello.vue new file mode 100644 index 000000000000..1f5c59ed2dc0 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/Hello.vue @@ -0,0 +1,36 @@ + + + + diff --git a/tests/integration/fixtures/vue-sfc/test.js.snap b/tests/integration/fixtures/vue-sfc/test.js.snap new file mode 100644 index 000000000000..49bd30cc3897 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/test.js.snap @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`it should produce the expected lint ouput 1`] = ` +Array [ + Object { + "errorCount": 1, + "filePath": "/usr/linked/Hello.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "column": 29, + "endColumn": 32, + "endLine": 31, + "line": 31, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + ], + "source": " + + + +", + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/fixtures/vue-sfc/test.sh b/tests/integration/fixtures/vue-sfc/test.sh new file mode 100755 index 000000000000..ba89362dcd13 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Generate the package.json to use +node /usr/utils/generate-package-json.js + +# Install dependencies +npm install + +# Use the local volumes for our own packages +npm install $(npm pack /usr/typescript-estree | tail -1) +npm install $(npm pack /usr/parser | tail -1) +npm install $(npm pack /usr/eslint-plugin | tail -1) + +# Install the latest vue-eslint-parser (this may break us occassionally, but it's probably good to get that feedback early) +npm install vue-eslint-parser@latest + +# Run the linting +# (the "|| true" helps make sure that we run our tests on failed linting runs as well) +npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.vue || true + +# Run our assertions against the linting output +npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/vue-sfc/tsconfig.json b/tests/integration/fixtures/vue-sfc/tsconfig.json new file mode 100644 index 000000000000..86423f3e4aa2 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "strict": true + } +} \ No newline at end of file diff --git a/tests/integration/run-all-tests.sh b/tests/integration/run-all-tests.sh new file mode 100755 index 000000000000..5b43af062465 --- /dev/null +++ b/tests/integration/run-all-tests.sh @@ -0,0 +1,11 @@ +# Ensure child script failures are propagated +set -e + +# We run the services serially and in a non-detached state just that we can ensure predictable +# exit codes for all of our integration tests, and we can ensure CI builds pass or fail appropriately + +# typescript-and-tslint-plugins-together +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit typescript-and-tslint-plugins-together + +# vue-sfc +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-sfc From 24dac452fe984638cab924788e73e13591cc7e1d Mon Sep 17 00:00:00 2001 From: Tarik Onalan Date: Mon, 29 Jul 2019 08:56:14 -0700 Subject: [PATCH 03/58] docs: fix typo in documentation for explicit-function-return-type (#772) Resolves #769. --- .../eslint-plugin/docs/rules/explicit-function-return-type.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 01755e395409..b1ac9af14ff4 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -142,9 +142,9 @@ let objectPropCast = { declare functionWithArg(arg: () => number); functionWithArg(() => 1); -declare functionWithObjectArg(arg: { meth: () => number }); +declare functionWithObjectArg(arg: { method: () => number }); functionWithObjectArg({ - meth() { + method() { return 1; }, }); From 22e9ae59c9f0becdfe44cdcfb01a2b631daaee51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Huy=20Dang=20L=C3=AA-Ng=C3=B4?= Date: Mon, 29 Jul 2019 13:34:56 -0700 Subject: [PATCH 04/58] fix(eslint-plugin): [no-explicit-any] Fix ignoreRestArgs for interfaces (#777) --- .../docs/rules/no-explicit-any.md | 30 +++++++ .../src/rules/no-explicit-any.ts | 4 +- .../tests/rules/no-explicit-any.test.ts | 81 +++++++++++++++++++ 3 files changed, 114 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md index ccec9e952313..861eb0566e23 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.md +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.md @@ -128,6 +128,21 @@ const baz1 = function (...args: any[]) {} const baz2 = function (...args: readonly any[]) {} const baz3 = function (...args: Array) {} const baz4 = function (...args: ReadonlyArray) {} + +interface Qux1 { (...args: any[]): void; } +interface Qux2 { (...args: readonly any[]): void; } +interface Qux3 { (...args: Array): void; } +interface Qux4 { (...args: ReadonlyArray): void; } + +function quux1(fn: (...args: any[]) => void): void {} +function quux2(fn: (...args: readonly any[]) => void): void {} +function quux3(fn: (...args: Array) => void): void {} +function quux4(fn: (...args: ReadonlyArray) => void): void {} + +function quuz1(): ((...args: any[]) => void) {} +function quuz2(): ((...args: readonly any[]) => void) {} +function quuz3(): ((...args: Array) => void) {} +function quuz4(): ((...args: ReadonlyArray) => void) {} ``` Examples of **correct** code for the `{ "ignoreRestArgs": true }` option: @@ -149,6 +164,21 @@ const baz1 = function (...args: any[]) {} const baz2 = function (...args: readonly any[]) {} const baz3 = function (...args: Array) {} const baz4 = function (...args: ReadonlyArray) {} + +interface Qux1 { (...args: any[]): void; } +interface Qux2 { (...args: readonly any[]): void; } +interface Qux3 { (...args: Array): void; } +interface Qux4 { (...args: ReadonlyArray): void; } + +function quux1(fn: (...args: any[]) => void): void {} +function quux2(fn: (...args: readonly any[]) => void): void {} +function quux3(fn: (...args: Array) => void): void {} +function quux4(fn: (...args: ReadonlyArray) => void): void {} + +function quuz1(): ((...args: any[]) => void) {} +function quuz2(): ((...args: readonly any[]) => void) {} +function quuz3(): ((...args: Array) => void) {} +function quuz4(): ((...args: ReadonlyArray) => void) {} ``` ## When Not To Use It diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index a84327a0d553..43f81b8607e5 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -51,7 +51,7 @@ export default util.createRule({ /** * Checks if the node is an arrow function, function declaration or function expression * @param node the node to be validated. - * @returns true if the node is an arrow function, function declaration or function expression + * @returns true if the node is an arrow function, function declaration, function expression, function type, or call signature * @private */ function isNodeValidFunction(node: TSESTree.Node): boolean { @@ -59,6 +59,8 @@ export default util.createRule({ AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.FunctionExpression, + AST_NODE_TYPES.TSFunctionType, + AST_NODE_TYPES.TSCallSignatureDeclaration, ].includes(node.type); } diff --git a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts index b27cc8111bc0..c5624ba06351 100644 --- a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts +++ b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts @@ -189,6 +189,54 @@ type obj = { code: `const baz4 = (...args: ReadonlyArray) => {}`, options: [{ ignoreRestArgs: true }], }, + { + code: `interface Qux1 { (...args: any[]): void; }`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `interface Qux2 { (...args: readonly any[]): void; }`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `interface Qux3 { (...args: Array): void; }`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `interface Qux4 { (...args: ReadonlyArray): void; }`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quux1(fn: (...args: any[]) => void): void {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quux2(fn: (...args: readonly any[]) => void): void {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quux3(fn: (...args: Array) => void): void {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quux4(fn: (...args: ReadonlyArray) => void): void {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quuz1(): ((...args: any[]) => void) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quuz2(): ((...args: readonly any[]) => void) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quuz3(): ((...args: Array) => void) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function quuz4(): ((...args: ReadonlyArray) => void) {}`, + options: [{ ignoreRestArgs: true }], + }, ], invalid: ([ { @@ -787,6 +835,39 @@ type obj = { }, ], }, + { + code: `interface Qux5 { (...args: any): void; }`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 28, + }, + ], + }, + { + code: `function quux5(fn: (...args: any) => void): void {}`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 30, + }, + ], + }, + { + code: `function quuz5(): ((...args: any) => void) {}`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 30, + }, + ], + }, ] as InvalidTestCase[]).reduce((acc, testCase) => { acc.push(testCase); const options = testCase.options || []; From b731df98cb7a70c2f034ad06f94da63ea9ed06f9 Mon Sep 17 00:00:00 2001 From: Glen Winters Date: Mon, 29 Jul 2019 15:54:49 -0500 Subject: [PATCH 05/58] docs(eslint-plugin): Improve ban-types description (#773) --- packages/eslint-plugin/README.md | 2 +- packages/eslint-plugin/docs/rules/ban-types.md | 5 +++-- packages/eslint-plugin/src/rules/ban-types.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 05916fa1cbdf..a6db1f9ec469 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -127,7 +127,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | | | :thought_balloon: | | [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | | | | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | | [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions. | :heavy_check_mark: | | | diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index dc88b913f2ca..4da27a930418 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -1,6 +1,7 @@ -# Enforces that types will not to be used (ban-types) +# Bans specific types from being used (ban-types) -Bans specific types from being used. Does not ban the corresponding runtime objects from being used. +This rule bans specific types and can suggest alternatives. It does not ban the +corresponding runtime objects from being used. ## Rule Details diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 1a38bf66f287..bd3d8bf1b93e 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -46,7 +46,7 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Enforces that types will not to be used', + description: 'Bans specific types from being used', category: 'Best Practices', recommended: 'error', }, From 73f8c791e82aee0d5d8f5f8a7a6287126e597769 Mon Sep 17 00:00:00 2001 From: cherryblossom000 <31467609+cherryblossom000@users.noreply.github.com> Date: Wed, 31 Jul 2019 01:29:41 +1000 Subject: [PATCH 06/58] docs(prefer-readonly): add rule name to title (#779) The "(prefer-readonly)" part wasn't in the title. --- packages/eslint-plugin/docs/rules/prefer-readonly.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly.md b/packages/eslint-plugin/docs/rules/prefer-readonly.md index b3f0a5420109..f75a3c349cbe 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly.md @@ -1,4 +1,4 @@ -# require never-modified private members be marked as `readonly` +# require never-modified private members be marked as `readonly` (prefer-readonly) This rule enforces that private members are marked as `readonly` if they're never modified outside of the constructor. From 84916e6713d05ffccc208149b623c86004098435 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Thu, 1 Aug 2019 17:39:47 -0700 Subject: [PATCH 07/58] fix(eslint-plugin): [typedef] support default value for parameter (#785) --- packages/eslint-plugin/src/rules/typedef.ts | 19 ++++++-- .../eslint-plugin/tests/rules/typedef.test.ts | 46 ++++++++++++++++++- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 5e0465e0e231..e47ccad9522a 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -69,10 +69,21 @@ export default util.createRule<[Options], MessageIds>({ function checkParameters(params: TSESTree.Parameter[]) { for (const param of params) { - if ( - param.type !== AST_NODE_TYPES.TSParameterProperty && - !param.typeAnnotation - ) { + let annotationNode: TSESTree.Node | undefined; + + switch (param.type) { + case AST_NODE_TYPES.AssignmentPattern: + annotationNode = param.left; + break; + case AST_NODE_TYPES.TSParameterProperty: + annotationNode = param.parameter; + break; + default: + annotationNode = param; + break; + } + + if (annotationNode !== undefined && !annotationNode.typeAnnotation) { report(param, getNodeName(param)); } } diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index 8c281fe5e395..49d98e2654f5 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -101,13 +101,21 @@ ruleTester.run('typedef', rule, { }, ], }, - // Parameters + // Function parameters `function receivesNumber(a: number): void { }`, `function receivesStrings(a: string, b: string): void { }`, `function receivesNumber([a]: [number]): void { }`, `function receivesNumbers([a, b]: number[]): void { }`, `function receivesString({ a }: { a: string }): void { }`, `function receivesStrings({ a, b }: { [i: string ]: string }): void { }`, + `function receivesNumber(a: number = 123): void { }`, + // Method parameters + `class Test { + public method(x: number): number { return x; } + }`, + `class Test { + public method(x: number = 123): number { return x; } + }`, // Property declarations `type Test = { member: number; @@ -291,7 +299,7 @@ ruleTester.run('typedef', rule, { }, ], }, - // Parameters + // Function parameters { code: `function receivesNumber(a): void { }`, errors: [ @@ -350,6 +358,40 @@ ruleTester.run('typedef', rule, { }, ], }, + // Method parameters + { + code: `class Test { + public method(x): number { return x; } + }`, + errors: [ + { + column: 23, + messageId: 'expectedTypedefNamed', + }, + ], + }, + { + code: `class Test { + public method(x = 123): number { return x; } + }`, + errors: [ + { + column: 23, + messageId: 'expectedTypedef', + }, + ], + }, + { + code: `class Test { + public constructor(public x) { } + }`, + errors: [ + { + column: 28, + messageId: 'expectedTypedef', + }, + ], + }, // Property declarations { code: `type Test = { From 39e41b56ca26047cc1a1fdf7330e0bee928dc720 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Thu, 1 Aug 2019 17:57:04 -0700 Subject: [PATCH 08/58] fix(eslint-plugin): [typedef] support "for..in", "for..of" (#787) --- packages/eslint-plugin/src/rules/typedef.ts | 27 ++++++++++++++++++- .../eslint-plugin/tests/rules/typedef.test.ts | 25 +++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index e47ccad9522a..3c535467f2ce 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -142,7 +142,32 @@ export default util.createRule<[Options], MessageIds>({ options[OptionKeys.VariableDeclaration] && !node.id.typeAnnotation ) { - report(node, getNodeName(node.id)); + // Are we inside a context that does not allow type annotations? + let typeAnnotationRequired = true; + + let current: TSESTree.Node | undefined = node.parent; + while (current) { + switch (current.type) { + case AST_NODE_TYPES.VariableDeclaration: + // Keep looking upwards + current = current.parent; + break; + case AST_NODE_TYPES.ForOfStatement: + case AST_NODE_TYPES.ForInStatement: + // Stop traversing and don't report an error + typeAnnotationRequired = false; + current = undefined; + break; + default: + // Stop traversing + current = undefined; + break; + } + } + + if (typeAnnotationRequired) { + report(node, getNodeName(node.id)); + } } }, }; diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index 49d98e2654f5..b1a7b08bcf09 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -198,6 +198,31 @@ ruleTester.run('typedef', rule, { }, ], }, + // Contexts where TypeScript doesn't allow annotations + { + code: `for (x of [1, 2, 3]) { }`, + options: [ + { + variableDeclaration: true, + }, + ], + }, + { + code: `for (const x in {}) { }`, + options: [ + { + variableDeclaration: true, + }, + ], + }, + { + code: `try { } catch (e) { }`, + options: [ + { + variableDeclaration: true, + }, + ], + }, ], invalid: [ // Array destructuring From 3c902a1d98e75af4b9b59398dfb5c24b6d74ca96 Mon Sep 17 00:00:00 2001 From: Niles Date: Thu, 8 Aug 2019 10:40:04 -0500 Subject: [PATCH 09/58] fix(eslint-plugin): add `Literal` to `RuleListener` types (#824) --- packages/experimental-utils/src/ts-eslint/Rule.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 0175309d752f..89ac7b532885 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -270,6 +270,7 @@ interface RuleListener { JSXSpreadChild?: RuleFunction; JSXText?: RuleFunction; LabeledStatement?: RuleFunction; + Literal?: RuleFunction; LogicalExpression?: RuleFunction; MemberExpression?: RuleFunction; MetaProperty?: RuleFunction; From 42b3013ab846669fd730628f5cb0b043cfedabba Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 9 Aug 2019 17:19:19 +0100 Subject: [PATCH 10/58] chore: misc package.json updates related to v2 (#832) --- package.json | 2 +- packages/eslint-plugin-tslint/package.json | 2 +- packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/package.json | 2 +- packages/parser/package.json | 2 +- packages/typescript-estree/package.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 98a6c27fc2df..d0c730ff1b4f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ ] }, "engines": { - "node": ">=6.14.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "devDependencies": { "@commitlint/cli": "^8.1.0", diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index bed7e2fd46f4..bf40809b2db4 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -11,7 +11,7 @@ "tslint" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 991831222811..516ee6b4f98f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -9,7 +9,7 @@ "typescript" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "files": [ "dist", @@ -54,7 +54,7 @@ "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^1.9.0", + "@typescript-eslint/parser": "^2.0.0-alpha.0", "eslint": "^5.0.0 || ^6.0.0" } } diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 5cbedf3e6cb3..4574f3129d10 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "files": [ "dist", diff --git a/packages/parser/package.json b/packages/parser/package.json index c11e9cb790aa..bc3f3cf29b07 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -9,7 +9,7 @@ "LICENSE" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index fabdc79810cc..e0a0e6618820 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -10,7 +10,7 @@ "LICENSE" ], "engines": { - "node": ">=6.14.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", From ebbcc010c546b5777c14f0b33ead851b620184e0 Mon Sep 17 00:00:00 2001 From: Torleif Berger Date: Sat, 10 Aug 2019 02:32:16 +0200 Subject: [PATCH 11/58] fix(eslint-plugin): [efrt] flag default export w/allowExpressions (#831) BREAKING: the rule didn't previously flag default exports with this option --- .../rules/explicit-function-return-type.md | 20 +++++------ .../rules/explicit-function-return-type.ts | 3 +- .../explicit-function-return-type.test.ts | 33 +++++++++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index b1ac9af14ff4..f31d6f42b8ba 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -84,6 +84,10 @@ Examples of **incorrect** code for this rule with `{ allowExpressions: true }`: ```ts function test() {} + +const fn = () => {}; + +export default () => {}; ``` Examples of **correct** code for this rule with `{ allowExpressions: true }`: @@ -155,24 +159,20 @@ functionWithObjectArg({ Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions: true }`: ```ts -var arrowFn = (x: number) => (y: number) => x + y; +var arrowFn = () => () => {}; -function fn(x: number) { - return function(y: number) { - return x + y; - }; +function fn() { + return function() {}; } ``` Examples of **correct** code for this rule with `{ allowHigherOrderFunctions: true }`: ```ts -var arrowFn = (x: number) => (y: number): number => x + y; +var arrowFn = () => (): void => {}; -function fn(x: number) { - return function(y: number): number { - return x + y; - }; +function fn() { + return function(): void {}; } ``` diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b431fe7675ce..44ea2d03c8e2 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -256,7 +256,8 @@ export default util.createRule({ if ( options.allowExpressions && node.parent.type !== AST_NODE_TYPES.VariableDeclarator && - node.parent.type !== AST_NODE_TYPES.MethodDefinition + node.parent.type !== AST_NODE_TYPES.MethodDefinition && + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 72d64d2abe06..32f23792591e 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -90,6 +90,15 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: `export default (): void => {}`, + options: [ + { + allowExpressions: true, + }, + ], + }, { filename: 'test.ts', code: ` @@ -417,6 +426,30 @@ function test() { }, ], }, + { + filename: 'test.ts', + code: 'export default () => {};', + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 16, + }, + ], + }, + { + filename: 'test.ts', + code: 'export default function() {};', + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 16, + }, + ], + }, { filename: 'test.ts', code: "var arrowFn = () => 'test';", From de6cc1d51a7b908ab2a731c5ce3c1d537062645f Mon Sep 17 00:00:00 2001 From: Ken <2770219+ken0x0a@users.noreply.github.com> Date: Tue, 13 Aug 2019 00:59:14 +0900 Subject: [PATCH 12/58] docs(eslint-plugin): [no-useless-constructor] add example setup (#837) --- .../eslint-plugin/docs/rules/no-useless-constructor.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md index 821f6a5d1052..0aa1f4a5c984 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md @@ -71,6 +71,16 @@ class A extends B { } ``` +## Rule Changes + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "no-useless-constructor": "off", + "@typescript-eslint/no-useless-constructor": "error", +} +``` + ## When Not To Use It If you don't want to be notified about unnecessary constructors, you can safely disable this rule. From 428567d7cc0985b1da754f092289212df3fe1bda Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 13 Aug 2019 02:50:38 -0700 Subject: [PATCH 13/58] feat(eslint-plugin)!: change recommended config (#729) BREAKING CHANGE: recommended config changes are considered breaking --- .eslintrc.js | 25 +++-------- .prettierrc => .prettierrc.json | 0 .../eslint-plugin-tslint/src/custom-linter.ts | 4 +- packages/eslint-plugin/README.md | 38 ++++++++-------- .../docs/rules/no-inferrable-types.md | 4 +- packages/eslint-plugin/package.json | 2 + packages/eslint-plugin/src/configs/all.json | 2 + packages/eslint-plugin/src/configs/base.json | 8 +--- .../src/configs/recommended.json | 32 +++++++++----- .../eslint-plugin/src/rules/array-type.ts | 7 +-- .../eslint-plugin/src/rules/await-thenable.ts | 4 +- .../eslint-plugin/src/rules/ban-ts-ignore.ts | 2 +- packages/eslint-plugin/src/rules/ban-types.ts | 5 ++- packages/eslint-plugin/src/rules/camelcase.ts | 2 +- .../src/rules/class-name-casing.ts | 4 +- .../src/rules/consistent-type-assertions.ts | 10 ++--- .../src/rules/consistent-type-definitions.ts | 5 ++- .../rules/explicit-function-return-type.ts | 4 +- .../rules/explicit-member-accessibility.ts | 9 ++-- .../src/rules/generic-type-naming.ts | 3 +- .../indent-new-do-not-use/OffsetStorage.ts | 12 +++-- .../src/rules/indent-new-do-not-use/index.ts | 15 +++---- packages/eslint-plugin/src/rules/indent.ts | 3 +- .../src/rules/interface-name-prefix.ts | 5 ++- .../src/rules/member-ordering.ts | 8 ++-- .../src/rules/no-empty-function.ts | 8 ++-- .../src/rules/no-empty-interface.ts | 2 +- .../src/rules/no-explicit-any.ts | 5 ++- .../src/rules/no-extra-parens.ts | 8 ++-- .../src/rules/no-extraneous-class.ts | 2 +- .../src/rules/no-floating-promises.ts | 2 +- .../src/rules/no-for-in-array.ts | 4 +- .../src/rules/no-inferrable-types.ts | 16 ++++--- .../src/rules/no-magic-numbers.ts | 2 +- .../eslint-plugin/src/rules/no-misused-new.ts | 8 ++-- .../src/rules/no-misused-promises.ts | 19 +++++--- .../eslint-plugin/src/rules/no-namespace.ts | 2 +- .../src/rules/no-non-null-assertion.ts | 4 +- .../src/rules/no-parameter-properties.ts | 5 ++- .../src/rules/no-require-imports.ts | 6 ++- .../eslint-plugin/src/rules/no-this-alias.ts | 6 +-- .../eslint-plugin/src/rules/no-type-alias.ts | 5 ++- .../src/rules/no-unnecessary-qualifier.ts | 2 +- .../rules/no-unnecessary-type-arguments.ts | 4 +- .../rules/no-unnecessary-type-assertion.ts | 4 +- .../src/rules/no-use-before-define.ts | 2 +- .../src/rules/no-useless-constructor.ts | 2 +- .../src/rules/no-var-requires.ts | 2 +- .../eslint-plugin/src/rules/prefer-for-of.ts | 2 +- .../src/rules/prefer-function-type.ts | 11 +++-- .../src/rules/prefer-includes.ts | 2 +- .../src/rules/prefer-namespace-keyword.ts | 2 +- .../src/rules/prefer-readonly.ts | 38 ++++++++-------- .../src/rules/prefer-regexp-exec.ts | 4 +- .../rules/prefer-string-starts-ends-with.ts | 2 +- .../src/rules/promise-function-async.ts | 12 +++-- .../src/rules/require-array-sort-compare.ts | 2 +- .../eslint-plugin/src/rules/require-await.ts | 8 ++-- .../src/rules/restrict-plus-operands.ts | 2 +- packages/eslint-plugin/src/rules/semi.ts | 3 +- .../src/rules/triple-slash-reference.ts | 10 ++--- .../src/rules/type-annotation-spacing.ts | 4 +- packages/eslint-plugin/src/rules/typedef.ts | 22 +++++----- .../eslint-plugin/src/rules/unbound-method.ts | 6 +-- .../src/rules/unified-signatures.ts | 21 ++++----- packages/eslint-plugin/src/util/misc.ts | 4 +- packages/eslint-plugin/src/util/types.ts | 7 ++- packages/eslint-plugin/tests/RuleTester.ts | 2 +- .../eslint-plugin/tests/rules/indent/utils.ts | 3 +- .../tests/rules/no-this-alias.test.ts | 10 +++++ .../tests/rules/no-unused-vars.test.ts | 8 ++-- .../eslint-plugin/tools/generate-configs.ts | 44 ++++++++++++++----- .../tools/validate-configs/checkConfigAll.ts | 4 +- .../checkConfigRecommended.ts | 4 +- .../validate-docs/validate-table-structure.ts | 3 +- .../src/eslint-utils/RuleCreator.ts | 2 +- .../src/eslint-utils/deepMerge.ts | 5 ++- packages/parser/src/analyze-scope.ts | 18 ++++---- packages/parser/src/parser.ts | 7 ++- packages/parser/src/scope/scope-manager.ts | 6 ++- packages/parser/src/simple-traverse.ts | 4 +- packages/parser/tests/lib/basics.ts | 2 +- packages/parser/tests/lib/jsx.ts | 2 +- packages/parser/tests/tools/scope-analysis.ts | 21 +++++---- packages/parser/tests/tools/test-utils.ts | 17 +++---- .../typescript-estree/src/ast-converter.ts | 5 ++- packages/typescript-estree/src/convert.ts | 17 ++++--- packages/typescript-estree/src/node-utils.ts | 11 ++++- packages/typescript-estree/src/parser.ts | 22 +++++++--- .../typescript-estree/src/tsconfig-parser.ts | 25 +++++++---- .../tests/ast-alignment/fixtures-to-test.ts | 4 +- .../tests/ast-alignment/parse.ts | 19 +++++--- .../tests/ast-alignment/utils.ts | 10 ++--- .../typescript-estree/tests/lib/convert.ts | 8 ++-- packages/typescript-estree/tests/lib/jsx.ts | 7 +-- .../tests/lib/semanticInfo.ts | 4 +- .../typescript-estree/tools/test-utils.ts | 10 ++--- .../utils/jest-snapshot-resolver.js | 1 + tools/generate-contributors.ts | 4 +- yarn.lock | 7 ++- 100 files changed, 470 insertions(+), 341 deletions(-) rename .prettierrc => .prettierrc.json (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 45426c37acf6..32a476969d3a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,23 +21,12 @@ module.exports = { // our plugin :D // - '@typescript-eslint/ban-ts-ignore': 'error', - '@typescript-eslint/consistent-type-definitions': 'error', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-member-accessibility': 'off', - '@typescript-eslint/indent': 'off', - '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-inferrable-types': 'error', - '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], + '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-parameter-properties': 'off', - '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-includes': 'error', - '@typescript-eslint/prefer-regexp-exec': 'error', - '@typescript-eslint/prefer-string-starts-ends-with': 'error', + '@typescript-eslint/unbound-method': 'off', // // eslint base @@ -110,12 +99,12 @@ module.exports = { 'import/no-mutable-exports': 'error', // Prevent importing the default as if it were named 'import/no-named-default': 'error', - // Prohibit named exports // we want everything to be a named export - 'import/no-named-export': 'off', + // Prohibit named exports + 'import/no-named-export': 'off', // we want everything to be a named export // Forbid a module from importing itself 'import/no-self-import': 'error', - // Require modules with a single export to use a default export // we want everything to be named - 'import/prefer-default-export': 'off', + // Require modules with a single export to use a default export + 'import/prefer-default-export': 'off', // we want everything to be named }, parserOptions: { sourceType: 'module', diff --git a/.prettierrc b/.prettierrc.json similarity index 100% rename from .prettierrc rename to .prettierrc.json diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts index 5de914e5f8f9..eb8527b99d71 100644 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ b/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -1,5 +1,5 @@ import { ILinterOptions, Linter, LintResult } from 'tslint'; -import { Program } from 'typescript'; +import { Program, SourceFile } from 'typescript'; // We need to access the program, but Linter has private program already // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -14,7 +14,7 @@ export class CustomLinter extends TSLintLinter { return super.getResult(); } - getSourceFile(fileName: string) { + getSourceFile(fileName: string): SourceFile | undefined { return this.program.getSourceFile(fileName); } } diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index a6db1f9ec469..516f9c48daef 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -124,65 +124,65 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | | [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | | | :thought_balloon: | -| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | | | | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | +| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | :heavy_check_mark: | | | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | | [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions. | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | | [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | :heavy_check_mark: | | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | | | | [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | | [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` | :heavy_check_mark: | | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | +| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names should or should not prefixed with `I` | :heavy_check_mark: | | | | [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility | | | | | [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | | [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | | | | +| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :heavy_check_mark: | | | | [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | | | | [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | | [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | | [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately. | | | :thought_balloon: | -| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | | | :thought_balloon: | +| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallows magic numbers | | | | | [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | | | :thought_balloon: | +| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :heavy_check_mark: | | | | [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :heavy_check_mark: | | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | :heavy_check_mark: | | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | | [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | | | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | | [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | | [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Warns if an explicitly specified type argument is the default for that type parameter | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | | [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | | [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | | [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | | [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | | [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | -| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | | | :thought_balloon: | -| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | | :thought_balloon: | | [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Enforce giving `compare` argument to `Array#sort` | | | :thought_balloon: | -| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | | | :thought_balloon: | +| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | | [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | | [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | | :thought_balloon: | -| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | | | | +| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :heavy_check_mark: | | | | [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | -| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | | | :thought_balloon: | +| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | diff --git a/packages/eslint-plugin/docs/rules/no-inferrable-types.md b/packages/eslint-plugin/docs/rules/no-inferrable-types.md index 9dbabe276c3d..7dd159b02e5a 100644 --- a/packages/eslint-plugin/docs/rules/no-inferrable-types.md +++ b/packages/eslint-plugin/docs/rules/no-inferrable-types.md @@ -24,8 +24,8 @@ The default options are: ```JSON { - "ignoreParameters": true, - "ignoreProperties": true, + "ignoreParameters": false, + "ignoreProperties": false, } ``` diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 516ee6b4f98f..14b417ac5c73 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -49,8 +49,10 @@ "devDependencies": { "@types/json-schema": "^7.0.3", "@types/marked": "^0.6.5", + "@types/prettier": "^1.18.0", "chalk": "^2.4.2", "marked": "^0.7.0", + "prettier": "*", "typescript": "*" }, "peerDependencies": { diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 0c17ccb04266..30a7cafafb56 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -24,6 +24,7 @@ "@typescript-eslint/member-ordering": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "no-empty-function": "off", "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "error", @@ -62,6 +63,7 @@ "@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/promise-function-async": "error", "@typescript-eslint/require-array-sort-compare": "error", + "require-await": "off", "@typescript-eslint/require-await": "error", "@typescript-eslint/restrict-plus-operands": "error", "semi": "off", diff --git a/packages/eslint-plugin/src/configs/base.json b/packages/eslint-plugin/src/configs/base.json index 6f56100a6ae7..9580ed622cfc 100644 --- a/packages/eslint-plugin/src/configs/base.json +++ b/packages/eslint-plugin/src/configs/base.json @@ -1,9 +1,5 @@ { "parser": "@typescript-eslint/parser", - "parserOptions": { - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ] + "parserOptions": { "sourceType": "module" }, + "plugins": ["@typescript-eslint"] } diff --git a/packages/eslint-plugin/src/configs/recommended.json b/packages/eslint-plugin/src/configs/recommended.json index 121b85bf17a6..95d18847686e 100644 --- a/packages/eslint-plugin/src/configs/recommended.json +++ b/packages/eslint-plugin/src/configs/recommended.json @@ -1,38 +1,48 @@ { "extends": "./configs/base.json", "rules": { - "no-var": "error", - "prefer-const": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", "camelcase": "off", "@typescript-eslint/camelcase": "error", "@typescript-eslint/class-name-casing": "error", "@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/explicit-member-accessibility": "error", - "indent": "off", - "@typescript-eslint/indent": "error", "@typescript-eslint/interface-name-prefix": "error", "@typescript-eslint/member-delimiter-style": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "no-empty-function": "off", + "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-for-in-array": "error", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/no-parameter-properties": "error", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-this-alias": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "warn", "no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "error", "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/type-annotation-spacing": "error" + "@typescript-eslint/prefer-regexp-exec": "error", + "@typescript-eslint/prefer-string-starts-ends-with": "error", + "require-await": "off", + "@typescript-eslint/require-await": "error", + "@typescript-eslint/triple-slash-reference": "error", + "@typescript-eslint/type-annotation-spacing": "error", + "@typescript-eslint/unbound-method": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error" } } diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index 8fe28bc32177..b9977618c40c 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -94,7 +94,8 @@ export default util.createRule({ docs: { description: 'Requires using either `T[]` or `Array` for arrays', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, fixable: 'code', messages: { @@ -168,7 +169,7 @@ export default util.createRule({ } return { - TSArrayType(node: TSESTree.TSArrayType) { + TSArrayType(node): void { if ( isArrayOption || (isArraySimpleOption && isSimpleType(node.elementType)) @@ -241,7 +242,7 @@ export default util.createRule({ }); }, - TSTypeReference(node: TSESTree.TSTypeReference) { + TSTypeReference(node): void { if ( isGenericOption || node.typeName.type !== AST_NODE_TYPES.Identifier diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 7a5db98db9c4..304321001f7b 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -9,7 +9,7 @@ export default util.createRule({ docs: { description: 'Disallows awaiting a value that is not a Thenable', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.', @@ -24,7 +24,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - AwaitExpression(node) { + AwaitExpression(node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get< ts.AwaitExpression >(node); diff --git a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts index 87af895627d2..7d7a32e6cfc9 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts @@ -7,7 +7,7 @@ export default util.createRule({ docs: { description: 'Bans “// @ts-ignore” comments from being used', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: [], messages: { diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index bd3d8bf1b93e..a8c2cec6c06e 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -25,7 +25,7 @@ function stringifyTypeName( function getCustomMessage( bannedType: null | string | { message?: string; fixWith?: string }, -) { +): string { if (bannedType === null) { return ''; } @@ -108,7 +108,7 @@ export default util.createRule({ ], create(context, [{ types: bannedTypes }]) { return { - TSTypeReference({ typeName }) { + TSTypeReference({ typeName }): void { const name = stringifyTypeName(typeName, context.getSourceCode()); if (name in bannedTypes) { @@ -124,6 +124,7 @@ export default util.createRule({ name: name, customMessage, }, + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type fix: fixWith ? fixer => fixer.replaceText(typeName, fixWith) : null, }); } diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index ffa5a62ed894..4bb614cba9d7 100644 --- a/packages/eslint-plugin/src/rules/camelcase.ts +++ b/packages/eslint-plugin/src/rules/camelcase.ts @@ -90,7 +90,7 @@ export default util.createRule({ } return { - Identifier(node) { + Identifier(node): void { /* * Leading and trailing underscores are commonly used to flag * private/protected identifiers, strip them diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index 1c76edd118b7..cb238f87ac7b 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -64,7 +64,7 @@ export default util.createRule({ | TSESTree.ClassDeclaration | TSESTree.TSInterfaceDeclaration | TSESTree.ClassExpression, - ) { + ): void { // class expressions (i.e. export default class {}) are OK if (node.id && !isPascalCase(node.id.name)) { report(node, node.id); @@ -72,7 +72,7 @@ export default util.createRule({ }, "VariableDeclarator[init.type='ClassExpression']"( node: TSESTree.VariableDeclarator, - ) { + ): void { if ( node.id.type === AST_NODE_TYPES.ArrayPattern || node.id.type === AST_NODE_TYPES.ObjectPattern diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 6380f9f00035..a5f87250da03 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -77,7 +77,7 @@ export default util.createRule({ function reportIncorrectAssertionType( node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, - ) { + ): void { const messageId = options.assertionStyle; context.report({ node, @@ -89,7 +89,7 @@ export default util.createRule({ }); } - function checkType(node: TSESTree.TypeNode) { + function checkType(node: TSESTree.TypeNode): boolean { switch (node.type) { case AST_NODE_TYPES.TSAnyKeyword: case AST_NODE_TYPES.TSUnknownKeyword: @@ -107,7 +107,7 @@ export default util.createRule({ function checkExpression( node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, - ) { + ): void { if ( options.assertionStyle === 'never' || options.objectLiteralTypeAssertions === 'allow' || @@ -137,7 +137,7 @@ export default util.createRule({ } return { - TSTypeAssertion(node) { + TSTypeAssertion(node): void { if (options.assertionStyle !== 'angle-bracket') { reportIncorrectAssertionType(node); return; @@ -145,7 +145,7 @@ export default util.createRule({ checkExpression(node); }, - TSAsExpression(node) { + TSAsExpression(node): void { if (options.assertionStyle !== 'as') { reportIncorrectAssertionType(node); return; diff --git a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts index 01fa92dd3d07..cf9e851c81cf 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts @@ -9,6 +9,7 @@ export default util.createRule({ description: 'Consistent with type definition either `interface` or `type`', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -29,7 +30,7 @@ export default util.createRule({ return { "TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"( node: TSESTree.TSTypeAliasDeclaration, - ) { + ): void { if (option === 'interface') { context.report({ node: node.id, @@ -63,7 +64,7 @@ export default util.createRule({ }); } }, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (option === 'type') { context.report({ node: node.id, diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 44ea2d03c8e2..67692c20fc03 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -47,8 +47,8 @@ export default util.createRule({ defaultOptions: [ { allowExpressions: false, - allowTypedFunctionExpressions: false, - allowHigherOrderFunctions: false, + allowTypedFunctionExpressions: true, + allowHigherOrderFunctions: true, }, ], create(context, [options]) { diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 8d2b590ffad8..21a5a8cda189 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -33,8 +33,9 @@ export default util.createRule({ docs: { description: 'Require explicit accessibility modifiers on class properties and methods', - category: 'Best Practices', - recommended: 'error', + category: 'Stylistic Issues', + // too opinionated to be recommended + recommended: false, }, messages: { missingAccessibility: @@ -82,7 +83,7 @@ export default util.createRule({ nodeType: string, node: TSESTree.Node, nodeName: string, - ) { + ): void { context.report({ node: node, messageId: messageId, @@ -179,7 +180,7 @@ export default util.createRule({ */ function checkParameterPropertyAccessibilityModifier( node: TSESTree.TSParameterProperty, - ) { + ): void { const nodeType = 'parameter property'; // HAS to be an identifier or assignment or TSC will throw if ( diff --git a/packages/eslint-plugin/src/rules/generic-type-naming.ts b/packages/eslint-plugin/src/rules/generic-type-naming.ts index 784a2fc3b0cf..95516174448f 100644 --- a/packages/eslint-plugin/src/rules/generic-type-naming.ts +++ b/packages/eslint-plugin/src/rules/generic-type-naming.ts @@ -10,6 +10,7 @@ export default util.createRule({ docs: { description: 'Enforces naming of generic type variables', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -30,7 +31,7 @@ export default util.createRule({ const regex = new RegExp(rule!); return { - TSTypeParameter(node) { + TSTypeParameter(node): void { const name = node.name.name; if (name && !regex.test(name)) { diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts index 475e3c35d7b0..082ca05129d2 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts @@ -2,7 +2,11 @@ // License: https://github.com/eslint/eslint/blob/48700fc8408f394887cdedd071b22b757700fdcb/LICENSE import { TSESTree } from '@typescript-eslint/experimental-utils'; -import { BinarySearchTree, TokenOrComment } from './BinarySearchTree'; +import { + BinarySearchTree, + TokenOrComment, + TreeValue, +} from './BinarySearchTree'; import { TokenInfo } from './TokenInfo'; /** @@ -34,7 +38,7 @@ export class OffsetStorage { this.ignoredTokens = new WeakSet(); } - private getOffsetDescriptor(token: TokenOrComment) { + private getOffsetDescriptor(token: TokenOrComment): TreeValue { return this.tree.findLe(token.range[0]).value; } @@ -151,8 +155,8 @@ export class OffsetStorage { public setDesiredOffsets( range: [number, number], fromToken: TokenOrComment | null, - offset: number = 0, - force: boolean = false, + offset = 0, + force = false, ): void { /* * Offset ranges are stored as a collection of nodes, where each node maps a numeric key to an offset diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts index 3549da45d74d..56909f15fa7e 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts @@ -25,15 +25,13 @@ import { OffsetStorage } from './OffsetStorage'; import { TokenInfo } from './TokenInfo'; import { createRule, ExcludeKeys, RequireKeys } from '../../util'; -function createGlobalLinebreakMatcher() { - return /\r\n|[\r\n\u2028\u2029]/gu; -} +const GLOBAL_LINEBREAK_REGEX = /\r\n|[\r\n\u2028\u2029]/gu; +const WHITESPACE_REGEX = /\s*$/u; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ -const WHITESPACE_REGEX = /\s*$/u; const KNOWN_NODES = new Set([ AST_NODE_TYPES.AssignmentExpression, AST_NODE_TYPES.AssignmentPattern, @@ -440,7 +438,7 @@ export default createRule({ expectedAmount: number, actualSpaces: number, actualTabs: number, - ) { + ): { expected: string; actual: string | number } { const expectedStatement = `${expectedAmount} ${indentType}${ expectedAmount === 1 ? '' : 's' }`; // e.g. "2 tabs" @@ -568,9 +566,7 @@ export default createRule({ */ function countTrailingLinebreaks(str: string): number { const trailingWhitespace = WHITESPACE_REGEX.exec(str)![0]; - const linebreakMatches = createGlobalLinebreakMatcher().exec( - trailingWhitespace, - ); + const linebreakMatches = GLOBAL_LINEBREAK_REGEX.exec(trailingWhitespace); return linebreakMatches === null ? 0 : linebreakMatches.length; } @@ -587,7 +583,7 @@ export default createRule({ startToken: TSESTree.Token, endToken: TSESTree.Token, offset: number | string, - ) { + ): void { /** * Gets the first token of a given element, including surrounding parentheses. * @param element A node in the `elements` list @@ -1589,6 +1585,7 @@ export default createRule({ const listener = baseOffsetListeners[key] as TSESLint.RuleFunction< TSESTree.Node >; + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type acc[key] = node => listenerCallQueue.push({ listener, node }); return acc; diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 76d1edf1cdbb..aca492d4b4da 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -90,7 +90,8 @@ export default util.createRule({ docs: { description: 'Enforce consistent indentation', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, fixable: 'whitespace', schema: baseRule.meta.schema, diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 1af78f79a53c..119765522213 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -8,8 +8,11 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Require that interface names be prefixed with `I`', + description: + 'Require that interface names should or should not prefixed with `I`', category: 'Stylistic Issues', + // this will always be recommended as there's no reason to use this convention + // https://github.com/typescript-eslint/typescript-eslint/issues/374 recommended: 'error', }, messages: { diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index d2becd1655fa..72020afc6008 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -364,28 +364,28 @@ export default util.createRule({ } return { - ClassDeclaration(node) { + ClassDeclaration(node): void { validateMembersOrder( node.body.body, options.classes || options.default!, true, ); }, - ClassExpression(node) { + ClassExpression(node): void { validateMembersOrder( node.body.body, options.classExpressions || options.default!, true, ); }, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { validateMembersOrder( node.body.body, options.interfaces || options.default!, false, ); }, - TSTypeLiteral(node) { + TSTypeLiteral(node): void { validateMembersOrder( node.members, options.typeLiterals || options.default!, diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts index d64568a874f6..31aa5d8bb630 100644 --- a/packages/eslint-plugin/src/rules/no-empty-function.ts +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -15,7 +15,7 @@ export default util.createRule({ docs: { description: 'Disallow empty functions', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, @@ -81,7 +81,7 @@ export default util.createRule({ */ function isConciseConstructor( node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, - ) { + ): boolean { // Check TypeScript specific nodes return ( isConstructor(node) && isBodyEmpty(node) && hasParameterProperties(node) @@ -89,12 +89,12 @@ export default util.createRule({ } return { - FunctionDeclaration(node: TSESTree.FunctionDeclaration) { + FunctionDeclaration(node): void { if (!isConciseConstructor(node)) { rules.FunctionDeclaration(node); } }, - FunctionExpression(node: TSESTree.FunctionExpression) { + FunctionExpression(node): void { if (!isConciseConstructor(node)) { rules.FunctionExpression(node); } diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 4d2a0a5a4882..55fbdb5337e3 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -40,7 +40,7 @@ export default util.createRule({ ], create(context, [{ allowSingleExtends }]) { return { - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (node.body.body.length !== 0) { // interface contains members --> Nothing to report return; diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 43f81b8607e5..249265a7683c 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -167,7 +167,7 @@ export default util.createRule({ } return { - TSAnyKeyword(node) { + TSAnyKeyword(node): void { if (ignoreRestArgs && isNodeDescendantOfRestElementInFunction(node)) { return; } @@ -175,7 +175,8 @@ export default util.createRule({ let fix: TSESLint.ReportFixFunction | null = null; if (fixToUnknown) { - fix = fixer => fixer.replaceText(node, 'unknown'); + fix = (fixer => + fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction; } context.report({ diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 28e69478d7e5..7b8d091807c3 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -31,7 +31,7 @@ export default util.createRule({ function binaryExp( node: TSESTree.BinaryExpression | TSESTree.LogicalExpression, - ) { + ): void { const rule = rules.BinaryExpression as (n: typeof node) => void; // makes the rule think it should skip the left or right @@ -56,7 +56,9 @@ export default util.createRule({ return rule(node); } - function callExp(node: TSESTree.CallExpression | TSESTree.NewExpression) { + function callExp( + node: TSESTree.CallExpression | TSESTree.NewExpression, + ): void { const rule = rules.CallExpression as (n: typeof node) => void; if (node.callee.type === AST_NODE_TYPES.TSAsExpression) { @@ -74,7 +76,7 @@ export default util.createRule({ } function unaryUpdateExpression( node: TSESTree.UnaryExpression | TSESTree.UpdateExpression, - ) { + ): void { const rule = rules.UnaryExpression as (n: typeof node) => void; if (node.argument.type === AST_NODE_TYPES.TSAsExpression) { diff --git a/packages/eslint-plugin/src/rules/no-extraneous-class.ts b/packages/eslint-plugin/src/rules/no-extraneous-class.ts index 846416866f25..4756b5928f33 100644 --- a/packages/eslint-plugin/src/rules/no-extraneous-class.ts +++ b/packages/eslint-plugin/src/rules/no-extraneous-class.ts @@ -54,7 +54,7 @@ export default util.createRule({ ], create(context, [{ allowConstructorOnly, allowEmpty, allowStaticOnly }]) { return { - ClassBody(node) { + ClassBody(node): void { const parent = node.parent as | TSESTree.ClassDeclaration | TSESTree.ClassExpression diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 04d6664525c8..5bc2f75adaa4 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -24,7 +24,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - ExpressionStatement(node) { + ExpressionStatement(node): void { const { expression } = parserServices.esTreeNodeToTSNodeMap.get< ts.ExpressionStatement >(node); diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 970c621887e6..03171e7fdf71 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -7,7 +7,7 @@ export default util.createRule({ docs: { description: 'Disallow iterating over an array with a for-in loop', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { forInViolation: @@ -19,7 +19,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - ForInStatement(node) { + ForInStatement(node): void { const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); const originalNode = parserServices.esTreeNodeToTSNodeMap.get< diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index f3b44e512fa7..40fc6a60c7eb 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -44,24 +44,30 @@ export default util.createRule({ }, defaultOptions: [ { - ignoreParameters: true, - ignoreProperties: true, + ignoreParameters: false, + ignoreProperties: false, }, ], create(context, [{ ignoreParameters, ignoreProperties }]) { - function isFunctionCall(init: TSESTree.Expression, callName: string) { + function isFunctionCall( + init: TSESTree.Expression, + callName: string, + ): boolean { return ( init.type === AST_NODE_TYPES.CallExpression && init.callee.type === AST_NODE_TYPES.Identifier && init.callee.name === callName ); } - function isLiteral(init: TSESTree.Expression, typeName: string) { + function isLiteral(init: TSESTree.Expression, typeName: string): boolean { return ( init.type === AST_NODE_TYPES.Literal && typeof init.value === typeName ); } - function isIdentifier(init: TSESTree.Expression, ...names: string[]) { + function isIdentifier( + init: TSESTree.Expression, + ...names: string[] + ): boolean { return ( init.type === AST_NODE_TYPES.Identifier && names.includes(init.name) ); diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 8a50fa87c390..005bae9eb0ae 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -150,7 +150,7 @@ export default util.createRule({ } return { - Literal(node) { + Literal(node): void { // Check if the node is a TypeScript enum declaration if (options.ignoreEnums && isParentTSEnumDeclaration(node)) { return; diff --git a/packages/eslint-plugin/src/rules/no-misused-new.ts b/packages/eslint-plugin/src/rules/no-misused-new.ts index aa9d0cb366cf..67d00b131f0e 100644 --- a/packages/eslint-plugin/src/rules/no-misused-new.ts +++ b/packages/eslint-plugin/src/rules/no-misused-new.ts @@ -16,7 +16,7 @@ export default util.createRule({ schema: [], messages: { errorMessageInterface: 'Interfaces cannot be constructed, only classes.', - errorMessageClass: 'Class cannon have method named `new`.', + errorMessageClass: 'Class cannot have method named `new`.', }, }, defaultOptions: [], @@ -69,7 +69,7 @@ export default util.createRule({ return { 'TSInterfaceBody > TSConstructSignatureDeclaration'( node: TSESTree.TSConstructSignatureDeclaration, - ) { + ): void { if ( isMatchingParentType( node.parent!.parent as TSESTree.TSInterfaceDeclaration, @@ -85,7 +85,7 @@ export default util.createRule({ }, "TSMethodSignature[key.name='constructor']"( node: TSESTree.TSMethodSignature, - ) { + ): void { context.report({ node, messageId: 'errorMessageInterface', @@ -93,7 +93,7 @@ export default util.createRule({ }, "ClassBody > MethodDefinition[key.name='new']"( node: TSESTree.MethodDefinition, - ) { + ): void { if (node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression) { if ( node.parent && diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index b36046352d7d..6d06ef8807a2 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -17,7 +17,7 @@ export default util.createRule({ docs: { description: 'Avoid using promises in places not designed to handle them', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { voidReturn: @@ -73,13 +73,15 @@ export default util.createRule({ NewExpression: checkArguments, }; - function checkTestConditional(node: { test: TSESTree.Expression | null }) { + function checkTestConditional(node: { + test: TSESTree.Expression | null; + }): void { if (node.test) { checkConditional(node.test); } } - function checkConditional(node: TSESTree.Expression) { + function checkConditional(node: TSESTree.Expression): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); if (isAlwaysThenable(checker, tsNode)) { context.report({ @@ -91,7 +93,7 @@ export default util.createRule({ function checkArguments( node: TSESTree.CallExpression | TSESTree.NewExpression, - ) { + ): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get< ts.CallExpression | ts.NewExpression >(node); @@ -126,7 +128,7 @@ export default util.createRule({ // alternates in a union) to be thenable. Otherwise, you might be trying to // check if something is defined or undefined and get caught because one of the // branches is thenable. -function isAlwaysThenable(checker: ts.TypeChecker, node: ts.Node) { +function isAlwaysThenable(checker: ts.TypeChecker, node: ts.Node): boolean { const type = checker.getTypeAtLocation(node); for (const subType of tsutils.unionTypeParts(checker.getApparentType(type))) { @@ -195,7 +197,7 @@ function isFunctionParam( function voidFunctionParams( checker: ts.TypeChecker, node: ts.CallExpression | ts.NewExpression, -) { +): Set { const voidReturnIndices = new Set(); const thenableReturnIndices = new Set(); const type = checker.getTypeAtLocation(node.expression); @@ -237,7 +239,10 @@ function voidFunctionParams( } // Returns true if the expression is a function that returns a thenable -function returnsThenable(checker: ts.TypeChecker, node: ts.Expression) { +function returnsThenable( + checker: ts.TypeChecker, + node: ts.Expression, +): boolean { const type = checker.getApparentType(checker.getTypeAtLocation(node)); for (const subType of tsutils.unionTypeParts(type)) { diff --git a/packages/eslint-plugin/src/rules/no-namespace.ts b/packages/eslint-plugin/src/rules/no-namespace.ts index ca68fcf647b5..3698b4f941bd 100644 --- a/packages/eslint-plugin/src/rules/no-namespace.ts +++ b/packages/eslint-plugin/src/rules/no-namespace.ts @@ -53,7 +53,7 @@ export default util.createRule({ return { "TSModuleDeclaration[global!=true][id.type='Identifier']"( node: TSESTree.TSModuleDeclaration, - ) { + ): void { if ( (node.parent && node.parent.type === AST_NODE_TYPES.TSModuleDeclaration) || diff --git a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts index 6ed336e4d2d3..4e888c58bb64 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts @@ -8,7 +8,7 @@ export default util.createRule({ description: 'Disallows non-null assertions using the `!` postfix operator', category: 'Stylistic Issues', - recommended: 'error', + recommended: 'warn', }, messages: { noNonNull: 'Forbidden non-null assertion.', @@ -18,7 +18,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - TSNonNullExpression(node) { + TSNonNullExpression(node): void { context.report({ node, messageId: 'noNonNull', diff --git a/packages/eslint-plugin/src/rules/no-parameter-properties.ts b/packages/eslint-plugin/src/rules/no-parameter-properties.ts index a7727a33602b..9b6bb31e6541 100644 --- a/packages/eslint-plugin/src/rules/no-parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/no-parameter-properties.ts @@ -27,7 +27,8 @@ export default util.createRule({ description: 'Disallow the use of parameter properties in class constructors', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, messages: { noParamProp: @@ -81,7 +82,7 @@ export default util.createRule({ } return { - TSParameterProperty(node) { + TSParameterProperty(node): void { const modifiers = getModifiers(node); if (!allows.includes(modifiers)) { diff --git a/packages/eslint-plugin/src/rules/no-require-imports.ts b/packages/eslint-plugin/src/rules/no-require-imports.ts index afb0b4a38480..91d81e0d8c53 100644 --- a/packages/eslint-plugin/src/rules/no-require-imports.ts +++ b/packages/eslint-plugin/src/rules/no-require-imports.ts @@ -18,13 +18,15 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - 'CallExpression > Identifier[name="require"]'(node: TSESTree.Identifier) { + 'CallExpression > Identifier[name="require"]'( + node: TSESTree.Identifier, + ): void { context.report({ node: node.parent!, messageId: 'noRequireImports', }); }, - TSExternalModuleReference(node) { + TSExternalModuleReference(node): void { context.report({ node, messageId: 'noRequireImports', diff --git a/packages/eslint-plugin/src/rules/no-this-alias.ts b/packages/eslint-plugin/src/rules/no-this-alias.ts index e156cbd24e2f..8865fad2c3fb 100644 --- a/packages/eslint-plugin/src/rules/no-this-alias.ts +++ b/packages/eslint-plugin/src/rules/no-this-alias.ts @@ -19,7 +19,7 @@ export default util.createRule({ docs: { description: 'Disallow aliasing `this`', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: [ { @@ -46,7 +46,7 @@ export default util.createRule({ }, defaultOptions: [ { - allowDestructuring: false, + allowDestructuring: true, allowedNames: [], }, ], @@ -54,7 +54,7 @@ export default util.createRule({ return { "VariableDeclarator[init.type='ThisExpression']"( node: TSESTree.VariableDeclarator, - ) { + ): void { const { id } = node; if (allowDestructuring && id.type !== AST_NODE_TYPES.Identifier) { diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index f260d124133f..1648b89f0dfa 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -44,6 +44,7 @@ export default util.createRule({ docs: { description: 'Disallow the use of type aliases', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -188,7 +189,7 @@ export default util.createRule({ */ function validateTypeAliases( type: TypeWithLabel, - isTopLevel: boolean = false, + isTopLevel = false, ): void { if (type.node.type === AST_NODE_TYPES.TSFunctionType) { // callback @@ -268,7 +269,7 @@ export default util.createRule({ } return { - TSTypeAliasDeclaration(node) { + TSTypeAliasDeclaration(node): void { const types = getTypes(node.typeAnnotation); if (types.length === 1) { // is a top level type annotation diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 23a98cb9bef5..64f58848d79b 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -132,7 +132,7 @@ export default util.createRule({ namespacesInScope.push(esTreeNodeToTSNodeMap.get(node)); } - function exitDeclaration() { + function exitDeclaration(): void { namespacesInScope.pop(); } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index d93e205c7bb5..100a9d261c0e 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -73,7 +73,7 @@ export default util.createRule<[], MessageIds>({ } return { - TSTypeParameterInstantiation(node) { + TSTypeParameterInstantiation(node): void { const parentDeclaration = parserServices.esTreeNodeToTSNodeMap.get< ExtendingClassLikeDeclaration | ParameterCapableTSNode >(node.parent!); @@ -104,7 +104,7 @@ function getArgsAndParameters( function getTypeParametersFromNode( node: ParameterCapableTSNode, checker: ts.TypeChecker, -) { +): readonly ts.TypeParameterDeclaration[] | undefined { if (ts.isExpressionWithTypeArguments(node)) { return getTypeParametersFromType(node.expression, checker); } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index c91c3d678c7b..11da74d88c91 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -27,7 +27,7 @@ export default util.createRule({ description: 'Warns if a type assertion does not change the type of an expression', category: 'Best Practices', - recommended: false, + recommended: 'error', }, fixable: 'code', messages: { @@ -166,7 +166,7 @@ export default util.createRule({ } return { - TSNonNullExpression(node) { + TSNonNullExpression(node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get< ts.NonNullExpression >(node); diff --git a/packages/eslint-plugin/src/rules/no-use-before-define.ts b/packages/eslint-plugin/src/rules/no-use-before-define.ts index 20ed4edc77aa..e40da7038930 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -255,7 +255,7 @@ export default util.createRule({ } return { - Program() { + Program(): void { findVariablesInScope(context.getScope()); }, }; diff --git a/packages/eslint-plugin/src/rules/no-useless-constructor.ts b/packages/eslint-plugin/src/rules/no-useless-constructor.ts index 6410fa5fa435..3587c7953119 100644 --- a/packages/eslint-plugin/src/rules/no-useless-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-useless-constructor.ts @@ -59,7 +59,7 @@ export default util.createRule({ create(context) { const rules = baseRule.create(context); return { - MethodDefinition(node) { + MethodDefinition(node): void { if ( node.value && node.value.type === AST_NODE_TYPES.FunctionExpression && diff --git a/packages/eslint-plugin/src/rules/no-var-requires.ts b/packages/eslint-plugin/src/rules/no-var-requires.ts index 29b1c77dd34a..274cf2c1ceb2 100644 --- a/packages/eslint-plugin/src/rules/no-var-requires.ts +++ b/packages/eslint-plugin/src/rules/no-var-requires.ts @@ -22,7 +22,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - CallExpression(node) { + CallExpression(node): void { if ( node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === 'require' && diff --git a/packages/eslint-plugin/src/rules/prefer-for-of.ts b/packages/eslint-plugin/src/rules/prefer-for-of.ts index 89f6c5403032..5aef0845a533 100644 --- a/packages/eslint-plugin/src/rules/prefer-for-of.ts +++ b/packages/eslint-plugin/src/rules/prefer-for-of.ts @@ -181,7 +181,7 @@ export default util.createRule({ } return { - 'ForStatement:exit'(node: TSESTree.ForStatement) { + 'ForStatement:exit'(node: TSESTree.ForStatement): void { if (!isSingleVariableDeclaration(node.init)) { return; } diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index f375b1bb8f28..dae4fae32956 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -72,7 +72,7 @@ export default util.createRule({ | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration, parent: TSESTree.Node, - ) { + ): string { const start = call.range[0]; const colonPos = call.returnType!.range[0] - start; const text = sourceCode.getText().slice(start, call.range[1]); @@ -102,7 +102,10 @@ export default util.createRule({ * @param member The TypeElement being checked * @param node The parent of member being checked */ - function checkMember(member: TSESTree.TypeElement, node: TSESTree.Node) { + function checkMember( + member: TSESTree.TypeElement, + node: TSESTree.Node, + ): void { if ( (member.type === AST_NODE_TYPES.TSCallSignatureDeclaration || member.type === AST_NODE_TYPES.TSConstructSignatureDeclaration) && @@ -141,12 +144,12 @@ export default util.createRule({ } return { - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (!hasOneSupertype(node) && node.body.body.length === 1) { checkMember(node.body.body[0], node); } }, - 'TSTypeLiteral[members.length = 1]'(node: TSESTree.TSTypeLiteral) { + 'TSTypeLiteral[members.length = 1]'(node: TSESTree.TSTypeLiteral): void { checkMember(node.members[0], node); }, }; diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 2db17e11d1dd..384edf018595 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -13,7 +13,7 @@ export default createRule({ docs: { description: 'Enforce `includes` method over `indexOf` method', category: 'Best Practices', - recommended: false, + recommended: 'error', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts index 6059a731a942..9137fe912aa6 100644 --- a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts +++ b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts @@ -26,7 +26,7 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); return { - TSModuleDeclaration(node) { + TSModuleDeclaration(node): void { // Do nothing if the name is a string. if (!node.id || node.id.type === AST_NODE_TYPES.Literal) { return; diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 01f4ea320bab..22c85fd03437 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -61,7 +61,7 @@ export default util.createRule({ node: ts.PropertyAccessExpression, parent: ts.Node, classScope: ClassScope, - ) { + ): void { if (ts.isBinaryExpression(parent)) { handleParentBinaryExpression(node, parent, classScope); return; @@ -84,7 +84,7 @@ export default util.createRule({ node: ts.PropertyAccessExpression, parent: ts.BinaryExpression, classScope: ClassScope, - ) { + ): void { if ( parent.left === node && tsutils.isAssignmentKind(parent.operatorToken.kind) @@ -96,7 +96,7 @@ export default util.createRule({ function handleParentPostfixOrPrefixUnaryExpression( node: ts.PostfixUnaryExpression | ts.PrefixUnaryExpression, classScope: ClassScope, - ) { + ): void { if ( node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken @@ -107,14 +107,16 @@ export default util.createRule({ } } - function isConstructor(node: TSESTree.Node) { + function isConstructor(node: TSESTree.Node): boolean { return ( node.type === AST_NODE_TYPES.MethodDefinition && node.kind === 'constructor' ); } - function isFunctionScopeBoundaryInStack(node: TSESTree.Node) { + function isFunctionScopeBoundaryInStack( + node: TSESTree.Node, + ): boolean | tsutils.ScopeBoundary { if (classScopeStack.length === 0) { return false; } @@ -129,7 +131,7 @@ export default util.createRule({ function getEsNodesFromViolatingNode( violatingNode: ParameterOrPropertyDeclaration, - ) { + ): { esNode: TSESTree.Node; nameNode: TSESTree.Node } { if (ts.isParameterPropertyDeclaration(violatingNode)) { return { esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), @@ -148,7 +150,7 @@ export default util.createRule({ return { 'ClassDeclaration, ClassExpression'( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, - ) { + ): void { classScopeStack.push( new ClassScope( checker, @@ -157,7 +159,7 @@ export default util.createRule({ ), ); }, - 'ClassDeclaration, ClassExpression:exit'() { + 'ClassDeclaration, ClassExpression:exit'(): void { const finalizedClassScope = classScopeStack.pop()!; const sourceCode = context.getSourceCode(); @@ -175,7 +177,7 @@ export default util.createRule({ }); } }, - MemberExpression(node) { + MemberExpression(node): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get< ts.PropertyAccessExpression >(node); @@ -187,7 +189,7 @@ export default util.createRule({ ); } }, - [functionScopeBoundaries](node: TSESTree.Node) { + [functionScopeBoundaries](node: TSESTree.Node): void { if (isConstructor(node)) { classScopeStack[classScopeStack.length - 1].enterConstructor( parserServices.esTreeNodeToTSNodeMap.get( @@ -198,7 +200,7 @@ export default util.createRule({ classScopeStack[classScopeStack.length - 1].enterNonConstructor(); } }, - [`${functionScopeBoundaries}:exit`](node: TSESTree.Node) { + [`${functionScopeBoundaries}:exit`](node: TSESTree.Node): void { if (isConstructor(node)) { classScopeStack[classScopeStack.length - 1].exitConstructor(); } else if (isFunctionScopeBoundaryInStack(node)) { @@ -247,7 +249,7 @@ class ClassScope { } } - public addDeclaredVariable(node: ParameterOrPropertyDeclaration) { + public addDeclaredVariable(node: ParameterOrPropertyDeclaration): void { if ( !tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) || tsutils.isModifierFlagSet(node, ts.ModifierFlags.Readonly) || @@ -270,7 +272,7 @@ class ClassScope { ).set(node.name.getText(), node); } - public addVariableModification(node: ts.PropertyAccessExpression) { + public addVariableModification(node: ts.PropertyAccessExpression): void { const modifierType = this.checker.getTypeAtLocation(node.expression); if ( modifierType.symbol === undefined || @@ -295,7 +297,7 @@ class ClassScope { ).add(node.name.text); } - public enterConstructor(node: ts.ConstructorDeclaration) { + public enterConstructor(node: ts.ConstructorDeclaration): void { this.constructorScopeDepth = DIRECTLY_INSIDE_CONSTRUCTOR; for (const parameter of node.parameters) { @@ -305,23 +307,23 @@ class ClassScope { } } - public exitConstructor() { + public exitConstructor(): void { this.constructorScopeDepth = OUTSIDE_CONSTRUCTOR; } - public enterNonConstructor() { + public enterNonConstructor(): void { if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) { this.constructorScopeDepth += 1; } } - public exitNonConstructor() { + public exitNonConstructor(): void { if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) { this.constructorScopeDepth -= 1; } } - public finalizeUnmodifiedPrivateNonReadonlys() { + public finalizeUnmodifiedPrivateNonReadonlys(): ParameterOrPropertyDeclaration[] { this.memberVariableModifications.forEach(variableName => { this.privateModifiableMembers.delete(variableName); }); diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index c48e2351985f..bd1a48fcb613 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -12,7 +12,7 @@ export default createRule({ description: 'Prefer RegExp#exec() over String#match() if no global flag is provided', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { regExpExecOverStringMatch: 'Use the `RegExp#exec()` method instead.', @@ -39,7 +39,7 @@ export default createRule({ return { "CallExpression[arguments.length=1] > MemberExpression.callee[property.name='match'][computed=false]"( node: TSESTree.MemberExpression, - ) { + ): void { const callNode = node.parent as TSESTree.CallExpression; const arg = callNode.arguments[0]; const evaluated = getStaticValue(arg, globalScope); diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 4e902dfd584a..2ffac6728acd 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -20,7 +20,7 @@ export default createRule({ description: 'Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { preferStartsWith: "Use 'String#startsWith' method instead.", diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 48d63cf0f545..faf55f95fa71 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -86,7 +86,7 @@ export default util.createRule({ const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); - function validateNode(node: TSESTree.Node) { + function validateNode(node: TSESTree.Node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); const signatures = checker .getTypeAtLocation(originalNode) @@ -111,17 +111,21 @@ export default util.createRule({ return { 'ArrowFunctionExpression[async = false]'( node: TSESTree.ArrowFunctionExpression, - ) { + ): void { if (checkArrowFunctions) { validateNode(node); } }, - 'FunctionDeclaration[async = false]'(node: TSESTree.FunctionDeclaration) { + 'FunctionDeclaration[async = false]'( + node: TSESTree.FunctionDeclaration, + ): void { if (checkFunctionDeclarations) { validateNode(node); } }, - 'FunctionExpression[async = false]'(node: TSESTree.FunctionExpression) { + 'FunctionExpression[async = false]'( + node: TSESTree.FunctionExpression, + ): void { if ( node.parent && 'kind' in node.parent && diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index a9745be16e02..5b3f430420f3 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -26,7 +26,7 @@ export default util.createRule({ return { "CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]"( node: TSESTree.MemberExpression, - ) { + ): void { // Get the symbol of the `sort` method. const tsNode = service.esTreeNodeToTSNodeMap.get(node); const sortSymbol = checker.getSymbolAtLocation(tsNode); diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index cbdd08791d9f..ef1092b46db3 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -23,7 +23,7 @@ export default util.createRule({ docs: { description: 'Disallow async functions which have no `await` expression', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, @@ -46,7 +46,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, - ) { + ): void { scopeInfo = { upper: scopeInfo, returnsPromise: false, @@ -79,7 +79,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, - ) { + ): void { if (scopeInfo) { if (!scopeInfo.returnsPromise) { switch (node.type) { @@ -109,7 +109,7 @@ export default util.createRule({ 'FunctionExpression[async = true]:exit': exitFunction, 'ArrowFunctionExpression[async = true]:exit': exitFunction, - ReturnStatement(node: TSESTree.ReturnStatement) { + ReturnStatement(node): void { if (!scopeInfo) { return; } diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index 6d68d5f7dfc8..df523033bf70 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -83,7 +83,7 @@ export default util.createRule({ } return { - "BinaryExpression[operator='+']"(node: TSESTree.BinaryExpression) { + "BinaryExpression[operator='+']"(node: TSESTree.BinaryExpression): void { const leftType = getNodeType(node.left); const rightType = getNodeType(node.right); diff --git a/packages/eslint-plugin/src/rules/semi.ts b/packages/eslint-plugin/src/rules/semi.ts index 8130088eb309..8d1ada467e3c 100644 --- a/packages/eslint-plugin/src/rules/semi.ts +++ b/packages/eslint-plugin/src/rules/semi.ts @@ -16,6 +16,7 @@ export default util.createRule({ docs: { description: 'Require or disallow semicolons instead of ASI', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, fixable: 'code', @@ -59,7 +60,7 @@ export default util.createRule({ return { ...rules, ...nodesToCheck, - ExportDefaultDeclaration(node) { + ExportDefaultDeclaration(node): void { if (node.declaration.type !== AST_NODE_TYPES.TSInterfaceDeclaration) { rules.ExportDefaultDeclaration(node); } diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 7d74ab0c603d..c5ab5772523a 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -18,7 +18,7 @@ export default util.createRule({ description: 'Sets preference level for triple slash directives versus ES6-style import declarations', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { tripleSlashReference: @@ -57,7 +57,7 @@ export default util.createRule({ importName: string; })[] = []; - function hasMatchingReference(source: TSESTree.Literal) { + function hasMatchingReference(source: TSESTree.Literal): void { references.forEach(reference => { if (reference.importName === source.value) { context.report({ @@ -71,20 +71,20 @@ export default util.createRule({ }); } return { - ImportDeclaration(node) { + ImportDeclaration(node): void { if (programNode) { const source = node.source as TSESTree.Literal; hasMatchingReference(source); } }, - TSImportEqualsDeclaration(node) { + TSImportEqualsDeclaration(node): void { if (programNode) { const source = (node.moduleReference as TSESTree.TSExternalModuleReference) .expression as TSESTree.Literal; hasMatchingReference(source); } }, - Program(node) { + Program(node): void { if (lib === 'always' && path === 'always' && types == 'always') { return; } diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index f5e11f51fb07..d0f1c5b45a44 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -185,12 +185,12 @@ export default util.createRule({ } return { - TSMappedType(node) { + TSMappedType(node): void { if (node.typeAnnotation) { checkTypeAnnotationSpacing(node.typeAnnotation); } }, - TSTypeAnnotation(node) { + TSTypeAnnotation(node): void { checkTypeAnnotationSpacing(node.typeAnnotation); }, }; diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 3c535467f2ce..182568e57488 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -55,7 +55,7 @@ export default util.createRule<[Options], MessageIds>({ }, ], create(context, [options]) { - function report(location: TSESTree.Node, name?: string) { + function report(location: TSESTree.Node, name?: string): void { context.report({ node: location, messageId: name ? 'expectedTypedefNamed' : 'expectedTypedef', @@ -63,11 +63,13 @@ export default util.createRule<[Options], MessageIds>({ }); } - function getNodeName(node: TSESTree.Parameter | TSESTree.PropertyName) { + function getNodeName( + node: TSESTree.Parameter | TSESTree.PropertyName, + ): string | undefined { return node.type === AST_NODE_TYPES.Identifier ? node.name : undefined; } - function checkParameters(params: TSESTree.Parameter[]) { + function checkParameters(params: TSESTree.Parameter[]): void { for (const param of params) { let annotationNode: TSESTree.Node | undefined; @@ -90,17 +92,17 @@ export default util.createRule<[Options], MessageIds>({ } return { - ArrayPattern(node) { + ArrayPattern(node): void { if (options[OptionKeys.ArrayDestructuring] && !node.typeAnnotation) { report(node); } }, - ArrowFunctionExpression(node) { + ArrowFunctionExpression(node): void { if (options[OptionKeys.ArrowParameter]) { checkParameters(node.params); } }, - ClassProperty(node) { + ClassProperty(node): void { if ( options[OptionKeys.MemberVariableDeclaration] && !node.typeAnnotation @@ -115,19 +117,19 @@ export default util.createRule<[Options], MessageIds>({ }, 'FunctionDeclaration, FunctionExpression'( node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, - ) { + ): void { if (options[OptionKeys.Parameter]) { checkParameters(node.params); } }, - ObjectPattern(node) { + ObjectPattern(node): void { if (options[OptionKeys.ObjectDestructuring] && !node.typeAnnotation) { report(node); } }, 'TSIndexSignature, TSPropertySignature'( node: TSESTree.TSIndexSignature | TSESTree.TSPropertySignature, - ) { + ): void { if (options[OptionKeys.PropertyDeclaration] && !node.typeAnnotation) { report( node, @@ -137,7 +139,7 @@ export default util.createRule<[Options], MessageIds>({ ); } }, - VariableDeclarator(node) { + VariableDeclarator(node): void { if ( options[OptionKeys.VariableDeclaration] && !node.id.typeAnnotation diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 88892b634176..0db82b2c7704 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -25,7 +25,7 @@ export default util.createRule({ category: 'Best Practices', description: 'Enforces unbound methods are called with their expected scope', - recommended: false, + recommended: 'error', }, messages: { unbound: @@ -54,7 +54,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - [AST_NODE_TYPES.MemberExpression](node: TSESTree.MemberExpression) { + MemberExpression(node): void { if (isSafeUse(node)) { return; } @@ -73,7 +73,7 @@ export default util.createRule({ }, }); -function isDangerousMethod(symbol: ts.Symbol, ignoreStatic: boolean) { +function isDangerousMethod(symbol: ts.Symbol, ignoreStatic: boolean): boolean { const { valueDeclaration } = symbol; if (!valueDeclaration) { // working around https://github.com/microsoft/TypeScript/issues/31294 diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 04695fcc3027..1c3f747bc51b 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -55,6 +55,7 @@ export default util.createRule({ description: 'Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter', category: 'Variables', + // too opinionated to be recommended recommended: false, }, type: 'suggestion', @@ -307,14 +308,14 @@ export default util.createRule({ typeParameters?: TSESTree.TSTypeParameterDeclaration, ): IsTypeParameter { if (typeParameters === undefined) { - return () => false; + return (() => false) as IsTypeParameter; } const set = new Set(); for (const t of typeParameters.params) { set.add(t.name.name); } - return typeName => set.has(typeName); + return (typeName => set.has(typeName)) as IsTypeParameter; } /** True if any of the outer type parameters are used in a signature. */ @@ -476,7 +477,7 @@ export default util.createRule({ function createScope( parent: ScopeNode, typeParameters?: TSESTree.TSTypeParameterDeclaration, - ) { + ): void { currentScope && scopes.push(currentScope); currentScope = { overloads: new Map(), @@ -485,7 +486,7 @@ export default util.createRule({ }; } - function checkScope() { + function checkScope(): void { const failures = checkOverloads( Array.from(currentScope.overloads.values()), currentScope.typeParameters, @@ -494,7 +495,7 @@ export default util.createRule({ currentScope = scopes.pop()!; } - function addOverload(signature: OverloadNode, key?: string) { + function addOverload(signature: OverloadNode, key?: string): void { key = key || getOverloadKey(signature); if (currentScope && signature.parent === currentScope.parent && key) { const overloads = currentScope.overloads.get(key); @@ -513,15 +514,15 @@ export default util.createRule({ return { Program: createScope, TSModuleBlock: createScope, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { createScope(node.body, node.typeParameters); }, - ClassDeclaration(node) { + ClassDeclaration(node): void { createScope(node.body, node.typeParameters); }, TSTypeLiteral: createScope, // collect overloads - TSDeclareFunction(node) { + TSDeclareFunction(node): void { if (node.id && !node.body) { addOverload(node, node.id.name); } @@ -529,12 +530,12 @@ export default util.createRule({ TSCallSignatureDeclaration: addOverload, TSConstructSignatureDeclaration: addOverload, TSMethodSignature: addOverload, - TSAbstractMethodDefinition(node) { + TSAbstractMethodDefinition(node): void { if (!node.value.body) { addOverload(node); } }, - MethodDefinition(node) { + MethodDefinition(node): void { if (!node.value.body) { addOverload(node); } diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 30587b336ed9..cae887c229f1 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -11,14 +11,14 @@ import { /** * Check if the context file name is *.d.ts or *.d.tsx */ -export function isDefinitionFile(fileName: string) { +export function isDefinitionFile(fileName: string): boolean { return /\.d\.tsx?$/i.test(fileName || ''); } /** * Upper cases the first character or the string */ -export function upperCaseFirst(str: string) { +export function upperCaseFirst(str: string): string { return str[0].toUpperCase() + str.slice(1); } diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index 83a8bbabf575..6f769d7f950a 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -186,7 +186,10 @@ export function isTypeFlagSet( /** * @returns Whether a type is an instance of the parent type, including for the parent's base types. */ -export const typeIsOrHasBaseType = (type: ts.Type, parentType: ts.Type) => { +export function typeIsOrHasBaseType( + type: ts.Type, + parentType: ts.Type, +): boolean { if (type.symbol === undefined || parentType.symbol === undefined) { return false; } @@ -208,4 +211,4 @@ export const typeIsOrHasBaseType = (type: ts.Type, parentType: ts.Type) => { } return false; -}; +} diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index fe3d06d4fc87..978adc109669 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -68,7 +68,7 @@ class RuleTester extends TSESLint.RuleTester { } } -function getFixturesRootDir() { +function getFixturesRootDir(): string { return path.join(process.cwd(), 'tests/fixtures/'); } diff --git a/packages/eslint-plugin/tests/rules/indent/utils.ts b/packages/eslint-plugin/tests/rules/indent/utils.ts index 72cedd3ea645..badfbc1c3c6f 100644 --- a/packages/eslint-plugin/tests/rules/indent/utils.ts +++ b/packages/eslint-plugin/tests/rules/indent/utils.ts @@ -17,6 +17,7 @@ type MessageIds = InferMessageIdsTypeFromRule; * @returns The template literal, with spaces removed from all lines */ export function unIndent(strings: TemplateStringsArray): string { + const WHITESPACE_REGEX = / */u; const templateValue = strings[0]; const lines = templateValue .replace(/^\n/u, '') @@ -24,7 +25,7 @@ export function unIndent(strings: TemplateStringsArray): string { .split('\n'); const lineIndents = lines .filter(line => line.trim()) - .map(line => / */u.exec(line)![0].length); + .map(line => WHITESPACE_REGEX.exec(line)![0].length); const minLineIndent = Math.min(...lineIndents); return lines.map(line => line.slice(minLineIndent)).join('\n'); diff --git a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts index c1ddce12186f..03723eb9515d 100644 --- a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts @@ -68,6 +68,11 @@ declare module 'foo' { }, { code: 'const { props, state } = this;', + options: [ + { + allowDestructuring: false, + }, + ], errors: [destructureError], }, { @@ -104,6 +109,11 @@ class TestClass { } } `, + options: [ + { + allowDestructuring: false, + }, + ], errors: [ idError, idError, diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts index d09724e8eee2..45bb8c80db15 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts @@ -10,10 +10,12 @@ const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -function error(messages: { message: string; line: number; column: number }[]) { - // the base rule doesn't have messageIds +// the base rule doesn't have messageIds +function error( + messages: { message: string; line: number; column: number }[], // eslint-disable-next-line @typescript-eslint/no-explicit-any - return messages as any[]; +): any[] { + return messages; } ruleTester.run('no-unused-vars', rule, { diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 5e293018eb4c..d7f5fb29afd9 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -2,8 +2,11 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; +import { format, resolveConfig } from 'prettier'; import rules from '../src/rules'; +const prettierConfig = resolveConfig(__dirname); + interface LinterConfigRules { [name: string]: | TSESLint.Linter.RuleLevel @@ -23,29 +26,40 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'func-call-spacing', 'indent', 'no-array-constructor', + 'no-empty-function', 'no-extra-parens', 'no-magic-numbers', 'no-unused-vars', 'no-use-before-define', 'no-useless-constructor', + 'require-await', 'semi', ]); +// list of rules from the base plugin that we think should be turned on for typescript code +const BASE_RULES_THAT_ARE_RECOMMENDED = new Set([ + 'no-var', + 'prefer-const', + 'prefer-rest-params', + 'prefer-spread', +]); -const ruleEntries = Object.entries(rules); +const ruleEntries = Object.entries(rules).sort((a, b) => + a[0].localeCompare(b[0]), +); /** * Helper function reduces records to key - value pairs. * @param config * @param entry */ -const reducer = ( +function reducer( config: LinterConfigRules, entry: [string, TSESLint.RuleModule], settings: { errorLevel?: 'error' | 'warn'; filterDeprecated: boolean; }, -) => { +): LinterConfigRules { const key = entry[0]; const value = entry[1]; @@ -81,13 +95,17 @@ const reducer = ( config[ruleName] = usedSetting; return config; -}; +} /** * Helper function writes configuration. */ function writeConfig(config: LinterConfig, filePath: string): void { - fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`); + const configStr = format(JSON.stringify(config), { + parser: 'json', + ...prettierConfig, + }); + fs.writeFileSync(filePath, configStr); } const baseConfig: LinterConfig = { @@ -117,14 +135,18 @@ console.log(); console.log( '------------------------------ recommended.json ------------------------------', ); +const recommendedRules = ruleEntries + .filter(entry => !!entry[1].meta.docs.recommended) + .reduce( + (config, entry) => reducer(config, entry, { filterDeprecated: false }), + {}, + ); +BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { + recommendedRules[ruleName] = 'error'; +}); const recommendedConfig: LinterConfig = { extends: './configs/base.json', - rules: ruleEntries - .filter(entry => !!entry[1].meta.docs.recommended) - .reduce( - (config, entry) => reducer(config, entry, { filterDeprecated: false }), - {}, - ), + rules: recommendedRules, }; writeConfig( recommendedConfig, diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts index 84981b8816e7..fab57fe20cf6 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts @@ -3,13 +3,13 @@ import { logRule } from '../log'; const prefix = '@typescript-eslint/'; -function checkConfigAll() { +function checkConfigAll(): boolean { const { rules } = plugin; const all = plugin.configs.all.rules; const allNames = new Set(Object.keys(all)); - return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { if (!rule.meta.deprecated) { const prefixed = `${prefix}${ruleName}` as keyof typeof all; if (allNames.has(prefixed)) { diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts index 21f2faa876dc..ae2561431127 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts @@ -3,13 +3,13 @@ import { logRule } from '../log'; const prefix = '@typescript-eslint/'; -function checkConfigRecommended() { +function checkConfigRecommended(): boolean { const { rules } = plugin; const recommended = plugin.configs.recommended.rules; const recommendedNames = new Set(Object.keys(recommended)); - return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { if (!rule.meta.deprecated && rule.meta.docs.recommended !== false) { const prefixed = `${prefix}${ruleName}` as keyof typeof recommended; if (recommendedNames.has(prefixed)) { diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts index e9d339c10c23..ed6a8131edba 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts @@ -3,6 +3,7 @@ import chalk from 'chalk'; import marked from 'marked'; import { logError } from '../log'; +const RULE_LINK_REGEX = /\[`@typescript-eslint\/(.+)`\]/; function validateTableStructure( rules: Record>>, rulesTable: marked.Tokens.Table, @@ -13,7 +14,7 @@ function validateTableStructure( let hasErrors = false; rulesTable.cells.forEach((row, rowIndex) => { - const match = /\[`@typescript-eslint\/(.+)`\]/.exec(row[0]); + const match = RULE_LINK_REGEX.exec(row[0]); if (!match) { logError(chalk.bold(`Unable to parse link in row ${rowIndex}:`), row[0]); hasErrors = true; diff --git a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts index e14242fca723..3edb71e5a55b 100644 --- a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts +++ b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts @@ -42,7 +42,7 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { url: urlCreator(name), }, }, - create(context) { + create(context): TRuleListener { const optionsWithDefault = applyDefault( defaultOptions, context.options, diff --git a/packages/experimental-utils/src/eslint-utils/deepMerge.ts b/packages/experimental-utils/src/eslint-utils/deepMerge.ts index 966a0db08212..3db67a594078 100644 --- a/packages/experimental-utils/src/eslint-utils/deepMerge.ts +++ b/packages/experimental-utils/src/eslint-utils/deepMerge.ts @@ -18,7 +18,10 @@ export function isObjectNotArray( * @param second The second object * @returns a new object */ -export function deepMerge(first: ObjectLike = {}, second: ObjectLike = {}) { +export function deepMerge( + first: ObjectLike = {}, + second: ObjectLike = {}, +): Record { // get the unique set of keys across both objects const keys = new Set(Object.keys(first).concat(Object.keys(second))); diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index 6c7e5a38428f..1b98c064db09 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -21,7 +21,7 @@ function overrideDefine( this: TSESLintScope.Scope, node: TSESTree.Node, definition: TSESLintScope.Definition, - ) { + ): void { define.call(this, node, definition); // Set `variable.eslintUsed` to tell ESLint that the variable is exported. @@ -147,7 +147,7 @@ class Referencer extends TSESLintScope.Referencer { const upperScope = this.currentScope(); // Process the name. - if (type === 'FunctionDeclaration' && id) { + if (type === AST_NODE_TYPES.FunctionDeclaration && id) { upperScope.__define( id, new TSESLintScope.Definition( @@ -166,14 +166,14 @@ class Referencer extends TSESLintScope.Referencer { const def = defs[i]; if ( def.type === 'FunctionName' && - def.node.type === 'TSDeclareFunction' + def.node.type === AST_NODE_TYPES.TSDeclareFunction ) { defs.splice(i, 1); identifiers.splice(i, 1); break; } } - } else if (type === 'FunctionExpression' && id) { + } else if (type === AST_NODE_TYPES.FunctionExpression && id) { scopeManager.__nestFunctionExpressionNameScope(node); } @@ -213,7 +213,7 @@ class Referencer extends TSESLintScope.Referencer { this.visit(returnType); // Process the body. - if (body && body.type === 'BlockStatement') { + if (body && body.type === AST_NODE_TYPES.BlockStatement) { this.visitChildren(body); } else { this.visit(body); @@ -732,7 +732,7 @@ class Referencer extends TSESLintScope.Referencer { return; } - if (id && id.type === 'Identifier') { + if (id && id.type === AST_NODE_TYPES.Identifier) { scope.__define( id, new TSESLintScope.Definition( @@ -777,7 +777,7 @@ class Referencer extends TSESLintScope.Referencer { */ TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void { const { id, moduleReference } = node; - if (id && id.type === 'Identifier') { + if (id && id.type === AST_NODE_TYPES.Identifier) { this.currentScope().__define( id, new TSESLintScope.Definition( @@ -809,7 +809,7 @@ class Referencer extends TSESLintScope.Referencer { scopeManager.__currentScope = globalScope; // Skip TSModuleBlock to avoid to create that block scope. - if (node.body && node.body.type === 'TSModuleBlock') { + if (node.body && node.body.type === AST_NODE_TYPES.TSModuleBlock) { node.body.body.forEach(this.visit, this); } @@ -845,7 +845,7 @@ class Referencer extends TSESLintScope.Referencer { export function analyzeScope( ast: TSESTree.Program, parserOptions: ParserOptions, -) { +): ScopeManager { const options = { ignoreEval: true, optimistic: false, diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index fb5142f9b37d..830a282da1e4 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -28,7 +28,7 @@ interface ParseForESLintResult { function validateBoolean( value: boolean | undefined, - fallback: boolean = false, + fallback = false, ): boolean { if (typeof value !== 'boolean') { return fallback; @@ -44,7 +44,10 @@ export const version = packageJSON.version; export const Syntax = Object.freeze(AST_NODE_TYPES); -export function parse(code: string, options?: ParserOptions) { +export function parse( + code: string, + options?: ParserOptions, +): ParseForESLintResult['ast'] { return parseForESLint(code, options).ast; } diff --git a/packages/parser/src/scope/scope-manager.ts b/packages/parser/src/scope/scope-manager.ts index 648e24b77f8b..c179bd512d3d 100644 --- a/packages/parser/src/scope/scope-manager.ts +++ b/packages/parser/src/scope/scope-manager.ts @@ -13,12 +13,14 @@ export class ScopeManager extends TSESLintScope.ScopeManager { } /** @internal */ - __nestEnumScope(node: TSESTree.TSEnumDeclaration) { + __nestEnumScope(node: TSESTree.TSEnumDeclaration): TSESLintScope.Scope { return this.__nestScope(new EnumScope(this, this.__currentScope, node)); } /** @internal */ - __nestEmptyFunctionScope(node: TSESTree.TSDeclareFunction) { + __nestEmptyFunctionScope( + node: TSESTree.TSDeclareFunction, + ): TSESLintScope.Scope { return this.__nestScope( new EmptyFunctionScope(this, this.__currentScope, node), ); diff --git a/packages/parser/src/simple-traverse.ts b/packages/parser/src/simple-traverse.ts index 10f58918799c..a616f239a7b4 100644 --- a/packages/parser/src/simple-traverse.ts +++ b/packages/parser/src/simple-traverse.ts @@ -26,7 +26,7 @@ class SimpleTraverser { this.enter = enter; } - traverse(node: unknown, parent: TSESTree.Node | undefined) { + traverse(node: unknown, parent: TSESTree.Node | undefined): void { if (!isValidNode(node)) { return; } @@ -54,6 +54,6 @@ class SimpleTraverser { export function simpleTraverse( startingNode: TSESTree.Node, options: SimpleTraverseOptions, -) { +): void { new SimpleTraverser(options).traverse(startingNode, undefined); } diff --git a/packages/parser/tests/lib/basics.ts b/packages/parser/tests/lib/basics.ts index d526745e341b..c06e8e57be12 100644 --- a/packages/parser/tests/lib/basics.ts +++ b/packages/parser/tests/lib/basics.ts @@ -39,7 +39,7 @@ export const Price: React.SFC = function Price(props) {} linter.defineRule('test', { create(context) { return { - TSTypeReference(node) { + TSTypeReference(node): void { const name = context.getSourceCode().getText(node.typeName); context.report({ node, diff --git a/packages/parser/tests/lib/jsx.ts b/packages/parser/tests/lib/jsx.ts index 4d7f6a3f9bf0..530b26c444b5 100644 --- a/packages/parser/tests/lib/jsx.ts +++ b/packages/parser/tests/lib/jsx.ts @@ -27,7 +27,7 @@ describe('JSX', () => { * Test each fixture file */ function testFixture(fixturesDir: string, useJSXTextNode: boolean) { - return (filename: string) => { + return (filename: string): void => { const code = fs.readFileSync(filename, 'utf8'); const config = { useJSXTextNode, diff --git a/packages/parser/tests/tools/scope-analysis.ts b/packages/parser/tests/tools/scope-analysis.ts index e7aab1d9951a..373b863be818 100644 --- a/packages/parser/tests/tools/scope-analysis.ts +++ b/packages/parser/tests/tools/scope-analysis.ts @@ -8,20 +8,20 @@ export class ReferenceResolver { this.map = new Map(); } - resolve(obj: any, properties: any) { + resolve(obj: any, properties: any): any { const resolved = Object.assign({ $id: this.map.size }, properties); this.map.set(obj, resolved); return resolved; } - ref(obj: any) { + ref(obj: any): any { if (typeof obj !== 'object' || obj === null) { return obj; } - const { map } = this; + const map = this.map; return { - get $ref() { + get $ref(): any { return map.get(obj).$id; }, }; @@ -34,7 +34,7 @@ export class ReferenceResolver { * @param {ASTNode} node The AST node object. * @returns {Object} The object that can be used for JSON.stringify. */ -export function nodeToJSON(node: any) { +export function nodeToJSON(node: any): any { if (!node) { return node; } @@ -52,7 +52,7 @@ export function nodeToJSON(node: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function variableToJSON(variable: any, resolver: any) { +export function variableToJSON(variable: any, resolver: any): any { const { name, eslintUsed } = variable; const defs = variable.defs.map((d: any) => ({ type: d.type, @@ -80,7 +80,7 @@ export function variableToJSON(variable: any, resolver: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function referenceToJSON(reference: any, resolver: any) { +export function referenceToJSON(reference: any, resolver: any): any { const kind = `${reference.isRead() ? 'r' : ''}${ reference.isWrite() ? 'w' : '' }`; @@ -104,7 +104,10 @@ export function referenceToJSON(reference: any, resolver: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function scopeToJSON(scope: any, resolver = new ReferenceResolver()) { +export function scopeToJSON( + scope: any, + resolver = new ReferenceResolver(), +): any { const { type, functionExpressionScope, isStrict } = scope; const block = nodeToJSON(scope.block); const variables = scope.variables.map((v: any) => @@ -142,7 +145,7 @@ export function scopeToJSON(scope: any, resolver = new ReferenceResolver()) { }); } -export function getScopeTree(scopeManager: any) { +export function getScopeTree(scopeManager: any): any { const { globalScope } = scopeManager; // Do the postprocess to test. diff --git a/packages/parser/tests/tools/test-utils.ts b/packages/parser/tests/tools/test-utils.ts index 1ce769a521bb..28dd40d2e077 100644 --- a/packages/parser/tests/tools/test-utils.ts +++ b/packages/parser/tests/tools/test-utils.ts @@ -18,7 +18,7 @@ const defaultConfig = { * @param ast the AST object * @returns copy of the AST object */ -function getRaw(ast: TSESTree.Program) { +function getRaw(ast: TSESTree.Program): TSESTree.Program { return JSON.parse( JSON.stringify(ast, (key, value) => { if ((key === 'start' || key === 'end') && typeof value === 'number') { @@ -39,18 +39,18 @@ function getRaw(ast: TSESTree.Program) { export function createSnapshotTestBlock( code: string, config: ParserOptions = {}, -) { +): () => void { config = Object.assign({}, defaultConfig, config); /** * @returns {Object} the AST object */ - function parse() { + function parse(): TSESTree.Program { const ast = parser.parseForESLint(code, config).ast; return getRaw(ast); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); @@ -77,18 +77,19 @@ export function createSnapshotTestBlock( export function createScopeSnapshotTestBlock( code: string, config: ParserOptions = {}, -) { +): () => void { config = Object.assign({}, defaultConfig, config); /** * @returns {Object} the AST object */ - function parse() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function parse(): any { const result = parser.parseForESLint(code, config); return getScopeTree(result.scopeManager); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); @@ -123,7 +124,7 @@ export function formatSnapshotName( filename: string, fixturesDir: string, fileExtension = '.js', -) { +): string { return `fixtures/${filename .replace(fixturesDir + '/', '') .replace(fileExtension, '')}`; diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index 9cb2bdc974a8..fffb9ea15cfd 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -1,14 +1,15 @@ import { SourceFile } from 'typescript'; -import { convertError, Converter } from './convert'; +import { convertError, Converter, ASTMaps } from './convert'; import { convertComments } from './convert-comments'; import { convertTokens } from './node-utils'; import { Extra } from './parser-options'; +import { TSESTree } from './ts-estree'; export function astConverter( ast: SourceFile, extra: Extra, shouldPreserveNodeMaps: boolean, -) { +): { estree: TSESTree.Program; astMaps: ASTMaps | undefined } { /** * The TypeScript compiler produced fundamental parse errors when parsing the * source. diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index dedae68dd172..3a7d2de99dc1 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -19,8 +19,10 @@ import { isESTreeClassMember, isOptional, unescapeStringLiteralText, + TSError, } from './node-utils'; import { AST_NODE_TYPES, TSESTree, TSNode } from './ts-estree'; +import { ParserWeakMap } from './parser-options'; const SyntaxKind = ts.SyntaxKind; @@ -35,7 +37,7 @@ interface ConverterOptions { * @param error the error object * @returns converted error object */ -export function convertError(error: any) { +export function convertError(error: any): TSError { return createError( error.file, error.start, @@ -43,14 +45,19 @@ export function convertError(error: any) { ); } +export interface ASTMaps { + esTreeNodeToTSNodeMap: ParserWeakMap; + tsNodeToESTreeNodeMap: ParserWeakMap; +} + export class Converter { private readonly ast: ts.SourceFile; private readonly options: ConverterOptions; private readonly esTreeNodeToTSNodeMap = new WeakMap(); private readonly tsNodeToESTreeNodeMap = new WeakMap(); - private allowPattern: boolean = false; - private inTypeMode: boolean = false; + private allowPattern = false; + private inTypeMode = false; /** * Converts a TypeScript node into an ESTree node @@ -63,7 +70,7 @@ export class Converter { this.options = options; } - getASTMaps() { + getASTMaps(): ASTMaps { return { esTreeNodeToTSNodeMap: this.esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap: this.tsNodeToESTreeNodeMap, @@ -168,7 +175,7 @@ export class Converter { private registerTSNodeInNodeMap( node: ts.Node, result: TSESTree.BaseNode | null, - ) { + ): void { if (result && this.options.shouldPreserveNodeMaps) { if (!this.tsNodeToESTreeNodeMap.has(node)) { this.tsNodeToESTreeNodeMap.set(node, result); diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index f1666635b11c..c23daf6e3173 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -644,6 +644,13 @@ export function getNodeContainer( return container!; } +export interface TSError { + index: number; + lineNumber: number; + column: number; + message: string; +} + /** * @param ast the AST object * @param start the index at which the error starts @@ -654,7 +661,7 @@ export function createError( ast: ts.SourceFile, start: number, message: string, -) { +): TSError { const loc = ast.getLineAndCharacterOfPosition(start); return { index: start, @@ -668,7 +675,7 @@ export function createError( * @param n the TSNode * @param ast the TS AST */ -export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile) { +export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean { // If we have a token or node that has a non-zero width, it must have tokens. // Note: getWidth() does not take trivia into account. return n.kind === SyntaxKind.EndOfFileToken diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 564114d7ccb7..f215fa44492c 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -33,7 +33,7 @@ let warnedAboutTSVersion = false; * * @param options Parser options */ -function getFileName({ jsx }: { jsx?: boolean }) { +function getFileName({ jsx }: { jsx?: boolean }): string { return jsx ? 'estree.tsx' : 'estree.ts'; } @@ -62,6 +62,11 @@ function resetExtra(): void { }; } +interface ASTAndProgram { + ast: ts.SourceFile; + program: ts.Program | undefined; +} + /** * @param code The code of the file being linted * @param options The config object @@ -71,7 +76,7 @@ function getASTFromProject( code: string, options: TSESTreeOptions, createDefaultProgram: boolean, -) { +): ASTAndProgram | undefined { const filePath = options.filePath || getFileName(options); const astAndProgram = firstDefined( calculateProjectParserOptions(code, filePath, extra), @@ -95,7 +100,10 @@ function getASTFromProject( * @param options The config object * @returns If found, returns the source file corresponding to the code and the containing program */ -function getASTAndDefaultProject(code: string, options: TSESTreeOptions) { +function getASTAndDefaultProject( + code: string, + options: TSESTreeOptions, +): ASTAndProgram | undefined { const fileName = options.filePath || getFileName(options); const program = createProgram(code, fileName, extra); const ast = program && program.getSourceFile(fileName); @@ -106,7 +114,7 @@ function getASTAndDefaultProject(code: string, options: TSESTreeOptions) { * @param code The code of the file being linted * @returns Returns a new source file and program corresponding to the linted code */ -function createNewProgram(code: string) { +function createNewProgram(code: string): ASTAndProgram { const FILENAME = getFileName(extra); const compilerHost: ts.CompilerHost = { @@ -170,7 +178,7 @@ function getProgramAndAST( options: TSESTreeOptions, shouldProvideParserServices: boolean, createDefaultProgram: boolean, -) { +): ASTAndProgram | undefined { return ( (shouldProvideParserServices && getASTFromProject(code, options, createDefaultProgram)) || @@ -293,7 +301,7 @@ function warnAboutTSVersion(): void { // Parser //------------------------------------------------------------------------------ -type AST = TSESTree.Program & +export type AST = TSESTree.Program & (T['range'] extends true ? { range: [number, number] } : {}) & (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : {}) & (T['comment'] extends true ? { comments: TSESTree.Comment[] } : {}); @@ -403,7 +411,7 @@ export function parseAndGenerateServices< options, shouldProvideParserServices, extra.createDefaultProgram, - ); + )!; /** * Determine whether or not two-way maps of converted AST nodes should be preserved * during the conversion process diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 091990533498..88c631715450 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -34,7 +34,7 @@ const parsedFilesSeen = new Set(); * Clear tsconfig caches. * Primarily used for testing. */ -export function clearCaches() { +export function clearCaches(): void { knownWatchProgramMap.clear(); watchCallbackTrackingMap.clear(); parsedFilesSeen.clear(); @@ -58,7 +58,7 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { ); } -const noopFileWatcher = { close: () => {} }; +const noopFileWatcher = { close: (): void => {} }; function getTsconfigPath(tsconfigPath: string, extra: Extra): string { return path.isAbsolute(tsconfigPath) @@ -118,7 +118,7 @@ export function calculateProjectParserOptions( // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding) => + watchCompilerHost.readFile = (filePath, encoding): string | undefined => path.normalize(filePath) === path.normalize(currentLintOperationState.filePath) ? currentLintOperationState.code @@ -128,7 +128,7 @@ export function calculateProjectParserOptions( watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; // ensure process doesn't emit programs - watchCompilerHost.afterProgramCreate = program => { + watchCompilerHost.afterProgramCreate = (program): void => { // report error if there are any errors in the config file const configFileDiagnostics = program .getConfigFileParsingDiagnostics() @@ -143,18 +143,20 @@ export function calculateProjectParserOptions( }; // register callbacks to trigger program updates without using fileWatchers + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type watchCompilerHost.watchFile = (fileName, callback) => { const normalizedFileName = path.normalize(fileName); watchCallbackTrackingMap.set(normalizedFileName, callback); return { - close: () => { + close: (): void => { watchCallbackTrackingMap.delete(normalizedFileName); }, }; }; // ensure fileWatchers aren't created for directories - watchCompilerHost.watchDirectory = () => noopFileWatcher; + watchCompilerHost.watchDirectory = (): typeof noopFileWatcher => + noopFileWatcher; // we're using internal typescript APIs which aren't on the types /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -163,8 +165,9 @@ export function calculateProjectParserOptions( .onCachedDirectoryStructureHostCreate; (watchCompilerHost as any).onCachedDirectoryStructureHostCreate = ( host: any, - ) => { + ): void => { const oldReadDirectory = host.readDirectory; + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type host.readDirectory = ( path: string, extensions?: readonly string[], @@ -206,7 +209,11 @@ export function calculateProjectParserOptions( * @param extra.project Provided tsconfig paths * @returns The program containing just the file being linted and associated library files */ -export function createProgram(code: string, filePath: string, extra: Extra) { +export function createProgram( + code: string, + filePath: string, + extra: Extra, +): ts.Program | undefined { if (!extra.projects || extra.projects.length !== 1) { return undefined; } @@ -225,7 +232,7 @@ export function createProgram(code: string, filePath: string, extra: Extra) { const compilerHost = ts.createCompilerHost(commandLine.options, true); const oldReadFile = compilerHost.readFile; - compilerHost.readFile = (fileName: string) => + compilerHost.readFile = (fileName: string): string | undefined => path.normalize(fileName) === path.normalize(filePath) ? code : oldReadFile(fileName); diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 4b8e05d166b3..64f2453fc60b 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -33,8 +33,6 @@ const sharedFixturesDirPath = path.join( class FixturesTester { protected fixtures: FixturePatternConfig[] = []; - constructor() {} - /** * Utility to generate a FixturePatternConfig object containing the glob pattern for specific subsections of the fixtures/ directory, * including the capability to ignore specific nested patterns. @@ -45,7 +43,7 @@ class FixturesTester { public addFixturePatternConfig( fixturesSubPath: string, config: CreateFixturePatternConfig = {}, - ) { + ): void { let _fixturesDirPath = fixturesDirPath; if (!fs.existsSync(path.join(fixturesDirPath, fixturesSubPath))) { _fixturesDirPath = sharedFixturesDirPath; diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 43c23ce44d7c..7fba488c78d8 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -1,12 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + import { ParserPlugin } from '@babel/parser'; import codeFrame from 'babel-code-frame'; import * as parser from '../../src/parser'; import * as parseUtils from './utils'; -function createError(message: string, line: number, column: number) { +function createError( + message: string, + line: number, + column: number, +): SyntaxError { // Construct an error similar to the ones thrown by Babylon. const error = new SyntaxError(`${message} (${line}:${column})`); - // eslint-disable-next-line @typescript-eslint/no-explicit-any (error as any).loc = { line, column, @@ -14,7 +19,7 @@ function createError(message: string, line: number, column: number) { return error; } -function parseWithBabelParser(text: string, jsx: boolean = true) { +function parseWithBabelParser(text: string, jsx = true): any { const babel = require('@babel/parser'); const plugins: ParserPlugin[] = [ 'typescript', @@ -40,7 +45,7 @@ function parseWithBabelParser(text: string, jsx: boolean = true) { }); } -function parseWithTypeScriptESTree(text: string, jsx: boolean = true) { +function parseWithTypeScriptESTree(text: string, jsx = true): parser.AST { try { const result = parser.parseAndGenerateServices(text, { loc: true, @@ -69,12 +74,14 @@ interface ASTComparisonParseOptions { jsx?: boolean; } -export function parse(text: string, opts: ASTComparisonParseOptions) { +export function parse( + text: string, + opts: ASTComparisonParseOptions, +): { parseError: any | null; ast: any | null } { /** * Always return a consistent interface, there will be times when we expect both * parsers to fail to parse the invalid source. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any const result: { parseError: any | null; ast: any | null } = { parseError: null, ast: null, diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 43be2143e785..563fd19cc309 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -26,7 +26,7 @@ export function omitDeep( root: any, keysToOmit: { key: string; predicate: Function }[], nodes: Record void> = {}, -) { +): any { function shouldOmit(keyName: string, val: any): boolean { if (keysToOmit && keysToOmit.length) { return keysToOmit.some( @@ -36,7 +36,7 @@ export function omitDeep( return false; } - function visit(node: any, parent: any) { + function visit(node: any, parent: any): void { if (!node) { return; } @@ -72,8 +72,8 @@ export function omitDeep( /** * Common predicates for Babylon AST preprocessing */ -const always = () => true; -const ifNumber = (val: any) => typeof val === 'number'; +const always = (): boolean => true; +const ifNumber = (val: any): boolean => typeof val === 'number'; /** * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... @@ -290,7 +290,7 @@ export function preprocessBabylonAST(ast: any): any { export function removeLocationDataAndSourceTypeFromProgramNode( ast: any, ignoreSourceType: boolean, -) { +): any { delete ast.loc; delete ast.range; if (ignoreSourceType) { diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts index 4a5ac51be55f..2a275c53fb4c 100644 --- a/packages/typescript-estree/tests/lib/convert.ts +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -100,7 +100,7 @@ describe('convert', () => { instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -134,7 +134,7 @@ describe('convert', () => { instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -167,7 +167,7 @@ describe('convert', () => { const program = instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if (node.kind !== ts.SyntaxKind.EndOfFileToken) { expect(ast).toBe( @@ -184,7 +184,7 @@ describe('convert', () => { expect(maps.esTreeNodeToTSNodeMap.get(program.body[0])).toBeDefined(); expect(program.body[0]).not.toBe( - maps.tsNodeToESTreeNodeMap.get(ast.statements[0]), + maps.tsNodeToESTreeNodeMap.get(ast.statements[0] as any), ); checkMaps(ast); }); diff --git a/packages/typescript-estree/tests/lib/jsx.ts b/packages/typescript-estree/tests/lib/jsx.ts index 52b6debdf6b4..a3e0148907cc 100644 --- a/packages/typescript-estree/tests/lib/jsx.ts +++ b/packages/typescript-estree/tests/lib/jsx.ts @@ -23,11 +23,8 @@ describe('JSX', () => { /** * Test each fixture file */ - function testFixture( - fixturesDir: string, - useJSXTextNode: boolean, - ): (filename: string) => void { - return filename => { + function testFixture(fixturesDir: string, useJSXTextNode: boolean) { + return (filename: string): void => { const code = readFileSync(filename, 'utf8'); const config: TSESTreeOptions = { loc: true, diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 7e5c634db9d3..1afab0c5e444 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -280,7 +280,7 @@ describe('semanticInfo', () => { function testIsolatedFile( parseResult: ParseAndGenerateServicesResult, -) { +): void { // get type checker expect(parseResult).toHaveProperty('services.program.getTypeChecker'); const checker = parseResult.services.program!.getTypeChecker(); @@ -331,7 +331,7 @@ function testIsolatedFile( * @param {ts.TypeChecker} checker * @param {ts.Node} tsNode */ -function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node) { +function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node): void { const nodeType = checker.getTypeAtLocation(tsNode); expect(nodeType.flags).toBe(ts.TypeFlags.Object); expect((nodeType as ts.ObjectType).objectFlags).toBe( diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index 16210df104fb..b9fcb51cab64 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -6,7 +6,7 @@ import { TSESTreeOptions } from '../src/parser-options'; * @param {Object} ast the AST object * @returns {Object} copy of the AST object */ -export function getRaw(ast: parser.TSESTree.Program) { +export function getRaw(ast: parser.TSESTree.Program): parser.TSESTree.Program { return JSON.parse( JSON.stringify(ast, (key, value) => { if ((key === 'start' || key === 'end') && typeof value === 'number') { @@ -20,7 +20,7 @@ export function getRaw(ast: parser.TSESTree.Program) { export function parseCodeAndGenerateServices( code: string, config: TSESTreeOptions, -) { +): parser.ParseAndGenerateServicesResult { return parser.parseAndGenerateServices(code, config); } @@ -36,18 +36,18 @@ export function createSnapshotTestBlock( code: string, config: TSESTreeOptions, generateServices?: true, -) { +): () => void { /** * @returns {Object} the AST object */ - function parse() { + function parse(): parser.TSESTree.Program { const ast = generateServices ? parser.parseAndGenerateServices(code, config).ast : parser.parse(code, config); return getRaw(ast); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); diff --git a/tests/integration/utils/jest-snapshot-resolver.js b/tests/integration/utils/jest-snapshot-resolver.js index 3032ef5d575c..366a96118398 100644 --- a/tests/integration/utils/jest-snapshot-resolver.js +++ b/tests/integration/utils/jest-snapshot-resolver.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ /** * Use a jest snapshotResolver to map the test snapshot output back to the * linked volume. This means that even though we are running our tests inside diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 34bf65ac52f3..11b237656153 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -35,7 +35,7 @@ interface AllContributorsUser { contributions: string[]; } -async function* fetchUsers(page = 1) { +async function* fetchUsers(page = 1): AsyncIterableIterator { let lastLength = 0; do { const response = await fetch(`${contributorsApiUrl}&page=${page}`, { @@ -61,7 +61,7 @@ async function* fetchUsers(page = 1) { ); } -async function main() { +async function main(): Promise { const githubContributors: Contributor[] = []; // fetch all of the contributor info diff --git a/yarn.lock b/yarn.lock index 5924927ec6d2..c86527946ff0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1428,6 +1428,11 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== +"@types/prettier@^1.18.0": + version "1.18.0" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.0.tgz#d2dbe4d5f76b455138f13a2d881278e2c06a733d" + integrity sha512-5N6WK/XXs9PLPpge2KOmOSaIym2vIo32GsrxM5YOFs7uZ8R9L/acg+hQzWsfwoHEpasqQkH0+3LzLTbiF1GFLQ== + "@types/semver@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.1.tgz#a984b405c702fa5a7ec6abc56b37f2ba35ef5af6" @@ -6988,7 +6993,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@^1.18.2: +prettier@*, prettier@^1.18.2: version "1.18.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== From 90b36ddac2f6de006fd59f2a9234df1eb2d1606e Mon Sep 17 00:00:00 2001 From: Taeheon Kim Date: Wed, 14 Aug 2019 01:39:11 +0900 Subject: [PATCH 14/58] docs(eslint-plugin): update ROADMAP.md (#844) --- packages/eslint-plugin/ROADMAP.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 58580935012b..65b5dcd46ba6 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -22,7 +22,7 @@ | [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] | | [`no-inferrable-types`] | ✅ | [`@typescript-eslint/no-inferrable-types`] | | [`no-internal-module`] | ✅ | [`@typescript-eslint/prefer-namespace-keyword`] | -| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] | +| [`no-magic-numbers`] | ✅ | [`@typescript-eslint/no-magic-numbers`] | | [`no-namespace`] | ✅ | [`@typescript-eslint/no-namespace`] | | [`no-non-null-assertion`] | ✅ | [`@typescript-eslint/no-non-null-assertion`] | | [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] | @@ -620,6 +620,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/no-unnecessary-type-arguments`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md [`@typescript-eslint/semi`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md [`@typescript-eslint/no-floating-promises`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md +[`@typescript-eslint/no-magic-numbers`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md From d3470c963eb436d9e5128301d4579fb2b251de7c Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 20:37:21 +0100 Subject: [PATCH 15/58] feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) BREAKING CHANGE: removed some rules from recommended config --- .eslintrc.js | 1 + packages/eslint-plugin/README.md | 21 ++++++- packages/eslint-plugin/package.json | 6 +- .../recommended-requiring-type-checking.json | 19 +++++++ .../src/configs/recommended.json | 10 ---- packages/eslint-plugin/src/index.ts | 2 + .../eslint-plugin/src/rules/await-thenable.ts | 1 + .../src/rules/no-floating-promises.ts | 1 + .../src/rules/no-for-in-array.ts | 1 + .../src/rules/no-misused-promises.ts | 1 + .../src/rules/no-unnecessary-qualifier.ts | 1 + .../rules/no-unnecessary-type-arguments.ts | 1 + .../rules/no-unnecessary-type-assertion.ts | 1 + .../src/rules/prefer-includes.ts | 1 + .../src/rules/prefer-readonly.ts | 1 + .../src/rules/prefer-regexp-exec.ts | 1 + .../rules/prefer-string-starts-ends-with.ts | 1 + .../src/rules/promise-function-async.ts | 1 + .../src/rules/require-array-sort-compare.ts | 1 + .../eslint-plugin/src/rules/require-await.ts | 1 + .../src/rules/restrict-plus-operands.ts | 1 + .../src/rules/strict-boolean-expressions.ts | 1 + .../eslint-plugin/src/rules/unbound-method.ts | 1 + .../eslint-plugin/tools/generate-configs.ts | 56 ++++++++++++++++++- .../checkConfigRecommended.ts | 6 +- ...kConfigRecommendedRequiringTypeChecking.ts | 45 +++++++++++++++ .../tools/validate-configs/index.ts | 6 ++ .../validate-docs/validate-table-rules.ts | 24 ++++++++ .../experimental-utils/src/ts-eslint/Rule.ts | 5 ++ tests/integration/docker-compose.yml | 17 ++++++ .../.eslintrc.yml | 17 ++++++ .../Dockerfile | 17 ++++++ .../index.ts | 1 + .../test.js.snap | 44 +++++++++++++++ .../test.sh | 19 +++++++ tests/integration/run-all-tests.sh | 3 + 36 files changed, 317 insertions(+), 19 deletions(-) create mode 100644 packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json create mode 100644 packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/Dockerfile create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/index.ts create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/test.js.snap create mode 100755 tests/integration/fixtures/recommended-does-not-require-program/test.sh diff --git a/.eslintrc.js b/.eslintrc.js index 32a476969d3a..ef3d195354eb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', ], rules: { // diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 516f9c48daef..1ecc3e86cf97 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -51,7 +51,7 @@ You can also enable all the recommended rules for our plugin. Add `plugin:@types } ``` -You can also use [eslint:recommended](https://eslint.org/docs/rules/) with this plugin. Add both `eslint:recommended` and `plugin:@typescript-eslint/eslint-recommended`: +You can also use [eslint:recommended](https://eslint.org/docs/rules/) (the set of rules which are recommended for all projects by the ESLint Team) with this plugin. As noted in the root README, not all eslint core rules are compatible with TypeScript, so you need to add both `eslint:recommended` and `plugin:@typescript-eslint/eslint-recommended` (which will adjust the one from eslint appropriately for TypeScript) to your config: ```json { @@ -63,7 +63,24 @@ You can also use [eslint:recommended](https://eslint.org/docs/rules/) with this } ``` -If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions". +As of version 2 of this plugin, _by design_, none of the rules in the main `recommended` config require type-checking in order to run. This means that they are more lightweight and faster to run. + +Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You wou apply this _in addition_ to the recommended configs previously mentioned, e.g.: + +```json +{ + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ] +} +``` + +Pro Tip: For larger codebases you may want to consider splitting our linting into two separate stages: 1. fast feedback rules which operate purely based on syntax (no type-checking), 2. rules which are based on semantics (type-checking). + +NOTE: If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions". If you do not do this, you will get a runtime error which explains this. ```json { diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 14b417ac5c73..e0d1c05a9fec 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -30,11 +30,11 @@ "main": "dist/index.js", "scripts": { "build": "tsc -p tsconfig.build.json", - "check:docs": "ts-node --files ./tools/validate-docs/index.ts", - "check:configs": "ts-node --files ./tools/validate-configs/index.ts", + "check:docs": "../../node_modules/.bin/ts-node --files ./tools/validate-docs/index.ts", + "check:configs": "../../node_modules/.bin/ts-node --files ./tools/validate-configs/index.ts", "clean": "rimraf dist/", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "generate:configs": "ts-node --files tools/generate-configs.ts", + "generate:configs": "../../node_modules/.bin/ts-node --files tools/generate-configs.ts", "prebuild": "npm run clean", "test": "jest --coverage", "typecheck": "tsc --noEmit" diff --git a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json new file mode 100644 index 000000000000..68867b532483 --- /dev/null +++ b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json @@ -0,0 +1,19 @@ +{ + "extends": "./configs/base.json", + "rules": { + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-for-in-array": "error", + "@typescript-eslint/no-misused-promises": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/prefer-includes": "error", + "@typescript-eslint/prefer-regexp-exec": "error", + "@typescript-eslint/prefer-string-starts-ends-with": "error", + "require-await": "off", + "@typescript-eslint/require-await": "error", + "@typescript-eslint/unbound-method": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error" + } +} diff --git a/packages/eslint-plugin/src/configs/recommended.json b/packages/eslint-plugin/src/configs/recommended.json index 95d18847686e..7d7a5628c9d8 100644 --- a/packages/eslint-plugin/src/configs/recommended.json +++ b/packages/eslint-plugin/src/configs/recommended.json @@ -2,7 +2,6 @@ "extends": "./configs/base.json", "rules": { "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/await-thenable": "error", "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", "camelcase": "off", @@ -18,28 +17,19 @@ "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "warn", - "@typescript-eslint/no-for-in-array": "error", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-namespace": "error", "@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-this-alias": "error", - "@typescript-eslint/no-unnecessary-type-assertion": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "warn", "no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "error", "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/prefer-regexp-exec": "error", - "@typescript-eslint/prefer-string-starts-ends-with": "error", - "require-await": "off", - "@typescript-eslint/require-await": "error", "@typescript-eslint/triple-slash-reference": "error", "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unbound-method": "error", "no-var": "error", "prefer-const": "error", "prefer-rest-params": "error", diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 0fb5516ba720..d8e55844e1d3 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -3,6 +3,7 @@ import rules from './rules'; import all from './configs/all.json'; import base from './configs/base.json'; import recommended from './configs/recommended.json'; +import recommendedRequiringTypeChecking from './configs/recommended-requiring-type-checking.json'; import eslintRecommended from './configs/eslint-recommended'; export = { @@ -12,5 +13,6 @@ export = { base, recommended, 'eslint-recommended': eslintRecommended, + 'recommended-requiring-type-checking': recommendedRequiringTypeChecking, }, }; diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 304321001f7b..94dc75cf78d7 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -10,6 +10,7 @@ export default util.createRule({ description: 'Disallows awaiting a value that is not a Thenable', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.', diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 5bc2f75adaa4..816cc0846706 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -10,6 +10,7 @@ export default util.createRule({ description: 'Requires Promise-like values to be handled appropriately.', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { floating: 'Promises must be handled appropriately', diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 03171e7fdf71..db15d310457c 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -8,6 +8,7 @@ export default util.createRule({ description: 'Disallow iterating over an array with a for-in loop', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { forInViolation: diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 6d06ef8807a2..63d0f0bf483c 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -18,6 +18,7 @@ export default util.createRule({ description: 'Avoid using promises in places not designed to handle them', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { voidReturn: diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 64f58848d79b..1017be32222f 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -10,6 +10,7 @@ export default util.createRule({ category: 'Best Practices', description: 'Warns when a namespace qualifier is unnecessary', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 100a9d261c0e..040650ea05d4 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -29,6 +29,7 @@ export default util.createRule<[], MessageIds>({ 'Warns if an explicitly specified type argument is the default for that type parameter', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 11da74d88c91..61583878bae9 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -28,6 +28,7 @@ export default util.createRule({ 'Warns if a type assertion does not change the type of an expression', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 384edf018595..fcb5dfca4f57 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -14,6 +14,7 @@ export default createRule({ description: 'Enforce `includes` method over `indexOf` method', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 22c85fd03437..2c8ab3671be8 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -32,6 +32,7 @@ export default util.createRule({ "Requires that private members are marked as `readonly` if they're never modified outside of the constructor", category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index bd1a48fcb613..fea08554c3ad 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -13,6 +13,7 @@ export default createRule({ 'Prefer RegExp#exec() over String#match() if no global flag is provided', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { regExpExecOverStringMatch: 'Use the `RegExp#exec()` method instead.', diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 2ffac6728acd..56344783b34d 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -21,6 +21,7 @@ export default createRule({ 'Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { preferStartsWith: "Use 'String#startsWith' method instead.", diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index faf55f95fa71..225b2bd83675 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -22,6 +22,7 @@ export default util.createRule({ 'Requires any function or method that returns a Promise to be marked async', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { missingAsync: 'Functions that return promises must be async.', diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index 5b3f430420f3..e88f2791f8f1 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -12,6 +12,7 @@ export default util.createRule({ description: 'Enforce giving `compare` argument to `Array#sort`', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { requireCompare: "Require 'compare' argument.", diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index ef1092b46db3..7441b4648966 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -24,6 +24,7 @@ export default util.createRule({ description: 'Disallow async functions which have no `await` expression', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index df523033bf70..1f715f1f9022 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -11,6 +11,7 @@ export default util.createRule({ 'When adding two variables, operands must both be of type number or of type string', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { notNumbers: diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index d9077bf31548..9c3c5b6ea98e 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -27,6 +27,7 @@ export default util.createRule({ description: 'Restricts the types allowed in boolean expressions', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, schema: [ { diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 0db82b2c7704..c76ac76f9d03 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -26,6 +26,7 @@ export default util.createRule({ description: 'Enforces unbound methods are called with their expected scope', recommended: 'error', + requiresTypeChecking: true, }, messages: { unbound: diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index d7f5fb29afd9..cda1b0771ead 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -58,6 +58,7 @@ function reducer( settings: { errorLevel?: 'error' | 'warn'; filterDeprecated: boolean; + filterRequiresTypeChecking?: 'include' | 'exclude'; }, ): LinterConfigRules { const key = entry[0]; @@ -67,6 +68,22 @@ function reducer( return config; } + // Explicitly exclude rules requiring type-checking + if ( + settings.filterRequiresTypeChecking === 'exclude' && + value.meta.docs.requiresTypeChecking === true + ) { + return config; + } + + // Explicitly include rules requiring type-checking + if ( + settings.filterRequiresTypeChecking === 'include' && + value.meta.docs.requiresTypeChecking !== true + ) { + return config; + } + const ruleName = `${RULE_NAME_PREFIX}${key}`; const recommendation = value.meta.docs.recommended; const usedSetting = settings.errorLevel @@ -119,7 +136,7 @@ writeConfig(baseConfig, path.resolve(__dirname, '../src/configs/base.json')); console.log(); console.log( - '---------------------------------- all.json ----------------------------------', + '------------------------------------------------ all.json ------------------------------------------------', ); const allConfig: LinterConfig = { extends: './configs/base.json', @@ -133,12 +150,16 @@ writeConfig(allConfig, path.resolve(__dirname, '../src/configs/all.json')); console.log(); console.log( - '------------------------------ recommended.json ------------------------------', + '------------------------------ recommended.json (should not require program) ------------------------------', ); const recommendedRules = ruleEntries .filter(entry => !!entry[1].meta.docs.recommended) .reduce( - (config, entry) => reducer(config, entry, { filterDeprecated: false }), + (config, entry) => + reducer(config, entry, { + filterDeprecated: false, + filterRequiresTypeChecking: 'exclude', + }), {}, ); BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { @@ -152,3 +173,32 @@ writeConfig( recommendedConfig, path.resolve(__dirname, '../src/configs/recommended.json'), ); + +console.log(); +console.log( + '--------------------------------- recommended-requiring-type-checking.json ---------------------------------', +); +const recommendedRulesRequiringProgram = ruleEntries + .filter(entry => !!entry[1].meta.docs.recommended) + .reduce( + (config, entry) => + reducer(config, entry, { + filterDeprecated: false, + filterRequiresTypeChecking: 'include', + }), + {}, + ); +BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { + recommendedRulesRequiringProgram[ruleName] = 'error'; +}); +const recommendedRequiringTypeCheckingConfig: LinterConfig = { + extends: './configs/base.json', + rules: recommendedRulesRequiringProgram, +}; +writeConfig( + recommendedRequiringTypeCheckingConfig, + path.resolve( + __dirname, + '../src/configs/recommended-requiring-type-checking.json', + ), +); diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts index ae2561431127..28f0c7b21a50 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts @@ -10,7 +10,11 @@ function checkConfigRecommended(): boolean { const recommendedNames = new Set(Object.keys(recommended)); return Object.entries(rules).reduce((acc, [ruleName, rule]) => { - if (!rule.meta.deprecated && rule.meta.docs.recommended !== false) { + if ( + !rule.meta.deprecated && + rule.meta.docs.recommended !== false && + rule.meta.docs.requiresTypeChecking !== true + ) { const prefixed = `${prefix}${ruleName}` as keyof typeof recommended; if (recommendedNames.has(prefixed)) { if (recommended[prefixed] !== rule.meta.docs.recommended) { diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts new file mode 100644 index 000000000000..a63f5e42c236 --- /dev/null +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts @@ -0,0 +1,45 @@ +import plugin from '../../src/index'; +import { logRule } from '../log'; + +const prefix = '@typescript-eslint/'; + +function checkConfigRecommendedRequiringTypeChecking(): boolean { + const { rules } = plugin; + + const recommendedRequiringTypeChecking = + plugin.configs['recommended-requiring-type-checking'].rules; + const recommendedNames = new Set( + Object.keys(recommendedRequiringTypeChecking), + ); + + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + if ( + !rule.meta.deprecated && + rule.meta.docs.recommended !== false && + rule.meta.docs.requiresTypeChecking === true + ) { + const prefixed = `${prefix}${ruleName}` as keyof typeof recommendedRequiringTypeChecking; + if (recommendedNames.has(prefixed)) { + if ( + recommendedRequiringTypeChecking[prefixed] !== + rule.meta.docs.recommended + ) { + logRule( + false, + ruleName, + 'incorrect setting compared to the rule meta.', + ); + return true; + } + } else { + logRule(false, ruleName, 'missing in the config.'); + return true; + } + } + + logRule(true, ruleName); + return acc; + }, false); +} + +export { checkConfigRecommendedRequiringTypeChecking }; diff --git a/packages/eslint-plugin/tools/validate-configs/index.ts b/packages/eslint-plugin/tools/validate-configs/index.ts index cb64df536481..1c05196a677e 100644 --- a/packages/eslint-plugin/tools/validate-configs/index.ts +++ b/packages/eslint-plugin/tools/validate-configs/index.ts @@ -1,11 +1,17 @@ import chalk from 'chalk'; import { checkConfigRecommended } from './checkConfigRecommended'; +import { checkConfigRecommendedRequiringTypeChecking } from './checkConfigRecommendedRequiringTypeChecking'; import { checkConfigAll } from './checkConfigAll'; let hasErrors = false; console.log(chalk.underline('Checking config "recommended"')); hasErrors = checkConfigRecommended() || hasErrors; +console.log( + chalk.underline('Checking config "recommended-requiring-type-checking"'), +); +hasErrors = checkConfigRecommendedRequiringTypeChecking() || hasErrors; + console.log(); console.log(chalk.underline('Checking config "all"')); hasErrors = checkConfigAll() || hasErrors; diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts index c3e712ca525f..b85172d0fdc4 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts @@ -105,7 +105,31 @@ function validateTableRules( const ruleFileContents = fs.readFileSync( path.resolve(__dirname, `../../src/rules/${ruleName}.ts`), ); + const usesTypeInformation = ruleFileContents.includes('getParserServices'); + const tableRowHasThoughtBalloon = !!rowNeedsTypeInfo; + if (rule.meta.docs.requiresTypeChecking === true) { + if (!usesTypeInformation) { + errors.push( + 'Rule has `requiresTypeChecking` set in its meta, but it does not actually use type information - fix by removing `meta.docs.requiresTypeChecking`', + ); + } else if (!tableRowHasThoughtBalloon) { + errors.push( + 'Rule was documented as not using type information, when it actually does - fix by updating the plugin README.md', + ); + } + } else { + if (usesTypeInformation) { + errors.push( + 'Rule does not have `requiresTypeChecking` set in its meta, despite using type information - fix by setting `meta.docs.requiresTypeChecking: true` in the rule', + ); + } else if (tableRowHasThoughtBalloon) { + errors.push( + `Rule was documented as using type information, when it actually doesn't - fix by updating the plugin README.md`, + ); + } + } + validateTableBoolean( usesTypeInformation, rowNeedsTypeInfo, diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 89ac7b532885..75acea5988ce 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -32,6 +32,11 @@ interface RuleMetaDataDocs { * The URL of the rule's docs */ url: string; + /** + * Does the rule require us to create a full TypeScript Program in order for it + * to type-check code. This is only used for documentation purposes. + */ + requiresTypeChecking?: boolean; } interface RuleMetaData { /** diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index 5d10d7661774..74bfb63dab22 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -36,3 +36,20 @@ services: - /usr/eslint-plugin/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/vue-sfc:/usr/linked + + recommended-does-not-require-program: + build: ./fixtures/recommended-does-not-require-program + container_name: "recommended-does-not-require-program" + volumes: + # Runtime link to the relevant built @typescript-eslint packages and integration test utils, + # but apply an empty volume for the package tests, we don't need those. + - ../../package.json/:/usr/root-package.json + - ./utils/:/usr/utils + - ../../packages/parser/:/usr/parser + - /usr/parser/tests + - ../../packages/typescript-estree/:/usr/typescript-estree + - /usr/typescript-estree/tests + - ../../packages/eslint-plugin/:/usr/eslint-plugin + - /usr/eslint-plugin/tests + # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. + - ./fixtures/recommended-does-not-require-program:/usr/linked diff --git a/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml new file mode 100644 index 000000000000..75de006c68de --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml @@ -0,0 +1,17 @@ +# This integration test exists to make sure that the recommended config does +# not require a program to be specified to ensure a fast and simple initial +# setup. Users can add on one of our other configs if they want to opt in to +# more expensive checks. +root: true + +# Local version of @typescript-eslint/parser +parser: '@typescript-eslint/parser' + +extends: +- 'eslint:recommended' +- 'plugin:@typescript-eslint/eslint-recommended' +- 'plugin:@typescript-eslint/recommended' + +plugins: +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' diff --git a/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile b/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile new file mode 100644 index 000000000000..3b281e624c87 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile @@ -0,0 +1,17 @@ +FROM node:carbon + +# Copy the test.sh into the container. Every other file will be linked, rather +# than copied to allow for changes without rebuilds wherever possible +WORKDIR /usr +COPY ./test.sh /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toMatchSnapshot();\n" \ + "});\n" > test.js + +# Run the integration test +CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/recommended-does-not-require-program/index.ts b/tests/integration/fixtures/recommended-does-not-require-program/index.ts new file mode 100644 index 000000000000..838b04b94755 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/index.ts @@ -0,0 +1 @@ +var foo = true diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap b/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap new file mode 100644 index 000000000000..36d059733d53 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`it should produce the expected lint ouput 1`] = ` +Array [ + Object { + "errorCount": 1, + "filePath": "/usr/linked/index.ts", + "fixableErrorCount": 1, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "column": 1, + "endColumn": 15, + "endLine": 1, + "fix": Object { + "range": Array [ + 0, + 3, + ], + "text": "let", + }, + "line": 1, + "message": "Unexpected var, use let or const instead.", + "nodeType": "VariableDeclaration", + "ruleId": "no-var", + "severity": 2, + }, + Object { + "column": 5, + "endColumn": 8, + "endLine": 1, + "line": 1, + "message": "'foo' is assigned a value but never used.", + "nodeType": "Identifier", + "ruleId": "@typescript-eslint/no-unused-vars", + "severity": 1, + }, + ], + "source": "var foo = true +", + "warningCount": 1, + }, +] +`; diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.sh b/tests/integration/fixtures/recommended-does-not-require-program/test.sh new file mode 100755 index 000000000000..1fa77f5cbdf7 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Generate the package.json to use +node /usr/utils/generate-package-json.js + +# Install dependencies +npm install + +# Use the local volumes for our own packages +npm install $(npm pack /usr/typescript-estree | tail -1) +npm install $(npm pack /usr/parser | tail -1) +npm install $(npm pack /usr/eslint-plugin | tail -1) + +# Run the linting +# (the "|| true" helps make sure that we run our tests on failed linting runs as well) +npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true + +# Run our assertions against the linting output +npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/run-all-tests.sh b/tests/integration/run-all-tests.sh index 5b43af062465..4506da773492 100755 --- a/tests/integration/run-all-tests.sh +++ b/tests/integration/run-all-tests.sh @@ -9,3 +9,6 @@ docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-con # vue-sfc docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-sfc + +# recommended-does-not-require-program +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit recommended-does-not-require-program From 0c4f474ccba2fd329cb43ae2309e786b51889a81 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Tue, 13 Aug 2019 12:52:28 -0700 Subject: [PATCH 16/58] feat(eslint-plugin): [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations (#790) --- .../docs/rules/class-name-casing.md | 16 +++ .../docs/rules/interface-name-prefix.md | 85 +++++++++++-- .../src/rules/class-name-casing.ts | 32 ++++- .../src/rules/interface-name-prefix.ts | 113 ++++++++++++++++-- .../tests/rules/class-name-casing.test.ts | 18 +++ .../tests/rules/interface-name-prefix.test.ts | 63 +++++++++- 6 files changed, 302 insertions(+), 25 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/class-name-casing.md b/packages/eslint-plugin/docs/rules/class-name-casing.md index a1fba58e323e..f594a9854f18 100644 --- a/packages/eslint-plugin/docs/rules/class-name-casing.md +++ b/packages/eslint-plugin/docs/rules/class-name-casing.md @@ -5,6 +5,17 @@ This rule enforces PascalCased names for classes and interfaces. ## Rule Details This rule aims to make it easy to differentiate classes from regular variables at a glance. +The `_` prefix is sometimes used to designate a private declaration, so the rule also supports a name +that might be `_Example` instead of `Example`. + +## Options + +This rule has an object option: + +- `"allowUnderscorePrefix": false`: (default) does not allow the name to have an underscore prefix +- `"allowUnderscorePrefix": true`: allows the name to optionally have an underscore prefix + +## Examples Examples of **incorrect** code for this rule: @@ -16,6 +27,8 @@ class Another_Invalid_Class_Name {} var bar = class invalidName {}; interface someInterface {} + +class _InternalClass {} ``` Examples of **correct** code for this rule: @@ -28,6 +41,9 @@ export default class {} var foo = class {}; interface SomeInterface {} + +/* eslint @typescript-eslint/class-name-casing: { "allowUnderscorePrefix": true } */ +class _InternalClass {} ``` ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/interface-name-prefix.md b/packages/eslint-plugin/docs/rules/interface-name-prefix.md index c6d907568a17..309dcbe4f243 100644 --- a/packages/eslint-plugin/docs/rules/interface-name-prefix.md +++ b/packages/eslint-plugin/docs/rules/interface-name-prefix.md @@ -1,22 +1,35 @@ # Require that interface names be prefixed with `I` (interface-name-prefix) -It can be hard to differentiate between classes and interfaces. -Prefixing interfaces with "I" can help telling them apart at a glance. +Interfaces often represent important software contracts, so it can be helpful to prefix their names with `I`. +The unprefixed name is then available for a class that provides a standard implementation of the interface. +Alternatively, the contributor guidelines for the TypeScript repo suggest +[never prefixing](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#names) interfaces with `I`. ## Rule Details -This rule enforces consistency of interface naming prefix conventions. +This rule enforces whether or not the `I` prefix is required for interface names. +The `_` prefix is sometimes used to designate a private declaration, so the rule also supports a private interface +that might be named `_IAnimal` instead of `IAnimal`. ## Options -This rule has a string option. +This rule has an object option: -- `"never"` (default) disallows all interfaces being prefixed with `"I"` -- `"always"` requires all interfaces be prefixed with `"I"` +- `{ "prefixWithI": "never" }`: (default) disallows all interfaces being prefixed with `"I"` or `"_I"` +- `{ "prefixWithI": "always" }`: requires all interfaces be prefixed with `"I"` (but does not allow `"_I"`) +- `{ "prefixWithI": "always", "allowUnderscorePrefix": true }`: requires all interfaces be prefixed with + either `"I"` or `"_I"` + +For backwards compatibility, this rule supports a string option instead: + +- `"never"`: Equivalent to `{ "prefixWithI": "never" }` +- `"always"`: Equivalent to `{ "prefixWithI": "always" }` + +## Examples ### never -TypeScript suggests [never prefixing](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#names) interfaces with "I". +**Configuration:** `{ "prefixWithI": "never" }` The following patterns are considered warnings: @@ -24,6 +37,14 @@ The following patterns are considered warnings: interface IAnimal { name: string; } + +interface IIguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` The following patterns are not warnings: @@ -32,16 +53,30 @@ The following patterns are not warnings: interface Animal { name: string; } + +interface Iguana { + name: string; +} ``` ### always +**Configuration:** `{ "prefixWithI": "always" }` + The following patterns are considered warnings: ```ts interface Animal { name: string; } + +interface Iguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` The following patterns are not warnings: @@ -50,6 +85,42 @@ The following patterns are not warnings: interface IAnimal { name: string; } + +interface IIguana { + name: string; +} +``` + +### always and allowing underscores + +**Configuration:** `{ "prefixWithI": "always", "allowUnderscorePrefix": true }` + +The following patterns are considered warnings: + +```ts +interface Animal { + name: string; +} + +interface Iguana { + name: string; +} +``` + +The following patterns are not warnings: + +```ts +interface IAnimal { + name: string; +} + +interface IIguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` ## When Not To Use It diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index cb238f87ac7b..c71a39fd2ac4 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -4,7 +4,14 @@ import { } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; -export default util.createRule({ +type Options = [ + { + allowUnderscorePrefix?: boolean; + }, +]; +type MessageIds = 'notPascalCased'; + +export default util.createRule({ name: 'class-name-casing', meta: { type: 'suggestion', @@ -16,16 +23,31 @@ export default util.createRule({ messages: { notPascalCased: "{{friendlyName}} '{{name}}' must be PascalCased.", }, - schema: [], + schema: [ + { + type: 'object', + properties: { + allowUnderscorePrefix: { + type: 'boolean', + default: false, + }, + }, + additionalProperties: false, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [{ allowUnderscorePrefix: false }], + create(context, [options]) { /** * Determine if the identifier name is PascalCased * @param name The identifier name */ function isPascalCase(name: string): boolean { - return /^[A-Z][0-9A-Za-z]*$/.test(name); + if (options.allowUnderscorePrefix) { + return /^_?[A-Z][0-9A-Za-z]*$/.test(name); + } else { + return /^[A-Z][0-9A-Za-z]*$/.test(name); + } } /** diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 119765522213..13284fc2aa34 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -1,8 +1,43 @@ import * as util from '../util'; -type Options = ['never' | 'always']; +type ParsedOptions = + | { + prefixWithI: 'never'; + } + | { + prefixWithI: 'always'; + allowUnderscorePrefix: boolean; + }; +type Options = [ + + | 'never' + | 'always' + | { + prefixWithI?: 'never'; + } + | { + prefixWithI: 'always'; + allowUnderscorePrefix?: boolean; + }, +]; type MessageIds = 'noPrefix' | 'alwaysPrefix'; +/** + * Parses a given value as options. + */ +export function parseOptions([options]: Options): ParsedOptions { + if (options === 'always') { + return { prefixWithI: 'always', allowUnderscorePrefix: false }; + } + if (options !== 'never' && options.prefixWithI === 'always') { + return { + prefixWithI: 'always', + allowUnderscorePrefix: !!options.allowUnderscorePrefix, + }; + } + return { prefixWithI: 'never' }; +} + export default util.createRule({ name: 'interface-name-prefix', meta: { @@ -21,13 +56,46 @@ export default util.createRule({ }, schema: [ { - enum: ['never', 'always'], + oneOf: [ + { + enum: [ + // Deprecated, equivalent to: { prefixWithI: 'never' } + 'never', + // Deprecated, equivalent to: { prefixWithI: 'always', allowUnderscorePrefix: false } + 'always', + ], + }, + { + type: 'object', + properties: { + prefixWithI: { + type: 'string', + enum: ['never'], + }, + }, + additionalProperties: false, + }, + { + type: 'object', + properties: { + prefixWithI: { + type: 'string', + enum: ['always'], + }, + allowUnderscorePrefix: { + type: 'boolean', + }, + }, + required: ['prefixWithI'], // required to select this "oneOf" alternative + additionalProperties: false, + }, + ], }, ], }, - defaultOptions: ['never'], - create(context, [option]) { - const never = option !== 'always'; + defaultOptions: [{ prefixWithI: 'never' }], + create(context, [options]) { + const parsedOptions = parseOptions([options]); /** * Checks if a string is prefixed with "I". @@ -41,21 +109,42 @@ export default util.createRule({ return /^I[A-Z]/.test(name); } + /** + * Checks if a string is prefixed with "I" or "_I". + * @param name The string to check + */ + function isPrefixedWithIOrUnderscoreI(name: string): boolean { + if (typeof name !== 'string') { + return false; + } + + return /^_?I[A-Z]/.test(name); + } + return { TSInterfaceDeclaration(node): void { - if (never) { - if (isPrefixedWithI(node.id.name)) { + if (parsedOptions.prefixWithI === 'never') { + if (isPrefixedWithIOrUnderscoreI(node.id.name)) { context.report({ node: node.id, messageId: 'noPrefix', }); } } else { - if (!isPrefixedWithI(node.id.name)) { - context.report({ - node: node.id, - messageId: 'alwaysPrefix', - }); + if (parsedOptions.allowUnderscorePrefix) { + if (!isPrefixedWithIOrUnderscoreI(node.id.name)) { + context.report({ + node: node.id, + messageId: 'alwaysPrefix', + }); + } + } else { + if (!isPrefixedWithI(node.id.name)) { + context.report({ + node: node.id, + messageId: 'alwaysPrefix', + }); + } } } }, diff --git a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts index af85e24472f5..7409fd927e65 100644 --- a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts +++ b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts @@ -14,6 +14,10 @@ ruleTester.run('class-name-casing', rule, { sourceType: 'module', }, }, + { + code: 'class _NameWithUnderscore {}', + options: [{ allowUnderscorePrefix: true }], + }, 'var Foo = class {};', 'interface SomeInterface {}', 'class ClassNameWithDigit2 {}', @@ -50,6 +54,20 @@ ruleTester.run('class-name-casing', rule, { }, ], }, + { + code: 'class _NameWithUnderscore {}', + errors: [ + { + messageId: 'notPascalCased', + data: { + friendlyName: 'Class', + name: '_NameWithUnderscore', + }, + line: 1, + column: 7, + }, + ], + }, { code: 'var foo = class {};', errors: [ diff --git a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts index 09cf548c7ac8..337a96a368fb 100644 --- a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts +++ b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts @@ -1,6 +1,29 @@ -import rule from '../../src/rules/interface-name-prefix'; +import assert from 'assert'; +import rule, { parseOptions } from '../../src/rules/interface-name-prefix'; import { RuleTester } from '../RuleTester'; +describe('interface-name-prefix', () => { + it('parseOptions', () => { + assert.deepEqual(parseOptions(['never']), { prefixWithI: 'never' }); + assert.deepEqual(parseOptions(['always']), { + prefixWithI: 'always', + allowUnderscorePrefix: false, + }); + assert.deepEqual(parseOptions([{}]), { prefixWithI: 'never' }); + assert.deepEqual(parseOptions([{ prefixWithI: 'never' }]), { + prefixWithI: 'never', + }); + assert.deepEqual(parseOptions([{ prefixWithI: 'always' }]), { + prefixWithI: 'always', + allowUnderscorePrefix: false, + }); + assert.deepEqual( + parseOptions([{ prefixWithI: 'always', allowUnderscorePrefix: true }]), + { prefixWithI: 'always', allowUnderscorePrefix: true }, + ); + }); +}); + const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); @@ -22,6 +45,14 @@ interface IAnimal { }, { code: ` +interface _IAnimal { + name: string; +} + `, + options: [{ prefixWithI: 'always', allowUnderscorePrefix: true }], + }, + { + code: ` interface IIguana { name: string; } @@ -85,6 +116,21 @@ interface Animal { }, { code: ` +interface Animal { + name: string; +} + `, + options: [{ prefixWithI: 'always', allowUnderscorePrefix: true }], + errors: [ + { + messageId: 'alwaysPrefix', + line: 2, + column: 11, + }, + ], + }, + { + code: ` interface Iguana { name: string; } @@ -117,6 +163,21 @@ interface IIguana { code: ` interface IAnimal { name: string; +} + `, + options: ['never'], + errors: [ + { + messageId: 'noPrefix', + line: 2, + column: 11, + }, + ], + }, + { + code: ` +interface _IAnimal { + name: string; } `, options: ['never'], From 0cfc48e1e8a2222a542006361005aa57824c4a4f Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 13 Aug 2019 16:30:42 -0400 Subject: [PATCH 17/58] fix(typescript-estree): jsx comment parsing (#703) --- .../tests/lib/__snapshots__/comments.ts.snap | 790 ++++++++++++++++++ .../jsx-tag-comment-after-prop.src.js | 11 + .../typescript-estree/src/convert-comments.ts | 4 +- .../tests/lib/__snapshots__/comments.ts.snap | 790 ++++++++++++++++++ .../semantic-diagnostics-enabled.ts.snap | 2 + 5 files changed, 1596 insertions(+), 1 deletion(-) create mode 100644 packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js diff --git a/packages/parser/tests/lib/__snapshots__/comments.ts.snap b/packages/parser/tests/lib/__snapshots__/comments.ts.snap index d04a7d39a320..92affb66677c 100644 --- a/packages/parser/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/comments.ts.snap @@ -7282,6 +7282,796 @@ Object { } `; +exports[`Comments fixtures/jsx-tag-comment-after-prop.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 66, + 75, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "raw": "123", + "type": "Literal", + "value": 123, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 99, + 109, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "raw": "\\"woof\\"", + "type": "Literal", + "value": "woof", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 38, + 118, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 38, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 123, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 125, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 125, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 125, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 125, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "Line", + "value": " one", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 84, + 90, + ], + "type": "Line", + "value": " two", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Numeric", + "value": "123", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "type": "JSXText", + "value": "\\"woof\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` Object { "body": Array [ diff --git a/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js b/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js new file mode 100644 index 000000000000..f6321a0a0c2a --- /dev/null +++ b/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js @@ -0,0 +1,11 @@ +const pure = () => { + return ( + + ); +} + diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 159c24cf3efe..d3738774cd90 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -147,7 +147,9 @@ export function convertComments( // Rescan after a JSX expression if ( container.parent && - container.parent.kind === ts.SyntaxKind.JsxExpression + container.parent.kind === ts.SyntaxKind.JsxExpression && + container.parent.parent && + container.parent.parent.kind === ts.SyntaxKind.JsxElement ) { kind = triviaScanner.reScanJsxToken(); continue; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap index e143fdb8524f..b90f5eb45487 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap @@ -7282,6 +7282,796 @@ Object { } `; +exports[`Comments fixtures/jsx-tag-comment-after-prop.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 66, + 75, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "raw": "123", + "type": "Literal", + "value": 123, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 99, + 109, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "raw": "\\"woof\\"", + "type": "Literal", + "value": "woof", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 38, + 118, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 38, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 123, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 125, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 125, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 125, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 125, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "Line", + "value": " one", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 84, + 90, + ], + "type": "Line", + "value": " two", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Numeric", + "value": "123", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "type": "JSXText", + "value": "\\"woof\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 7af41c0f3025..b4f79cd04d1f 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -18,6 +18,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-generic-with-comment-in-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comment-after-prop.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; From 05ba26879dd5a5a0e1159951c8b24dc5e0e5cc4a Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 21:31:17 +0000 Subject: [PATCH 18/58] chore: publish v2.0.0 --- CHANGELOG.md | 66 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 22 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +- packages/eslint-plugin/CHANGELOG.md | 62 ++++++++++++++++++++ packages/eslint-plugin/package.json | 4 +- packages/experimental-utils/CHANGELOG.md | 30 ++++++++++ packages/experimental-utils/package.json | 4 +- packages/parser/CHANGELOG.md | 28 +++++++++ packages/parser/package.json | 8 +-- packages/shared-fixtures/CHANGELOG.md | 12 ++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 30 ++++++++++ packages/typescript-estree/package.json | 4 +- 14 files changed, 265 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff90c01198b3..306e15820217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,72 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) +* feat(eslint-plugin)!: [array-type] rework options (#654) ([1389393](https://github.com/typescript-eslint/typescript-eslint/commit/1389393)), closes [#654](https://github.com/typescript-eslint/typescript-eslint/issues/654) [#635](https://github.com/typescript-eslint/typescript-eslint/issues/635) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] flag default export w/allowExpressions ([#831](https://github.com/typescript-eslint/typescript-eslint/issues/831)) ([ebbcc01](https://github.com/typescript-eslint/typescript-eslint/commit/ebbcc01)) +* **eslint-plugin:** [no-explicit-any] Fix ignoreRestArgs for interfaces ([#777](https://github.com/typescript-eslint/typescript-eslint/issues/777)) ([22e9ae5](https://github.com/typescript-eslint/typescript-eslint/commit/22e9ae5)) +* **eslint-plugin:** [no-useless-constructor] handle bodyless constructor ([#685](https://github.com/typescript-eslint/typescript-eslint/issues/685)) ([55e788c](https://github.com/typescript-eslint/typescript-eslint/commit/55e788c)) +* **eslint-plugin:** [prefer-readonly] TypeError when having comp… ([#761](https://github.com/typescript-eslint/typescript-eslint/issues/761)) ([211b1b5](https://github.com/typescript-eslint/typescript-eslint/commit/211b1b5)) +* **eslint-plugin:** [typedef] support "for..in", "for..of" ([#787](https://github.com/typescript-eslint/typescript-eslint/issues/787)) ([39e41b5](https://github.com/typescript-eslint/typescript-eslint/commit/39e41b5)) +* **eslint-plugin:** [typedef] support default value for parameter ([#785](https://github.com/typescript-eslint/typescript-eslint/issues/785)) ([84916e6](https://github.com/typescript-eslint/typescript-eslint/commit/84916e6)) +* **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) +* **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +* **eslint-plugin:** [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations ([#790](https://github.com/typescript-eslint/typescript-eslint/issues/790)) ([0c4f474](https://github.com/typescript-eslint/typescript-eslint/commit/0c4f474)) +* **eslint-plugin:** [no-var-requires] report on foo(require('')) ([#725](https://github.com/typescript-eslint/typescript-eslint/issues/725)) ([b2ca20d](https://github.com/typescript-eslint/typescript-eslint/commit/b2ca20d)), closes [#665](https://github.com/typescript-eslint/typescript-eslint/issues/665) +* **eslint-plugin:** [promise-function-async] make allowAny default true ([#733](https://github.com/typescript-eslint/typescript-eslint/issues/733)) ([590ca50](https://github.com/typescript-eslint/typescript-eslint/commit/590ca50)) +* **eslint-plugin:** [strict-boolean-expressions] add ignoreRhs option ([#691](https://github.com/typescript-eslint/typescript-eslint/issues/691)) ([fd6be42](https://github.com/typescript-eslint/typescript-eslint/commit/fd6be42)) +* **eslint-plugin:** add support for object props in CallExpressions ([#728](https://github.com/typescript-eslint/typescript-eslint/issues/728)) ([8141f01](https://github.com/typescript-eslint/typescript-eslint/commit/8141f01)) +* **eslint-plugin:** added new rule typedef ([#581](https://github.com/typescript-eslint/typescript-eslint/issues/581)) ([35cc99b](https://github.com/typescript-eslint/typescript-eslint/commit/35cc99b)) +* **eslint-plugin:** added new rule use-default-type-parameter ([#562](https://github.com/typescript-eslint/typescript-eslint/issues/562)) ([2b942ba](https://github.com/typescript-eslint/typescript-eslint/commit/2b942ba)) +* **eslint-plugin:** move opinionated rules between configs ([#595](https://github.com/typescript-eslint/typescript-eslint/issues/595)) ([4893aec](https://github.com/typescript-eslint/typescript-eslint/commit/4893aec)) +* **eslint-plugin:** remove deprecated rules ([#739](https://github.com/typescript-eslint/typescript-eslint/issues/739)) ([e32c7ad](https://github.com/typescript-eslint/typescript-eslint/commit/e32c7ad)) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* **eslint-plugin:** both 'eslint-recommended' and 'recommended' have changed. +* **eslint-plugin:** removing rules +* changes config structure + +```ts +type ArrayOption = 'array' | 'generic' | 'array-simple'; +type Options = [ + { + // default case for all arrays + default: ArrayOption, + // optional override for readonly arrays + readonly?: ArrayOption, + }, +]; +``` +* **eslint-plugin:** changing default rule config +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/lerna.json b/lerna.json index b700c7342eb2..e4b8a9078807 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.13.0", + "version": "2.0.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index fc36ec031752..1339f31787c9 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index bf40809b2db4..a35949dc244b 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.13.0", + "version": "2.0.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.13.0" + "@typescript-eslint/parser": "2.0.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index b7ff8b2d6ac6..ac4b1f894c4d 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,68 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] flag default export w/allowExpressions ([#831](https://github.com/typescript-eslint/typescript-eslint/issues/831)) ([ebbcc01](https://github.com/typescript-eslint/typescript-eslint/commit/ebbcc01)) +* **eslint-plugin:** [no-explicit-any] Fix ignoreRestArgs for interfaces ([#777](https://github.com/typescript-eslint/typescript-eslint/issues/777)) ([22e9ae5](https://github.com/typescript-eslint/typescript-eslint/commit/22e9ae5)) +* **eslint-plugin:** [no-useless-constructor] handle bodyless constructor ([#685](https://github.com/typescript-eslint/typescript-eslint/issues/685)) ([55e788c](https://github.com/typescript-eslint/typescript-eslint/commit/55e788c)) +* **eslint-plugin:** [prefer-readonly] TypeError when having comp… ([#761](https://github.com/typescript-eslint/typescript-eslint/issues/761)) ([211b1b5](https://github.com/typescript-eslint/typescript-eslint/commit/211b1b5)) +* **eslint-plugin:** [typedef] support "for..in", "for..of" ([#787](https://github.com/typescript-eslint/typescript-eslint/issues/787)) ([39e41b5](https://github.com/typescript-eslint/typescript-eslint/commit/39e41b5)) +* **eslint-plugin:** [typedef] support default value for parameter ([#785](https://github.com/typescript-eslint/typescript-eslint/issues/785)) ([84916e6](https://github.com/typescript-eslint/typescript-eslint/commit/84916e6)) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) +* feat(eslint-plugin)!: [array-type] rework options (#654) ([1389393](https://github.com/typescript-eslint/typescript-eslint/commit/1389393)), closes [#654](https://github.com/typescript-eslint/typescript-eslint/issues/654) [#635](https://github.com/typescript-eslint/typescript-eslint/issues/635) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +* **eslint-plugin:** [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations ([#790](https://github.com/typescript-eslint/typescript-eslint/issues/790)) ([0c4f474](https://github.com/typescript-eslint/typescript-eslint/commit/0c4f474)) +* **eslint-plugin:** [no-var-requires] report on foo(require('')) ([#725](https://github.com/typescript-eslint/typescript-eslint/issues/725)) ([b2ca20d](https://github.com/typescript-eslint/typescript-eslint/commit/b2ca20d)), closes [#665](https://github.com/typescript-eslint/typescript-eslint/issues/665) +* **eslint-plugin:** [promise-function-async] make allowAny default true ([#733](https://github.com/typescript-eslint/typescript-eslint/issues/733)) ([590ca50](https://github.com/typescript-eslint/typescript-eslint/commit/590ca50)) +* **eslint-plugin:** [strict-boolean-expressions] add ignoreRhs option ([#691](https://github.com/typescript-eslint/typescript-eslint/issues/691)) ([fd6be42](https://github.com/typescript-eslint/typescript-eslint/commit/fd6be42)) +* **eslint-plugin:** add support for object props in CallExpressions ([#728](https://github.com/typescript-eslint/typescript-eslint/issues/728)) ([8141f01](https://github.com/typescript-eslint/typescript-eslint/commit/8141f01)) +* **eslint-plugin:** added new rule typedef ([#581](https://github.com/typescript-eslint/typescript-eslint/issues/581)) ([35cc99b](https://github.com/typescript-eslint/typescript-eslint/commit/35cc99b)) +* **eslint-plugin:** added new rule use-default-type-parameter ([#562](https://github.com/typescript-eslint/typescript-eslint/issues/562)) ([2b942ba](https://github.com/typescript-eslint/typescript-eslint/commit/2b942ba)) +* **eslint-plugin:** move opinionated rules between configs ([#595](https://github.com/typescript-eslint/typescript-eslint/issues/595)) ([4893aec](https://github.com/typescript-eslint/typescript-eslint/commit/4893aec)) +* **eslint-plugin:** remove deprecated rules ([#739](https://github.com/typescript-eslint/typescript-eslint/issues/739)) ([e32c7ad](https://github.com/typescript-eslint/typescript-eslint/commit/e32c7ad)) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* **eslint-plugin:** both 'eslint-recommended' and 'recommended' have changed. +* **eslint-plugin:** removing rules +* changes config structure + +```ts +type ArrayOption = 'array' | 'generic' | 'array-simple'; +type Options = [ + { + // default case for all arrays + default: ArrayOption, + // optional override for readonly arrays + readonly?: ArrayOption, + }, +]; +``` +* **eslint-plugin:** changing default rule config +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e0d1c05a9fec..b3d3734d15e2 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.13.0", + "version": "2.0.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", "eslint-utils": "^1.4.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 243445d33cda..8ea9fd4a22c6 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) +* **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 4574f3129d10..c4fde675f184 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "1.13.0", + "version": "2.0.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "1.13.0", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 0b158483fcf8..23eb1182e2a2 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index bc3f3cf29b07..4d67b9a555e5 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.13.0", + "version": "2.0.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -42,13 +42,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.13.0", - "@typescript-eslint/typescript-estree": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "1.13.0", + "@typescript-eslint/shared-fixtures": "2.0.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 2c796c965bbf..3aec5aabbcd5 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index d211eed6e38a..0fedd2edbe95 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.13.0", + "version": "2.0.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2267143f5c7a..27a2f9ea6a3c 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index e0a0e6618820..d7c8bae66ef9 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.13.0", + "version": "2.0.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -53,7 +53,7 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "1.13.0", + "@typescript-eslint/shared-fixtures": "2.0.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 2e2fe90c6645cfc59e59a90b6542415e735dcbb9 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 22:50:38 +0100 Subject: [PATCH 19/58] chore: reenable automated canary releases for master (#849) --- azure-pipelines.yml | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e3bdabad3471..960eb86b11d5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,28 +77,28 @@ jobs: yarn test displayName: 'Run unit tests' - # - job: publish_canary_version - # displayName: Publish the latest code as a canary version - # dependsOn: - # - primary_code_validation_and_tests - # - unit_tests_on_other_node_versions - # condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest')) - # pool: - # vmImage: 'Ubuntu-16.04' - # steps: - # - task: NodeTool@0 - # inputs: - # versionSpec: 11 - # displayName: 'Install Node.js 11' - - # - script: | - # # This also runs a build as part of the postinstall - # # bootstrap - # yarn --ignore-engines --frozen-lockfile - - # - script: | - # npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) - - # - script: | - # npx lerna publish --canary --exact --force-publish --yes - # displayName: 'Publish all packages to npm' + - job: publish_canary_version + displayName: Publish the latest code as a canary version + dependsOn: + - primary_code_validation_and_tests + - unit_tests_on_other_node_versions + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest')) + pool: + vmImage: 'Ubuntu-16.04' + steps: + - task: NodeTool@0 + inputs: + versionSpec: 11 + displayName: 'Install Node.js 11' + + - script: | + # This also runs a build as part of the postinstall + # bootstrap + yarn --ignore-engines --frozen-lockfile + + - script: | + npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) + + - script: | + npx lerna publish --canary --exact --force-publish --yes + displayName: 'Publish all packages to npm' From ca3b6a57b589213c6761cc311127cf3aa7e42082 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 14 Aug 2019 19:23:39 +0300 Subject: [PATCH 20/58] docs(parser): fix typo (#855) --- packages/parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index 45c620280f15..cbabebd95f8a 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -55,7 +55,7 @@ The following additional configuration options are available by specifying them ```ts { "extends": "./tsconfig.json", // path to existing tsconfig - "includes": [ + "include": [ "src/**/*.ts", "test/**/*.ts", // etc From a8da33010a87e61f6fc03fb93b7ea20853c90bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=97=E4=BD=A0=E6=98=AF=E5=B0=8F=E7=8C=AB=E5=92=AA?= Date: Thu, 15 Aug 2019 11:56:59 +0800 Subject: [PATCH 21/58] docs(eslint-plugin): fix link in indent docs (#860) --- packages/eslint-plugin/docs/rules/indent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/indent.md b/packages/eslint-plugin/docs/rules/indent.md index 5678ba291da2..4ffd6f894c70 100644 --- a/packages/eslint-plugin/docs/rules/indent.md +++ b/packages/eslint-plugin/docs/rules/indent.md @@ -90,7 +90,7 @@ This rule has an object option: - `"ObjectExpression"` (default: 1) enforces indentation level for properties in objects. It can be set to the string `"first"`, indicating that all properties in the object should be aligned with the first property. This can also be set to `"off"` to disable checking for object properties. - `"ImportDeclaration"` (default: 1) enforces indentation level for import statements. It can be set to the string `"first"`, indicating that all imported members from a module should be aligned with the first member in the list. This can also be set to `"off"` to disable checking for imported module members. - `"flatTernaryExpressions": true` (`false` by default) requires no indentation for ternary expressions which are nested in other ternary expressions. -- `"ignoredNodes"` accepts an array of [selectors](/docs/developer-guide/selectors.md). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. +- `"ignoredNodes"` accepts an array of [selectors](https://eslint.org/docs/developer-guide/selectors). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. - `"ignoreComments"` (default: false) can be used when comments do not need to be aligned with nodes on the previous or next line. Level of indentation denotes the multiple of the indent specified. Example: From 5eb40dc323720778955c68202117cec38f1f478a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bouhier Date: Thu, 15 Aug 2019 14:13:32 -0700 Subject: [PATCH 22/58] fix(eslint-plugin): readme typo (#867) --- packages/eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 1ecc3e86cf97..e0f32686c9de 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -65,7 +65,7 @@ You can also use [eslint:recommended](https://eslint.org/docs/rules/) (the set o As of version 2 of this plugin, _by design_, none of the rules in the main `recommended` config require type-checking in order to run. This means that they are more lightweight and faster to run. -Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You wou apply this _in addition_ to the recommended configs previously mentioned, e.g.: +Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You would apply this _in addition_ to the recommended configs previously mentioned, e.g.: ```json { From 32d37453121743b329df9b587b78a75c1bdd5efb Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Thu, 15 Aug 2019 18:56:49 -0700 Subject: [PATCH 23/58] chore: fix line end character for json/md (#869) --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index 8db1f2632df7..73968f2a6144 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,7 @@ * text=auto *.js eol=lf +*.json eol=lf +*.md eol=lf *.ts eol=lf *.tsx eol=lf *.yml eol=lf From 4b0d2d9f9b8ab370150119eb9bee0908b6751203 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 00:19:17 -0700 Subject: [PATCH 24/58] chore(eslint-plugin): fix peer dependency (#859) --- packages/eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index b3d3734d15e2..6706be22576a 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -56,7 +56,7 @@ "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^2.0.0-alpha.0", + "@typescript-eslint/parser": "^2.0.0", "eslint": "^5.0.0 || ^6.0.0" } } From 580eceb83183ddc7a4798eb5bc55a36f71dcda89 Mon Sep 17 00:00:00 2001 From: Ben Lichtman Date: Mon, 19 Aug 2019 01:50:35 -0700 Subject: [PATCH 25/58] fix(eslint-plugin): [unified-signatures] type comparison and exported nodes (#839) --- .gitignore | 3 + .../src/rules/unified-signatures.ts | 38 +++++++++--- .../tests/rules/unified-signatures.test.ts | 58 +++++++++++++++++++ .../src/ts-estree/ts-estree.ts | 1 + 4 files changed, 93 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 55599f0c1844..3a06baccf6f5 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ jspm_packages/ .DS_Store .idea dist + +# Editor-specific metadata folders +.vs diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 1c3f747bc51b..c4c7f9bf4275 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -35,6 +35,9 @@ type ScopeNode = | TSESTree.TSTypeLiteral; type OverloadNode = MethodDefinition | SignatureDefinition; +type ContainingNode = + | TSESTree.ExportNamedDeclaration + | TSESTree.ExportDefaultDeclaration; type SignatureDefinition = | TSESTree.FunctionExpression @@ -424,7 +427,8 @@ export default util.createRule({ a === b || (a !== undefined && b !== undefined && - a.typeAnnotation.type === b.typeAnnotation.type) + sourceCode.getText(a.typeAnnotation) === + sourceCode.getText(b.typeAnnotation)) ); } @@ -495,9 +499,16 @@ export default util.createRule({ currentScope = scopes.pop()!; } - function addOverload(signature: OverloadNode, key?: string): void { + function addOverload( + signature: OverloadNode, + key?: string, + containingNode?: ContainingNode, + ): void { key = key || getOverloadKey(signature); - if (currentScope && signature.parent === currentScope.parent && key) { + if ( + currentScope && + (containingNode || signature).parent === currentScope.parent + ) { const overloads = currentScope.overloads.get(key); if (overloads !== undefined) { overloads.push(signature); @@ -521,11 +532,10 @@ export default util.createRule({ createScope(node.body, node.typeParameters); }, TSTypeLiteral: createScope, + // collect overloads TSDeclareFunction(node): void { - if (node.id && !node.body) { - addOverload(node, node.id.name); - } + addOverload(node, node.id.name, getExportingNode(node)); }, TSCallSignatureDeclaration: addOverload, TSConstructSignatureDeclaration: addOverload, @@ -540,6 +550,7 @@ export default util.createRule({ addOverload(node); } }, + // validate scopes 'Program:exit': checkScope, 'TSModuleBlock:exit': checkScope, @@ -550,7 +561,20 @@ export default util.createRule({ }, }); -function getOverloadKey(node: OverloadNode): string | undefined { +function getExportingNode( + node: TSESTree.TSDeclareFunction, +): + | TSESTree.ExportNamedDeclaration + | TSESTree.ExportDefaultDeclaration + | undefined { + return node.parent && + (node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration || + node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration) + ? node.parent + : undefined; +} + +function getOverloadKey(node: OverloadNode): string { const info = getOverloadInfo(node); return ( diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index 5d65e2f18013..c8f9740662dd 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -105,6 +105,30 @@ interface I { function f(x: T[]): void; function f(x: T): void; `, + // Same name, different scopes + ` +declare function foo(n: number): number; + +declare module "hello" { + function foo(n: number, s: string): number; +} +`, + // children of block not checked to match TSLint + ` +{ + function block(): number; + function block(n: number): number; + function block(n?: number): number { + return 3; + } +} +`, + ` +export interface Foo { + bar(baz: string): number[]; + bar(): string[]; +} +`, ], invalid: [ { @@ -591,5 +615,39 @@ class Foo { }, ], }, + { + code: ` +export function foo(line: number): number; +export function foo(line: number, character?: number): number; +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 3, + column: 35, + }, + ], + }, + { + code: ` +declare function foo(line: number): number; +export function foo(line: number, character?: number): number; +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 3, + column: 35, + }, + ], + }, ], }); diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index f079fd68d471..7276f8d93e33 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -1040,6 +1040,7 @@ export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { } export interface TSDeclareFunction extends FunctionDeclarationBase { + id: Identifier; type: AST_NODE_TYPES.TSDeclareFunction; } From 656d25528f6e9772a80d2569312c302c4bb6329b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 01:51:33 -0700 Subject: [PATCH 26/58] docs: add more issue templates (#811) --- .github/ISSUE_TEMPLATE.md | 37 +++++++++++++++++++ .../eslint-plugin-typescript.md | 2 +- .../ISSUE_TEMPLATE/typescript-eslint-utils.md | 20 ++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/typescript-eslint-utils.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000000..e219ef75b4fd --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,37 @@ +--- +name: catch-all template +about: Provides some general structure to issues that people choose to log outside the normal flow +title: '' +labels: triage +assignees: '' +--- + +**What were you trying to do?** + +```json +{ + "rules": { + "@typescript-eslint/": [""] + } +} +``` + +```ts +// Put your code here +``` + +**What did you expect to happen?** + +**What actually happened?** + +**Versions** + +| package | version | +| --------------------------------------- | ------- | +| `@typescript-eslint/eslint-plugin` | `X.Y.Z` | +| `@typescript-eslint/parser` | `X.Y.Z` | +| `@typescript-eslint/typescript-estree` | `X.Y.Z` | +| `@typescript-eslint/experimental-utils` | `X.Y.Z` | +| `TypeScript` | `X.Y.Z` | +| `node` | `X.Y.Z` | +| `npm` | `X.Y.Z` | diff --git a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md index 010b5c01cb3c..ad7d8fb4944f 100644 --- a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md +++ b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md @@ -22,7 +22,7 @@ Are you opening an issue because the rule you're trying to use is not found? 1) Check the releases log: https://github.com/typescript-eslint/typescript-eslint/releases - If the rule isn't listed there, then chances are it hasn't been released to the main npm tag yet. 2) Try installing the `canary` tag: `npm i @typescript-eslint/eslint-plugin@canary`. - - The canary tag is built for every commit to master, so it contains the bleeding edge build. + - The canary tag is built for every commit to master, so it contains the bleeding edge build. 3) If ESLint still can't find the rule, then consider reporting an issue. --> diff --git a/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md b/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md new file mode 100644 index 000000000000..8403568e4ac2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md @@ -0,0 +1,20 @@ +--- +name: '@typescript-eslint/experimental-utils' +about: Report an issue with the `@typescript-eslint/experimental-utils` package +title: '' +labels: 'package: utils, triage' +assignees: '' +--- + +**What did you expect to happen?** + +**What actually happened?** + +**Versions** + +| package | version | +| --------------------------------------- | ------- | +| `@typescript-eslint/experimental-utils` | `X.Y.Z` | +| `TypeScript` | `X.Y.Z` | +| `node` | `X.Y.Z` | +| `npm` | `X.Y.Z` | From 9f8209952c2325763f490b6b283dfa717e3df1b5 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 19 Aug 2019 12:03:14 +0300 Subject: [PATCH 27/58] feat(eslint-plugin): add quotes [extension] (#762) --- packages/eslint-plugin/README.md | 1 + packages/eslint-plugin/docs/rules/quotes.md | 22 + packages/eslint-plugin/src/configs/all.json | 2 + packages/eslint-plugin/src/rules/index.ts | 2 + packages/eslint-plugin/src/rules/quotes.ts | 62 ++ .../eslint-plugin/tests/rules/quotes.test.ts | 662 ++++++++++++++++++ .../eslint-plugin/tools/generate-configs.ts | 1 + .../eslint-plugin/typings/eslint-rules.d.ts | 20 + 8 files changed, 772 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/quotes.md create mode 100644 packages/eslint-plugin/src/rules/quotes.ts create mode 100644 packages/eslint-plugin/tests/rules/quotes.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index e0f32686c9de..a3ce816616ba 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -191,6 +191,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | | :thought_balloon: | +| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | | [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Enforce giving `compare` argument to `Array#sort` | | | :thought_balloon: | | [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/quotes.md b/packages/eslint-plugin/docs/rules/quotes.md new file mode 100644 index 000000000000..e707a94b3d36 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/quotes.md @@ -0,0 +1,22 @@ +# Enforce the consistent use of either backticks, double, or single quotes + +## Rule Details + +This rule extends the base [eslint/quotes](https://eslint.org/docs/rules/quotes) rule. +It supports all options and features of the base rule. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "quotes": "off", + "@typescript-eslint/quotes": ["error"] +} +``` + +## Options + +See [eslint/quotes options](https://eslint.org/docs/rules/quotes#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/quotes.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 30a7cafafb56..cce896718db1 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -62,6 +62,8 @@ "@typescript-eslint/prefer-regexp-exec": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/promise-function-async": "error", + "quotes": "off", + "@typescript-eslint/quotes": "error", "@typescript-eslint/require-array-sort-compare": "error", "require-await": "off", "@typescript-eslint/require-await": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index db155e691bfa..bd39c7867e33 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -48,6 +48,7 @@ import preferReadonly from './prefer-readonly'; import preferRegexpExec from './prefer-regexp-exec'; import preferStringStartsEndsWith from './prefer-string-starts-ends-with'; import promiseFunctionAsync from './promise-function-async'; +import quotes from './quotes'; import requireArraySortCompare from './require-array-sort-compare'; import requireAwait from './require-await'; import restrictPlusOperands from './restrict-plus-operands'; @@ -112,6 +113,7 @@ export default { 'prefer-regexp-exec': preferRegexpExec, 'prefer-string-starts-ends-with': preferStringStartsEndsWith, 'promise-function-async': promiseFunctionAsync, + quotes: quotes, 'require-array-sort-compare': requireArraySortCompare, 'require-await': requireAwait, 'restrict-plus-operands': restrictPlusOperands, diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts new file mode 100644 index 000000000000..97efc04c821d --- /dev/null +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -0,0 +1,62 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/quotes'; +import * as util from '../util'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'quotes', + meta: { + type: 'layout', + docs: { + description: + 'Enforce the consistent use of either backticks, double, or single quotes', + category: 'Stylistic Issues', + recommended: false, + }, + fixable: 'code', + messages: baseRule.meta.messages, + schema: baseRule.meta.schema, + }, + defaultOptions: [ + 'double', + { + allowTemplateLiterals: false, + avoidEscape: false, + }, + ], + create(context, [option]) { + const rules = baseRule.create(context); + + const isModuleDeclaration = (node: TSESTree.Literal): boolean => { + return ( + !!node.parent && node.parent.type === AST_NODE_TYPES.TSModuleDeclaration + ); + }; + + const isTypeLiteral = (node: TSESTree.Literal): boolean => { + return !!node.parent && node.parent.type === AST_NODE_TYPES.TSLiteralType; + }; + + return { + Literal(node) { + if ( + option === 'backtick' && + (isModuleDeclaration(node) || isTypeLiteral(node)) + ) { + return; + } + + rules.Literal(node); + }, + + TemplateLiteral(node) { + rules.TemplateLiteral(node); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/quotes.test.ts b/packages/eslint-plugin/tests/rules/quotes.test.ts new file mode 100644 index 000000000000..bec1f4b7e98c --- /dev/null +++ b/packages/eslint-plugin/tests/rules/quotes.test.ts @@ -0,0 +1,662 @@ +import rule from '../../src/rules/quotes'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, +}); + +/** + * the base rule `quotes` doesn't use a message id + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useDoubleQuote: any = { + message: 'Strings must use doublequote.', +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useSingleQuote: any = { + message: 'Strings must use singlequote.', +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useBacktick: any = { + message: 'Strings must use backtick.', +}; + +ruleTester.run('quotes', rule, { + valid: [ + { + code: `declare module '*.html' {}`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` + class A { + public prop: IProps['prop']; + } + `, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + + /** ESLint */ + `var foo = "bar";`, + { + code: `var foo = 'bar';`, + options: ['single'], + }, + { + code: `var foo = "bar";`, + options: ['double'], + }, + { + code: `var foo = 1;`, + options: ['single'], + }, + { + code: `var foo = 1;`, + options: ['double'], + }, + { + code: `var foo = "'";`, + options: [ + 'single', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo = '"';`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo = <>Hello world;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: ['double'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['double'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: "var foo = `bar 'baz'`;", + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `bar "baz"`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `var foo = 1;`, + options: ['backtick'], + }, + { + code: 'var foo = "a string containing `backtick` quotes";', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo =
;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + + // Backticks are only okay if they have substitutions, contain a line break, or are tagged + { + code: 'var foo = `back\ntick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\rtick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\u2028tick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\u2029tick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\\\\\ntick`;', // 2 backslashes followed by a newline + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\\\\\\\\\ntick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `\n`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back${x}tick`;', + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = tag`backtick`;', + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + }, + + // Backticks are also okay if allowTemplateLiterals + { + code: "var foo = `bar 'foo' baz` + 'bar';", + options: [ + 'single', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `bar \'foo\' baz` + "bar";', + options: [ + 'double', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: "var foo = `bar 'foo' baz` + `bar`;", + options: [ + 'backtick', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + + // `backtick` should not warn the directive prologues. + { + code: '"use strict"; var foo = `backtick`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: '"use strict"; \'use strong\'; "use asm"; var foo = `backtick`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + 'function foo() { "use strict"; "use strong"; "use asm"; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + "(function() { 'use strict'; 'use strong'; 'use asm'; var foo = `backtick`; })();", + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + '(() => { "use strict"; "use strong"; "use asm"; var foo = `backtick`; })();', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + + // `backtick` should not warn import/export sources. + { + code: `import "a"; import 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + { + code: `import a from "a"; import b from 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + { + code: `export * from "a"; export * from 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + + // `backtick` should not warn property/method names (not computed). + { + code: `var obj = {"key0": 0, 'key1': 1};`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `class Foo { 'bar'(){} }`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `class Foo { static ''(){} }`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + ], + + invalid: [ + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: ['single'], + errors: [useSingleQuote], + }, + { + code: 'var foo = `bar`;', + output: `var foo = 'bar';`, + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + errors: [useSingleQuote], + }, + { + code: `var foo = 'don\\'t';`, + output: `var foo = "don't";`, + errors: [useDoubleQuote], + }, + { + code: `var msg = "Plugin '" + name + "' not found"`, + output: `var msg = 'Plugin \\'' + name + '\\' not found'`, + options: ['single'], + errors: [ + { ...useSingleQuote, column: 11 }, + { ...useSingleQuote, column: 31 }, + ], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: ['double'], + errors: [useDoubleQuote], + }, + { + code: 'var foo = `bar`;', + output: `var foo = "bar";`, + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: [ + 'single', + { + avoidEscape: true, + }, + ], + errors: [useSingleQuote], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = '\\\\';`, + output: `var foo = "\\\\\";`, // eslint-disable-line no-useless-escape + options: [ + 'double', + { + avoidEscape: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: [ + 'single', + { + allowTemplateLiterals: true, + }, + ], + errors: [useSingleQuote], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: [ + 'double', + { + allowTemplateLiterals: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = 'bar';`, + output: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: "var foo = 'b${x}a$r';", + output: 'var foo = `b\\${x}a$r`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: 'var foo = "bar";', + output: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: `var foo = "bar";`, + output: 'var foo = `bar`;', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: `var foo = 'bar';`, + output: 'var foo = `bar`;', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + + // "use strict" is *not* a directive prologue in these statements so is subject to the rule + { + code: 'var foo = `backtick`; "use strict";', + output: 'var foo = `backtick`; `use strict`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + { + code: '{ "use strict"; var foo = `backtick`; }', + output: '{ `use strict`; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + { + code: 'if (1) { "use strict"; var foo = `backtick`; }', + output: 'if (1) { `use strict`; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + + // `backtick` should warn computed property names. + { + code: `var obj = {["key0"]: 0, ['key1']: 1};`, + output: 'var obj = {[`key0`]: 0, [`key1`]: 1};', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick, useBacktick], + }, + { + code: `class Foo { ['a'](){} static ['b'](){} }`, + output: 'class Foo { [`a`](){} static [`b`](){} }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick, useBacktick], + }, + + // https://github.com/eslint/eslint/issues/7084 + { + code: `
`, + output: `
`, + options: [`single`], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + errors: [useSingleQuote], + }, + { + code: `
`, + output: `
`, + options: ['double'], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + errors: [useDoubleQuote], + }, + { + code: `
`, + output: '
', + options: ['backtick'], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 2015, + }, + errors: [useBacktick], + }, + + // https://github.com/eslint/eslint/issues/7610 + { + code: '`use strict`;', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'function foo() { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'foo = function() { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '() => { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '() => { foo(); `use strict`; }', + output: `() => { foo(); "use strict"; }`, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'foo(); `use strict`;', + output: 'foo(); "use strict";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + + // https://github.com/eslint/eslint/issues/7646 + { + code: 'var foo = `foo\\nbar`;', + output: 'var foo = "foo\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'var foo = `foo\\\nbar`;', // 1 backslash followed by a newline + output: 'var foo = "foo\\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'var foo = `foo\\\\\\\nbar`;', // 3 backslashes followed by a newline + output: 'var foo = "foo\\\\\\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '````', + output: '""``', + parserOptions: { ecmaVersion: 6 }, + errors: [{ ...useDoubleQuote, line: 1, column: 1 }], + }, + ], +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index cda1b0771ead..b400ca057224 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -29,6 +29,7 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'no-empty-function', 'no-extra-parens', 'no-magic-numbers', + 'quotes', 'no-unused-vars', 'no-use-before-define', 'no-useless-constructor', diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 4e5fe5b64495..dcc37035c9de 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -461,3 +461,23 @@ declare module 'eslint/lib/rules/semi' { >; export = rule; } + +declare module 'eslint/lib/rules/quotes' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + never, + [ + 'single' | 'double' | 'backtick', + { + allowTemplateLiterals?: boolean; + avoidEscape?: boolean; + }?, + ], + { + Literal(node: TSESTree.Literal): void; + TemplateLiteral(node: TSESTree.TemplateLiteral): void; + } + >; + export = rule; +} From b00666735bc6f7fc0580e9342cf92aba7cf4185c Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 19 Aug 2019 13:50:23 +0300 Subject: [PATCH 28/58] fix(eslint-plugin): [member-naming] should match constructor args (#771) --- .../eslint-plugin/src/rules/member-naming.ts | 69 ++++++++++++++---- .../tests/rules/member-naming.test.ts | 70 +++++++++++++++++++ 2 files changed, 124 insertions(+), 15 deletions(-) diff --git a/packages/eslint-plugin/src/rules/member-naming.ts b/packages/eslint-plugin/src/rules/member-naming.ts index 9995b6cf1e35..d850ef69060e 100644 --- a/packages/eslint-plugin/src/rules/member-naming.ts +++ b/packages/eslint-plugin/src/rules/member-naming.ts @@ -1,4 +1,7 @@ -import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; import * as util from '../util'; interface Config { @@ -61,37 +64,73 @@ export default util.createRule({ return acc; }, {}); - /** - * Check that the property name matches the convention for its - * accessibility. - * @param {ASTNode} node the named node to evaluate. - * @returns {void} - * @private - */ + function getParameterNode( + node: TSESTree.TSParameterProperty, + ): TSESTree.Identifier | null { + if (node.parameter.type === AST_NODE_TYPES.AssignmentPattern) { + return node.parameter.left as TSESTree.Identifier; + } + + if (node.parameter.type === AST_NODE_TYPES.Identifier) { + return node.parameter; + } + + return null; + } + + function validateParameterName(node: TSESTree.TSParameterProperty): void { + const parameterNode = getParameterNode(node); + if (!parameterNode) { + return; + } + + validate(parameterNode, parameterNode.name, node.accessibility); + } + function validateName( node: TSESTree.MethodDefinition | TSESTree.ClassProperty, ): void { - const name = util.getNameFromClassMember(node, sourceCode); - const accessibility: Modifiers = node.accessibility || 'public'; - const convention = conventions[accessibility]; - - const method = node as TSESTree.MethodDefinition; - if (method.kind === 'constructor') { + if ( + node.type === AST_NODE_TYPES.MethodDefinition && + node.kind === 'constructor' + ) { return; } + validate( + node.key, + util.getNameFromClassMember(node, sourceCode), + node.accessibility, + ); + } + + /** + * Check that the name matches the convention for its accessibility. + * @param {ASTNode} node the named node to evaluate. + * @param {string} name + * @param {Modifiers} accessibility + * @returns {void} + * @private + */ + function validate( + node: TSESTree.Identifier | TSESTree.Expression, + name: string, + accessibility: Modifiers = 'public', + ): void { + const convention = conventions[accessibility]; if (!convention || convention.test(name)) { return; } context.report({ - node: node.key, + node, messageId: 'incorrectName', data: { accessibility, name, convention }, }); } return { + TSParameterProperty: validateParameterName, MethodDefinition: validateName, ClassProperty: validateName, }; diff --git a/packages/eslint-plugin/tests/rules/member-naming.test.ts b/packages/eslint-plugin/tests/rules/member-naming.test.ts index 96ec4b104f3c..851d70ea706c 100644 --- a/packages/eslint-plugin/tests/rules/member-naming.test.ts +++ b/packages/eslint-plugin/tests/rules/member-naming.test.ts @@ -86,6 +86,30 @@ class Class { }, ], }, + + { + code: ` +class Test { + constructor(public __a: string, protected __b: string, private __c: string = 100) {} +} + `, + options: [ + { + protected: '^__', + private: '^__', + public: '^__', + }, + ], + }, + { + code: + // Semantically invalid test case, TS has to throw an error. + ` +class Foo { + constructor(private ...name: string[], private [test]: [string]) {} +} + `, + }, ], invalid: [ { @@ -329,5 +353,51 @@ class Class { }, ], }, + { + code: ` +class Test { + constructor(public a: string, protected b: string, private c: string = 100) {} +} + `, + options: [ + { + public: '^__', + protected: '^__', + private: '^__', + }, + ], + errors: [ + { + messageId: 'incorrectName', + data: { + accessibility: 'public', + convention: '/^__/', + name: 'a', + }, + line: 3, + column: 24, + }, + { + messageId: 'incorrectName', + data: { + accessibility: 'protected', + convention: '/^__/', + name: 'b', + }, + line: 3, + column: 45, + }, + { + messageId: 'incorrectName', + data: { + accessibility: 'private', + convention: '/^__/', + name: 'c', + }, + line: 3, + column: 64, + }, + ], + }, ], }); From 14c6f807ec3e3184b358952cdc4d01977d112ff1 Mon Sep 17 00:00:00 2001 From: Zen <843968788@qq.com> Date: Mon, 19 Aug 2019 19:14:57 +0800 Subject: [PATCH 29/58] feat: [no-unnecessary-type-assertion] allow `as const` arrow functions (#876) --- .../rules/explicit-function-return-type.ts | 38 +++++++++++++ .../explicit-function-return-type.test.ts | 56 +++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 67692c20fc03..da3e7334b6ab 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -9,6 +9,7 @@ type Options = [ allowExpressions?: boolean; allowTypedFunctionExpressions?: boolean; allowHigherOrderFunctions?: boolean; + allowDirectConstAssertionInArrowFunctions?: boolean; }, ]; type MessageIds = 'missingReturnType'; @@ -39,6 +40,9 @@ export default util.createRule({ allowHigherOrderFunctions: { type: 'boolean', }, + allowDirectConstAssertionInArrowFunctions: { + type: 'boolean', + }, }, additionalProperties: false, }, @@ -49,6 +53,7 @@ export default util.createRule({ allowExpressions: false, allowTypedFunctionExpressions: true, allowHigherOrderFunctions: true, + allowDirectConstAssertionInArrowFunctions: true, }, ], create(context, [options]) { @@ -203,6 +208,30 @@ export default util.createRule({ ); } + /** + * Checks if a function belongs to: + * `() => ({ action: 'xxx' }) as const` + */ + function returnsConstAssertionDirectly( + node: TSESTree.ArrowFunctionExpression, + ): boolean { + const { body } = node; + if (body.type === AST_NODE_TYPES.TSAsExpression) { + const { typeAnnotation } = body; + if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) { + const { typeName } = typeAnnotation; + if ( + typeName.type === AST_NODE_TYPES.Identifier && + typeName.name === 'const' + ) { + return true; + } + } + } + + return false; + } + /** * Checks if a function declaration/expression has a return type. */ @@ -263,6 +292,15 @@ export default util.createRule({ } } + // https://github.com/typescript-eslint/typescript-eslint/issues/653 + if ( + node.type === AST_NODE_TYPES.ArrowFunctionExpression && + options.allowDirectConstAssertionInArrowFunctions && + returnsConstAssertionDirectly(node) + ) { + return; + } + checkFunctionReturnType(node); } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 32f23792591e..942ed5ea2e89 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -308,6 +308,20 @@ foo({ }, ], }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => (({ type: "X", value }) as const); +const func = (value: number) => ({ type: "X", value } as const); +const func = (value: number) => (x as const); +const func = (value: number) => x as const; + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: true, + }, + ], + }, ], invalid: [ { @@ -749,5 +763,47 @@ foo({ }, ], }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => ({ type: "X", value } as any); +const func = (value: number) => ({ type: "X", value } as Action); + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: true, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 2, + column: 14, + }, + { + messageId: 'missingReturnType', + line: 3, + column: 14, + }, + ], + }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => ({ type: "X", value } as const); + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: false, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 2, + column: 14, + }, + ], + }, ], }); From c68e033f423d1143330e8e21104d5de10185e9a8 Mon Sep 17 00:00:00 2001 From: Ankeet Maini Date: Mon, 19 Aug 2019 18:57:34 +0530 Subject: [PATCH 30/58] feat(eslint-plugin): [no-type-alias] support tuples (#775) --- .../eslint-plugin/docs/rules/no-type-alias.md | 76 +++++ .../eslint-plugin/src/rules/no-type-alias.ts | 145 +++++----- .../tests/rules/no-type-alias.test.ts | 261 ++++++++++++++++++ .../src/ts-estree/ts-estree.ts | 2 +- 4 files changed, 408 insertions(+), 76 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 63656dfada80..46230f3d3293 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -86,6 +86,7 @@ or more of the following you may pass an object with the options set as follows: - `allowCallbacks` set to `"always"` will allow you to use type aliases with callbacks (Defaults to `"never"`) - `allowLiterals` set to `"always"` will allow you to use type aliases with literal objects (Defaults to `"never"`) - `allowMappedTypes` set to `"always"` will allow you to use type aliases as mapping tools (Defaults to `"never"`) +- `allowTupleTypes` set to `"always"` will allow you to use type aliases with tuples (Defaults to `"never"`) ### allowAliases @@ -453,6 +454,81 @@ type Foo = { readonly [P in keyof T]: T[P] } & type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` +### allowTupleTypes + +This applies to tuple types (`type Foo = [number]`). + +The setting accepts the following options: + +- `"always"` or `"never"` to active or deactivate the feature. +- `"in-unions"`, allows tuples in union statements, e.g. `type Foo = [string] | [string, string];` +- `"in-intersections"`, allows tuples in intersection statements, e.g. `type Foo = [string] & [string, string];` +- `"in-unions-and-intersections"`, allows tuples in union and/or intersection statements. + +Examples of **correct** code for the `{ "allowTupleTypes": "always" }` options: + +```ts +type Foo = [number]; + +type Foo = [number] | [number, number]; + +type Foo = [number] & [number, number]; + +type Foo = [number] | [number, number] & [string, string]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions" }` option: + +```ts +type Foo = [number]; + +type Foo = [number] & [number, number]; + +type Foo = [string] & [number]; +``` + +Examples of **correct** code for the `{ "allowTupleTypes": "in-unions" }` option: + +```ts +type Foo = [number] | [number, number]; + +type Foo = [string] | [number]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-intersections" }` option: + +```ts +type Foo = [number]; + +type Foo = [number] | [number, number]; + +type Foo = [string] | [number]; +``` + +Examples of **correct** code for the `{ "allowTupleTypes": "in-intersections" }` option: + +```ts +type Foo = [number] & [number, number]; + +type Foo = [string] & [number]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions-and-intersections" }` option: + +```ts +type Foo = [number]; + +type Foo = [string]; +``` + +Examples of **correct** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option: + +```ts +type Foo = [number] & [number, number]; + +type Foo = [string] | [number]; +``` + ## When Not To Use It When you can't express some shape with an interface or you need to use a union, tuple type, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 1648b89f0dfa..68d537cc09b8 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -4,27 +4,27 @@ import { } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; +type Values = + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; +const enumValues: Values[] = [ + 'always', + 'never', + 'in-unions', + 'in-intersections', + 'in-unions-and-intersections', +]; + type Options = [ { - allowAliases?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; + allowAliases?: Values; allowCallbacks?: 'always' | 'never'; - allowLiterals?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; - allowMappedTypes?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; + allowLiterals?: Values; + allowMappedTypes?: Values; + allowTupleTypes?: Values; }, ]; type MessageIds = 'noTypeAlias' | 'noCompositionAlias'; @@ -57,34 +57,19 @@ export default util.createRule({ type: 'object', properties: { allowAliases: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, }, allowCallbacks: { enum: ['always', 'never'], }, allowLiterals: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, }, allowMappedTypes: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, + }, + allowTupleTypes: { + enum: enumValues, }, }, additionalProperties: false, @@ -97,11 +82,20 @@ export default util.createRule({ allowCallbacks: 'never', allowLiterals: 'never', allowMappedTypes: 'never', + allowTupleTypes: 'never', }, ], create( context, - [{ allowAliases, allowCallbacks, allowLiterals, allowMappedTypes }], + [ + { + allowAliases, + allowCallbacks, + allowLiterals, + allowMappedTypes, + allowTupleTypes, + }, + ], ) { const unions = ['always', 'in-unions', 'in-unions-and-intersections']; const intersections = [ @@ -180,6 +174,36 @@ export default util.createRule({ }); } + const isValidTupleType = (type: TypeWithLabel) => { + if (type.node.type === AST_NODE_TYPES.TSTupleType) { + return true; + } + if (type.node.type === AST_NODE_TYPES.TSTypeOperator) { + if ( + ['keyof', 'readonly'].includes(type.node.operator) && + type.node.typeAnnotation && + type.node.typeAnnotation.type === AST_NODE_TYPES.TSTupleType + ) { + return true; + } + } + return false; + }; + + const checkAndReport = ( + optionValue: Values, + isTopLevel: boolean, + type: TypeWithLabel, + label: string, + ) => { + if ( + optionValue === 'never' || + !isSupportedComposition(isTopLevel, type.compositionType, optionValue) + ) { + reportError(type.node, type.compositionType, isTopLevel, label); + } + }; + /** * Validates the node looking for aliases, callbacks and literals. * @param node the node to be validated. @@ -198,48 +222,19 @@ export default util.createRule({ } } else if (type.node.type === AST_NODE_TYPES.TSTypeLiteral) { // literal object type - if ( - allowLiterals === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowLiterals!, - ) - ) { - reportError(type.node, type.compositionType, isTopLevel, 'Literals'); - } + checkAndReport(allowLiterals!, isTopLevel, type, 'Literals'); } else if (type.node.type === AST_NODE_TYPES.TSMappedType) { // mapped type - if ( - allowMappedTypes === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowMappedTypes!, - ) - ) { - reportError( - type.node, - type.compositionType, - isTopLevel, - 'Mapped types', - ); - } + checkAndReport(allowMappedTypes!, isTopLevel, type, 'Mapped types'); + } else if (isValidTupleType(type)) { + // tuple types + checkAndReport(allowTupleTypes!, isTopLevel, type, 'Tuple Types'); } else if ( type.node.type.endsWith('Keyword') || aliasTypes.has(type.node.type) ) { // alias / keyword - if ( - allowAliases === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowAliases!, - ) - ) { - reportError(type.node, type.compositionType, isTopLevel, 'Aliases'); - } + checkAndReport(allowAliases!, isTopLevel, type, 'Aliases'); } else { // unhandled type - shouldn't happen reportError(type.node, type.compositionType, isTopLevel, 'Unhandled'); diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index 3c3d83520e8f..d17348af7460 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -376,6 +376,69 @@ type Foo = { code: 'type Foo = typeof bar | typeof baz;', options: [{ allowAliases: 'in-unions' }], }, + { + code: 'type Foo = keyof [string]', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, + { + code: 'type Foo = readonly [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = readonly [string] | readonly [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = readonly [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & readonly [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | readonly [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, + { + code: 'type Foo = keyof [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = keyof [string] | keyof [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = keyof [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & keyof [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | keyof [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, ], invalid: [ { @@ -2915,5 +2978,203 @@ type Foo = { }, ], }, + { + code: 'type Foo = [number] | [number, number]', + options: [{ allowTupleTypes: 'never' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number] & [number, number]', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number] | [number, number]', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = readonly [number] | keyof [number, number]', + options: [{ allowTupleTypes: 'never' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 32, + }, + ], + }, + { + code: 'type Foo = keyof [number] & [number, number]', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 29, + }, + ], + }, + { + code: 'type Foo = [number] | readonly [number, number]', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = readonly [number];', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = keyof [number];', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = readonly [number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, ], }); diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 7276f8d93e33..51529a470cba 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -1324,7 +1324,7 @@ export interface TSTypeLiteral extends BaseNode { export interface TSTypeOperator extends BaseNode { type: AST_NODE_TYPES.TSTypeOperator; operator: 'keyof' | 'unique' | 'readonly'; - typeAnnotation?: TSTypeAnnotation; + typeAnnotation?: TypeNode; } export interface TSTypeParameter extends BaseNode { From 8f3b0a8e48abaffe5707d401e37ae5d2b616d1b9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 08:56:01 -0700 Subject: [PATCH 31/58] fix(typescript-estree): improve missing project file error msg (#866) Fixes #853 --- .../no-unnecessary-type-assertion.test.ts | 6 -- .../rules/restrict-plus-operands.test.ts | 16 ++--- packages/parser/README.md | 29 +++++---- packages/typescript-estree/jest.config.js | 8 +++ packages/typescript-estree/src/convert.ts | 2 +- packages/typescript-estree/src/parser.ts | 39 +++++++++++- .../typescript-estree/src/tsconfig-parser.ts | 5 +- .../fixtures/invalidFileErrors/js/included.js | 1 + .../invalidFileErrors/js/included.jsx | 1 + .../invalidFileErrors/js/notIncluded.js | 1 + .../invalidFileErrors/js/notIncluded.jsx | 1 + .../invalidFileErrors/other/included.vue | 1 + .../invalidFileErrors/other/notIncluded.vue | 1 + .../other/unknownFileType.unknown | 1 + .../fixtures/invalidFileErrors/ts/included.ts | 1 + .../invalidFileErrors/ts/included.tsx | 1 + .../invalidFileErrors/ts/notIncluded.ts | 1 + .../invalidFileErrors/ts/notIncluded.tsx | 1 + .../fixtures/invalidFileErrors/tsconfig.json | 9 +++ .../tests/lib/__snapshots__/parse.ts.snap | 36 +++++++++++ packages/typescript-estree/tests/lib/parse.ts | 60 ++++++++++++++++++- .../tests/lib/semanticInfo.ts | 4 +- packages/typescript-estree/tsconfig.json | 3 +- 23 files changed, 190 insertions(+), 38 deletions(-) create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts index 4c06e95a042e..4b4e496253f5 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -99,12 +99,6 @@ foo(str!); ` declare function a(a: string): any; declare const b: string | null; -class Mx { - @a(b!) - private prop = 1; -} - `, - ` class Mx { @a(b!) private prop = 1; diff --git a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts index fdda8fe0ef4b..44583a202a1d 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -26,37 +26,37 @@ ruleTester.run('restrict-plus-operands', rule, { `var foo = BigInt(1) + 1n`, `var foo = 1n; foo + 2n`, ` -function test () : number { return 2; } +function test(s: string, n: number) : number { return 2; } var foo = test("5.5", 10) + 10; - `, + `, ` var x = 5; var z = 8.2; var foo = x + z; - `, + `, ` var w = "6.5"; var y = "10"; var foo = y + w; - `, + `, 'var foo = 1 + 1;', "var foo = '1' + '1';", ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = pair.first + 10; - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = pair.first + (10 as number); - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = "5.5" + pair.second; - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = ("5.5" as string) + pair.second; - `, + `, `const foo = 'hello' + (someBoolean ? 'a' : 'b') + (() => someBoolean ? 'c' : 'd')() + 'e';`, `const balls = true;`, `balls === true;`, diff --git a/packages/parser/README.md b/packages/parser/README.md index cbabebd95f8a..718e2c82ba50 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -52,25 +52,30 @@ The following additional configuration options are available by specifying them - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```ts - { - "extends": "./tsconfig.json", // path to existing tsconfig - "include": [ - "src/**/*.ts", - "test/**/*.ts", - // etc - ] - } - ``` + ```ts + { + // extend your base config so you don't have to redefine your compilerOptions + "extends": "./tsconfig.json", + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "typings/**/*.ts", + // etc + + // if you have a mixed JS/TS codebase, don't forget to include your JS files + "src/**/*.js" + ] + } + ``` - **`tsconfigRootDir`** - default `undefined`. This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. -- **`createDefaultProgram`** - default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. However, this may incur significant performance costs, so this option is primarily included for backwards-compatibility. See the **`project`** section for more information. - - **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file - **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported +- **`createDefaultProgram`** - default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. **Using this option will incur significant performance costs. This option is primarily included for backwards-compatibility.** See the **`project`** section above for more information. + ### .eslintrc.json ```json diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 4005947d2777..e01f6ed07751 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -10,4 +10,12 @@ module.exports = { collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], coverageReporters: ['text-summary', 'lcov'], + globals: { + 'ts-jest': { + diagnostics: { + // ignore the diagnostic error for the invalidFileErrors fixtures + ignoreCodes: [5056], + }, + }, + }, }; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 3a7d2de99dc1..43ab7889c6bb 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -67,7 +67,7 @@ export class Converter { */ constructor(ast: ts.SourceFile, options: ConverterOptions) { this.ast = ast; - this.options = options; + this.options = { ...options }; } getASTMaps(): ASTMaps { diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index f215fa44492c..1b89136928a6 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,3 +1,4 @@ +import path from 'path'; import semver from 'semver'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { astConverter } from './ast-converter'; @@ -9,6 +10,7 @@ import { TSESTree } from './ts-estree'; import { calculateProjectParserOptions, createProgram, + defaultCompilerOptions, } from './tsconfig-parser'; /** @@ -87,9 +89,39 @@ function getASTFromProject( ); if (!astAndProgram && !createDefaultProgram) { - throw new Error( - `If "parserOptions.project" has been set for @typescript-eslint/parser, ${filePath} must be included in at least one of the projects provided.`, - ); + // the file was either not matched within the tsconfig, or the extension wasn't expected + const errorLines = [ + '"parserOptions.project" has been set for @typescript-eslint/parser.', + `The file does not match your project config: ${filePath}.`, + ]; + let hasMatchedAnError = false; + + const fileExtension = path.extname(filePath); + if (!['.ts', '.tsx', '.js', '.jsx'].includes(fileExtension)) { + const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; + if (extra.extraFileExtensions && extra.extraFileExtensions.length > 0) { + if (!extra.extraFileExtensions.includes(fileExtension)) { + errorLines.push( + `${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`, + ); + hasMatchedAnError = true; + } + } else { + errorLines.push( + `${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`, + ); + hasMatchedAnError = true; + } + } + + if (!hasMatchedAnError) { + errorLines.push( + 'The file must be included in at least one of the projects provided.', + ); + hasMatchedAnError = true; + } + + throw new Error(errorLines.join('\n')); } return astAndProgram; @@ -158,6 +190,7 @@ function createNewProgram(code: string): ASTAndProgram { noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined, + ...defaultCompilerOptions, }, compilerHost, ); diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 88c631715450..affbe0906276 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -9,9 +9,10 @@ import { Extra } from './parser-options'; /** * Default compiler options for program generation from single root file */ -const defaultCompilerOptions: ts.CompilerOptions = { +export const defaultCompilerOptions: ts.CompilerOptions = { allowNonTsExtensions: true, allowJs: true, + checkJs: true, }; /** @@ -109,7 +110,7 @@ export function calculateProjectParserOptions( // create compiler host const watchCompilerHost = ts.createWatchCompilerHost( tsconfigPath, - /*optionsToExtend*/ { allowNonTsExtensions: true } as ts.CompilerOptions, + defaultCompilerOptions, ts.sys, ts.createSemanticDiagnosticsBuilderProgram, diagnosticReporter, diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx new file mode 100644 index 000000000000..25005f98f8fd --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json new file mode 100644 index 000000000000..de5d69d736c8 --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json @@ -0,0 +1,9 @@ +{ + "include": [ + "ts/included.ts", + "ts/included.tsx", + "js/included.js", + "js/included.jsx", + "other/included.vue" + ] +} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index 38e378d9f7e0..bca89ec8d8c6 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -189,6 +189,42 @@ Object { } `; +exports[`parse() invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension does not match 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/other/unknownFileType.unknown. +The extension for the file (.unknown) is non-standard. It should be added to your existing \\"parserOptions.extraFileExtensions\\"." +`; + +exports[`parse() invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches the file isn't included 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/other/notIncluded.vue. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/ts/notIncluded.ts. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 2`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/ts/notIncluded.tsx. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 3`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/js/notIncluded.js. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 4`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/js/notIncluded.jsx. +The file must be included in at least one of the projects provided." +`; + exports[`parse() non string code should correctly convert code to a string for parse() 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 57a4bc057424..6ed8db76cbc9 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -1,8 +1,8 @@ +import { join, resolve, relative } from 'path'; import * as parser from '../../src/parser'; import * as astConverter from '../../src/ast-converter'; import { TSESTreeOptions } from '../../src/parser-options'; import { createSnapshotTestBlock } from '../../tools/test-utils'; -import { join } from 'path'; const FIXTURES_DIR = './tests/fixtures/simpleProject'; @@ -145,7 +145,7 @@ describe('parse()', () => { }; const projectConfig: TSESTreeOptions = { ...baseConfig, - tsconfigRootDir: join(process.cwd(), FIXTURES_DIR), + tsconfigRootDir: FIXTURES_DIR, project: './tsconfig.json', }; @@ -241,4 +241,60 @@ describe('parse()', () => { ).toBeUndefined(); }); }); + + describe('invalid file error messages', () => { + const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: './tsconfig.json', + extraFileExtensions: ['.vue'], + }; + const testParse = (filePath: string) => (): void => { + parser.parseAndGenerateServices(code, { + ...config, + filePath: relative(process.cwd(), join(PROJECT_DIR, filePath)), + }); + }; + + describe('project includes', () => { + it("doesn't error for matched files", () => { + expect(testParse('ts/included.ts')).not.toThrow(); + expect(testParse('ts/included.tsx')).not.toThrow(); + expect(testParse('js/included.js')).not.toThrow(); + expect(testParse('js/included.jsx')).not.toThrow(); + }); + + it('errors for not included files', () => { + expect(testParse('ts/notIncluded.ts')).toThrowErrorMatchingSnapshot(); + expect(testParse('ts/notIncluded.tsx')).toThrowErrorMatchingSnapshot(); + expect(testParse('js/notIncluded.js')).toThrowErrorMatchingSnapshot(); + expect(testParse('js/notIncluded.jsx')).toThrowErrorMatchingSnapshot(); + }); + }); + + describe('"parserOptions.extraFileExtensions" is non-empty', () => { + describe('the extension matches', () => { + it('the file is included', () => { + expect(testParse('other/included.vue')).not.toThrow(); + }); + + it("the file isn't included", () => { + expect( + testParse('other/notIncluded.vue'), + ).toThrowErrorMatchingSnapshot(); + }); + }); + + it('the extension does not match', () => { + expect( + testParse('other/unknownFileType.unknown'), + ).toThrowErrorMatchingSnapshot(); + }); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 1afab0c5e444..157edec74126 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -236,9 +236,7 @@ describe('semanticInfo', () => { `function M() { return Base }`, createOptions(''), ), - ).toThrow( - `If "parserOptions.project" has been set for @typescript-eslint/parser, must be included in at least one of the projects provided.`, - ); + ).toThrow(/The file does not match your project config: /); }); it('non-existent project file', () => { diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index e389d7edef33..2ea9199d2638 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -3,5 +3,6 @@ "compilerOptions": { "outDir": "./dist" }, - "include": ["src", "tests", "tools"] + "include": ["src", "tests", "tools"], + "exclude": ["tests/fixtures/**/*"] } From 9e5f21e65afee3b6f4384f6cf1e45ff4d8e720a8 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+Teoxoy@users.noreply.github.com> Date: Mon, 19 Aug 2019 18:11:18 +0200 Subject: [PATCH 32/58] feat(typescript-estree): Accept a glob pattern for `options.project` (#806) --- packages/parser/README.md | 18 +++++++++++++++++- packages/typescript-estree/package.json | 3 +++ packages/typescript-estree/src/parser.ts | 11 +++++++++++ .../typescript-estree/src/tsconfig-parser.ts | 4 ++-- yarn.lock | 7 ++++++- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index 718e2c82ba50..c0e0187b314e 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -50,9 +50,25 @@ The following additional configuration options are available by specifying them - **`project`** - default `undefined`. This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. You may want to use this setting in tandem with the `tsconfigRootDir` option below. + - Accepted values: + + ```js + // path + project: './tsconfig.json'; + + // glob pattern + project: './packages/**/tsconfig.json'; + + // array of paths and/or glob patterns + project: [ + './packages/**/tsconfig.json', + './separate-package/tsconfig.json', + ]; + ``` + - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```ts + ```js { // extend your base config so you don't have to redefine your compilerOptions "extends": "./tsconfig.json", diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d7c8bae66ef9..9400fb5def34 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -41,6 +41,8 @@ "unit-tests": "jest \"./tests/lib/.*\"" }, "dependencies": { + "glob": "^7.1.4", + "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", "semver": "^6.2.0" }, @@ -50,6 +52,7 @@ "@babel/types": "^7.3.2", "@types/babel-code-frame": "^6.20.1", "@types/glob": "^7.1.1", + "@types/is-glob": "^4.0.1", "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 1b89136928a6..df8df03f0c29 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,6 +1,8 @@ import path from 'path'; import semver from 'semver'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports +import { sync as globSync } from 'glob'; +import isGlob from 'is-glob'; import { astConverter } from './ast-converter'; import { convertError } from './convert'; import { firstDefined } from './node-utils'; @@ -285,6 +287,15 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.projects = options.project; } + // Transform glob patterns into paths + if (extra.projects) { + extra.projects = extra.projects.reduce( + (projects, project) => + projects.concat(isGlob(project) ? globSync(project) : project), + [], + ); + } + if (typeof options.tsconfigRootDir === 'string') { extra.tsconfigRootDir = options.tsconfigRootDir; } diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index affbe0906276..364dd0543c8e 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -72,7 +72,7 @@ function getTsconfigPath(tsconfigPath: string, extra: Extra): string { * @param code The code being linted * @param filePath The path of the file being parsed * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.project Provided tsconfig paths + * @param extra.projects Provided tsconfig paths * @returns The programs corresponding to the supplied tsconfig paths */ export function calculateProjectParserOptions( @@ -207,7 +207,7 @@ export function calculateProjectParserOptions( * @param code The code being linted * @param filePath The file being linted * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.project Provided tsconfig paths + * @param extra.projects Provided tsconfig paths * @returns The program containing just the file being linted and associated library files */ export function createProgram( diff --git a/yarn.lock b/yarn.lock index c86527946ff0..559279edf28d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1345,6 +1345,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/is-glob@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.1.tgz#a93eec1714172c8eb3225a1cc5eb88c2477b7d00" + integrity sha512-k3RS5HyBPu4h+5hTmIEfPB2rl5P3LnGdQEZrV2b9OWTJVtsUQ2VBcedqYKGqxvZqle5UALUXdSfVA8nf3HfyWQ== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -4706,7 +4711,7 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0: +is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== From 4a29098c5b2484c144f48594d6a62ec342a5cf30 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 17:21:15 -0700 Subject: [PATCH 33/58] docs(parser): clarify project references (#884) Closes #856 --- packages/parser/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index c0e0187b314e..042fb4f5f540 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -66,9 +66,11 @@ The following additional configuration options are available by specifying them ]; ``` + - Note that if you use project references, TypeScript will not automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the `project` field either separately, or via a glob. + - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```js + ```jsonc { // extend your base config so you don't have to redefine your compilerOptions "extends": "./tsconfig.json", From c1c94601a1ab578b2521e3c4fba12650d02a700b Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 21 Aug 2019 01:15:24 +0900 Subject: [PATCH 34/58] docs(eslint-plugin): [explicit-member-accessibility] example (#887) --- .../docs/rules/explicit-member-accessibility.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 3ed9bb7e5d07..9f8c313d3df6 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -79,7 +79,7 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, animalName) { + public constructor(public breed, name) { // Parameter property and constructor this.animalName = name; } @@ -102,7 +102,7 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, animalName) { + public constructor(public breed, name) { // Parameter property and constructor this.animalName = name; } @@ -125,7 +125,7 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, animalName) { + constructor(protected breed, name) { // Parameter property and constructor this.name = name; } From 2a710233e7b00c811c91f866f5d4a1c258bac250 Mon Sep 17 00:00:00 2001 From: Niles Date: Wed, 21 Aug 2019 10:42:58 -0500 Subject: [PATCH 35/58] docs(eslint-plugin): correct typo (#891) --- packages/eslint-plugin/src/configs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/configs/README.md b/packages/eslint-plugin/src/configs/README.md index 3ba76f661e66..95accb694903 100644 --- a/packages/eslint-plugin/src/configs/README.md +++ b/packages/eslint-plugin/src/configs/README.md @@ -52,4 +52,4 @@ If you disagree with a rule (or it disagrees with your codebase), consider using ### Suggesting changes to the recommended set -If you feel _very_, **very**, **_very_** strongly that a specific rule should (or should not) be in the recommended ruleset, please feel free to file an issue along with a **detailed** argument explaning your reasoning. We expect to see you citing concrete evidence supporting why (or why not) a rule is considered best practice. **Please note that if your reasoning is along the lines of "it's what my project/company does", or "I don't like the rule", then we will likely close the request without discussion.** +If you feel _very_, **very**, **_very_** strongly that a specific rule should (or should not) be in the recommended ruleset, please feel free to file an issue along with a **detailed** argument explaining your reasoning. We expect to see you citing concrete evidence supporting why (or why not) a rule is considered best practice. **Please note that if your reasoning is along the lines of "it's what my project/company does", or "I don't like the rule", then we will likely close the request without discussion.** From 6a30de2e00828563d2ddedf5d931f30d07f1a682 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 21 Aug 2019 09:11:41 -0700 Subject: [PATCH 36/58] docs: update contributors list --- .all-contributorsrc | 106 +++++++++++++++++++++++++++------ .prettierignore | 2 + CONTRIBUTORS.md | 56 ++++++++++++++++- package.json | 2 +- tools/generate-contributors.ts | 2 +- yarn.lock | 8 +-- 6 files changed, 149 insertions(+), 27 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index b6b3e43aa31c..f44ccc64c550 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -23,13 +23,6 @@ "profile": "https://github.com/armano2", "contributions": [] }, - { - "login": "soda0289", - "name": "Reyad Attiyat", - "avatar_url": "https://avatars1.githubusercontent.com/u/2373964?v=4", - "profile": "https://github.com/soda0289", - "contributions": [] - }, { "login": "bradzacher", "name": "Brad Zacher", @@ -37,6 +30,13 @@ "profile": "https://github.com/bradzacher", "contributions": [] }, + { + "login": "soda0289", + "name": "Reyad Attiyat", + "avatar_url": "https://avatars1.githubusercontent.com/u/2373964?v=4", + "profile": "https://github.com/soda0289", + "contributions": [] + }, { "login": "weirdpattern", "name": "Patricio Trevino", @@ -60,7 +60,7 @@ }, { "login": "uniqueiniquity", - "name": "Benjamin Lichtman", + "name": "Ben Lichtman", "avatar_url": "https://avatars1.githubusercontent.com/u/9092011?v=4", "profile": "https://github.com/uniqueiniquity", "contributions": [] @@ -79,6 +79,20 @@ "profile": "https://github.com/Pajn", "contributions": [] }, + { + "login": "mysticatea", + "name": "Toru Nagashima", + "avatar_url": "https://avatars2.githubusercontent.com/u/1937871?v=4", + "profile": "https://github.com/mysticatea", + "contributions": [] + }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars1.githubusercontent.com/u/3335181?v=4", + "profile": "https://github.com/JoshuaKGoldberg", + "contributions": [] + }, { "login": "azz", "name": "Lucas Azzola", @@ -101,10 +115,10 @@ "contributions": [] }, { - "login": "mysticatea", - "name": "Toru Nagashima", - "avatar_url": "https://avatars2.githubusercontent.com/u/1937871?v=4", - "profile": "https://github.com/mysticatea", + "login": "scottohara", + "name": "Scott O'Hara", + "avatar_url": "https://avatars3.githubusercontent.com/u/289327?v=4", + "profile": "https://github.com/scottohara", "contributions": [] }, { @@ -121,6 +135,27 @@ "profile": "https://github.com/lukyth", "contributions": [] }, + { + "login": "ldrick", + "name": "Ricky Lippmann", + "avatar_url": "https://avatars3.githubusercontent.com/u/3674067?v=4", + "profile": "https://github.com/ldrick", + "contributions": [] + }, + { + "login": "SimenB", + "name": "Simen Bekkhus", + "avatar_url": "https://avatars1.githubusercontent.com/u/1404810?v=4", + "profile": "https://github.com/SimenB", + "contributions": [] + }, + { + "login": "gavinbarron", + "name": "Gavin Barron", + "avatar_url": "https://avatars2.githubusercontent.com/u/7122716?v=4", + "profile": "https://github.com/gavinbarron", + "contributions": [] + }, { "login": "platinumazure", "name": "Kevin Partington", @@ -128,18 +163,39 @@ "profile": "https://github.com/platinumazure", "contributions": [] }, + { + "login": "duailibe", + "name": "Lucas Duailibe", + "avatar_url": "https://avatars3.githubusercontent.com/u/1574588?v=4", + "profile": "https://github.com/duailibe", + "contributions": [] + }, + { + "login": "octogonz", + "name": "Pete Gonzalez", + "avatar_url": "https://avatars0.githubusercontent.com/u/4673363?v=4", + "profile": "https://github.com/octogonz", + "contributions": [] + }, { "login": "mightyiam", - "name": "Shahar Or", + "name": "Shahar Dawn Or", "avatar_url": "https://avatars2.githubusercontent.com/u/635591?v=4", "profile": "https://github.com/mightyiam", "contributions": [] }, { - "login": "invalid-email-address", - "name": "Check your git settings!", - "avatar_url": "https://avatars0.githubusercontent.com/u/148100?v=4", - "profile": "https://github.com/invalid-email-address", + "login": "a-tarasyuk", + "name": "Alexander T.", + "avatar_url": "https://avatars0.githubusercontent.com/u/509265?v=4", + "profile": "https://github.com/a-tarasyuk", + "contributions": [] + }, + { + "login": "webschik", + "name": "Denys Kniazevych", + "avatar_url": "https://avatars2.githubusercontent.com/u/1665314?v=4", + "profile": "https://github.com/webschik", "contributions": [] }, { @@ -155,7 +211,21 @@ "avatar_url": "https://avatars1.githubusercontent.com/u/17216317?v=4", "profile": "https://github.com/g-plane", "contributions": [] + }, + { + "login": "ThomasdenH", + "name": "Thomas den Hollander", + "avatar_url": "https://avatars0.githubusercontent.com/u/3889750?v=4", + "profile": "https://github.com/ThomasdenH", + "contributions": [] + }, + { + "login": "madbence", + "name": "Bence Dányi", + "avatar_url": "https://avatars2.githubusercontent.com/u/296735?v=4", + "profile": "https://github.com/madbence", + "contributions": [] } ], - "contributorsPerLine": 7 + "contributorsPerLine": 5 } \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index a86a2f04fc90..aed86e816d43 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,6 +9,8 @@ packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js .github packages/eslint-plugin/src/configs/*.json +.all-contributorsrc +CONTRIBUTORS.md # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d0f6e0b84d64..d458acc3c542 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -3,8 +3,58 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)): - -
James Henry
James Henry

Armano
Armano

Reyad Attiyat
Reyad Attiyat

Brad Zacher
Brad Zacher

Patricio Trevino
Patricio Trevino

Nicholas C. Zakas
Nicholas C. Zakas

Jed Fox
Jed Fox

Benjamin Lichtman
Benjamin Lichtman

Kai Cataldo
Kai Cataldo

Rasmus Eneman
Rasmus Eneman

Lucas Azzola
Lucas Azzola

Danny Fritz
Danny Fritz

Ika
Ika

Toru Nagashima
Toru Nagashima

mackie
mackie

Kanitkorn Sujautra
Kanitkorn Sujautra

Kevin Partington
Kevin Partington

Shahar Or
Shahar Or

Check your git settings!
Check your git settings!

Philipp A.
Philipp A.

Pig Fang
Pig Fang

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
James Henry
James Henry

Armano
Armano

Brad Zacher
Brad Zacher

Reyad Attiyat
Reyad Attiyat

Patricio Trevino
Patricio Trevino

Nicholas C. Zakas
Nicholas C. Zakas

Jed Fox
Jed Fox

Ben Lichtman
Ben Lichtman

Kai Cataldo
Kai Cataldo

Rasmus Eneman
Rasmus Eneman

Toru Nagashima
Toru Nagashima

Josh Goldberg
Josh Goldberg

Lucas Azzola
Lucas Azzola

Danny Fritz
Danny Fritz

Ika
Ika

Scott O'Hara
Scott O'Hara

mackie
mackie

Kanitkorn Sujautra
Kanitkorn Sujautra

Ricky Lippmann
Ricky Lippmann

Simen Bekkhus
Simen Bekkhus

Gavin Barron
Gavin Barron

Kevin Partington
Kevin Partington

Lucas Duailibe
Lucas Duailibe

Pete Gonzalez
Pete Gonzalez

Shahar Dawn Or
Shahar Dawn Or

Alexander T.
Alexander T.

Denys Kniazevych
Denys Kniazevych

Philipp A.
Philipp A.

Pig Fang
Pig Fang

Thomas den Hollander
Thomas den Hollander

Bence Dányi
Bence Dányi

+ + + -This list is auto-generated using `yarn generate-contributors`. +This list is auto-generated using `yarn generate-contributors`. It shows the top 100 contributors with > 3 contributions. diff --git a/package.json b/package.json index d0c730ff1b4f..da363951d700 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@commitlint/travis-cli": "^8.1.0", "@types/jest": "^24.0.15", "@types/node": "^12.6.8", - "all-contributors-cli": "^6.8.0", + "all-contributors-cli": "^6.8.1", "cz-conventional-changelog": "2.1.0", "eslint": "^6.0.0", "eslint-plugin-eslint-comments": "^3.1.2", diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 11b237656153..86de07723951 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -99,7 +99,7 @@ async function main(): Promise { imageSize: 100, commit: false, contributors, - contributorsPerLine: 7, + contributorsPerLine: 5, }; const rcPath = path.resolve(__dirname, '../.all-contributorsrc'); fs.writeFileSync(rcPath, JSON.stringify(allContributorsConfig, null, 2)); diff --git a/yarn.lock b/yarn.lock index 559279edf28d..7fef7edc509e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1706,10 +1706,10 @@ ajv@^6.10.0, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -all-contributors-cli@^6.8.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.8.0.tgz#1b98e9ee60ca3724ef50fb7469b8e85de1ebdec9" - integrity sha512-7xYAmljxgGL4w0XTRBuGTJMqf/xTGhvPyRbIp2InKfn0INo08faCT6gP18iyYMpVPotgAUcaGTeLrewh2IP54Q== +all-contributors-cli@^6.8.1: + version "6.8.1" + resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.8.1.tgz#70c8c560ad05d054c09798d4a155887c82c5d553" + integrity sha512-06nnLE9Gl0gGqUIzmELNT/k8IWF31Xgq97GkuMJjEOS+3DFXuJ/0U+AJwa9UxP3Ivlqn484xXx4o3XDqPhytjA== dependencies: "@babel/runtime" "^7.2.0" async "^3.0.1" From 29fddfd149599c241d011fb9e1eb2bc830098d4e Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Thu, 22 Aug 2019 02:48:44 +1000 Subject: [PATCH 37/58] fix(eslint-plugin): [require-await] Allow concise arrow function bodies (#826) --- .../eslint-plugin/src/rules/require-await.ts | 26 ++++++++++-- .../tests/rules/require-await.test.ts | 42 ++++++++++++++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 7441b4648966..065066dece2c 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -64,6 +64,15 @@ export default util.createRule({ case AST_NODE_TYPES.ArrowFunctionExpression: rules.ArrowFunctionExpression(node); + + // If body type is not BlockStatment, we need to check the return type here + if (node.body.type !== AST_NODE_TYPES.BlockStatement) { + const expression = parserServices.esTreeNodeToTSNodeMap.get( + node.body, + ); + scopeInfo.returnsPromise = isThenableType(expression); + } + break; } } @@ -102,6 +111,18 @@ export default util.createRule({ } } + /** + * Checks if the node returns a thenable type + * + * @param {ASTNode} node - The node to check + * @returns {boolean} + */ + function isThenableType(node: ts.Node) { + const type = checker.getTypeAtLocation(node); + + return tsutils.isThenableType(checker, node, type); + } + return { 'FunctionDeclaration[async = true]': enterFunction, 'FunctionExpression[async = true]': enterFunction, @@ -122,10 +143,7 @@ export default util.createRule({ return; } - const type = checker.getTypeAtLocation(expression); - if (tsutils.isThenableType(checker, expression, type)) { - scopeInfo.returnsPromise = true; - } + scopeInfo.returnsPromise = isThenableType(expression); }, AwaitExpression: rules.AwaitExpression as TSESLint.RuleFunction< diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 3ea207713b2d..38a925de1d2c 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -41,9 +41,15 @@ ruleTester.run('require-await', rule, { }`, }, { - // Non-async arrow function expression + // Non-async arrow function expression (concise-body) code: `const numberOne = (): number => 1;`, }, + { + // Non-async arrow function expression (block-body) + code: `const numberOne = (): number => { + return 1; + };`, + }, { // Async function declaration with await code: `async function numberOne(): Promise { @@ -57,9 +63,15 @@ ruleTester.run('require-await', rule, { }`, }, { - // Async arrow function expression with await + // Async arrow function expression with await (concise-body) code: `const numberOne = async (): Promise => await 1;`, }, + { + // Async arrow function expression with await (block-body) + code: `const numberOne = async (): Promise => { + return await 1; + };`, + }, { // Async function declaration with promise return code: `async function numberOne(): Promise { @@ -72,6 +84,16 @@ ruleTester.run('require-await', rule, { return Promise.resolve(1); }`, }, + { + // Async arrow function with promise return (concise-body) + code: `const numberOne = async (): Promise => Promise.resolve(1);`, + }, + { + // Async arrow function with promise return (block-body) + code: `const numberOne = async (): Promise => { + return Promise.resolve(1); + };`, + }, { // Async function declaration with async function return code: `async function numberOne(): Promise { @@ -90,6 +112,22 @@ ruleTester.run('require-await', rule, { return Promise.resolve(x); }`, }, + { + // Async arrow function with async function return (concise-body) + code: `const numberOne = async (): Promise => getAsyncNumber(1); + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + }, + { + // Async arrow function with async function return (block-body) + code: `const numberOne = async (): Promise => { + return getAsyncNumber(1); + }; + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + }, ], invalid: [ From 92e2b31c77bae0c8c541ef2ae5032e1f0a37aae9 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 23 Aug 2019 12:41:28 +1200 Subject: [PATCH 38/58] chore(parser): add `types` field to `package.json` (#893) --- packages/parser/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/parser/package.json b/packages/parser/package.json index 4d67b9a555e5..bda37838c79f 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -3,6 +3,7 @@ "version": "2.0.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", + "types": "dist/parser.d.ts", "files": [ "dist", "README.md", From cddfdca913b1baa958151e237eac947eaea8f31b Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Sat, 24 Aug 2019 01:30:51 +1000 Subject: [PATCH 39/58] fix(eslint-plugin): [promise-function-async] Allow async get/set (#820) --- .../eslint-plugin/src/rules/promise-function-async.ts | 8 ++++++++ .../tests/rules/promise-function-async.test.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 225b2bd83675..8ec816b456b1 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -103,6 +103,14 @@ export default util.createRule({ return; } + if ( + node.parent && + node.parent.type === 'Property' && + (node.parent.kind === 'get' || node.parent.kind === 'set') + ) { + return; + } + context.report({ messageId: 'missingAsync', node, diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 829bb9a091c6..ed798ca18e27 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -63,6 +63,12 @@ const invalidAsyncModifiers = { }, set asyncGetter(p: Promise) { return p; + }, + get asyncGetterFunc() { + return async () => new Promise(); + }, + set asyncGetterFunc(p: () => Promise) { + return p; } } `, From 5ab13a8d651f02dbf60a41ff2d2ac646f632635b Mon Sep 17 00:00:00 2001 From: Ryan Wilson-Perkin Date: Sat, 24 Aug 2019 15:20:14 -0400 Subject: [PATCH 40/58] docs(eslint-plugin): no-var-requires: Add example for ES6 modules (#900) Fixes #899 Adds an example to the documentation for replacing `require` with ES6 modules. Since this isn't going to work on everyone's system, I'm happy to also add a comment on this line stating the restrictions if the maintainers of this think it would be appropriate. --- packages/eslint-plugin/docs/rules/no-var-requires.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-plugin/docs/rules/no-var-requires.md b/packages/eslint-plugin/docs/rules/no-var-requires.md index b5e57bdcbfe2..fb8e7a547216 100644 --- a/packages/eslint-plugin/docs/rules/no-var-requires.md +++ b/packages/eslint-plugin/docs/rules/no-var-requires.md @@ -17,6 +17,7 @@ Examples of **correct** code for this rule: ```ts import foo = require('foo'); require('foo'); +import foo from 'foo'; ``` ## When Not To Use It From 16136f3ef8a58450e416967d4cb9d1ee0158eae8 Mon Sep 17 00:00:00 2001 From: Austin Gatlin Date: Tue, 27 Aug 2019 23:34:12 +0700 Subject: [PATCH 41/58] docs(eslint-plugin): correct typo in no-unused-vars (#910) --- packages/eslint-plugin/docs/rules/no-unused-vars.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md index 9cb7a52fe651..f6091165b7ce 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.md +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md @@ -76,7 +76,7 @@ myFunc = setTimeout(function() { myFunc(); }, 50); -// Only the second argument from the descructured array is used. +// Only the second argument from the destructured array is used. function getY([, y]) { return y; } From 56034736fb3ce6b4d573996a78d408966f67649d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 27 Aug 2019 12:56:31 -0400 Subject: [PATCH 42/58] fix(eslint-plugin): [typedef] don't flag destructuring when variables is disabled (#819) --- packages/eslint-plugin/src/rules/typedef.ts | 51 +++++++++---------- .../eslint-plugin/tests/rules/typedef.test.ts | 18 +++++++ 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 182568e57488..3d9d76f3872f 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -141,36 +141,35 @@ export default util.createRule<[Options], MessageIds>({ }, VariableDeclarator(node): void { if ( - options[OptionKeys.VariableDeclaration] && - !node.id.typeAnnotation + !options[OptionKeys.VariableDeclaration] || + node.id.typeAnnotation || + (node.id.type === AST_NODE_TYPES.ArrayPattern && + !options[OptionKeys.ArrayDestructuring]) || + (node.id.type === AST_NODE_TYPES.ObjectPattern && + !options[OptionKeys.ObjectDestructuring]) ) { - // Are we inside a context that does not allow type annotations? - let typeAnnotationRequired = true; - - let current: TSESTree.Node | undefined = node.parent; - while (current) { - switch (current.type) { - case AST_NODE_TYPES.VariableDeclaration: - // Keep looking upwards - current = current.parent; - break; - case AST_NODE_TYPES.ForOfStatement: - case AST_NODE_TYPES.ForInStatement: - // Stop traversing and don't report an error - typeAnnotationRequired = false; - current = undefined; - break; - default: - // Stop traversing - current = undefined; - break; - } - } + return; + } - if (typeAnnotationRequired) { - report(node, getNodeName(node.id)); + let current: TSESTree.Node | undefined = node.parent; + while (current) { + switch (current.type) { + case AST_NODE_TYPES.VariableDeclaration: + // Keep looking upwards + current = current.parent; + break; + case AST_NODE_TYPES.ForOfStatement: + case AST_NODE_TYPES.ForInStatement: + // Stop traversing and don't report an error + return; + default: + // Stop traversing + current = undefined; + break; } } + + report(node, getNodeName(node.id)); }, }; }, diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index b1a7b08bcf09..d5ea514f59eb 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -198,6 +198,24 @@ ruleTester.run('typedef', rule, { }, ], }, + { + code: `const [a, b] = [1, 2];`, + options: [ + { + objectDestructuring: false, + variableDeclaration: true, + }, + ], + }, + { + code: `const { a, b } = { a: '', b: '' };`, + options: [ + { + objectDestructuring: false, + variableDeclaration: true, + }, + ], + }, // Contexts where TypeScript doesn't allow annotations { code: `for (x of [1, 2, 3]) { }`, From 344bafe5c7b17611f496de52f10c0ed556fe81c7 Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Wed, 28 Aug 2019 03:32:18 +1000 Subject: [PATCH 43/58] fix(eslint-plugin): [unbound-method] Allow typeof expressions (Fixes #692) (#904) --- packages/eslint-plugin/src/rules/unbound-method.ts | 3 +++ packages/eslint-plugin/tests/rules/unbound-method.test.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index c76ac76f9d03..8be7a842c461 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -120,6 +120,9 @@ function isSafeUse(node: TSESTree.Node): boolean { case AST_NODE_TYPES.TaggedTemplateExpression: return parent.tag === node; + case AST_NODE_TYPES.UnaryExpression: + return parent.operator === 'typeof'; + case AST_NODE_TYPES.TSNonNullExpression: case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 061b4edf524b..2c0d1aaf188f 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -97,6 +97,12 @@ instane.boundStatic && 0; ContainsMethods.boundStatic ? 1 : 0; ContainsMethods.unboundStatic ? 1 : 0; + +typeof instance.bound === 'function'; +typeof instance.unbound === 'function'; + +typeof ContainsMethods.boundStatic === 'function'; +typeof ContainsMethods.unboundStatic === 'function'; `, `interface RecordA { readonly type: "A" From 29a01b801063f661c396980810ffbebfd54a8fce Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 28 Aug 2019 21:30:23 +0300 Subject: [PATCH 44/58] fix(eslint-plugin): [unbound-method] false positive in equality comparisons (#914) --- packages/eslint-plugin/src/rules/unbound-method.ts | 3 +++ .../eslint-plugin/tests/rules/unbound-method.test.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 8be7a842c461..46bbe779c66c 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -123,6 +123,9 @@ function isSafeUse(node: TSESTree.Node): boolean { case AST_NODE_TYPES.UnaryExpression: return parent.operator === 'typeof'; + case AST_NODE_TYPES.BinaryExpression: + return ['instanceof', '==', '!=', '===', '!=='].includes(parent.operator); + case AST_NODE_TYPES.TSNonNullExpression: case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 2c0d1aaf188f..520b28fc1d1d 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -52,15 +52,27 @@ instance.unbound\`\`; if (instance.bound) { } if (instance.unbound) { } +if (instance.bound !== undefined) { } +if (instance.unbound !== undefined) { } + if (ContainsMethods.boundStatic) { } if (ContainsMethods.unboundStatic) { } +if (ContainsMethods.boundStatic !== undefined) { } +if (ContainsMethods.unboundStatic !== undefined) { } + while (instance.bound) { } while (instance.unbound) { } +while (instance.bound !== undefined) { } +while (instance.unbound !== undefined) { } + while (ContainsMethods.boundStatic) { } while (ContainsMethods.unboundStatic) { } +while (ContainsMethods.boundStatic !== undefined) { } +while (ContainsMethods.unboundStatic !== undefined) { } + instance.bound as any; ContainsMethods.boundStatic as any; From a4e625fc97d05e6bce82f58cd2a877cc35a87820 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 29 Aug 2019 19:33:12 +0300 Subject: [PATCH 45/58] fix(eslint-plugin): [no-inferrable-types] ignore optional props (#918) --- packages/eslint-plugin/src/rules/no-inferrable-types.ts | 2 +- .../tests/rules/no-inferrable-types.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index 40fc6a60c7eb..92a582526795 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -250,7 +250,7 @@ export default util.createRule({ // Essentially a readonly property without a type // will result in its value being the type, leading to // compile errors if the type is stripped. - if (ignoreProperties || node.readonly) { + if (ignoreProperties || node.readonly || node.optional) { return; } reportInferrableType(node, node.typeAnnotation, node.value); diff --git a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts index fb2563ed4eeb..2301d6eda5c2 100644 --- a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts +++ b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts @@ -123,6 +123,15 @@ ruleTester.run('no-inferrable-types', rule, { "class Foo { a: number = 5; b: boolean = true; c: string = 'foo'; }", options: [{ ignoreProperties: true }], }, + { + code: ` +class Foo { + a?: number = 5; + b?: boolean = true; + c?: string = 'foo'; +} + `, + }, ], invalid: [ From 6bd7f2d0c0df0361b96509e337e60c77467fde36 Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Fri, 30 Aug 2019 04:32:03 +0300 Subject: [PATCH 46/58] fix(eslint-plugin): [typedef] handle AssignmentPattern inside TSParameterProperty (#923) --- packages/eslint-plugin/src/rules/typedef.ts | 9 ++++ .../eslint-plugin/tests/rules/typedef.test.ts | 47 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 3d9d76f3872f..19c4244d9f99 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -79,6 +79,15 @@ export default util.createRule<[Options], MessageIds>({ break; case AST_NODE_TYPES.TSParameterProperty: annotationNode = param.parameter; + + // Check TS parameter property with default value like `constructor(private param: string = 'something') {}` + if ( + annotationNode && + annotationNode.type === AST_NODE_TYPES.AssignmentPattern + ) { + annotationNode = annotationNode.left; + } + break; default: annotationNode = param; diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index d5ea514f59eb..c9e35c356eb2 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -109,6 +109,19 @@ ruleTester.run('typedef', rule, { `function receivesString({ a }: { a: string }): void { }`, `function receivesStrings({ a, b }: { [i: string ]: string }): void { }`, `function receivesNumber(a: number = 123): void { }`, + // Constructor parameters + `class Test { + constructor() {} + }`, + `class Test { + constructor(param: string) {} + }`, + `class Test { + constructor(param: string = 'something') {} + }`, + `class Test { + constructor(private param: string = 'something') {} + }`, // Method parameters `class Test { public method(x: number): number { return x; } @@ -401,6 +414,40 @@ ruleTester.run('typedef', rule, { }, ], }, + // Constructor parameters + { + code: `class Test { + constructor(param) {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedefNamed', + }, + ], + }, + { + code: `class Test { + constructor(param = 'something') {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedef', + }, + ], + }, + { + code: `class Test { + constructor(private param = 'something') {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedef', + }, + ], + }, // Method parameters { code: `class Test { From 65eb99348c8694fc1437f6b601454d2ad0e2834f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 30 Aug 2019 19:17:21 +0300 Subject: [PATCH 47/58] feat(eslint-plugin): [expl-func-ret-type] make error loc smaller (#919) --- .../rules/explicit-function-return-type.ts | 49 +++++++ .../explicit-function-return-type.test.ts | 122 +++++++++++++++++- 2 files changed, 166 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index da3e7334b6ab..b050578c189a 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -1,6 +1,7 @@ import { TSESTree, AST_NODE_TYPES, + AST_TOKEN_TYPES, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -57,6 +58,53 @@ export default util.createRule({ }, ], create(context, [options]) { + const sourceCode = context.getSourceCode(); + + /** + * Returns start column position + * @param node + */ + function getLocStart( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): TSESTree.LineAndColumnData { + /* highlight method name */ + const parent = node.parent; + if ( + parent && + (parent.type === AST_NODE_TYPES.MethodDefinition || + (parent.type === AST_NODE_TYPES.Property && parent.method)) + ) { + return parent.loc.start; + } + + return node.loc.start; + } + + /** + * Returns end column position + * @param node + */ + function getLocEnd( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): TSESTree.LineAndColumnData { + /* highlight `=>` */ + if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { + return sourceCode.getTokenBefore( + node.body, + token => + token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', + )!.loc.end; + } + + return sourceCode.getTokenBefore(node.body!)!.loc.end; + } + /** * Checks if a node is a constructor. * @param node The node to check @@ -258,6 +306,7 @@ export default util.createRule({ context.report({ node, + loc: { start: getLocStart(node), end: getLocEnd(node) }, messageId: 'missingReturnType', }); } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 942ed5ea2e89..0c67b903ceeb 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -327,15 +327,37 @@ const func = (value: number) => x as const; { filename: 'test.ts', code: ` +function test( + a: number, + b: number, +) { + return; +} + `, + errors: [ + { + messageId: 'missingReturnType', + line: 2, + endLine: 5, + column: 1, + endColumn: 2, + }, + ], + }, + { + filename: 'test.ts', + code: ` function test() { - return; + return; } `, errors: [ { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 1, + endColumn: 16, }, ], }, @@ -343,14 +365,16 @@ function test() { filename: 'test.ts', code: ` var fn = function() { - return 1; + return 1; }; `, errors: [ { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 10, + endColumn: 20, }, ], }, @@ -363,7 +387,9 @@ var arrowFn = () => 'test'; { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 15, + endColumn: 20, }, ], }, @@ -380,23 +406,39 @@ class Test { return; } arrow = () => 'arrow'; + private method() { + return; + } } `, errors: [ { messageId: 'missingReturnType', line: 4, - column: 11, + endLine: 4, + column: 3, + endColumn: 13, }, { messageId: 'missingReturnType', line: 8, - column: 9, + endLine: 8, + column: 3, + endColumn: 11, }, { messageId: 'missingReturnType', line: 11, + endLine: 11, column: 11, + endColumn: 16, + }, + { + messageId: 'missingReturnType', + line: 12, + endLine: 12, + column: 3, + endColumn: 19, }, ], }, @@ -412,7 +454,9 @@ function test() { { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 1, + endColumn: 16, }, ], }, @@ -424,7 +468,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 13, + endColumn: 18, }, ], }, @@ -436,7 +482,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 13, + endColumn: 23, }, ], }, @@ -448,7 +496,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 21, }, ], }, @@ -460,7 +510,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 26, }, ], }, @@ -472,7 +524,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 15, + endColumn: 20, }, ], }, @@ -484,7 +538,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 26, }, ], }, @@ -497,6 +553,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, + column: 12, + endColumn: 17, }, ], }, @@ -513,6 +572,9 @@ const x = { { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 8, + endColumn: 13, }, ], }, @@ -529,6 +591,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 8, + endColumn: 13, }, ], }, @@ -540,7 +605,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 7, + endColumn: 12, }, ], }, @@ -552,7 +619,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 7, + endColumn: 18, }, ], }, @@ -564,7 +633,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 21, }, ], }, @@ -576,7 +647,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 27, }, ], }, @@ -588,7 +661,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 24, + endColumn: 29, }, ], }, @@ -600,7 +675,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 24, + endColumn: 35, }, ], }, @@ -623,7 +700,9 @@ function FunctionDeclaration() { { messageId: 'missingReturnType', line: 7, + endLine: 7, column: 11, + endColumn: 16, }, ], }, @@ -635,7 +714,9 @@ function FunctionDeclaration() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 22, + endColumn: 27, }, ], }, @@ -659,22 +740,37 @@ foo(() => '') { messageId: 'missingReturnType', line: 3, + endLine: 3, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 5, + endLine: 5, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 6, + endLine: 6, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 7, + endLine: 7, + column: 5, + endColumn: 10, }, ], }, @@ -700,7 +796,9 @@ new Accumulator().accumulate(() => 1); { messageId: 'missingReturnType', line: 10, + endLine: 10, column: 30, + endColumn: 35, }, ], }, @@ -716,7 +814,9 @@ new Accumulator().accumulate(() => 1); { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 2, + endColumn: 7, }, ], }, @@ -749,17 +849,23 @@ foo({ { messageId: 'missingReturnType', line: 4, - column: 7, + endLine: 4, + column: 3, + endColumn: 9, }, { messageId: 'missingReturnType', line: 9, + endLine: 9, column: 9, + endColumn: 20, }, { messageId: 'missingReturnType', line: 14, + endLine: 14, column: 9, + endColumn: 14, }, ], }, @@ -778,12 +884,16 @@ const func = (value: number) => ({ type: "X", value } as Action); { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 14, + endColumn: 32, }, { messageId: 'missingReturnType', line: 3, + endLine: 3, column: 14, + endColumn: 32, }, ], }, @@ -801,7 +911,9 @@ const func = (value: number) => ({ type: "X", value } as const); { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 14, + endColumn: 32, }, ], }, From 989c13a359519f40fc8c74cc86c4a017dee94c09 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 30 Aug 2019 16:14:05 -0700 Subject: [PATCH 48/58] docs(eslint-plugin): [efrt] fix default values in docs --- .../eslint-plugin/docs/rules/explicit-function-return-type.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index f31d6f42b8ba..5f729129b7a3 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -73,8 +73,8 @@ type Options = { const defaults = { allowExpressions: false, - allowTypedFunctionExpressions: false, - allowHigherOrderFunctions: false, + allowTypedFunctionExpressions: true, + allowHigherOrderFunctions: true, }; ``` From 6849dc849797289267df17e2425c5098d76ed89f Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 2 Sep 2019 17:02:07 +0000 Subject: [PATCH 49/58] chore: publish v2.1.0 --- CHANGELOG.md | 30 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++ packages/eslint-plugin-tslint/package.json | 6 ++--- packages/eslint-plugin/CHANGELOG.md | 29 +++++++++++++++++++++ packages/eslint-plugin/package.json | 4 +-- packages/experimental-utils/CHANGELOG.md | 8 ++++++ packages/experimental-utils/package.json | 4 +-- packages/parser/CHANGELOG.md | 16 ++++++++++++ packages/parser/package.json | 8 +++--- packages/shared-fixtures/CHANGELOG.md | 8 ++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 18 +++++++++++++ packages/typescript-estree/package.json | 4 +-- 14 files changed, 132 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 306e15820217..547ce16d62b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [member-naming] should match constructor args ([#771](https://github.com/typescript-eslint/typescript-eslint/issues/771)) ([b006667](https://github.com/typescript-eslint/typescript-eslint/commit/b006667)) +* **eslint-plugin:** [no-inferrable-types] ignore optional props ([#918](https://github.com/typescript-eslint/typescript-eslint/issues/918)) ([a4e625f](https://github.com/typescript-eslint/typescript-eslint/commit/a4e625f)) +* **eslint-plugin:** [promise-function-async] Allow async get/set ([#820](https://github.com/typescript-eslint/typescript-eslint/issues/820)) ([cddfdca](https://github.com/typescript-eslint/typescript-eslint/commit/cddfdca)) +* **eslint-plugin:** [require-await] Allow concise arrow function bodies ([#826](https://github.com/typescript-eslint/typescript-eslint/issues/826)) ([29fddfd](https://github.com/typescript-eslint/typescript-eslint/commit/29fddfd)) +* **eslint-plugin:** [typedef] don't flag destructuring when variables is disabled ([#819](https://github.com/typescript-eslint/typescript-eslint/issues/819)) ([5603473](https://github.com/typescript-eslint/typescript-eslint/commit/5603473)) +* **eslint-plugin:** [typedef] handle AssignmentPattern inside TSParameterProperty ([#923](https://github.com/typescript-eslint/typescript-eslint/issues/923)) ([6bd7f2d](https://github.com/typescript-eslint/typescript-eslint/commit/6bd7f2d)) +* **eslint-plugin:** [unbound-method] Allow typeof expressions (Fixes [#692](https://github.com/typescript-eslint/typescript-eslint/issues/692)) ([#904](https://github.com/typescript-eslint/typescript-eslint/issues/904)) ([344bafe](https://github.com/typescript-eslint/typescript-eslint/commit/344bafe)) +* **eslint-plugin:** [unbound-method] false positive in equality comparisons ([#914](https://github.com/typescript-eslint/typescript-eslint/issues/914)) ([29a01b8](https://github.com/typescript-eslint/typescript-eslint/commit/29a01b8)) +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **eslint-plugin:** readme typo ([#867](https://github.com/typescript-eslint/typescript-eslint/issues/867)) ([5eb40dc](https://github.com/typescript-eslint/typescript-eslint/commit/5eb40dc)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* [no-unnecessary-type-assertion] allow `as const` arrow functions ([#876](https://github.com/typescript-eslint/typescript-eslint/issues/876)) ([14c6f80](https://github.com/typescript-eslint/typescript-eslint/commit/14c6f80)) +* **eslint-plugin:** [expl-func-ret-type] make error loc smaller ([#919](https://github.com/typescript-eslint/typescript-eslint/issues/919)) ([65eb993](https://github.com/typescript-eslint/typescript-eslint/commit/65eb993)) +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **eslint-plugin:** add quotes [extension] ([#762](https://github.com/typescript-eslint/typescript-eslint/issues/762)) ([9f82099](https://github.com/typescript-eslint/typescript-eslint/commit/9f82099)) +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/lerna.json b/lerna.json index e4b8a9078807..0380f9287e83 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.0", + "version": "2.1.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 1339f31787c9..ff9b5e6cecef 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index a35949dc244b..7250c2f6cb70 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "2.0.0", + "version": "2.1.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.0.0" + "@typescript-eslint/parser": "2.1.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index ac4b1f894c4d..699d0e12c9bc 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [member-naming] should match constructor args ([#771](https://github.com/typescript-eslint/typescript-eslint/issues/771)) ([b006667](https://github.com/typescript-eslint/typescript-eslint/commit/b006667)) +* **eslint-plugin:** [no-inferrable-types] ignore optional props ([#918](https://github.com/typescript-eslint/typescript-eslint/issues/918)) ([a4e625f](https://github.com/typescript-eslint/typescript-eslint/commit/a4e625f)) +* **eslint-plugin:** [promise-function-async] Allow async get/set ([#820](https://github.com/typescript-eslint/typescript-eslint/issues/820)) ([cddfdca](https://github.com/typescript-eslint/typescript-eslint/commit/cddfdca)) +* **eslint-plugin:** [require-await] Allow concise arrow function bodies ([#826](https://github.com/typescript-eslint/typescript-eslint/issues/826)) ([29fddfd](https://github.com/typescript-eslint/typescript-eslint/commit/29fddfd)) +* **eslint-plugin:** [typedef] don't flag destructuring when variables is disabled ([#819](https://github.com/typescript-eslint/typescript-eslint/issues/819)) ([5603473](https://github.com/typescript-eslint/typescript-eslint/commit/5603473)) +* **eslint-plugin:** [typedef] handle AssignmentPattern inside TSParameterProperty ([#923](https://github.com/typescript-eslint/typescript-eslint/issues/923)) ([6bd7f2d](https://github.com/typescript-eslint/typescript-eslint/commit/6bd7f2d)) +* **eslint-plugin:** [unbound-method] Allow typeof expressions (Fixes [#692](https://github.com/typescript-eslint/typescript-eslint/issues/692)) ([#904](https://github.com/typescript-eslint/typescript-eslint/issues/904)) ([344bafe](https://github.com/typescript-eslint/typescript-eslint/commit/344bafe)) +* **eslint-plugin:** [unbound-method] false positive in equality comparisons ([#914](https://github.com/typescript-eslint/typescript-eslint/issues/914)) ([29a01b8](https://github.com/typescript-eslint/typescript-eslint/commit/29a01b8)) +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **eslint-plugin:** readme typo ([#867](https://github.com/typescript-eslint/typescript-eslint/issues/867)) ([5eb40dc](https://github.com/typescript-eslint/typescript-eslint/commit/5eb40dc)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* [no-unnecessary-type-assertion] allow `as const` arrow functions ([#876](https://github.com/typescript-eslint/typescript-eslint/issues/876)) ([14c6f80](https://github.com/typescript-eslint/typescript-eslint/commit/14c6f80)) +* **eslint-plugin:** [expl-func-ret-type] make error loc smaller ([#919](https://github.com/typescript-eslint/typescript-eslint/issues/919)) ([65eb993](https://github.com/typescript-eslint/typescript-eslint/commit/65eb993)) +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **eslint-plugin:** add quotes [extension] ([#762](https://github.com/typescript-eslint/typescript-eslint/issues/762)) ([9f82099](https://github.com/typescript-eslint/typescript-eslint/commit/9f82099)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6706be22576a..9eb195cabe59 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.0.0", + "version": "2.1.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", "eslint-utils": "^1.4.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 8ea9fd4a22c6..4ed8006f4c7e 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index c4fde675f184..2f58babdc68d 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.0.0", + "version": "2.1.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.0.0", + "@typescript-eslint/typescript-estree": "2.1.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 23eb1182e2a2..0a9561dc15f9 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/parser/package.json b/packages/parser/package.json index bda37838c79f..34e5fb24f220 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.0.0", + "version": "2.1.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.0.0", - "@typescript-eslint/typescript-estree": "2.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", + "@typescript-eslint/typescript-estree": "2.1.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.0.0", + "@typescript-eslint/shared-fixtures": "2.1.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 3aec5aabbcd5..4f65be77af09 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 0fedd2edbe95..86b93d8157cc 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.0.0", + "version": "2.1.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 27a2f9ea6a3c..0fea11fa0f9c 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 9400fb5def34..4abba4d4ca0c 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.0.0", + "version": "2.1.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -56,7 +56,7 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.0.0", + "@typescript-eslint/shared-fixtures": "2.1.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 9fce08d555f54f66c6de69f9d9e7f062e46f7782 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 2 Sep 2019 13:41:49 -0400 Subject: [PATCH 50/58] chore(README): update notes regarding releases (#936) --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eabb3ee2eac6..7fb38e917662 100644 --- a/README.md +++ b/README.md @@ -187,16 +187,20 @@ If you are interested in using TypeScript and ESLint together, you will want to All of the packages are published with the same version number to make it easier to coordinate both releases and installations. -Additionally, we also publish a canary release on every successful merge to master, so you never need to wait for a new stable version to make use of any updates. +We publish a canary release on every successful merge to master, so **you never need to wait for a new stable version to make use of any updates**. -The `latest` (stable) version is: +Additionally, we promote the to the `latest` tag on NPM once per week, **on Mondays at 1pm Eastern**. + +The latest version under the `latest` tag is: NPM Version -The `canary` (latest master) version is: +The latest version under the `canary` tag **(latest commit to master)** is: NPM Version +(Note: The only exceptions to the automated publishes described above are when we are in the final phases of creating the next major version of the libraries - e.g. going from 1.x.x to 2.x.x. During these periods, we manually publish `canary` releases until we are happy with the release and promote it to `latest`.) +
## Supported TypeScript Version From 0f63e3fefbb240e3d80e885b44bbf0d3f841e064 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 2 Sep 2019 12:40:46 -0700 Subject: [PATCH 51/58] chore: support typescript 3.6 (#916) --- .eslintrc.js | 1 + package.json | 26 +- .../eslint-plugin-tslint/tests/index.spec.ts | 2 +- packages/eslint-plugin/package.json | 6 +- .../src/rules/no-extra-parens.ts | 5 + .../eslint-plugin/src/rules/no-type-alias.ts | 4 +- packages/eslint-plugin/src/rules/quotes.ts | 4 +- .../eslint-plugin/src/rules/require-await.ts | 2 +- .../eslint-plugin/typings/eslint-rules.d.ts | 1 + packages/experimental-utils/package.json | 2 +- packages/parser/package.json | 2 +- .../lib/__snapshots__/typescript.ts.snap | 1037 ++++--- .../basics/keyword-variables.src.ts | 14 +- packages/typescript-estree/package.json | 6 +- packages/typescript-estree/src/parser.ts | 2 +- .../tests/ast-alignment/fixtures-to-test.ts | 22 + .../tests/lib/__snapshots__/convert.ts.snap | 2 +- .../lib/__snapshots__/javascript.ts.snap | 5 +- .../lib/__snapshots__/typescript.ts.snap | 1417 +++++----- yarn.lock | 2439 ++++++++++------- 20 files changed, 2825 insertions(+), 2174 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ef3d195354eb..6ae76ac3b6cb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,6 +23,7 @@ module.exports = { // '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], + '@typescript-eslint/explicit-function-return-type': 'error', '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-use-before-define': 'off', diff --git a/package.json b/package.json index da363951d700..2cd6dc2b9e34 100644 --- a/package.json +++ b/package.json @@ -53,26 +53,26 @@ "@commitlint/cli": "^8.1.0", "@commitlint/config-conventional": "^8.1.0", "@commitlint/travis-cli": "^8.1.0", - "@types/jest": "^24.0.15", - "@types/node": "^12.6.8", + "@types/jest": "^24.0.18", + "@types/node": "^12.7.2", "all-contributors-cli": "^6.8.1", - "cz-conventional-changelog": "2.1.0", - "eslint": "^6.0.0", + "cz-conventional-changelog": "^3.0.2", + "eslint": "^6.2.2", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-plugin": "^2.1.0", - "eslint-plugin-import": "^2.18.0", - "eslint-plugin-jest": "^22.10.0", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-jest": "^22.15.2", "glob": "^7.1.4", - "husky": "^3.0.0", + "husky": "^3.0.4", "isomorphic-fetch": "^2.2.1", - "jest": "^24.8.0", - "lerna": "^3.15.0", - "lint-staged": "^9.2.0", + "jest": "^24.9.0", + "lerna": "^3.16.4", + "lint-staged": "^9.2.5", "prettier": "^1.18.2", - "rimraf": "^2.6.3", + "rimraf": "^3.0.0", "ts-jest": "^24.0.0", "ts-node": "^8.3.0", - "tslint": "^5.18.0", - "typescript": ">=3.2.1 <3.6.0" + "tslint": "^5.19.0", + "typescript": ">=3.2.1 <3.7.0" } } diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts index 0de1046ecf3f..4a4de5ac8d58 100644 --- a/packages/eslint-plugin-tslint/tests/index.spec.ts +++ b/packages/eslint-plugin-tslint/tests/index.spec.ts @@ -139,7 +139,7 @@ ruleTester.run('tslint/config', rule, { messageId: 'failure', data: { message: - 'Operands of \'+\' operation must either be both strings or both numbers, but found 1 + "2". Consider using template literals.', + 'Operands of \'+\' operation must either be both strings or both numbers or both bigints, but found 1 + "2". Consider using template literals.', ruleName: 'restrict-plus-operands', }, }, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 9eb195cabe59..c4b76fa4bdb0 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -41,15 +41,15 @@ }, "dependencies": { "@typescript-eslint/experimental-utils": "2.1.0", - "eslint-utils": "^1.4.0", + "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", - "tsutils": "^3.14.0" + "tsutils": "^3.17.1" }, "devDependencies": { "@types/json-schema": "^7.0.3", "@types/marked": "^0.6.5", - "@types/prettier": "^1.18.0", + "@types/prettier": "^1.18.2", "chalk": "^2.4.2", "marked": "^0.7.0", "prettier": "*", diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 7b8d091807c3..32904f3199cd 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -179,6 +179,11 @@ export default util.createRule({ return rules.ForStatement(node); }, + 'ForStatement > *.init:exit'(node: TSESTree.Node) { + if (node.type !== AST_NODE_TYPES.TSAsExpression) { + return rules['ForStatement > *.init:exit'](node); + } + }, // IfStatement LogicalExpression: binaryExp, MemberExpression(node) { diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 68d537cc09b8..38816b60a2fa 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -174,7 +174,7 @@ export default util.createRule({ }); } - const isValidTupleType = (type: TypeWithLabel) => { + const isValidTupleType = (type: TypeWithLabel): boolean => { if (type.node.type === AST_NODE_TYPES.TSTupleType) { return true; } @@ -195,7 +195,7 @@ export default util.createRule({ isTopLevel: boolean, type: TypeWithLabel, label: string, - ) => { + ): void => { if ( optionValue === 'never' || !isSupportedComposition(isTopLevel, type.compositionType, optionValue) diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts index 97efc04c821d..97b7a0a17ca2 100644 --- a/packages/eslint-plugin/src/rules/quotes.ts +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -43,7 +43,7 @@ export default util.createRule({ }; return { - Literal(node) { + Literal(node): void { if ( option === 'backtick' && (isModuleDeclaration(node) || isTypeLiteral(node)) @@ -54,7 +54,7 @@ export default util.createRule({ rules.Literal(node); }, - TemplateLiteral(node) { + TemplateLiteral(node): void { rules.TemplateLiteral(node); }, }; diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 065066dece2c..cc5ecc8bf609 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -117,7 +117,7 @@ export default util.createRule({ * @param {ASTNode} node - The node to check * @returns {boolean} */ - function isThenableType(node: ts.Node) { + function isThenableType(node: ts.Node): boolean { const type = checker.getTypeAtLocation(node); return tsutils.isThenableType(checker, node, type); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index dcc37035c9de..9eb02d5cce04 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -387,6 +387,7 @@ declare module 'eslint/lib/rules/no-extra-parens' { node: TSESTree.ForInStatement | TSESTree.ForOfStatement, ): void; ForStatement(node: TSESTree.ForStatement): void; + 'ForStatement > *.init:exit'(node: TSESTree.Node): void; IfStatement(node: TSESTree.IfStatement): void; LogicalExpression(node: TSESTree.LogicalExpression): void; MemberExpression(node: TSESTree.MemberExpression): void; diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 2f58babdc68d..5b87c0b88e15 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -38,7 +38,7 @@ "dependencies": { "@types/json-schema": "^7.0.3", "@typescript-eslint/typescript-estree": "2.1.0", - "eslint-scope": "^4.0.0" + "eslint-scope": "^5.0.0" }, "peerDependencies": { "eslint": "*" diff --git a/packages/parser/package.json b/packages/parser/package.json index 34e5fb24f220..2f5012268b73 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -45,7 +45,7 @@ "@types/eslint-visitor-keys": "^1.0.0", "@typescript-eslint/experimental-utils": "2.1.0", "@typescript-eslint/typescript-estree": "2.1.0", - "eslint-visitor-keys": "^1.0.0" + "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 7b48c204e9ca..7bf48b5ef3a5 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -18536,256 +18536,576 @@ Object { exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` Object { - "$id": 13, + "$id": 20, "block": Object { "range": Array [ 0, - 174, + 190, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 12, + "$id": 19, "block": Object { "range": Array [ 0, - 174, + 190, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "get", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 13, - ], - "type": "Literal", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "set", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 27, - 28, - ], - "type": "Literal", - }, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "module", - "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": Object { - "range": Array [ - 45, - 46, - ], - "type": "Literal", - }, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "type", - "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "range": Array [ - 61, - 62, - ], - "type": "Literal", - }, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "async", - "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": Object { - "range": Array [ - 78, - 79, - ], - "type": "Literal", - }, - }, + "childScopes": Array [ Object { - "$id": 11, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "is", - "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { + "$id": 18, + "block": Object { "range": Array [ - 92, - 93, + 0, + 110, ], - "type": "Literal", + "type": "BlockStatement", }, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 13, - }, - "variableMap": Object { - "async": Object { - "$ref": 4, - }, - "get": Object { - "$ref": 0, - }, - "is": Object { - "$ref": 5, - }, - "module": Object { - "$ref": 2, - }, - "set": Object { - "$ref": 1, - }, - "type": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 12, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 12, + "from": Object { + "$ref": 18, + }, + "identifier": Object { "name": "get", "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 6, + }, + "writeExpr": Object { "range": Array [ - 6, - 13, + 16, + 17, ], - "type": "VariableDeclarator", + "type": "Literal", }, - "parent": Object { + }, + Object { + "$id": 13, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "set", "range": Array [ - 0, - 14, + 27, + 30, ], - "type": "VariableDeclaration", + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": Object { + "range": Array [ + 33, + 34, + ], + "type": "Literal", + }, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 8, + }, + "writeExpr": Object { + "range": Array [ + 53, + 54, + ], + "type": "Literal", }, - "type": "Variable", }, + Object { + "$id": 15, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 9, + }, + "writeExpr": Object { + "range": Array [ + 71, + 72, + ], + "type": "Literal", + }, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 10, + }, + "writeExpr": Object { + "range": Array [ + 90, + 91, + ], + "type": "Literal", + }, + }, + Object { + "$id": 17, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 11, + }, + "writeExpr": Object { + "range": Array [ + 106, + 107, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "async": Object { + "$ref": 10, + }, + "get": Object { + "$ref": 6, + }, + "is": Object { + "$ref": 11, + }, + "module": Object { + "$ref": 8, + }, + "set": Object { + "$ref": 7, + }, + "type": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 10, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 4, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 35, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 54, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 55, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [ + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 64, + 72, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 58, + 73, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [ + Object { + "$ref": 15, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 10, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 82, + 91, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 76, + 92, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [ + Object { + "$ref": 16, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 11, + "defs": Array [ + Object { + "name": Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 101, + 107, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 95, + 108, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + ], + "name": "is", + "references": Array [ + Object { + "$ref": 17, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 20, + }, + "variableMap": Object { + "async": Object { + "$ref": 4, + }, + "get": Object { + "$ref": 0, + }, + "is": Object { + "$ref": 5, + }, + "module": Object { + "$ref": 2, + }, + "set": Object { + "$ref": 1, + }, + "type": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ Object { "name": Object { "name": "get", "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "node": Object { "range": Array [ - 107, - 110, + 123, + 126, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18797,28 +19117,16 @@ Object { Object { "name": "get", "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - Object { - "name": "get", - "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, ], "name": "get", - "references": Array [ - Object { - "$ref": 6, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18828,47 +19136,22 @@ Object { "name": Object { "name": "set", "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 28, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 15, - 29, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "set", - "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "node": Object { "range": Array [ - 114, - 117, + 130, + 133, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18880,28 +19163,16 @@ Object { Object { "name": "set", "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - Object { - "name": "set", - "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, ], "name": "set", - "references": Array [ - Object { - "$ref": 7, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18911,47 +19182,22 @@ Object { "name": Object { "name": "module", "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 36, - 46, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 30, - 47, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "module", - "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "node": Object { "range": Array [ - 121, - 127, + 137, + 143, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18963,28 +19209,16 @@ Object { Object { "name": "module", "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - Object { - "name": "module", - "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, ], "name": "module", - "references": Array [ - Object { - "$ref": 8, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18994,47 +19228,22 @@ Object { "name": Object { "name": "type", "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 54, - 62, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 48, - 63, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "type", - "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "node": Object { "range": Array [ - 131, - 135, + 147, + 151, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19046,28 +19255,16 @@ Object { Object { "name": "type", "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - Object { - "name": "type", - "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, ], "name": "type", - "references": Array [ - Object { - "$ref": 9, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -19077,47 +19274,22 @@ Object { "name": Object { "name": "async", "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 70, - 79, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "async", - "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "node": Object { "range": Array [ - 139, - 144, + 155, + 160, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19129,28 +19301,16 @@ Object { Object { "name": "async", "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - Object { - "name": "async", - "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, ], "name": "async", - "references": Array [ - Object { - "$ref": 10, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -19160,47 +19320,22 @@ Object { "name": Object { "name": "is", "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 87, - 93, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 81, - 94, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "is", - "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "node": Object { "range": Array [ - 148, - 150, + 164, + 166, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19212,28 +19347,16 @@ Object { Object { "name": "is", "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - Object { - "name": "is", - "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, ], "name": "is", - "references": Array [ - Object { - "$ref": 11, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, ], @@ -19247,7 +19370,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 13, + "$ref": 20, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts index a54c3851de81..a6b69461af8f 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts @@ -1,9 +1,11 @@ -const get = 1; -const set = 1; -const module = 1; -const type = 1; -const async = 1; -const is = 1; +{ + const get = 1; + const set = 1; + const module = 1; + const type = 1; + const async = 1; + const is = 1; +} import { get, diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 4abba4d4ca0c..13cc8202dd9b 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -44,11 +44,11 @@ "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", - "semver": "^6.2.0" + "semver": "^6.3.0" }, "devDependencies": { - "@babel/code-frame": "7.0.0", - "@babel/parser": "7.3.2", + "@babel/code-frame": "7.5.5", + "@babel/parser": "7.5.5", "@babel/types": "^7.3.2", "@types/babel-code-frame": "^6.20.1", "@types/glob": "^7.1.1", diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index df8df03f0c29..642b41aa4889 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -19,7 +19,7 @@ import { * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.6.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.7.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 64f2453fc60b..dfa1b047f36b 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -201,6 +201,10 @@ tester.addFixturePatternConfig('javascript/classes', { * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. */ 'class-one-method-super', // babel parse errors + /** + * TS3.6 made computed constructors parse as actual constructors. + */ + 'class-two-methods-computed-constructor', ], }); @@ -233,6 +237,11 @@ tester.addFixturePatternConfig('javascript/forIn', { * TODO: Investigate this in more detail */ 'for-in-with-assigment', // babel parse errors + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * SyntaxError: Invalid left-hand side in for-loop + */ + 'for-in-with-bare-assigment', ], }); @@ -249,6 +258,14 @@ tester.addFixturePatternConfig('javascript/modules', { * Expected babel parse errors - ts-estree is not currently throwing */ 'invalid-export-named-default', // babel parse errors + + // babel does not recognise these as modules + 'export-named-as-default', + 'export-named-as-specifier', + 'export-named-as-specifiers', + 'export-named-specifier', + 'export-named-specifiers-comma', + 'export-named-specifiers', ], ignoreSourceType: [ 'error-function', @@ -393,6 +410,11 @@ tester.addFixturePatternConfig('typescript/basics', { 'const-assertions', 'readonly-arrays', 'readonly-tuples', + /** + * [TS-ESTREE ERRORED, BUT BABEL DID NOT] + * SyntaxError: 'abstract' modifier can only appear on a class, method, or property declaration. + */ + 'abstract-class-with-abstract-constructor', ], ignoreSourceType: [ /** diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index 354bdd90f27b..b7266a75dd07 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -34,7 +34,7 @@ Object { }, "isDeclarationFile": false, "languageVariant": 1, - "languageVersion": 8, + "languageVersion": 99, "libReferenceDirectives": Array [], "lineMap": Array [ null, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index ca466f994e9c..5bf7a0b6adc3 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -26347,13 +26347,12 @@ Object { "line": 1, }, }, + "name": "constructor", "range": Array [ 9, 22, ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", + "type": "Identifier", }, "kind": "constructor", "loc": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index e433f0a3fc6c..f614a8e3c785 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -58612,478 +58612,497 @@ exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ + "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", }, - }, - "name": "get", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 12, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, }, + "range": Array [ + 10, + 17, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 12, - 13, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 6, - 13, + 4, + 18, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "VariableDeclaration", }, - }, - "range": Array [ - 0, - 14, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", }, - }, - "name": "set", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 12, - "line": 2, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, }, + "range": Array [ + 27, + 34, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 27, - 28, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ 21, - 28, + 35, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "VariableDeclaration", }, - }, - "range": Array [ - 15, - 29, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", }, - }, - "name": "module", - "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 15, - "line": 3, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, }, + "range": Array [ + 44, + 54, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 45, - 46, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 36, - 46, + 38, + 55, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "type": "VariableDeclaration", }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 30, - 47, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", }, - }, - "name": "type", - "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 13, - "line": 4, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, }, + "range": Array [ + 64, + 72, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 61, - 62, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 17, + "line": 5, }, "start": Object { - "column": 6, - "line": 4, + "column": 2, + "line": 5, }, }, "range": Array [ - 54, - 62, + 58, + 73, ], - "type": "VariableDeclarator", + "type": "VariableDeclaration", }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 48, - 63, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "async", - "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", }, - "start": Object { - "column": 14, - "line": 5, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 90, + 91, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - }, - "range": Array [ - 78, - 79, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 91, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 18, + "line": 6, }, "start": Object { - "column": 6, - "line": 5, + "column": 2, + "line": 6, }, }, "range": Array [ - 70, - 79, + 76, + 92, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 16, - "line": 5, + "type": "VariableDeclaration", }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 6, - }, - "start": Object { - "column": 6, - "line": 6, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", }, - }, - "name": "is", - "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 11, - "line": 6, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, }, + "range": Array [ + 101, + 107, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 92, - 93, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 15, + "line": 7, }, "start": Object { - "column": 6, - "line": 6, + "column": 2, + "line": 7, }, }, "range": Array [ - 87, - 93, + 95, + 108, ], - "type": "VariableDeclarator", + "type": "VariableDeclaration", }, ], - "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 1, + "line": 8, }, "start": Object { "column": 0, - "line": 6, + "line": 1, }, }, "range": Array [ - 81, - 94, + 0, + 110, ], - "type": "VariableDeclaration", + "type": "BlockStatement", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 15, + "line": 17, }, "start": Object { "column": 0, - "line": 8, + "line": 10, }, }, "range": Array [ - 96, - 173, + 112, + 189, ], "source": Object { "loc": Object { "end": Object { "column": 20, - "line": 15, + "line": 17, }, "start": Object { "column": 7, - "line": 15, + "line": 17, }, }, "range": Array [ - 159, - 172, + 175, + 188, ], "raw": "'fake-module'", "type": "Literal", @@ -59095,51 +59114,51 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "name": "get", "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "local": Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "name": "get", "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "range": Array [ - 107, - 110, + 123, + 126, ], "type": "ImportSpecifier", }, @@ -59148,51 +59167,51 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "name": "set", "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "local": Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "name": "set", "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "range": Array [ - 114, - 117, + 130, + 133, ], "type": "ImportSpecifier", }, @@ -59201,51 +59220,51 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "name": "module", "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "local": Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "name": "module", "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "range": Array [ - 121, - 127, + 137, + 143, ], "type": "ImportSpecifier", }, @@ -59254,51 +59273,51 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "name": "type", "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "local": Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "name": "type", "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "range": Array [ - 131, - 135, + 147, + 151, ], "type": "ImportSpecifier", }, @@ -59307,51 +59326,51 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "name": "async", "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "local": Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "name": "async", "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "range": Array [ - 139, - 144, + 155, + 160, ], "type": "ImportSpecifier", }, @@ -59360,51 +59379,51 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "name": "is", "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "local": Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "name": "is", "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "range": Array [ - 148, - 150, + 164, + 166, ], "type": "ImportSpecifier", }, @@ -59415,7 +59434,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 16, + "line": 18, }, "start": Object { "column": 0, @@ -59424,24 +59443,42 @@ Object { }, "range": Array [ 0, - 174, + 190, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, "line": 1, }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, - 5, + 4, + 9, ], "type": "Keyword", "value": "const", @@ -59449,17 +59486,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", "value": "get", @@ -59467,17 +59504,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 10, - 11, + 14, + 15, ], "type": "Punctuator", "value": "=", @@ -59485,17 +59522,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], "type": "Numeric", "value": "1", @@ -59503,17 +59540,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 13, - 14, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -59521,17 +59558,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 15, - 20, + 21, + 26, ], "type": "Keyword", "value": "const", @@ -59539,17 +59576,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 21, - 24, + 27, + 30, ], "type": "Identifier", "value": "set", @@ -59557,17 +59594,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 10, - "line": 2, + "column": 12, + "line": 3, }, }, "range": Array [ - 25, - 26, + 31, + 32, ], "type": "Punctuator", "value": "=", @@ -59575,17 +59612,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 15, + "line": 3, }, "start": Object { - "column": 12, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 27, - 28, + 33, + 34, ], "type": "Numeric", "value": "1", @@ -59593,17 +59630,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 15, + "line": 3, }, }, "range": Array [ - 28, - 29, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -59611,17 +59648,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 4, }, "start": Object { - "column": 0, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 30, - 35, + 38, + 43, ], "type": "Keyword", "value": "const", @@ -59629,17 +59666,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 14, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 36, - 42, + 44, + 50, ], "type": "Identifier", "value": "module", @@ -59647,17 +59684,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 16, + "line": 4, }, "start": Object { - "column": 13, - "line": 3, + "column": 15, + "line": 4, }, }, "range": Array [ - 43, - 44, + 51, + 52, ], "type": "Punctuator", "value": "=", @@ -59665,17 +59702,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 18, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 17, + "line": 4, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Numeric", "value": "1", @@ -59683,17 +59720,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 16, - "line": 3, + "column": 18, + "line": 4, }, }, "range": Array [ - 46, - 47, + 54, + 55, ], "type": "Punctuator", "value": ";", @@ -59701,17 +59738,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 7, + "line": 5, }, "start": Object { - "column": 0, - "line": 4, + "column": 2, + "line": 5, }, }, "range": Array [ - 48, - 53, + 58, + 63, ], "type": "Keyword", "value": "const", @@ -59719,17 +59756,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 12, + "line": 5, }, "start": Object { - "column": 6, - "line": 4, + "column": 8, + "line": 5, }, }, "range": Array [ - 54, - 58, + 64, + 68, ], "type": "Identifier", "value": "type", @@ -59737,17 +59774,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 14, + "line": 5, }, "start": Object { - "column": 11, - "line": 4, + "column": 13, + "line": 5, }, }, "range": Array [ - 59, - 60, + 69, + 70, ], "type": "Punctuator", "value": "=", @@ -59755,17 +59792,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 16, + "line": 5, }, "start": Object { - "column": 13, - "line": 4, + "column": 15, + "line": 5, }, }, "range": Array [ - 61, - 62, + 71, + 72, ], "type": "Numeric", "value": "1", @@ -59773,17 +59810,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 17, + "line": 5, }, "start": Object { - "column": 14, - "line": 4, + "column": 16, + "line": 5, }, }, "range": Array [ - 62, - 63, + 72, + 73, ], "type": "Punctuator", "value": ";", @@ -59791,17 +59828,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 7, + "line": 6, }, "start": Object { - "column": 0, - "line": 5, + "column": 2, + "line": 6, }, }, "range": Array [ - 64, - 69, + 76, + 81, ], "type": "Keyword", "value": "const", @@ -59809,17 +59846,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 13, + "line": 6, }, "start": Object { - "column": 6, - "line": 5, + "column": 8, + "line": 6, }, }, "range": Array [ - 70, - 75, + 82, + 87, ], "type": "Identifier", "value": "async", @@ -59827,17 +59864,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 5, + "column": 15, + "line": 6, }, "start": Object { - "column": 12, - "line": 5, + "column": 14, + "line": 6, }, }, "range": Array [ - 76, - 77, + 88, + 89, ], "type": "Punctuator", "value": "=", @@ -59845,17 +59882,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 17, + "line": 6, }, "start": Object { - "column": 14, - "line": 5, + "column": 16, + "line": 6, }, }, "range": Array [ - 78, - 79, + 90, + 91, ], "type": "Numeric", "value": "1", @@ -59863,17 +59900,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 18, + "line": 6, }, "start": Object { - "column": 15, - "line": 5, + "column": 17, + "line": 6, }, }, "range": Array [ - 79, - 80, + 91, + 92, ], "type": "Punctuator", "value": ";", @@ -59881,17 +59918,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 7, + "line": 7, }, "start": Object { - "column": 0, - "line": 6, + "column": 2, + "line": 7, }, }, "range": Array [ - 81, - 86, + 95, + 100, ], "type": "Keyword", "value": "const", @@ -59899,17 +59936,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 10, + "line": 7, }, "start": Object { - "column": 6, - "line": 6, + "column": 8, + "line": 7, }, }, "range": Array [ - 87, - 89, + 101, + 103, ], "type": "Identifier", "value": "is", @@ -59917,17 +59954,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 12, + "line": 7, }, "start": Object { - "column": 9, - "line": 6, + "column": 11, + "line": 7, }, }, "range": Array [ - 90, - 91, + 104, + 105, ], "type": "Punctuator", "value": "=", @@ -59935,17 +59972,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 14, + "line": 7, }, "start": Object { - "column": 11, - "line": 6, + "column": 13, + "line": 7, }, }, "range": Array [ - 92, - 93, + 106, + 107, ], "type": "Numeric", "value": "1", @@ -59953,17 +59990,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 15, + "line": 7, }, "start": Object { - "column": 12, - "line": 6, + "column": 14, + "line": 7, }, }, "range": Array [ - 93, - 94, + 107, + 108, ], "type": "Punctuator", "value": ";", @@ -59971,7 +60008,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 1, "line": 8, }, "start": Object { @@ -59980,8 +60017,26 @@ Object { }, }, "range": Array [ - 96, - 102, + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 112, + 118, ], "type": "Keyword", "value": "import", @@ -59990,16 +60045,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 8, + "line": 10, }, "start": Object { "column": 7, - "line": 8, + "line": 10, }, }, "range": Array [ - 103, - 104, + 119, + 120, ], "type": "Punctuator", "value": "{", @@ -60008,16 +60063,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", "value": "get", @@ -60026,16 +60081,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 9, + "line": 11, }, "start": Object { "column": 5, - "line": 9, + "line": 11, }, }, "range": Array [ - 110, - 111, + 126, + 127, ], "type": "Punctuator", "value": ",", @@ -60044,16 +60099,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", "value": "set", @@ -60062,16 +60117,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 10, + "line": 12, }, "start": Object { "column": 5, - "line": 10, + "line": 12, }, }, "range": Array [ - 117, - 118, + 133, + 134, ], "type": "Punctuator", "value": ",", @@ -60080,16 +60135,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", "value": "module", @@ -60098,16 +60153,16 @@ Object { "loc": Object { "end": Object { "column": 9, - "line": 11, + "line": 13, }, "start": Object { "column": 8, - "line": 11, + "line": 13, }, }, "range": Array [ - 127, - 128, + 143, + 144, ], "type": "Punctuator", "value": ",", @@ -60116,16 +60171,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", "value": "type", @@ -60134,16 +60189,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 12, + "line": 14, }, "start": Object { "column": 6, - "line": 12, + "line": 14, }, }, "range": Array [ - 135, - 136, + 151, + 152, ], "type": "Punctuator", "value": ",", @@ -60152,16 +60207,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", "value": "async", @@ -60170,16 +60225,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 13, + "line": 15, }, "start": Object { "column": 7, - "line": 13, + "line": 15, }, }, "range": Array [ - 144, - 145, + 160, + 161, ], "type": "Punctuator", "value": ",", @@ -60188,16 +60243,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", "value": "is", @@ -60206,16 +60261,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 14, + "line": 16, }, "start": Object { "column": 4, - "line": 14, + "line": 16, }, }, "range": Array [ - 150, - 151, + 166, + 167, ], "type": "Punctuator", "value": ",", @@ -60224,16 +60279,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 15, + "line": 17, }, "start": Object { "column": 0, - "line": 15, + "line": 17, }, }, "range": Array [ - 152, - 153, + 168, + 169, ], "type": "Punctuator", "value": "}", @@ -60242,16 +60297,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 15, + "line": 17, }, "start": Object { "column": 2, - "line": 15, + "line": 17, }, }, "range": Array [ - 154, - 158, + 170, + 174, ], "type": "Identifier", "value": "from", @@ -60260,16 +60315,16 @@ Object { "loc": Object { "end": Object { "column": 20, - "line": 15, + "line": 17, }, "start": Object { "column": 7, - "line": 15, + "line": 17, }, }, "range": Array [ - 159, - 172, + 175, + 188, ], "type": "String", "value": "'fake-module'", @@ -60278,16 +60333,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 15, + "line": 17, }, "start": Object { "column": 20, - "line": 15, + "line": 17, }, }, "range": Array [ - 172, - 173, + 188, + 189, ], "type": "Punctuator", "value": ";", diff --git a/yarn.lock b/yarn.lock index 7fef7edc509e..9f41d090fe99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,14 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" - integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== - dependencies: - "@babel/highlight" "^7.0.0" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": +"@babel/code-frame@7.5.5", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== @@ -93,12 +86,7 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.2.tgz#95cdeddfc3992a6ca2a1315191c1679ca32c55cd" - integrity sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ== - -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": +"@babel/parser@7.5.5", "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== @@ -218,7 +206,7 @@ babel-runtime "^6.23.0" lodash "4.17.14" -"@commitlint/load@^8.1.0": +"@commitlint/load@>6.1.1", "@commitlint/load@^8.1.0": version "8.1.0" resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-8.1.0.tgz#63b72ae5bb9152b8fa5b17c5428053032a9a49c8" integrity sha512-ra02Dvmd7Gp1+uFLzTY3yGOpHjPzl5T9wYg/xrtPJNiOWXvQ0Mw7THw+ucd1M5iLUWjvdavv2N87YDRc428wHg== @@ -297,7 +285,7 @@ babel-runtime "6.26.0" execa "0.9.0" -"@evocateur/libnpmaccess@^3.1.0": +"@evocateur/libnpmaccess@^3.1.2": version "3.1.2" resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" integrity sha512-KSCAHwNWro0CF2ukxufCitT9K5LjL/KuMmNzSu8wuwN2rjyKHD8+cmOsiybK+W5hdnwc5M1SmRlVCaMHQo+3rg== @@ -308,7 +296,7 @@ get-stream "^4.0.0" npm-package-arg "^6.1.0" -"@evocateur/libnpmpublish@^1.2.0": +"@evocateur/libnpmpublish@^1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.2.tgz#55df09d2dca136afba9c88c759ca272198db9f1a" integrity sha512-MJrrk9ct1FeY9zRlyeoyMieBjGDG9ihyyD9/Ft6MMrTxql9NyoEx2hw9casTIP4CdqEVu+3nQ2nXxoJ8RCXyFg== @@ -323,19 +311,6 @@ semver "^5.5.1" ssri "^6.0.1" -"@evocateur/npm-registry-fetch@^3.9.1": - version "3.9.2" - resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-3.9.2.tgz#4e23b8b6c812c34828520ce42b31fcdb927c77a3" - integrity sha512-lz4cWdC32z6iI05YT9y79YuJtp4IXUu9lAP5JA/Z/difUXJRLAKlemboY64ELa8BKDav/ktjeCKUUJL8jxNTig== - dependencies: - JSONStream "^1.3.4" - bluebird "^3.5.1" - figgy-pudding "^3.4.1" - lru-cache "^5.1.1" - make-fetch-happen "^4.0.2" - npm-package-arg "^6.1.0" - safe-buffer "^5.1.2" - "@evocateur/npm-registry-fetch@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz#8c4c38766d8d32d3200fcb0a83f064b57365ed66" @@ -349,17 +324,19 @@ npm-package-arg "^6.1.0" safe-buffer "^5.1.2" -"@evocateur/pacote@^9.6.0": - version "9.6.3" - resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.3.tgz#bcd7adbd3c2ef303aa89bd24166f06dd9c080d89" - integrity sha512-ExqNqcbdHQprEgKnY/uQz7WRtyHRbQxRl4JnVkSkmtF8qffRrF9K+piZKNLNSkRMOT/3H0e3IP44QVCHaXMWOQ== +"@evocateur/pacote@^9.6.3": + version "9.6.5" + resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.5.tgz#33de32ba210b6f17c20ebab4d497efc6755f4ae5" + integrity sha512-EI552lf0aG2nOV8NnZpTxNo2PcXKPmDbF9K8eCBFQdIZwHNGN/mi815fxtmUMa2wTa1yndotICIDt/V0vpEx2w== dependencies: "@evocateur/npm-registry-fetch" "^4.0.0" bluebird "^3.5.3" - cacache "^12.0.0" + cacache "^12.0.3" + chownr "^1.1.2" figgy-pudding "^3.5.1" get-stream "^4.1.0" glob "^7.1.4" + infer-owner "^1.0.4" lru-cache "^5.1.1" make-fetch-happen "^5.0.0" minimatch "^3.0.4" @@ -369,7 +346,7 @@ normalize-package-data "^2.5.0" npm-package-arg "^6.1.0" npm-packlist "^1.4.4" - npm-pick-manifest "^2.2.3" + npm-pick-manifest "^3.0.0" osenv "^0.1.5" promise-inflight "^1.0.1" promise-retry "^1.1.1" @@ -391,67 +368,77 @@ chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" - integrity sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A== +"@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== dependencies: "@jest/console" "^24.7.1" - "@jest/reporters" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.8.0" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" - jest-watcher "^24.8.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" micromatch "^3.1.10" p-each-series "^1.0.0" - pirates "^4.0.1" realpath-native "^1.1.0" rimraf "^2.5.4" + slash "^2.0.0" strip-ansi "^5.0.0" -"@jest/environment@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.8.0.tgz#0342261383c776bdd652168f68065ef144af0eac" - integrity sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw== - dependencies: - "@jest/fake-timers" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - -"@jest/fake-timers@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.8.0.tgz#2e5b80a4f78f284bcb4bd5714b8e10dd36a8d3d1" - integrity sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw== - dependencies: - "@jest/types" "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" - -"@jest/reporters@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" - integrity sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -459,13 +446,13 @@ istanbul-lib-instrument "^3.0.1" istanbul-lib-report "^2.0.4" istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.1.1" - jest-haste-map "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" - node-notifier "^5.2.1" + node-notifier "^5.4.2" slash "^2.0.0" source-map "^0.6.0" string-length "^2.0.0" @@ -479,119 +466,129 @@ graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" - integrity sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng== +"@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== dependencies: - "@jest/console" "^24.7.1" - "@jest/types" "^24.8.0" + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/test-sequencer@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" - integrity sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg== +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== dependencies: - "@jest/test-result" "^24.8.0" - jest-haste-map "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" -"@jest/transform@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.8.0.tgz#628fb99dce4f9d254c6fd9341e3eea262e06fef5" - integrity sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA== +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.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.8.0" - jest-regex-util "^24.3.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" micromatch "^3.1.10" + pirates "^4.0.1" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" - integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg== +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^12.0.9" - -"@lerna/add@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.15.0.tgz#10be562f43cde59b60f299083d54ac39520ec60a" - integrity sha512-+KrG4GFy/6FISZ+DwWf5Fj5YB4ESa4VTnSn/ujf3VEda6dxngHPN629j+TcPbsdOxUYVah+HuZbC/B8NnkrKpQ== - dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-conf" "3.13.0" + "@types/yargs" "^13.0.0" + +"@lerna/add@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.16.2.tgz#90ecc1be7051cfcec75496ce122f656295bd6e94" + integrity sha512-RAAaF8aODPogj2Ge9Wj3uxPFIBGpog9M+HwSuq03ZnkkO831AmasCTJDqV+GEpl1U2DvnhZQEwHpWmTT0uUeEw== + dependencies: + "@evocateur/pacote" "^9.6.3" + "@lerna/bootstrap" "3.16.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" npm-package-arg "^6.1.0" - p-map "^1.2.0" - semver "^5.5.0" + p-map "^2.1.0" + semver "^6.2.0" -"@lerna/batch-packages@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.14.0.tgz#0208663bab3ddbf57956b370aaec4c9ebee6c800" - integrity sha512-RlBkQVNTqk1qvn6PFWiWNiskllUHh6tXbTVm43mZRNd+vhAyvrQC8RWJxH0ECVvnFAt9rSNGRIVbEJ31WnNQLg== +"@lerna/batch-packages@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.16.0.tgz#1c16cb697e7d718177db744cbcbdac4e30253c8c" + integrity sha512-7AdMkANpubY/FKFI01im01tlx6ygOBJ/0JcixMUWoWP/7Ds3SWQF22ID6fbBr38jUWptYLDs2fagtTDL7YUPuA== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.16.0" npmlog "^4.1.2" -"@lerna/bootstrap@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.15.0.tgz#f53e0bbbbfb8367e609a06378409bfc673ff2930" - integrity sha512-4AxsPKKbgj2Ju03qDddQTpOHvpqnwd0yaiEU/aCcWv/4tDTe79NqUne2Z3+P2WZY0Zzb8+nUKcskwYBMTeq+Mw== - dependencies: - "@lerna/batch-packages" "3.14.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/has-npm-version" "3.14.2" - "@lerna/npm-install" "3.14.2" - "@lerna/package-graph" "3.14.0" +"@lerna/bootstrap@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.16.2.tgz#be268d940221d3c3270656b9b791b492559ad9d8" + integrity sha512-I+gs7eh6rv9Vyd+CwqL7sftRfOOsSzCle8cv/CGlMN7/p7EAVhxEdAw8SYoHIKHzipXszuqqy1Y3opyleD0qdA== + dependencies: + "@lerna/batch-packages" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/has-npm-version" "3.16.0" + "@lerna/npm-install" "3.16.0" + "@lerna/package-graph" "3.16.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-parallel-batches" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - "@lerna/symlink-dependencies" "3.14.2" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-parallel-batches" "3.16.0" + "@lerna/symlink-binary" "3.16.2" + "@lerna/symlink-dependencies" "3.16.2" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - get-port "^3.2.0" - multimatch "^2.1.0" + get-port "^4.2.0" + multimatch "^3.0.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" read-package-tree "^5.1.6" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/changed@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.15.0.tgz#20db9d992d697e4288c260aa38b989dcb93f4b40" - integrity sha512-Hns1ssI9T9xOTGVc7PT2jUaqzsSkxV3hV/Y7iFO0uKTk+fduyTwGTHU9A/ybQ/xi/9iaJbvaXyjxKiGoEnzmhg== +"@lerna/changed@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.16.4.tgz#c3e727d01453513140eee32c94b695de577dc955" + integrity sha512-NCD7XkK744T23iW0wqKEgF4R9MYmReUbyHCZKopFnsNpQdqumc3SOIvQUAkKCP6hQJmYvxvOieoVgy/CVDpZ5g== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/listable" "3.14.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.16.4" "@lerna/check-working-tree@3.14.2": version "3.14.2" @@ -611,17 +608,17 @@ execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.15.0.tgz#a94da50908a80ba443a0a682706aca79ac2ecf27" - integrity sha512-D1BN7BnJk6YjrSR7E7RiCmWiFVWDo3L+OSe6zDq6rNNYexPBtSi2JOCeF/Dibi3jd2luVu0zkVpUtuEEdPiD+A== +"@lerna/clean@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.16.0.tgz#1c134334cacea1b1dbeacdc580e8b9240db8efa1" + integrity sha512-5P9U5Y19WmYZr7UAMGXBpY7xCRdlR7zhHy8MAPDKVx70rFIBS6nWXn5n7Kntv74g7Lm1gJ2rsiH5tj1OPcRJgg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.14.2" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" @@ -645,78 +642,79 @@ figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.14.2.tgz#396201f6568ec5916bf2c11e7a29b0931fcd3e5b" - integrity sha512-+zSQ2ZovH8Uc0do5dR+sk8VvRJc6Xl+ZnJJGESIl17KSpEw/lVjcOyt6f3BP+WHn+iSOjMWcGvUVA601FIEdZw== +"@lerna/collect-updates@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.16.0.tgz#6db3ce8a740a4e2b972c033a63bdfb77f2553d8c" + integrity sha512-HwAIl815X2TNlmcp28zCrSdXfoZWNP7GJPEqNWYk7xDJTYLqQ+SrmKUePjb3AMGBwYAraZSEJLbHdBpJ5+cHmQ== dependencies: "@lerna/child-process" "3.14.2" "@lerna/describe-ref" "3.14.2" minimatch "^3.0.4" npmlog "^4.1.2" - slash "^1.0.0" + slash "^2.0.0" -"@lerna/command@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.15.0.tgz#e1dc1319054f1cf0b135aa0c5730f3335641a0ca" - integrity sha512-dZqr4rKFN+veuXakIQ1DcGUpzBgcWKaYFNN4O6/skOdVQaEfGefzo1sZET+q7k/BkypxkhXHXpv5UqqSuL/EHQ== +"@lerna/command@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.16.0.tgz#ba3dba49cb5ce4d11b48269cf95becd86e30773f" + integrity sha512-u7tE4GC4/gfbPA9eQg+0ulnoJ+PMoMqomx033r/IxqZrHtmJR9+pF/37S0fsxJ2hX/RMFPC7c9Q/i8NEufSpdQ== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/package-graph" "3.14.0" - "@lerna/project" "3.15.0" + "@lerna/package-graph" "3.16.0" + "@lerna/project" "3.16.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" dedent "^0.7.0" execa "^1.0.0" - is-ci "^1.0.10" - lodash "^4.17.5" + is-ci "^2.0.0" + lodash "^4.17.14" npmlog "^4.1.2" -"@lerna/conventional-commits@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.14.0.tgz#24f643550dc29d4f1249cc26d0eb453d7a1c513d" - integrity sha512-hGZ2qQZ9uEGf2eeIiIpEodSs9Qkkf/2uYEtNT7QN1RYISPUh6/lKGBssc5dpbCF64aEuxmemWLdlDf1ogG6++w== +"@lerna/conventional-commits@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.16.4.tgz#bf464f11b2f6534dad204db00430e1651b346a04" + integrity sha512-QSZJ0bC9n6FVaf+7KDIq5zMv8WnHXnwhyL5jG1Nyh3SgOg9q2uflqh7YsYB+G6FwaRfnPaKosh6obijpYg0llA== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" conventional-changelog-core "^3.1.6" - conventional-recommended-bump "^4.0.4" - fs-extra "^7.0.0" + conventional-recommended-bump "^5.0.0" + fs-extra "^8.1.0" get-stream "^4.0.0" + lodash.template "^4.5.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" - semver "^5.5.0" + pify "^4.0.1" + semver "^6.2.0" -"@lerna/create-symlink@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.14.0.tgz#f40ae06e8cebe70c694368ebf9a4af5ab380fbea" - integrity sha512-Kw51HYOOi6UfCKncqkgEU1k/SYueSBXgkNL91FR8HAZH7EPSRTEtp9mnJo568g0+Hog5C+3cOaWySwhHpRG29A== +"@lerna/create-symlink@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.16.2.tgz#412cb8e59a72f5a7d9463e4e4721ad2070149967" + integrity sha512-pzXIJp6av15P325sgiIRpsPXLFmkisLhMBCy4764d+7yjf2bzrJ4gkWVMhsv4AdF0NN3OyZ5jjzzTtLNqfR+Jw== dependencies: - cmd-shim "^2.0.2" - fs-extra "^7.0.0" + "@zkochan/cmd-shim" "^3.1.0" + fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.15.0.tgz#27bfadcbdf71d34226aa82432293f5290f7ab1aa" - integrity sha512-doXGt0HTwTQl8GkC2tOrraA/5OWbz35hJqi7Dsl3Fl0bAxiv9XmF3LykHFJ+YTDHfGpdoJ8tKu66f/VKP16G0w== +"@lerna/create@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.16.0.tgz#4de841ec7d98b29bb19fb7d6ad982e65f7a150e8" + integrity sha512-OZApR1Iz7awutbmj4sAArwhqCyKgcrnw9rH0aWAUrkYWrD1w4TwkvAcYAsfx5GpQGbLQwoXhoyyPwPfZRRWz3Q== dependencies: - "@evocateur/pacote" "^9.6.0" + "@evocateur/pacote" "^9.6.3" "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/npm-conf" "3.13.0" + "@lerna/command" "3.16.0" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" dedent "^0.7.0" - fs-extra "^7.0.0" - globby "^8.0.1" + fs-extra "^8.1.0" + globby "^9.2.0" init-package-json "^1.10.3" npm-package-arg "^6.1.0" p-reduce "^1.0.0" - pify "^3.0.0" - semver "^5.5.0" - slash "^1.0.0" + pify "^4.0.1" + semver "^6.2.0" + slash "^2.0.0" validate-npm-package-license "^3.0.3" validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" @@ -729,44 +727,44 @@ "@lerna/child-process" "3.14.2" npmlog "^4.1.2" -"@lerna/diff@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.15.0.tgz#573d6f58f6809d16752dcfab74c5e286b6678371" - integrity sha512-N1Pr0M554Bt+DlVoD+DXWGh92gcq6G9icn8sH5GSqfwi0XCpPNJ2i1BNEZpUQ6ulLWOMa1YHR4PypPxecRGBjA== +"@lerna/diff@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.16.0.tgz#6d09a786f9f5b343a2fdc460eb0be08a05b420aa" + integrity sha512-QUpVs5TPl8vBIne10/vyjUxanQBQQp7Lk3iaB8MnCysKr0O+oy7trWeFVDPEkBTCD177By7yPGyW5Yey1nCBbA== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/command" "3.16.0" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.15.0.tgz#b31510f47255367eb0d3e4a4f7b6ef8f7e41b985" - integrity sha512-YuXPd64TNG9wbb3lRvyMARQbdlbMZ1bJZ+GCm0enivnIWUyg0qtBDcfPY2dWpIgOif04zx+K/gmOX4lCaGM4UQ== +"@lerna/exec@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.16.0.tgz#2b6c033cee46181b6eede0eb12aad5c2c0181e89" + integrity sha512-mH3O5NXf/O88jBaBBTUf+d56CUkxpg782s3Jxy7HWbVuSUULt3iMRPTh+zEXO5/555etsIVVDDyUR76meklrJA== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/run-topologically" "3.14.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" + p-map "^2.1.0" -"@lerna/filter-options@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.14.2.tgz#7ba91cb54ff3fd9f4650ad8d7c40bc1075e44c2d" - integrity sha512-Ct8oYvRttbYB9JalngHhirb8o9ZVyLm5a9MpXNevXoHiu6j0vNhI19BQCwNnrL6wZvEHJnzPuUl/jO23tWxemg== +"@lerna/filter-options@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.16.0.tgz#b1660b4480c02a5c6efa4d0cd98b9afde4ed0bba" + integrity sha512-InIi1fF8+PxpCwir9bIy+pGxrdE6hvN0enIs1eNGCVS1TTE8osNgiZXa838bMQ1yaEccdcnVX6Z03BNKd56kNg== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/filter-packages" "3.13.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/filter-packages" "3.16.0" dedent "^0.7.0" -"@lerna/filter-packages@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.13.0.tgz#f5371249e7e1a15928e5e88c544a242e0162c21c" - integrity sha512-RWiZWyGy3Mp7GRVBn//CacSnE3Kw82PxE4+H6bQ3pDUw/9atXn7NRX+gkBVQIYeKamh7HyumJtyOKq3Pp9BADQ== +"@lerna/filter-packages@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.16.0.tgz#7d34dc8530c71016263d6f67dc65308ecf11c9fc" + integrity sha512-eGFzQTx0ogkGDCnbTuXqssryR6ilp8+dcXt6B+aq1MaqL/vOJRZyqMm4TY3CUOUnzZCi9S2WWyMw3PnAJOF+kg== dependencies: "@lerna/validation-error" "3.13.0" - multimatch "^2.1.0" + multimatch "^3.0.0" npmlog "^4.1.2" "@lerna/get-npm-exec-opts@3.13.0": @@ -776,23 +774,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/get-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.13.0.tgz#335e40d77f3c1855aa248587d3e0b2d8f4b06e16" - integrity sha512-EgSim24sjIjqQDC57bgXD9l22/HCS93uQBbGpkzEOzxAVzEgpZVm7Fm1t8BVlRcT2P2zwGnRadIvxTbpQuDPTg== +"@lerna/get-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.16.0.tgz#1b316b706dcee86c7baa55e50b087959447852ff" + integrity sha512-AjsFiaJzo1GCPnJUJZiTW6J1EihrPkc2y3nMu6m3uWFxoleklsSCyImumzVZJssxMi3CPpztj8LmADLedl9kXw== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.14.2.tgz#a743792b51cd9bdfb785186e429568827a6372eb" - integrity sha512-+2Xh7t4qVmXiXE2utPnh5T7YwSltG74JP7c+EiooRY5+3zjh9MpPOcTKxVY3xKclzpsyXMohk2KpTF4tzA5rrg== +"@lerna/github-client@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.0.tgz#619874e461641d4f59ab1b3f1a7ba22dba88125d" + integrity sha512-IVJjcKjkYaUEPJsDyAblHGEFFNKCRyMagbIDm14L7Ab94ccN6i4TKOqAFEJn2SJHYvKKBdp3Zj2zNlASOMe3DA== dependencies: "@lerna/child-process" "3.14.2" - "@octokit/plugin-enterprise-rest" "^2.1.1" - "@octokit/rest" "^16.16.0" + "@octokit/plugin-enterprise-rest" "^3.6.1" + "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" npmlog "^4.1.2" @@ -810,124 +808,124 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.14.2.tgz#ac17f7c68e92114b8332b95ae6cffec9c0d67a7b" - integrity sha512-cG+z5bB8JPd5f+nT2eLN2LmKg06O11AxlnUxgw2W7cLyc7cnsmMSp/rxt2JBMwW2r4Yn+CLLJIRwJZ2Es8jFSw== +"@lerna/has-npm-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.0.tgz#55764a4ce792f0c8553cf996a17f554b9e843288" + integrity sha512-TIY036dA9J8OyTrZq9J+it2DVKifL65k7hK8HhkUPpitJkw6jwbMObA/8D40LOGgWNPweJWqmlrTbRSwsR7DrQ== dependencies: "@lerna/child-process" "3.14.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/import@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.15.0.tgz#47f2da52059a96bb08a4c09e18d985258fce9ce1" - integrity sha512-4GKQgeTXBTwMbZNkYyPdQIVA41HIISD7D6XRNrDaG0falUfvoPsknijQPCBmGqeh66u1Fcn2+4lkL3OCTj2FMg== +"@lerna/import@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.16.0.tgz#b57cb453f4acfc60f6541fcbba10674055cb179d" + integrity sha512-trsOmGHzw0rL/f8BLNvd+9PjoTkXq2Dt4/V2UCha254hMQaYutbxcYu8iKPxz9x86jSPlH7FpbTkkHXDsoY7Yg== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/command" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.15.0.tgz#bda36de44c365972f87cbd287fe85b6fb7bb1070" - integrity sha512-VOqH6kFbFtfUbXxhSqXKY6bjnVp9nLuLRI6x9tVHOANX2LmSlXm17OUGBnNt+eM4uJLuiUsAR8nTlpCiz//lPQ== +"@lerna/init@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.16.0.tgz#31e0d66bbededee603338b487a42674a072b7a7d" + integrity sha512-Ybol/x5xMtBgokx4j7/Y3u0ZmNh0NiSWzBFVaOs2NOJKvuqrWimF67DKVz7yYtTYEjtaMdug64ohFF4jcT/iag== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - fs-extra "^7.0.0" - p-map "^1.2.0" - write-json-file "^2.3.0" - -"@lerna/link@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.15.0.tgz#718b4116a8eacb3fc73414ae8d97f8fdaf8125da" - integrity sha512-yKHuifADINobvDOLljBGkVGpVwy6J3mg5p9lQXBdOLXBoIKC8o/UKBR9JvZMFvT/Iy6zn6FPy1v5lz9iU1Ib0Q== - dependencies: - "@lerna/command" "3.15.0" - "@lerna/package-graph" "3.14.0" - "@lerna/symlink-dependencies" "3.14.2" - p-map "^1.2.0" - slash "^1.0.0" + "@lerna/command" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + write-json-file "^3.2.0" + +"@lerna/link@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.16.2.tgz#6c3a5658f6448a64dddca93d9348ac756776f6f6" + integrity sha512-eCPg5Lo8HT525fIivNoYF3vWghO3UgEVFdbsiPmhzwI7IQyZro5HWYzLtywSAdEog5XZpd2Bbn0CsoHWBB3gww== + dependencies: + "@lerna/command" "3.16.0" + "@lerna/package-graph" "3.16.0" + "@lerna/symlink-dependencies" "3.16.2" + p-map "^2.1.0" + slash "^2.0.0" -"@lerna/list@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.15.0.tgz#4e401c1ad990bb12bd38298cb61d21136420ff68" - integrity sha512-8SvxnlfAnbEzQDf2NL0IxWyUuqWTykF9cHt5/f5TOzgESClpaOkDtqwh/UlE8nVTzWMnxnQUPQi3UTKyJD3i3g== +"@lerna/list@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.16.0.tgz#883c00b2baf1e03c93e54391372f67a01b773c2f" + integrity sha512-TkvstoPsgKqqQ0KfRumpsdMXfRSEhdXqOLq519XyI5IRWYxhoqXqfi8gG37UoBPhBNoe64japn5OjphF3rOmQA== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/listable" "3.14.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" -"@lerna/listable@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.14.0.tgz#08f4c78e0466568e8e8a57d4ad09537f2bb7bbb9" - integrity sha512-ZK44Mo8xf/N97eQZ236SPSq0ek6+gk4HqHIx05foEMZVV1iIDH4a/nblLsJNjGQVsIdMYFPaqNJ0z+ZQfiJazQ== +"@lerna/listable@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.16.0.tgz#e6dc47a2d5a6295222663486f50e5cffc580f043" + integrity sha512-mtdAT2EEECqrJSDm/aXlOUFr1MRE4p6hppzY//Klp05CogQy6uGaKk+iKG5yyCLaOXFFZvG4HfO11CmoGSDWzw== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.16.0" chalk "^2.3.1" columnify "^1.5.4" -"@lerna/log-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.13.0.tgz#497b5f692a8d0e3f669125da97b0dadfd9e480f3" - integrity sha512-Rmjrcz+6aM6AEcEVWmurbo8+AnHOvYtDpoeMMJh9IZ9SmZr2ClXzmD7wSvjTQc8BwOaiWjjC/ukcT0UYA2m7wg== +"@lerna/log-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.16.0.tgz#f83991041ee77b2495634e14470b42259fd2bc16" + integrity sha512-Fp+McSNBV/P2mnLUYTaSlG8GSmpXM7krKWcllqElGxvAqv6chk2K3c2k80MeVB4WvJ9tRjUUf+i7HUTiQ9/ckQ== dependencies: - byte-size "^4.0.3" + byte-size "^5.0.1" columnify "^1.5.4" has-unicode "^2.0.1" npmlog "^4.1.2" -"@lerna/npm-conf@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.13.0.tgz#6b434ed75ff757e8c14381b9bbfe5d5ddec134a7" - integrity sha512-Jg2kANsGnhg+fbPEzE0X9nX5oviEAvWj0nYyOkcE+cgWuT7W0zpnPXC4hA4C5IPQGhwhhh0IxhWNNHtjTuw53g== +"@lerna/npm-conf@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.16.0.tgz#1c10a89ae2f6c2ee96962557738685300d376827" + integrity sha512-HbO3DUrTkCAn2iQ9+FF/eisDpWY5POQAOF1m7q//CZjdC2HSW3UYbKEGsSisFxSfaF9Z4jtrV+F/wX6qWs3CuA== dependencies: config-chain "^1.1.11" - pify "^3.0.0" + pify "^4.0.1" -"@lerna/npm-dist-tag@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.15.0.tgz#262dd1e67a4cf82ae78fadfe02622ebce4add078" - integrity sha512-lnbdwc4Ebs7/EI9fTIgbH3dxXnP+SuCcGhG7P5ZjOqo67SY09sRZGcygEzabpvIwXvKpBF8vCd4xxzjnF2u+PA== +"@lerna/npm-dist-tag@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.16.0.tgz#b2184cee5e1f291277396854820e1117a544b7ee" + integrity sha512-MQrBkqJJB9+eNphuj9w90QPMOs4NQXMuSRk9NqzeFunOmdDopPCV0Q7IThSxEuWnhJ2n3B7G0vWUP7tNMPdqIQ== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" - "@lerna/otplease" "3.14.0" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@lerna/otplease" "3.16.0" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.14.2.tgz#fd22ff432f8b7cbe05bedfd36b0506482f1a4732" - integrity sha512-JYJJRtLETrGpcQZa8Rj16vbye399RqnaXmJlZuZ2twjJ2DYVYtwkfsGEOdvdaKw5KVOEpWcAxBA9OMmKQtCLQw== +"@lerna/npm-install@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.0.tgz#8ec76a7a13b183bde438fd46296bf7a0d6f86017" + integrity sha512-APUOIilZCzDzce92uLEwzt1r7AEMKT/hWA1ThGJL+PO9Rn8A95Km3o2XZAYG4W0hR+P4O2nSVuKbsjQtz8CjFQ== dependencies: "@lerna/child-process" "3.14.2" "@lerna/get-npm-exec-opts" "3.13.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.15.0.tgz#89126d74ec97186475767b852954a5f55b732a71" - integrity sha512-G7rcNcSGjG0La8eHPXDvCvoNXbwNnP6XJ+GPh3CH5xiR/nikfLOa+Bfm4ytdjVWWxnKfCT4qyMTCoV1rROlqQQ== +"@lerna/npm-publish@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.16.2.tgz#a850b54739446c4aa766a0ceabfa9283bb0be676" + integrity sha512-tGMb9vfTxP57vUV5svkBQxd5Tzc+imZbu9ZYf8Mtwe0+HYfDjNiiHLIQw7G95w4YRdc5KsCE8sQ0uSj+f2soIg== dependencies: - "@evocateur/libnpmpublish" "^1.2.0" - "@lerna/otplease" "3.14.0" - "@lerna/run-lifecycle" "3.14.0" + "@evocateur/libnpmpublish" "^1.2.2" + "@lerna/otplease" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" + pify "^4.0.1" read-package-json "^2.0.13" "@lerna/npm-run-script@3.14.2": @@ -939,10 +937,10 @@ "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" -"@lerna/otplease@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.14.0.tgz#b539fd3e7a08452fc0db3b10010ca3cf0e4a73e7" - integrity sha512-rYAWzaYZ81bwnrmTkYWGgcc13bl/6DlG7pjWQWNGAJNLzO5zzj0xmXN5sMFJnNvDpSiS/ZS1sIuPvb4xnwLUkg== +"@lerna/otplease@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.16.0.tgz#de66aec4f3e835a465d7bea84b58a4ab6590a0fa" + integrity sha512-uqZ15wYOHC+/V0WnD2iTLXARjvx3vNrpiIeyIvVlDB7rWse9mL4egex/QSgZ+lDx1OID7l2kgvcUD9cFpbqB7Q== dependencies: "@lerna/prompt" "3.13.0" figgy-pudding "^3.5.1" @@ -954,64 +952,64 @@ dependencies: npmlog "^4.1.2" -"@lerna/pack-directory@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.14.2.tgz#577b8ebf867c9b636a2e4659a27552ee24d83b9d" - integrity sha512-b3LnJEmIml3sDj94TQT8R+kVyrDlmE7Su0WwcBYZDySXPMSZ38WA2/2Xjy/EWhXlFxp/nUJKyUG78nDrZ/00Uw== +"@lerna/pack-directory@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.16.4.tgz#3eae5f91bdf5acfe0384510ed53faddc4c074693" + integrity sha512-uxSF0HZeGyKaaVHz5FroDY9A5NDDiCibrbYR6+khmrhZtY0Bgn6hWq8Gswl9iIlymA+VzCbshWIMX4o2O8C8ng== dependencies: - "@lerna/get-packed" "3.13.0" - "@lerna/package" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" + "@lerna/get-packed" "3.16.0" + "@lerna/package" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - npm-packlist "^1.4.1" + npm-packlist "^1.4.4" npmlog "^4.1.2" - tar "^4.4.8" + tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.14.0.tgz#4ccdf446dccedfbbeb4efff3eb720cb6fcb109fc" - integrity sha512-dNpA/64STD5YXhaSlg4gT6Z474WPJVCHoX1ibsVIFu0fVgH609Y69bsdmbvTRdI7r6Dcu4ZfGxdR636RTrH+Eg== +"@lerna/package-graph@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.16.0.tgz#909c90fb41e02f2c19387342d2a5eefc36d56836" + integrity sha512-A2mum/gNbv7zCtAwJqoxzqv89As73OQNK2MgSX1SHWya46qoxO9a9Z2c5lOFQ8UFN5ZxqWMfFYXRCz7qzwmFXw== dependencies: - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/package@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.14.2.tgz#f893cb42e26c869df272dafbe1dd5a3473b0bd4d" - integrity sha512-YR/+CzYdufJYfsUlrfuhTjA35iSZpXK7mVOZmeR9iRWhSaqesm4kq2zfxm9vCpZV2oAQQZOwi4eo5h0rQBtdiw== +"@lerna/package@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.16.0.tgz#7e0a46e4697ed8b8a9c14d59c7f890e0d38ba13c" + integrity sha512-2lHBWpaxcBoiNVbtyLtPUuTYEaB/Z+eEqRS9duxpZs6D+mTTZMNy6/5vpEVSCBmzvdYpyqhqaYjjSLvjjr5Riw== dependencies: - load-json-file "^4.0.0" + load-json-file "^5.3.0" npm-package-arg "^6.1.0" write-pkg "^3.1.0" -"@lerna/prerelease-id-from-version@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.14.0.tgz#d5da9c26ac4a0d0ecde09018f06e41ca4dd444c2" - integrity sha512-Ap3Z/dNhqQuSrKmK+JmzYvQYI2vowxHvUVxZJiDVilW8dyNnxkCsYFmkuZytk5sxVz4VeGLNPS2RSsU5eeSS+Q== +"@lerna/prerelease-id-from-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.16.0.tgz#b24bfa789f5e1baab914d7b08baae9b7bd7d83a1" + integrity sha512-qZyeUyrE59uOK8rKdGn7jQz+9uOpAaF/3hbslJVFL1NqF9ELDTqjCPXivuejMX/lN4OgD6BugTO4cR7UTq/sZA== dependencies: - semver "^5.5.0" + semver "^6.2.0" -"@lerna/project@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.15.0.tgz#733b0993a849dcf5b68fcd0ec11d8f7de38a6999" - integrity sha512-eNGUWiMbQ9kh9kGkomtMnsLypS0rfLqxKgZP2+VnNVtIXjnLv4paeTm+1lkL+naNJUwhnpMk2NSLEeoxT/20QA== +"@lerna/project@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.16.0.tgz#2469a4e346e623fd922f38f5a12931dfb8f2a946" + integrity sha512-NrKcKK1EqXqhrGvslz6Q36+ZHuK3zlDhGdghRqnxDcHxMPT01NgLcmsnymmQ+gjMljuLRmvKYYCuHrknzX8VrA== dependencies: - "@lerna/package" "3.14.2" + "@lerna/package" "3.16.0" "@lerna/validation-error" "3.13.0" cosmiconfig "^5.1.0" dedent "^0.7.0" dot-prop "^4.2.0" - glob-parent "^3.1.0" - globby "^8.0.1" - load-json-file "^4.0.0" + glob-parent "^5.0.0" + globby "^9.2.0" + load-json-file "^5.3.0" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" resolve-from "^4.0.0" - write-json-file "^2.3.0" + write-json-file "^3.2.0" "@lerna/prompt@3.13.0": version "3.13.0" @@ -1021,40 +1019,41 @@ inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.15.0.tgz#54f93f8f0820d2d419d0b65df1eb55d8277090c9" - integrity sha512-6tRRBJ8olLSXfrUsR4f7vSfx0cT1oPi6/v06yI3afDSsUX6eQ3ooZh7gMY4RWmd+nM/IJHTUzhlKF6WhTvo+9g== +"@lerna/publish@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.16.4.tgz#4cd55d8be9943d9a68e316e930a90cda8590500e" + integrity sha512-XZY+gRuF7/v6PDQwl7lvZaGWs8CnX6WIPIu+OCcyFPSL/rdWegdN7HieKBHskgX798qRQc2GrveaY7bNoTKXAw== dependencies: - "@evocateur/libnpmaccess" "^3.1.0" - "@evocateur/npm-registry-fetch" "^3.9.1" - "@evocateur/pacote" "^9.6.0" + "@evocateur/libnpmaccess" "^3.1.2" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@evocateur/pacote" "^9.6.3" "@lerna/check-working-tree" "3.14.2" "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" "@lerna/describe-ref" "3.14.2" - "@lerna/log-packed" "3.13.0" - "@lerna/npm-conf" "3.13.0" - "@lerna/npm-dist-tag" "3.15.0" - "@lerna/npm-publish" "3.15.0" + "@lerna/log-packed" "3.16.0" + "@lerna/npm-conf" "3.16.0" + "@lerna/npm-dist-tag" "3.16.0" + "@lerna/npm-publish" "3.16.2" + "@lerna/otplease" "3.16.0" "@lerna/output" "3.13.0" - "@lerna/pack-directory" "3.14.2" - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/pack-directory" "3.16.4" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.16.4" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" - semver "^5.5.0" + semver "^6.2.0" "@lerna/pulse-till-done@3.13.0": version "3.13.0" @@ -1063,20 +1062,20 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.14.0.tgz#2abb36f445bd924d0f85ac7aec1445e9ef1e2c6c" - integrity sha512-6YTh3vDMW2hUxHdKeRvx4bosc9lZClKaN+DzC1XKTkwDbWrsjmEzLcemKL6QnyyeuryN2f/eto7P9iSe3z3pQQ== +"@lerna/query-graph@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.16.0.tgz#e6a46ebcd9d5b03f018a06eca2b471735353953c" + integrity sha512-p0RO+xmHDO95ChJdWkcy9TNLysLkoDARXeRHzY5U54VCwl3Ot/2q8fMCVlA5UeGXDutEyyByl3URqEpcQCWI7Q== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.16.0" figgy-pudding "^3.5.1" -"@lerna/resolve-symlink@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" - integrity sha512-Lc0USSFxwDxUs5JvIisS8JegjA6SHSAWJCMvi2osZx6wVRkEDlWG2B1JAfXUzCMNfHoZX0/XX9iYZ+4JIpjAtg== +"@lerna/resolve-symlink@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.16.0.tgz#37fc7095fabdbcf317c26eb74e0d0bde8efd2386" + integrity sha512-Ibj5e7njVHNJ/NOqT4HlEgPFPtPLWsO7iu59AM5bJDcAJcR96mLZ7KGVIsS2tvaO7akMEJvt2P+ErwCdloG3jQ== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" npmlog "^4.1.2" read-cmd-shim "^1.0.1" @@ -1090,68 +1089,68 @@ path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.14.0.tgz#0499eca0e7f393faf4e24e6c8737302a9059c22b" - integrity sha512-GUM3L9MzGRSW0WQ8wbLW1+SYStU1OFjW0GBzShhBnFrO4nGRrU7VchsLpcLu0hk2uCzyhsrDKzifEdOdUyMoEQ== +"@lerna/run-lifecycle@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.16.2.tgz#67b288f8ea964db9ea4fb1fbc7715d5bbb0bce00" + integrity sha512-RqFoznE8rDpyyF0rOJy3+KjZCeTkO8y/OB9orPauR7G2xQ7PTdCpgo7EO6ZNdz3Al+k1BydClZz/j78gNCmL2A== dependencies: - "@lerna/npm-conf" "3.13.0" + "@lerna/npm-conf" "3.16.0" figgy-pudding "^3.5.1" - npm-lifecycle "^2.1.1" + npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.13.0.tgz#0276bb4e7cd0995297db82d134ca2bd08d63e311" - integrity sha512-bICFBR+cYVF1FFW+Tlm0EhWDioTUTM6dOiVziDEGE1UZha1dFkMYqzqdSf4bQzfLS31UW/KBd/2z8jy2OIjEjg== +"@lerna/run-parallel-batches@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.16.0.tgz#5ace7911a2dd31dfd1e53c61356034e27df0e1fb" + integrity sha512-2J/Nyv+MvogmQEfC7VcS21ifk7w0HVvzo2yOZRPvkCzGRu/rducxtB4RTcr58XCZ8h/Bt1aqQYKExu3c/3GXwg== dependencies: - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" -"@lerna/run-topologically@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.14.0.tgz#2a560cb657f0ef1565c680b6001b4b01b872dc07" - integrity sha512-y+KBpC1YExFzGynovt9MY4O/bc3RrJaKeuXieiPfKGKxrdtmZe/r33oj/xePTXZq65jnw3SaU3H8S5CrrdkwDg== +"@lerna/run-topologically@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.16.0.tgz#39e29cfc628bbc8e736d8e0d0e984997ac01bbf5" + integrity sha512-4Hlpv4zDtKWa5Z0tPkeu0sK+bxZEKgkNESMGmWrUCNfj7xwvAJurcraK8+a2Y0TFYwf0qjSLY/MzX+ZbJA3Cgw== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.16.0" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.15.0.tgz#465028b5b561a050bd760924e4a0749de3f43172" - integrity sha512-KQBkzZYoEKmzILKjbjsm1KKVWFBXwAdwzqJWj/lfxxd3V5LRF8STASk8aiw8bSpB0bUL9TU/pbXakRxiNzjDwQ== +"@lerna/run@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.16.0.tgz#1ea568c6f303e47fa00b3403a457836d40738fd2" + integrity sha512-woTeLlB1OAAz4zzjdI6RyIxSGuxiUPHJZm89E1pDEPoWwtQV6HMdMgrsQd9ATsJ5Ez280HH4bF/LStAlqW8Ufg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" "@lerna/npm-run-script" "3.14.2" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-topologically" "3.16.0" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" - -"@lerna/symlink-binary@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.14.2.tgz#a832fdc6c4b1e5aaf9e6ac9c7e6c322746965eb0" - integrity sha512-tqMwuWi6z1da0AFFbleWyu3H9fqayiV50rjj4anFTfayel9jSjlA1xPG+56sGIP6zUUNuUSc9kLh7oRRmlauoA== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/package" "3.14.2" - fs-extra "^7.0.0" - p-map "^1.2.0" - -"@lerna/symlink-dependencies@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.14.2.tgz#e6b2a9544ff26addc1f4324734595e2f71dfc795" - integrity sha512-Ox7WKXnHZ7IwWlejcCq3n0Hd/yMLv8AwIryhvWxM/RauAge+ML4wg578SsdCyKob8ecgm/R0ytHiU06j81iL1w== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/resolve-symlink" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - fs-extra "^7.0.0" + p-map "^2.1.0" + +"@lerna/symlink-binary@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.16.2.tgz#f98a3d9da9e56f1d302dc0d5c2efeb951483ee66" + integrity sha512-kz9XVoFOGSF83gg4gBqH+mG6uxfJfTp8Uy+Cam40CvMiuzfODrGkjuBEFoM/uO2QOAwZvbQDYOBpKUa9ZxHS1Q== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/package" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + +"@lerna/symlink-dependencies@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.16.2.tgz#91d9909d35897aebd76a03644a00cd03c4128240" + integrity sha512-wnZqGJQ+Jvr1I3inxrkffrFZfmQI7Ta8gySw/UWCy95QtZWF/f5yk8zVIocCAsjzD0wgb3jJE3CFJ9W5iwWk1A== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/resolve-symlink" "3.16.0" + "@lerna/symlink-binary" "3.16.2" + fs-extra "^8.1.0" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" "@lerna/timer@3.13.0": @@ -1166,34 +1165,34 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.15.0.tgz#3c65d223d94f211312995266abb07ee6606d5f73" - integrity sha512-vReYX1NMXZ9PwzTZm97wAl/k3bmRnRZhnQi3mq/m49xTnDavq7p4sbUdFpvu8cVZNKnYS02pNIVGHrQw+K8ZCw== +"@lerna/version@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.16.4.tgz#b5cc37f3ad98358d599c6196c30b6efc396d42bf" + integrity sha512-ikhbMeIn5ljCtWTlHDzO4YvTmpGTX1lWFFIZ79Vd1TNyOr+OUuKLo/+p06mCl2WEdZu0W2s5E9oxfAAQbyDxEg== dependencies: "@lerna/check-working-tree" "3.14.2" "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/conventional-commits" "3.14.0" - "@lerna/github-client" "3.14.2" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/conventional-commits" "3.16.4" + "@lerna/github-client" "3.16.0" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/prompt" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" minimatch "^3.0.4" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" p-reduce "^1.0.0" p-waterfall "^1.0.0" - semver "^5.5.0" - slash "^1.0.0" + semver "^6.2.0" + slash "^2.0.0" temp-write "^3.4.0" "@lerna/write-log-file@3.13.0": @@ -1221,11 +1220,32 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" +"@nodelib/fs.scandir@2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.2.tgz#1f981cd5b83e85cfdeb386fc693d4baab392fa54" + integrity sha512-wrIBsjA5pl13f0RN4Zx4FNWmU71lv03meGKnqRUoCyan17s4V3WL92f3w3AIuWbNnpcrQyFBU5qMavJoB8d27w== + dependencies: + "@nodelib/fs.stat" "2.0.2" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.2", "@nodelib/fs.stat@^2.0.1": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.2.tgz#2762aea8fe78ea256860182dcb52d61ee4b8fda6" + integrity sha512-z8+wGWV2dgUhLqrtRYa03yDx4HWMvXKi1z8g3m2JyxAx8F7xk74asqPk5LAETjqDSGLFML/6CDl0+yFunSYicw== + "@nodelib/fs.stat@^1.1.2": version "1.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== +"@nodelib/fs.walk@^1.2.1": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.3.tgz#a555dc256acaf00c62b0db29529028dd4d4cb141" + integrity sha512-l6t8xEhfK9Sa4YO5mIRdau7XSOADfmh3jCr0evNHdY+HNkW6xuQhgMH7D73VV6WpZOagrW0UludvMTiifiwTfA== + dependencies: + "@nodelib/fs.scandir" "2.1.2" + fastq "^1.6.0" + "@octokit/endpoint@^5.1.0": version "5.3.0" resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.3.0.tgz#7c4a8d74e88176206817bf513b63b1859a84c475" @@ -1236,10 +1256,10 @@ universal-user-agent "^3.0.0" url-template "^2.0.8" -"@octokit/plugin-enterprise-rest@^2.1.1": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-2.2.2.tgz#c0e22067a043e19f96ff9c7832e2a3019f9be75c" - integrity sha512-CTZr64jZYhGWNTDGlSJ2mvIlFsm9OEO3LqWn9I/gmoHI4jRBp4kpHoFYNemG4oA75zUAcmbuWblb7jjP877YZw== +"@octokit/plugin-enterprise-rest@^3.6.1": + version "3.6.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-3.6.2.tgz#74de25bef21e0182b4fa03a8678cd00a4e67e561" + integrity sha512-3wF5eueS5OHQYuAEudkpN+xVeUsg8vYEMMenEzLphUZ7PRZ8OJtDcsreL3ad9zxXmBbaFWzLmFcdob5CLyZftA== "@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": version "1.0.4" @@ -1262,10 +1282,10 @@ once "^1.4.0" universal-user-agent "^3.0.0" -"@octokit/rest@^16.16.0": - version "16.28.4" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.28.4.tgz#2f8ef08305033bc91256530d6a3c98eada700660" - integrity sha512-ZBsfD46t3VNkwealxm5zloVgQta8d8o4KYBR/hMAZ582IgjmSDKZdkjyv5w37IUCM3tcPZWKUT+kml9pEIC2GA== +"@octokit/rest@^16.28.4": + version "16.28.7" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.28.7.tgz#a2c2db5b318da84144beba82d19c1a9dbdb1a1fa" + integrity sha512-cznFSLEhh22XD3XeqJw51OLSfyL2fcFKUO+v2Ep9MTAFfFLS1cK1Zwd1yEgQJmJoDnj4/vv3+fGGZweG+xsbIA== dependencies: "@octokit/request" "^5.0.0" "@octokit/request-error" "^1.0.2" @@ -1375,10 +1395,10 @@ resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== -"@types/jest@^24.0.15": - version "24.0.15" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.15.tgz#6c42d5af7fe3b44ffff7cc65de7bf741e8fa427f" - integrity sha512-MU1HIvWUme74stAoc3mgAi+aMlgKOudgEvQDIm1v4RkrDudBh1T+NFp5sftpBAdXdx1J0PbdpJ+M2EsSOi1djA== +"@types/jest@^24.0.18": + version "24.0.18" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" + integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== dependencies: "@types/jest-diff" "*" @@ -1423,20 +1443,25 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^12.0.2", "@types/node@^12.6.8": +"@types/node@*", "@types/node@^12.0.2": version "12.6.8" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== +"@types/node@^12.7.2": + version "12.7.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" + integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== -"@types/prettier@^1.18.0": - version "1.18.0" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.0.tgz#d2dbe4d5f76b455138f13a2d881278e2c06a733d" - integrity sha512-5N6WK/XXs9PLPpge2KOmOSaIym2vIo32GsrxM5YOFs7uZ8R9L/acg+hQzWsfwoHEpasqQkH0+3LzLTbiF1GFLQ== +"@types/prettier@^1.18.2": + version "1.18.2" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.2.tgz#069e7d132024d436fd1f5771f6932426a695f230" + integrity sha512-2JBasa5Qaj81Qsp/dxX2Njy+MdKC767WytHUDsRM7TYEfQvKPxsnGpnCBlBS1i2Aiv1YwCpmKSbQ6O6v8TpiKg== "@types/semver@^6.0.1": version "6.0.1" @@ -1448,10 +1473,34 @@ 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.12" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" - integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== +"@types/yargs-parser@*": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" + integrity sha512-wBlsw+8n21e6eTd4yVv8YD/E3xq0O6nNnJIquutAsFGE7EyMKz7W6RNT6BRu1SmdgmlCZ9tb0X+j+D6HGr8pZw== + +"@types/yargs@^13.0.0": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.2.tgz#a64674fc0149574ecd90ba746e932b5a5f7b3653" + integrity sha512-lwwgizwk/bIIU+3ELORkyuOgDjCh7zuWDFqRtPPhhVgq9N1F7CvLNKg1TX4f2duwtKQ0p044Au9r1PLIXHrIzQ== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/experimental-utils@^1.13.0": + version "1.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e" + integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "1.13.0" + eslint-scope "^4.0.0" + +"@typescript-eslint/typescript-estree@1.13.0": + version "1.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e" + integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" "@webassemblyjs/ast@1.8.5": version "1.8.5" @@ -1609,6 +1658,15 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== +"@zkochan/cmd-shim@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" + integrity sha512-o8l0+x7C7sMZU3v9GuJIAU10qQLtwR1dtRQIOmlNMtyaqhmpXOzx1HWiYoWfmmf9HHZoAkXpc9TM9PQYF9d4Jg== + dependencies: + is-windows "^1.0.0" + mkdirp-promise "^5.0.1" + mz "^2.5.0" + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1635,10 +1693,10 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +acorn-jsx@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" + integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== acorn-walk@^6.0.1: version "6.2.0" @@ -1650,11 +1708,16 @@ acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.0.7, acorn@^6.2.0: +acorn@^6.0.1, acorn@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== +acorn@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.0.0.tgz#26b8d1cd9a9b700350b71c0905546f64d1284e7a" + integrity sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ== + agent-base@4, agent-base@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" @@ -1676,6 +1739,14 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" +aggregate-error@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.0.tgz#5b5a3c95e9095f311c9ab16c19fb4f3527cd3f79" + integrity sha512-yKD9kEoJIR+2IFqhMwayIBgheLYbB3PS2OBhWae1L/ODTd/JF/30cW0bc9TqzRL3k4U41Dieu3BF4I29p8xesA== + dependencies: + clean-stack "^2.0.0" + indent-string "^3.2.0" + ajv-errors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" @@ -1759,6 +1830,11 @@ any-observable@^0.3.0: resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -1820,10 +1896,10 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= -array-differ@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" - integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= +array-differ@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" + integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== array-equal@^1.0.0: version "1.0.0" @@ -1853,13 +1929,18 @@ array-includes@^3.0.3: define-properties "^1.1.2" es-abstract "^1.7.0" -array-union@^1.0.1: +array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= dependencies: array-uniq "^1.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" @@ -1870,7 +1951,7 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -arrify@^1.0.0, arrify@^1.0.1: +arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= @@ -1992,16 +2073,16 @@ babel-eslint@^10.0.1: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babel-jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.8.0.tgz#5c15ff2b28e20b0f45df43fe6b7f2aae93dba589" - integrity sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw== +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== dependencies: - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.6.0" + babel-preset-jest "^24.9.0" chalk "^2.4.2" slash "^2.0.0" @@ -2014,10 +2095,10 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.3.0" test-exclude "^5.2.3" -babel-plugin-jest-hoist@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" - integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== dependencies: "@types/babel__traverse" "^7.0.6" @@ -2030,13 +2111,13 @@ babel-polyfill@6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-preset-jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" - integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.6.0" + babel-plugin-jest-hoist "^24.9.0" babel-runtime@6.26.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" @@ -2266,12 +2347,12 @@ byline@^5.0.0: resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE= -byte-size@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-4.0.4.tgz#29d381709f41aae0d89c631f1c81aec88cd40b23" - integrity sha512-82RPeneC6nqCdSwCX2hZUz3JPOvN5at/nTEw/CMf05Smu3Hrpo9Psb7LjN+k+XndNArG1EY8L4+BM3aTM4BCvw== +byte-size@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-5.0.1.tgz#4b651039a5ecd96767e71a3d7ed380e48bed4191" + integrity sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw== -cacache@^11.3.2, cacache@^11.3.3: +cacache@^11.3.2: version "11.3.3" resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.3.tgz#8bd29df8c6a718a6ebd2d010da4d7972ae3bbadc" integrity sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA== @@ -2311,6 +2392,27 @@ cacache@^12.0.0: unique-filename "^1.1.1" y18n "^4.0.0" +cacache@^12.0.3: + version "12.0.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" + integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== + dependencies: + bluebird "^3.5.5" + chownr "^1.1.1" + figgy-pudding "^3.5.1" + glob "^7.1.4" + graceful-fs "^4.1.15" + infer-owner "^1.0.3" + lru-cache "^5.1.1" + mississippi "^3.0.0" + mkdirp "^0.5.1" + move-concurrently "^1.0.1" + promise-inflight "^1.0.1" + rimraf "^2.6.3" + ssri "^6.0.1" + unique-filename "^1.1.1" + y18n "^4.0.0" + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -2326,6 +2428,11 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cachedir@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.2.0.tgz#19afa4305e05d79e417566882e0c8f960f62ff0e" + integrity sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ== + call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -2382,7 +2489,7 @@ camelcase@^4.1.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -2452,7 +2559,7 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.7" -chownr@^1.1.1: +chownr@^1.1.1, chownr@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A== @@ -2464,11 +2571,6 @@ chrome-trace-event@^1.0.0: dependencies: tslib "^1.9.0" -ci-info@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" - integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -2492,6 +2594,11 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== + cli-cursor@^2.0.0, cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -2535,14 +2642,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -cmd-shim@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" - integrity sha1-b8vamUg6j9FdfTChlspp1oii79s= - dependencies: - graceful-fs "^4.1.2" - mkdirp "~0.5.0" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -2593,6 +2692,27 @@ commander@^2.11.0, commander@^2.12.1, commander@^2.20.0, commander@~2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commitizen@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.0.3.tgz#c19a4213257d0525b85139e2f36db7cc3b4f6dae" + integrity sha512-lxu0F/Iq4dudoFeIl5pY3h3CQJzkmQuh3ygnaOvqhAD8Wu2pYBI17ofqSuPHNsBTEOh1r1AVa9kR4Hp0FAHKcQ== + dependencies: + cachedir "2.2.0" + cz-conventional-changelog "3.0.1" + dedent "0.7.0" + detect-indent "6.0.0" + find-node-modules "2.0.0" + find-root "1.1.0" + fs-extra "8.1.0" + glob "7.1.4" + inquirer "6.5.0" + is-utf8 "^0.2.1" + lodash "4.17.15" + minimist "1.2.0" + shelljs "0.7.6" + strip-bom "4.0.0" + strip-json-comments "3.0.1" + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2748,7 +2868,7 @@ conventional-commits-parser@^2.1.0: through2 "^2.0.0" trim-off-newlines "^1.0.0" -conventional-commits-parser@^3.0.2: +conventional-commits-parser@^3.0.2, conventional-commits-parser@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.3.tgz#c3f972fd4e056aa8b9b4f5f3d0e540da18bf396d" integrity sha512-KaA/2EeUkO4bKjinNfGUyqPTX/6w9JGshuQRik4r/wJz7rUw3+D3fDG6sZSEqJvKILzKXFQuFkpPLclcsAuZcg== @@ -2761,17 +2881,17 @@ conventional-commits-parser@^3.0.2: through2 "^3.0.0" trim-off-newlines "^1.0.0" -conventional-recommended-bump@^4.0.4: - version "4.1.1" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-4.1.1.tgz#37014fadeda267d0607e2fc81124da840a585127" - integrity sha512-JT2vKfSP9kR18RXXf55BRY1O3AHG8FPg5btP3l7LYfcWJsiXI6MCf30DepQ98E8Qhowvgv7a8iev0J1bEDkTFA== +conventional-recommended-bump@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz#5af63903947b6e089e77767601cb592cabb106ba" + integrity sha512-RVdt0elRcCxL90IrNP0fYCpq1uGt2MALko0eyeQ+zQuDVWtMGAy9ng6yYn3kax42lCj9+XBxQ8ZN6S9bdKxDhQ== dependencies: concat-stream "^2.0.0" conventional-changelog-preset-loader "^2.1.1" conventional-commits-filter "^2.0.2" - conventional-commits-parser "^3.0.2" + conventional-commits-parser "^3.0.3" git-raw-commits "2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" meow "^4.0.0" q "^1.5.1" @@ -2911,16 +3031,34 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -cz-conventional-changelog@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz#2f4bc7390e3244e4df293e6ba351e4c740a7c764" - integrity sha1-L0vHOQ4yROTfKT5ro1Hkx0Cnx2Q= +cz-conventional-changelog@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-3.0.1.tgz#b1f207ae050355e7ada65aad5c52e9de3d0c8e5b" + integrity sha512-7KASIwB8/ClEyCRvQrCPbN7WkQnUSjSSVNyPM+gDJ0jskLi8h8N2hrdpyeCk7fIqKMRzziqVSOBTB8yyLTMHGQ== dependencies: + chalk "^2.4.1" conventional-commit-types "^2.0.0" lodash.map "^4.5.1" - longest "^1.0.1" + longest "^2.0.1" right-pad "^1.0.1" word-wrap "^1.0.3" + optionalDependencies: + "@commitlint/load" ">6.1.1" + +cz-conventional-changelog@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-3.0.2.tgz#f6b9a406177ab07f9a3a087e06103a045b376260" + integrity sha512-MPxERbtQyVp0nnpCBiwzKGKmMBSswmCV3Jpef3Axqd5f3c/SOc6VFiSUlclOyZXBn3Xtf4snzt4O15hBTRb2gA== + dependencies: + chalk "^2.4.1" + commitizen "^4.0.3" + conventional-commit-types "^2.0.0" + lodash.map "^4.5.1" + longest "^2.0.1" + right-pad "^1.0.1" + word-wrap "^1.0.3" + optionalDependencies: + "@commitlint/load" ">6.1.1" damerau-levenshtein@^1.0.4: version "1.0.5" @@ -3016,7 +3154,7 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -dedent@^0.7.0: +dedent@0.7.0, dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= @@ -3072,18 +3210,19 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" -del@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" - integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== - dependencies: - "@types/glob" "^7.1.1" - globby "^6.1.0" - is-path-cwd "^2.0.0" - is-path-in-cwd "^2.0.0" - p-map "^2.0.0" - pify "^4.0.1" - rimraf "^2.6.3" +del@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/del/-/del-5.1.0.tgz#d9487c94e367410e6eff2925ee58c0c84a75b3a7" + integrity sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA== + dependencies: + globby "^10.0.1" + graceful-fs "^4.2.2" + is-glob "^4.0.1" + is-path-cwd "^2.2.0" + is-path-inside "^3.0.1" + p-map "^3.0.0" + rimraf "^3.0.0" + slash "^3.0.0" delayed-stream@~1.0.0: version "1.0.0" @@ -3108,6 +3247,16 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" +detect-file@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" + integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= + +detect-indent@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd" + integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA== + detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" @@ -3136,10 +3285,10 @@ didyoumean@^1.2.1: resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.1.tgz#e92edfdada6537d484d73c0172fd1eba0c4976ff" integrity sha1-6S7f2tplN9SE1zwBcv0eugxJdv8= -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-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== diff@^3.2.0: version "3.5.0" @@ -3160,14 +3309,20 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" - integrity sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag== +dir-glob@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" + integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== dependencies: - arrify "^1.0.1" path-type "^3.0.0" +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -3299,6 +3454,11 @@ enhanced-resolve@~0.9.0: memory-fs "^0.2.0" tapable "^0.1.8" +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= + err-code@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" @@ -3445,7 +3605,7 @@ eslint-plugin-eslint-plugin@^2.1.0: resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.1.0.tgz#a7a00f15a886957d855feacaafee264f039e62d5" integrity sha512-kT3A/ZJftt28gbl/Cv04qezb/NQ1dwYIbi8lyf806XMxkus7DvOVCLIfTXMrorp322Pnoez7+zabXH29tADIDg== -eslint-plugin-import@^2.17.1, eslint-plugin-import@^2.18.0: +eslint-plugin-import@^2.17.1: version "2.18.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.0.tgz#7a5ba8d32622fb35eb9c8db195c2090bd18a3678" integrity sha512-PZpAEC4gj/6DEMMoU2Df01C5c50r7zdGIN52Yfi7CvvWaYssG7Jt5R9nFG5gmqodxNOz9vQS87xk6Izdtpdrig== @@ -3462,7 +3622,31 @@ eslint-plugin-import@^2.17.1, eslint-plugin-import@^2.18.0: read-pkg-up "^2.0.0" resolve "^1.11.0" -eslint-plugin-jest@^22.10.0, eslint-plugin-jest@^22.4.1: +eslint-plugin-import@^2.18.2: + version "2.18.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" + integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== + dependencies: + array-includes "^3.0.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.4.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.0" + read-pkg-up "^2.0.0" + resolve "^1.11.0" + +eslint-plugin-jest@^22.15.2: + version "22.15.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.2.tgz#e3c10d9391f787744e31566f69ebb70c3a98e398" + integrity sha512-p4NME9TgXIt+KgpxcXyNBvO30ZKxwFAO1dJZBc2OGfDnXVEtPwEyNs95GSr6RIE3xLHdjd8ngDdE2icRRXrbxg== + dependencies: + "@typescript-eslint/experimental-utils" "^1.13.0" + +eslint-plugin-jest@^22.4.1: version "22.10.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.10.0.tgz#a22be77f4dc692808b88ead0059620bda299a97d" integrity sha512-iBEWJn60Z5bctcjacymUnOQ3xN3gdvGOy3tDHpalAa99r4+jwH0CvICsIIHBNXNlJxuklkbx+wxr49tXk6M0tg== @@ -3515,7 +3699,7 @@ eslint-scope@3.7.1: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^4.0.0, eslint-scope@^4.0.3: +eslint-scope@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -3523,10 +3707,18 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.3.1, eslint-utils@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" - integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ== +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== dependencies: eslint-visitor-keys "^1.0.0" @@ -3535,10 +3727,15 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.0.0.tgz#9223f19223de73b4ed730e11bff44a376b65844d" - integrity sha512-SrrIfcd4tOgsspOKTSwamuTOAMZOUigHQhVMrzNjz4/B9Za6SHQDIocMIyIDfwDgx6MhS15nS6HC8kumCV2qBQ== +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +eslint@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.2.2.tgz#03298280e7750d81fcd31431f3d333e43d93f24f" + integrity sha512-mf0elOkxHbdyGX1IJEUsNBzCDdyoUgljF3rRlgfyYh0pwGnreLc0jjD6ZuleOibjmnUWZLY2eXwSooeOgGJ2jw== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3546,45 +3743,46 @@ eslint@^6.0.0: cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^6.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.2" + eslint-visitor-keys "^1.1.0" + espree "^6.1.1" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^3.1.0" + glob-parent "^5.0.0" globals "^11.7.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" + inquirer "^6.4.1" is-glob "^4.0.0" js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" - integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q== +espree@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" + integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.0.0" + acorn-jsx "^5.0.2" + eslint-visitor-keys "^1.1.0" esprima@^3.1.3: version "3.1.3" @@ -3669,10 +3867,10 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.3.tgz#4b84301b33042cfb622771e886ed0b10e5634642" - integrity sha512-iM124nlyGSrXmuyZF1EMe83ESY2chIYVyDRZKgmcDynid2Q2v/+GuE7gNMl6Sy9Niwf4MC0DDxagOxeMPjuLsw== +execa@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.4.tgz#2f5cc589c81db316628627004ea4e37b93391d8e" + integrity sha512-VcQfhuGD51vQUQtKIq2fjGDLDbL6N1DTQVpYzxZ7LPIXw3HqTuIz6uxRmpV1qf8i31LHf2kjiaGI+GdHwRgbnQ== dependencies: cross-spawn "^6.0.5" get-stream "^5.0.0" @@ -3702,17 +3900,24 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.8.0.tgz#471f8ec256b7b6129ca2524b2a62f030df38718d" - integrity sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA== +expand-tilde@^2.0.0, expand-tilde@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= dependencies: - "@jest/types" "^24.8.0" + homedir-polyfill "^1.0.1" + +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + dependencies: + "@jest/types" "^24.9.0" ansi-styles "^3.2.0" - jest-get-type "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-regex-util "^24.3.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" extend-shallow@^2.0.1: version "2.0.1" @@ -3772,7 +3977,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-glob@^2.0.2: +fast-glob@^2.2.6: version "2.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== @@ -3784,6 +3989,18 @@ fast-glob@^2.0.2: merge2 "^1.2.3" micromatch "^3.1.10" +fast-glob@^3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.0.4.tgz#d484a41005cb6faeb399b951fd1bd70ddaebb602" + integrity sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg== + dependencies: + "@nodelib/fs.stat" "^2.0.1" + "@nodelib/fs.walk" "^1.2.1" + glob-parent "^5.0.0" + is-glob "^4.0.1" + merge2 "^1.2.3" + micromatch "^4.0.2" + fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -3794,6 +4011,13 @@ fast-levenshtein@~2.0.4: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastq@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.6.0.tgz#4ec8a38f4ac25f21492673adb7eae9cfef47d1c2" + integrity sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA== + dependencies: + reusify "^1.0.0" + fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" @@ -3854,7 +4078,15 @@ find-cache-dir@^2.0.0: make-dir "^2.0.0" pkg-dir "^3.0.0" -find-root@^1.1.0: +find-node-modules@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/find-node-modules/-/find-node-modules-2.0.0.tgz#5db1fb9e668a3d451db3d618cd167cdd59e41b69" + integrity sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw== + dependencies: + findup-sync "^3.0.0" + merge "^1.2.1" + +find-root@1.1.0, find-root@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== @@ -3889,6 +4121,16 @@ find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +findup-sync@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" + integrity sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg== + dependencies: + detect-file "^1.0.0" + is-glob "^4.0.0" + micromatch "^3.0.4" + resolve-dir "^1.0.1" + flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -3945,12 +4187,12 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" - integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== +fs-extra@8.1.0, fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== dependencies: - graceful-fs "^4.1.2" + graceful-fs "^4.2.0" jsonfile "^4.0.0" universalify "^0.1.0" @@ -4039,10 +4281,10 @@ get-pkg-repo@^1.0.0: parse-github-repo-url "^1.3.0" through2 "^2.0.0" -get-port@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" - integrity sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw= +get-port@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" + integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== get-stdin@7.0.0, get-stdin@^7.0.0: version "7.0.0" @@ -4128,6 +4370,14 @@ git-semver-tags@^2.0.2: meow "^4.0.0" semver "^5.5.0" +git-semver-tags@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.3.tgz#48988a718acf593800f99622a952a77c405bfa34" + integrity sha512-tj4FD4ww2RX2ae//jSrXZzrocla9db5h0V7ikPl1P/WwoZar9epdUhwR7XHXSgc+ZkNq72BEEerqQuicoEQfzA== + dependencies: + meow "^4.0.0" + semver "^6.0.0" + git-up@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" @@ -4158,12 +4408,19 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" +glob-parent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" + integrity sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg== + dependencies: + is-glob "^4.0.1" + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@7.1.4, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -4182,40 +4439,69 @@ global-dirs@^0.1.1: dependencies: ini "^1.3.4" +global-modules@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" + integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== + dependencies: + global-prefix "^1.0.1" + is-windows "^1.0.1" + resolve-dir "^1.0.0" + +global-prefix@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" + integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= + dependencies: + expand-tilde "^2.0.2" + homedir-polyfill "^1.0.1" + ini "^1.3.4" + is-windows "^1.0.1" + which "^1.2.14" + globals@^11.1.0, globals@^11.7.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= +globby@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" + integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" -globby@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" - integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w== +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== dependencies: - array-union "^1.0.1" - dir-glob "2.0.0" - fast-glob "^2.0.2" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + pify "^4.0.1" + slash "^2.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6: version "4.2.0" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== +graceful-fs@^4.2.0, graceful-fs@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" + integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" @@ -4330,6 +4616,13 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +homedir-polyfill@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== + dependencies: + parse-passwd "^1.0.0" + hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -4384,18 +4677,19 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.0.tgz#de63821a7049dc412b1afd753c259e2f6e227562" - integrity sha512-lKMEn7bRK+7f5eWPNGclDVciYNQt0GIkAQmhKl+uHP1qFzoN0h92kmH9HZ8PCwyVA2EQPD8KHf0FYWqnTxau+Q== +husky@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.4.tgz#10a48ac11ab50859b0939750fa0b4e07ad0bf669" + integrity sha512-7Rnt8aJfy+MlV28snmYK7O7vWwtOfeVxV6KhLpUFXlmx5ukQ1nQmNUB7QsAwSgdySB5X+bm7q7JIRgazqBUzKA== dependencies: + chalk "^2.4.2" cosmiconfig "^5.2.1" execa "^1.0.0" get-stdin "^7.0.0" is-ci "^2.0.0" opencollective-postinstall "^2.0.2" pkg-dir "^4.2.0" - please-upgrade-node "^3.1.1" + please-upgrade-node "^3.2.0" read-pkg "^5.1.1" run-node "^1.0.0" slash "^3.0.0" @@ -4424,12 +4718,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -ignore@^4.0.6: +ignore@^4.0.3, ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== @@ -4439,6 +4728,11 @@ ignore@^5.0.5: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" integrity sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ== +ignore@^5.1.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -4455,14 +4749,6 @@ import-fresh@^3.0.0: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - integrity sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ== - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -4483,11 +4769,16 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" -indent-string@^3.0.0: +indent-string@^3.0.0, indent-string@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= +infer-owner@^1.0.3, infer-owner@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -4530,7 +4821,7 @@ init-package-json@^1.10.3: validate-npm-package-license "^3.0.1" validate-npm-package-name "^3.0.0" -inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.2.2: +inquirer@6.5.0, inquirer@^6.2.0, inquirer@^6.2.1: version "6.5.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== @@ -4549,6 +4840,25 @@ inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.2.2: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@^6.4.1: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + interpret@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" @@ -4607,13 +4917,6 @@ is-callable@^1.1.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@^1.0.10: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" - integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== - dependencies: - ci-info "^1.5.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -4742,24 +5045,15 @@ is-observable@^1.1.0: dependencies: symbol-observable "^1.1.0" -is-path-cwd@^2.0.0: +is-path-cwd@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== -is-path-in-cwd@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" - integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== - dependencies: - is-path-inside "^2.1.0" - -is-path-inside@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" - integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== - dependencies: - path-is-inside "^1.0.2" +is-path-inside@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.1.tgz#7417049ed551d053ab82bba3fdd6baa6b3a81e89" + integrity sha512-CKstxrctq1kUesU6WhtZDbYKzzYBuRH0UYInAVrkc/EYdB9ltbfE0gOoayG9nhohG6447sOOVGhHqsdmBvkbNg== is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" @@ -4840,12 +5134,12 @@ is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-utf8@^0.2.0: +is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= -is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== @@ -4933,73 +5227,73 @@ istanbul-lib-source-maps@^3.0.1: rimraf "^2.6.3" source-map "^0.6.1" -istanbul-reports@^2.1.1: +istanbul-reports@^2.2.6: version "2.2.6" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== dependencies: handlebars "^4.1.2" -jest-changed-files@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.8.0.tgz#7e7eb21cf687587a85e50f3d249d1327e15b157b" - integrity sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug== +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.8.0.tgz#b075ac914492ed114fa338ade7362a301693e989" - integrity sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA== +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== dependencies: - "@jest/core" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" prompts "^2.0.1" realpath-native "^1.1.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-config@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.8.0.tgz#77db3d265a6f726294687cbbccc36f8a76ee0f4f" - integrity sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw== +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.8.0" - "@jest/types" "^24.8.0" - babel-jest "^24.8.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.8.0" - jest-environment-node "^24.8.0" - jest-get-type "^24.8.0" - jest-jasmine2 "^24.8.0" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" micromatch "^3.1.10" - pretty-format "^24.8.0" + pretty-format "^24.9.0" realpath-native "^1.1.0" -jest-diff@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172" - integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g== +jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.3.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" jest-docblock@^24.3.0: version "24.3.0" @@ -5008,123 +5302,124 @@ jest-docblock@^24.3.0: dependencies: detect-newline "^2.1.0" -jest-each@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.8.0.tgz#a05fd2bf94ddc0b1da66c6d13ec2457f35e52775" - integrity sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA== +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - jest-get-type "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" - -jest-environment-jsdom@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz#300f6949a146cabe1c9357ad9e9ecf9f43f38857" - integrity sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" jsdom "^11.5.1" -jest-environment-node@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.8.0.tgz#d3f726ba8bc53087a60e7a84ca08883a4c892231" - integrity sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q== +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" -jest-get-type@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc" - integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== -jest-haste-map@^24.8.0: - version "24.8.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.1.tgz#f39cc1d2b1d907e014165b4bd5a957afcb992982" - integrity sha512-SwaxMGVdAZk3ernAx2Uv2sorA7jm3Kx+lR0grp6rMmnY06Kn/urtKx1LPN2mGTea4fCT38impYT28FfcLUhX0g== +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" anymatch "^2.0.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.4.0" - jest-util "^24.8.0" - jest-worker "^24.6.0" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" micromatch "^3.1.10" sane "^4.0.3" walker "^1.0.7" optionalDependencies: fsevents "^1.2.7" -jest-jasmine2@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz#a9c7e14c83dd77d8b15e820549ce8987cc8cd898" - integrity sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong== +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.8.0" + expect "^24.9.0" is-generator-fn "^2.0.0" - jest-each "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" throat "^4.0.0" -jest-leak-detector@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" - integrity sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g== +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== dependencies: - pretty-format "^24.8.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-matcher-utils@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz#2bce42204c9af12bde46f83dc839efe8be832495" - integrity sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw== +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== dependencies: chalk "^2.0.1" - jest-diff "^24.8.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-message-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.8.0.tgz#0d6891e72a4beacc0292b638685df42e28d6218b" - integrity sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g== +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.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.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" - integrity sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A== +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -5136,113 +5431,119 @@ jest-regex-util@^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.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" - integrity sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw== +jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== + +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.8.0" + jest-snapshot "^24.9.0" -jest-resolve@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.8.0.tgz#84b8e5408c1f6a11539793e2b5feb1b6e722439f" - integrity sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw== +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.8.0.tgz#4f9ae07b767db27b740d7deffad0cf67ccb4c5bb" - integrity sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow== +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.8.0" + jest-config "^24.9.0" jest-docblock "^24.3.0" - jest-haste-map "^24.8.0" - jest-jasmine2 "^24.8.0" - jest-leak-detector "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.8.0.tgz#05f94d5b05c21f6dc54e427cd2e4980923350620" - integrity sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA== +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" + "@jest/environment" "^24.9.0" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.2" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-serializer@^24.4.0: - version "24.4.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" - integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== -jest-snapshot@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" - integrity sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg== +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - expect "^24.8.0" - jest-diff "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.8.0" - semver "^5.5.0" - -jest-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.8.0.tgz#41f0e945da11df44cc76d64ffb915d0716f46cd1" - integrity sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA== - dependencies: - "@jest/console" "^24.7.1" - "@jest/fake-timers" "^24.8.0" - "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5251,29 +5552,29 @@ jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" - integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== dependencies: - "@jest/types" "^24.8.0" - camelcase "^5.0.0" + "@jest/types" "^24.9.0" + camelcase "^5.3.1" chalk "^2.0.1" - jest-get-type "^24.8.0" - leven "^2.1.0" - pretty-format "^24.8.0" - -jest-watcher@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.8.0.tgz#58d49915ceddd2de85e238f6213cef1c93715de4" - integrity sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw== - dependencies: - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.9" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.8.0" + jest-util "^24.9.0" string-length "^2.0.0" jest-worker@^24.6.0: @@ -5284,13 +5585,21 @@ jest-worker@^24.6.0: merge-stream "^1.0.1" supports-color "^6.1.0" -jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" - integrity sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg== +jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== dependencies: import-local "^2.0.0" - jest-cli "^24.8.0" + jest-cli "^24.9.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -5472,33 +5781,33 @@ left-pad@^1.3.0: resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -lerna@^3.15.0: - version "3.15.0" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.15.0.tgz#b044dba8138d7a1a8dd48ac1d80e7541bdde0d1f" - integrity sha512-kRIQ3bgzkmew5/WZQ0C9WjH0IUf3ZmTNnBwTHfXgLkVY7td0lbwMQFD7zehflUn0zG4ou54o/gn+IfjF0ti/5A== +lerna@^3.16.4: + version "3.16.4" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.16.4.tgz#158cb4f478b680f46f871d5891f531f3a2cb31ec" + integrity sha512-0HfwXIkqe72lBLZcNO9NMRfylh5Ng1l8tETgYQ260ZdHRbPuaLKE3Wqnd2YYRRkWfwPyEyZO8mZweBR+slVe1A== dependencies: - "@lerna/add" "3.15.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/changed" "3.15.0" - "@lerna/clean" "3.15.0" + "@lerna/add" "3.16.2" + "@lerna/bootstrap" "3.16.2" + "@lerna/changed" "3.16.4" + "@lerna/clean" "3.16.0" "@lerna/cli" "3.13.0" - "@lerna/create" "3.15.0" - "@lerna/diff" "3.15.0" - "@lerna/exec" "3.15.0" - "@lerna/import" "3.15.0" - "@lerna/init" "3.15.0" - "@lerna/link" "3.15.0" - "@lerna/list" "3.15.0" - "@lerna/publish" "3.15.0" - "@lerna/run" "3.15.0" - "@lerna/version" "3.15.0" - import-local "^1.0.0" + "@lerna/create" "3.16.0" + "@lerna/diff" "3.16.0" + "@lerna/exec" "3.16.0" + "@lerna/import" "3.16.0" + "@lerna/init" "3.16.0" + "@lerna/link" "3.16.2" + "@lerna/list" "3.16.0" + "@lerna/publish" "3.16.4" + "@lerna/run" "3.16.0" + "@lerna/version" "3.16.4" + import-local "^2.0.0" npmlog "^4.1.2" -leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" - integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -5513,21 +5822,22 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@^9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.2.0.tgz#155e5723dffdaa55d252c47bab05a2962c1e9781" - integrity sha512-K/CQWcxYunc8lGMNTFvtI4+ybJcHW3K4Ghudz2OrJhIWdW/i1WWu9rGiVj4yJ0+D/xh8a08kp5slt89VZC9Eqg== +lint-staged@^9.2.5: + version "9.2.5" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.2.5.tgz#5a3e1e0a539a403bd7f88542bc3d34ce52efdbb3" + integrity sha512-d99gTBFMJ29159+9iRvaMEQstmNcPAbQbhHSYw6D/1FncvFdIj8lWHztaq3Uq+tbZPABHXQ/fyN7Rp1QwF8HIw== dependencies: chalk "^2.4.2" commander "^2.20.0" cosmiconfig "^5.2.1" debug "^4.1.1" dedent "^0.7.0" - del "^4.1.1" - execa "^2.0.1" + del "^5.0.0" + execa "^2.0.3" listr "^0.14.3" log-symbols "^3.0.0" micromatch "^4.0.2" + normalize-path "^3.0.0" please-upgrade-node "^3.1.1" string-argv "^0.3.0" stringify-object "^3.3.0" @@ -5607,6 +5917,17 @@ load-json-file@^4.0.0: pify "^3.0.0" strip-bom "^3.0.0" +load-json-file@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-5.3.0.tgz#4d3c1e01fa1c03ea78a60ac7af932c9ce53403f3" + integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== + dependencies: + graceful-fs "^4.1.15" + parse-json "^4.0.0" + pify "^4.0.1" + strip-bom "^3.0.0" + type-fest "^0.3.0" + loader-runner@^2.3.0: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" @@ -5689,7 +6010,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash.template@^4.0.2: +lodash.template@^4.0.2, lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== @@ -5714,11 +6035,16 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.14, lodash@^4.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: +lodash@4.17.14, lodash@^4.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.2.1: version "4.17.14" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== +lodash@4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" @@ -5742,10 +6068,10 @@ log-update@^2.3.0: cli-cursor "^2.0.0" wrap-ansi "^3.0.1" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= +longest@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-2.0.1.tgz#781e183296aa94f6d4d916dc335d0d17aefa23f8" + integrity sha1-eB4YMpaqlPbU2RbcM10NF676I/g= loose-envify@^1.0.0, loose-envify@^1.4.0: version "1.4.0" @@ -5802,23 +6128,6 @@ make-error@1.x, make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== -make-fetch-happen@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.2.tgz#2d156b11696fb32bffbafe1ac1bc085dd6c78a79" - integrity sha512-YMJrAjHSb/BordlsDEcVcPyTbiJKkzqMf48N8dAJZT9Zjctrkb6Yg4TY9Sq2AwSIQJFn5qBBKVTYt3vP5FMIHA== - dependencies: - agentkeepalive "^3.4.1" - cacache "^11.3.3" - http-cache-semantics "^3.8.1" - http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" - lru-cache "^5.1.1" - mississippi "^3.0.0" - node-fetch-npm "^2.0.2" - promise-retry "^1.1.1" - socks-proxy-agent "^4.0.0" - ssri "^6.0.0" - make-fetch-happen@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.0.tgz#a8e3fe41d3415dd656fe7b8e8172e1fb4458b38d" @@ -5976,7 +6285,12 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: +merge@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" + integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== + +micromatch@^3.0.4, 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" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6043,7 +6357,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@^3.0.0, minimatch@^3.0.4: +minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -6063,7 +6377,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= @@ -6112,7 +6426,14 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp-promise@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= + dependencies: + mkdirp "*" + +mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -6146,15 +6467,15 @@ ms@^2.0.0, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multimatch@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" - integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= +multimatch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" + integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA== dependencies: - array-differ "^1.0.0" - array-union "^1.0.1" - arrify "^1.0.0" - minimatch "^3.0.0" + array-differ "^2.0.3" + array-union "^1.0.2" + arrify "^1.0.1" + minimatch "^3.0.4" mute-stream@0.0.7: version "0.0.7" @@ -6166,6 +6487,15 @@ mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mz@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" @@ -6234,17 +6564,17 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== -node-gyp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" - integrity sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA== +node-gyp@^5.0.2: + version "5.0.3" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.3.tgz#80d64c23790244991b6d44532f0a351bedd3dd45" + integrity sha512-z/JdtkFGUm0QaQUusvloyYuGDub3nUbOo5de1Fz57cM++osBTvQatBUSTlF1k/w8vFHPxxXW6zxGvkxXSpaBkQ== dependencies: + env-paths "^1.0.0" glob "^7.0.3" graceful-fs "^4.1.2" mkdirp "^0.5.0" nopt "2 || 3" npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" request "^2.87.0" rimraf "2" semver "~5.3.0" @@ -6290,10 +6620,10 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.2.1: - version "5.4.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" - integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== dependencies: growly "^1.3.0" is-wsl "^1.1.0" @@ -6364,14 +6694,14 @@ npm-bundled@^1.0.1: resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== -npm-lifecycle@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.1.tgz#0027c09646f0fd346c5c93377bdaba59c6748fdf" - integrity sha512-+Vg6I60Z75V/09pdcH5iUo/99Q/vop35PaI99elvxk56azSVVsdsSsS/sXqKDNwbRRNN1qSxkcO45ZOu0yOWew== +npm-lifecycle@^3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-3.1.3.tgz#09e9b0b6686e85fd53bab82364386222d97a3730" + integrity sha512-M0QmmqbEHBXxDrmc6X3+eKjW9+F7Edg1ENau92WkYw1sox6wojHzEZJIRm1ItljEiaigZlKL8mXni/4ylAy1Dg== dependencies: byline "^5.0.0" graceful-fs "^4.1.15" - node-gyp "^4.0.0" + node-gyp "^5.0.2" resolve-from "^4.0.0" slide "^1.1.6" uid-number "0.0.6" @@ -6388,7 +6718,7 @@ npm-lifecycle@^2.1.1: semver "^5.5.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.6, npm-packlist@^1.4.1, npm-packlist@^1.4.4: +npm-packlist@^1.1.6, npm-packlist@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.4.tgz#866224233850ac534b63d1a6e76050092b5d2f44" integrity sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw== @@ -6396,10 +6726,10 @@ npm-packlist@^1.1.6, npm-packlist@^1.4.1, npm-packlist@^1.4.4: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -npm-pick-manifest@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" - integrity sha512-+IluBC5K201+gRU85vFlUwX3PFShZAbAgDNp2ewJdWMVSppdo/Zih0ul2Ecky/X7b51J7LrrUAP+XOmOCvYZqA== +npm-pick-manifest@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-3.0.1.tgz#19c350ffbe42e0c3c054dcd50dd5760556a98bd8" + integrity sha512-QsJY1LuN6vuGg2BDnteeWGYODOYWZZwbW/YyCKHK4tt9uE+k2d70eg+Kr1CSLbX157Nu8UtY/Afdv884RnJSrQ== dependencies: figgy-pudding "^3.5.1" npm-package-arg "^6.0.0" @@ -6608,7 +6938,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.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -6685,16 +7015,18 @@ p-map-series@^1.0.0: dependencies: p-reduce "^1.0.0" -p-map@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" - integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== - -p-map@^2.0.0: +p-map@^2.0.0, p-map@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== +p-map@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" + integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== + dependencies: + aggregate-error "^3.0.0" + p-pipe@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-1.2.0.tgz#4b1a11399a11520a67790ee5a0c1d5881d6befe9" @@ -6792,6 +7124,11 @@ parse-json@^5.0.0: json-parse-better-errors "^1.0.1" lines-and-columns "^1.1.6" +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= + parse-path@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.1.tgz#0ec769704949778cb3b8eda5e994c32073a1adff" @@ -6852,11 +7189,6 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -6895,6 +7227,11 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + pbkdf2@^3.0.3: version "3.0.17" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" @@ -6983,6 +7320,13 @@ please-upgrade-node@^3.1.1: dependencies: semver-compare "^1.0.0" +please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== + dependencies: + semver-compare "^1.0.0" + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -7003,12 +7347,12 @@ prettier@*, prettier@^1.18.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== -pretty-format@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" - integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw== +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" @@ -7365,6 +7709,13 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -7495,6 +7846,14 @@ resolve-cwd@^2.0.0: dependencies: resolve-from "^3.0.0" +resolve-dir@^1.0.0, resolve-dir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" + integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= + dependencies: + expand-tilde "^2.0.0" + global-modules "^1.0.0" + resolve-from@5.0.0, resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -7534,6 +7893,13 @@ resolve@1.x, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.3.2, dependencies: path-parse "^1.0.6" +resolve@^1.1.6: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -7552,6 +7918,11 @@ retry@^0.10.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= +reusify@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + right-pad@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" @@ -7564,6 +7935,13 @@ rimraf@2, rimraf@2.6.3, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6 dependencies: glob "^7.1.3" +rimraf@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" + integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -7589,6 +7967,11 @@ run-node@^1.0.0: resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== +run-parallel@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" + integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -7664,16 +8047,26 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== +semver@5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" + integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== + semver@6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.1.tgz#53f53da9b30b2103cd4f15eab3a18ecbcb210c9b" integrity sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ== -semver@^6.0.0, semver@^6.1.1, semver@^6.2.0: +semver@^6.0.0, semver@^6.1.1: version "6.2.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== +semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -7724,6 +8117,15 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +shelljs@0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" + integrity sha1-N5zM+1a5HIYB5HkzVutTgpJN6a0= + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" @@ -8077,6 +8479,11 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-bom@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -8111,7 +8518,12 @@ 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@3.0.1, strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + +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= @@ -8254,6 +8666,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= + dependencies: + any-promise "^1.0.0" + throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" @@ -8414,10 +8840,10 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint@^5.18.0: - version "5.18.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.18.0.tgz#f61a6ddcf372344ac5e41708095bbf043a147ac6" - integrity sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w== +tslint@^5.19.0: + version "5.19.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.19.0.tgz#a2cbd4a7699386da823f6b499b8394d6c47bb968" + integrity sha512-1LwwtBxfRJZnUvoS9c0uj8XQtAnyhWr9KlNvDIdB+oXyT+VpsOAaEhEgKi1HrZ8rq0ki/AAnbGSv4KM6/AfVZw== dependencies: "@babel/code-frame" "^7.0.0" builtin-modules "^1.1.1" @@ -8440,10 +8866,10 @@ tsutils@^2.29.0: dependencies: tslib "^1.8.1" -tsutils@^3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.14.0.tgz#bf8d5a7bae5369331fa0f2b0a5a10bd7f7396c77" - integrity sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw== +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== dependencies: tslib "^1.8.1" @@ -8471,6 +8897,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" + integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== + type-fest@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" @@ -8486,15 +8917,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== - -"typescript@>=3.2.1 <3.6.0": - version "3.5.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202" - integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw== +typescript@*, "typescript@>=3.2.1 <3.7.0": + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== uglify-js@^3.1.4: version "3.6.0" @@ -8632,6 +9058,11 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -8773,7 +9204,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.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.14, 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== @@ -8855,7 +9286,7 @@ write-file-atomic@2.4.1: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: +write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.2: version "2.4.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== @@ -8864,7 +9295,7 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-json-file@^2.2.0, write-json-file@^2.3.0: +write-json-file@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.3.0.tgz#2b64c8a33004d54b8698c76d585a77ceb61da32f" integrity sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8= @@ -8876,6 +9307,18 @@ write-json-file@^2.2.0, write-json-file@^2.3.0: sort-keys "^2.0.0" write-file-atomic "^2.0.0" +write-json-file@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" + integrity sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ== + dependencies: + detect-indent "^5.0.0" + graceful-fs "^4.1.15" + make-dir "^2.1.0" + pify "^4.0.1" + sort-keys "^2.0.0" + write-file-atomic "^2.4.2" + write-pkg@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-pkg/-/write-pkg-3.2.0.tgz#0e178fe97820d389a8928bc79535dbe68c2cff21" @@ -8946,7 +9389,7 @@ yargs-parser@^13.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@^12.0.1, yargs@^12.0.2: +yargs@^12.0.1: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== @@ -8964,7 +9407,7 @@ yargs@^12.0.1, yargs@^12.0.2: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^13.1.0: +yargs@^13.1.0, yargs@^13.3.0: version "13.3.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== From ccb98d8288d8f7346c0065f36a2d1ae8c054681a Mon Sep 17 00:00:00 2001 From: Ankeet Maini Date: Tue, 3 Sep 2019 01:58:40 +0530 Subject: [PATCH 52/58] fix(eslint-plugin): [expl-member-a11y] fix parameter properties (#912) --- .../rules/explicit-member-accessibility.md | 40 ++++ .../rules/explicit-member-accessibility.ts | 20 +- .../explicit-member-accessibility.test.ts | 211 ++++++++++++++++-- 3 files changed, 250 insertions(+), 21 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 9f8c313d3df6..ce9163700c56 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -214,6 +214,46 @@ class Animal { } ``` +e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'explicit' } } ]` + +The following code is considered incorrect with the example override + +```ts +class Animal { + constructor(readonly animalName: string) {} +} +``` + +The following code patterns are considered correct with the example override + +```ts +class Animal { + constructor(public readonly animalName: string) {} +} + +class Animal { + constructor(public animalName: string) {} +} +``` + +e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'no-public' } } ]` + +The following code is considered incorrect with the example override + +```ts +class Animal { + constructor(public readonly animalName: string) {} +} +``` + +The following code is considered correct with the example override + +```ts +class Animal { + constructor(public animalName: string) {} +} +``` + #### Disable any checks on given member type e.g. `[{ overrides: { accessors : 'off' } } ]` diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 21a5a8cda189..a1d61d56ded2 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -196,8 +196,24 @@ export default util.createRule({ : // has to be an Identifier or TSC will throw an error (node.parameter.left as TSESTree.Identifier).name; - if (paramPropCheck === 'no-public' && node.accessibility === 'public') { - reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName); + switch (paramPropCheck) { + case 'explicit': { + if (!node.accessibility) { + reportIssue('missingAccessibility', nodeType, node, nodeName); + } + break; + } + case 'no-public': { + if (node.accessibility === 'public' && node.readonly) { + reportIssue( + 'unwantedPublicAccessibility', + nodeType, + node, + nodeName, + ); + } + break; + } } } 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 abf6ca2b25ec..051cfb30642e 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -10,6 +10,104 @@ ruleTester.run('explicit-member-accessibility', rule, { { filename: 'test.ts', code: ` +class Test { + public constructor(private foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(protected foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(public foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` class Test { protected name: string private x: number @@ -147,11 +245,90 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public foo: number){} +} + `, + options: [ + { + accessibility: 'no-public', + }, + ], + }, ], invalid: [ { filename: 'test.ts', code: ` +export class XXXX { + public constructor(readonly value: string) {} +} + `, + options: [ + { + accessibility: 'off', + overrides: { + parameterProperties: 'explicit', + }, + }, + ], + errors: [ + { + messageId: 'missingAccessibility', + column: 22, + line: 3, + }, + ], + }, + { + filename: 'test.ts', + code: ` +export class WithParameterProperty { + public constructor(readonly value: string) {} +} + `, + options: [{ accessibility: 'explicit' }], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` +export class XXXX { + public constructor(readonly samosa: string) {} +} + `, + options: [ + { + accessibility: 'off', + overrides: { + constructors: 'explicit', + parameterProperties: 'explicit', + }, + }, + ], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` class Test { x: number public getX () { @@ -365,18 +542,21 @@ class Test { code: ` class Test { constructor(public x: number){} + public foo(): string { + return 'foo'; + } } `, errors: [ { - messageId: 'unwantedPublicAccessibility', + messageId: 'missingAccessibility', line: 3, - column: 15, + column: 3, }, ], options: [ { - accessibility: 'no-public', + overrides: { parameterProperties: 'no-public' }, }, ], }, @@ -385,9 +565,6 @@ class Test { code: ` class Test { constructor(public x: number){} - public foo(): string { - return 'foo'; - } } `, errors: [ @@ -396,30 +573,26 @@ class Test { line: 3, column: 3, }, - { - messageId: 'unwantedPublicAccessibility', - line: 3, - column: 15, - }, - ], - options: [ - { - overrides: { parameterProperties: 'no-public' }, - }, ], }, { filename: 'test.ts', code: ` class Test { - constructor(public x: number){} + constructor(public readonly x: number){} } `, + options: [ + { + accessibility: 'off', + overrides: { parameterProperties: 'no-public' }, + }, + ], errors: [ { - messageId: 'missingAccessibility', + messageId: 'unwantedPublicAccessibility', line: 3, - column: 3, + column: 15, }, ], }, From 736a074b80eafd88376a90e6595a42217d939890 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 3 Sep 2019 08:25:40 -0700 Subject: [PATCH 53/58] =?UTF-8?q?docs(eslint-plugin):=20explicitly=20docum?= =?UTF-8?q?ent=20mixed=20codebase=20usage=20fo=E2=80=A6=20(#939)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rules/explicit-function-return-type.md | 22 ++++++++++++++ .../rules/explicit-member-accessibility.md | 30 ++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 5f729129b7a3..7e3093ebfaa0 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -78,6 +78,28 @@ const defaults = { }; ``` +### Configuring in a mixed JS/TS codebase + +If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files. + +```jsonc +{ + "rules": { + // disable the rule for all files + "@typescript-eslint/explicit-function-return-type": "off" + }, + "overrides": [ + { + // enable the rule specifically for TypeScript files + "files": ["*.ts", "*.tsx"], + "rules": { + "@typescript-eslint/explicit-function-return-type": ["error"] + } + } + ] +} +``` + ### allowExpressions Examples of **incorrect** code for this rule with `{ allowExpressions: true }`: diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index ce9163700c56..38be4f21a3c1 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -18,7 +18,7 @@ type AccessibilityLevel = | 'no-public' // don't require public | 'off'; // don't check -interface Config { +type Options = { accessibility?: AccessibilityLevel; overrides?: { accessors?: AccessibilityLevel; @@ -28,14 +28,36 @@ interface Config { parameterProperties?: AccessibilityLevel; }; } + +const defaultOptions: Options = { + accessibility: 'explicit', +}; ``` -Default config: +### Configuring in a mixed JS/TS codebase + +If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files. -```JSON -{ "accessibility": "explicit" } +```jsonc +{ + "rules": { + // disable the rule for all files + "@typescript-eslint/explicit-member-accessibility": "off" + }, + "overrides": [ + { + // enable the rule specifically for TypeScript files + "files": ["*.ts", "*.tsx"], + "rules": { + "@typescript-eslint/explicit-member-accessibility": ["error"] + } + } + ] +} ``` +### `accessibility` + 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: From 6a5c77cf048e5415faa75a5b7a6b5714b6c47d08 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 3 Sep 2019 08:59:39 -0700 Subject: [PATCH 54/58] docs(eslint-plugin): fix formatting typo --- .../eslint-plugin/docs/rules/explicit-member-accessibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 38be4f21a3c1..96295809138c 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -27,7 +27,7 @@ type Options = { properties?: AccessibilityLevel; parameterProperties?: AccessibilityLevel; }; -} +}; const defaultOptions: Options = { accessibility: 'explicit', From e9fcf70da607f5aca4ed4cae26089923b9824908 Mon Sep 17 00:00:00 2001 From: Anandaroop Roy Date: Fri, 6 Sep 2019 12:30:57 -0400 Subject: [PATCH 55/58] docs: Update supported TypeScript version range (#951) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fb38e917662..216f89cdc37e 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ The latest version under the `canary` tag **(latest commit to master)** is: We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. -**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.6.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.7.0`.** This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. From e01dc5f1dfbb7a0ac7641314f0fa2f23c2dd2248 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 6 Sep 2019 22:08:34 +0300 Subject: [PATCH 56/58] feat(eslint-plugin): add brace-style [extension] (#810) --- packages/eslint-plugin/README.md | 1 + .../eslint-plugin/docs/rules/brace-style.md | 22 + packages/eslint-plugin/src/configs/all.json | 2 + .../eslint-plugin/src/rules/brace-style.ts | 45 + packages/eslint-plugin/src/rules/index.ts | 2 + .../tests/rules/brace-style.test.ts | 1113 +++++++++++++++++ .../eslint-plugin/tools/generate-configs.ts | 1 + .../eslint-plugin/typings/eslint-rules.d.ts | 27 + 8 files changed, 1213 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/brace-style.md create mode 100644 packages/eslint-plugin/src/rules/brace-style.ts create mode 100644 packages/eslint-plugin/tests/rules/brace-style.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index a3ce816616ba..178ca903a9fc 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -145,6 +145,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | :heavy_check_mark: | | | | [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | | [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | | [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions. | :heavy_check_mark: | | | diff --git a/packages/eslint-plugin/docs/rules/brace-style.md b/packages/eslint-plugin/docs/rules/brace-style.md new file mode 100644 index 000000000000..908fca707c1d --- /dev/null +++ b/packages/eslint-plugin/docs/rules/brace-style.md @@ -0,0 +1,22 @@ +# Enforce consistent brace style for blocks + +## Rule Details + +This rule extends the base [eslint/brace-style](https://eslint.org/docs/rules/brace-style) rule. +It supports all options and features of the base rule. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "brace-style": "off", + "@typescript-eslint/brace-style": ["error"] +} +``` + +## Options + +See [eslint/brace-style options](https://eslint.org/docs/rules/brace-style#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/brace-style.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index cce896718db1..0974b7a72638 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -6,6 +6,8 @@ "@typescript-eslint/await-thenable": "error", "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", + "brace-style": "off", + "@typescript-eslint/brace-style": "error", "camelcase": "off", "@typescript-eslint/camelcase": "error", "@typescript-eslint/class-name-casing": "error", diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts new file mode 100644 index 000000000000..0f0f75afb301 --- /dev/null +++ b/packages/eslint-plugin/src/rules/brace-style.ts @@ -0,0 +1,45 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/brace-style'; +import * as util from '../util'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'brace-style', + meta: { + type: 'layout', + docs: { + description: 'Enforce consistent brace style for blocks', + category: 'Stylistic Issues', + recommended: false, + }, + messages: baseRule.meta.messages, + fixable: baseRule.meta.fixable, + schema: baseRule.meta.schema, + }, + defaultOptions: ['1tbs'], + create(context) { + const rules = baseRule.create(context); + const checkBlockStatement = ( + node: TSESTree.TSModuleBlock | TSESTree.TSInterfaceBody, + ): void => { + rules.BlockStatement({ + type: AST_NODE_TYPES.BlockStatement, + parent: node.parent, + range: node.range, + body: node.body as any, // eslint-disable-line @typescript-eslint/no-explicit-any + loc: node.loc, + }); + }; + + return { + ...rules, + TSInterfaceBody: checkBlockStatement, + TSModuleBlock: checkBlockStatement, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index bd39c7867e33..8ae9d698ccab 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -3,6 +3,7 @@ import arrayType from './array-type'; import awaitThenable from './await-thenable'; import banTsIgnore from './ban-ts-ignore'; import banTypes from './ban-types'; +import braceStyle from './brace-style'; import camelcase from './camelcase'; import classNameCasing from './class-name-casing'; import consistentTypeAssertions from './consistent-type-assertions'; @@ -67,6 +68,7 @@ export default { 'await-thenable': awaitThenable, 'ban-ts-ignore': banTsIgnore, 'ban-types': banTypes, + 'brace-style': braceStyle, camelcase: camelcase, 'class-name-casing': classNameCasing, 'consistent-type-assertions': consistentTypeAssertions, diff --git a/packages/eslint-plugin/tests/rules/brace-style.test.ts b/packages/eslint-plugin/tests/rules/brace-style.test.ts new file mode 100644 index 000000000000..d1f586afc2f8 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/brace-style.test.ts @@ -0,0 +1,1113 @@ +import rule from '../../src/rules/brace-style'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, +}); + +ruleTester.run('brace-style', rule, { + valid: [ + { + code: ` +function f() { + if (true) + return { x: 1 }; + else { + var y = 2; + return y; + } +} + `, + }, + { + code: ` +if (tag === 1) glyph.id = pbf.readVarint(); +else if (tag === 2) glyph.bitmap = pbf.readBytes(); + `, + }, + { + code: ` +function foo () { + return; +} + `, + }, + { + code: ` +function a(b, +c, +d) { } + `, + }, + { + code: ` +!function foo () { + return; +} + `, + }, + { + code: ` +!function a(b, +c, +d) { } + `, + }, + { + code: ` +if (foo) { + bar(); +} + `, + }, + { + code: ` +if (a) { + b(); +} else { + c(); +} + `, + }, + { + code: ` +while (foo) { + bar(); +} + `, + }, + { + code: ` +for (;;) { + bar(); +} + `, + }, + { + code: ` +with (foo) { + bar(); +} + `, + }, + { + code: ` +switch (foo) { + case 'bar': break; +} + `, + }, + { + code: ` +try { + bar(); +} catch (e) { + baz(); +} + `, + }, + { + code: ` +do { + bar(); +} while (true) + `, + }, + { + code: ` +for (foo in bar) { + baz(); +} + `, + }, + { + code: ` +if (a && + b && + c) { + } + `, + }, + { + code: ` +switch(0) { +} + `, + }, + { + code: ` +class Foo { +} + `, + }, + { + code: ` +(class { +}) + `, + }, + { + code: ` +class +Foo { +} + `, + }, + { + code: ` +class Foo { + bar() { + } +} + `, + }, + { + code: ` +if (foo) { +} +else { +} + `, + options: ['stroustrup'], + }, + { + code: ` +if (foo) +{ +} +else +{ +} + `, + options: ['allman'], + }, + { + code: ` +try { + bar(); +} +catch (e) { + baz(); +} + `, + options: ['stroustrup'], + }, + { + code: ` +try +{ + bar(); +} +catch (e) +{ + baz(); +} + `, + options: ['allman'], + }, + { + code: `function foo () { return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `function foo () { a(); b(); return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `function a(b,c,d) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `!function foo () { return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `!function a(b,c,d) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (a) { b(); } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `while (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `for (;;) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `with (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `switch (foo) { case 'bar': break; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `try { bar(); } catch (e) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `do { bar(); } while (true)`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `for (foo in bar) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (a && b && c) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `switch(0) {}`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: ` +if (foo) {} +else {} + `, + options: ['stroustrup', { allowSingleLine: true }], + }, + { + code: ` +try { bar(); } +catch (e) { baz(); } + `, + options: ['stroustrup', { allowSingleLine: true }], + }, + { + code: `var foo = () => { return; }`, + options: ['stroustrup', { allowSingleLine: true }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` +if (foo) {} +else {} + `, + options: ['allman', { allowSingleLine: true }], + }, + { + code: ` +try { bar(); } +catch (e) { baz(); } + `, + options: ['allman', { allowSingleLine: true }], + }, + { + code: `var foo = () => { return; }`, + options: ['allman', { allowSingleLine: true }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` +if (tag === 1) fontstack.name = pbf.readString(); +else if (tag === 2) fontstack.range = pbf.readString(); +else if (tag === 3) { + var glyph = pbf.readMessage(readGlyph, {}); + fontstack.glyphs[glyph.id] = glyph; +} + `, + options: ['1tbs'], + }, + { + code: ` +if (tag === 1) fontstack.name = pbf.readString(); +else if (tag === 2) fontstack.range = pbf.readString(); +else if (tag === 3) { + var glyph = pbf.readMessage(readGlyph, {}); + fontstack.glyphs[glyph.id] = glyph; +} + `, + options: ['stroustrup'], + }, + { + code: ` +switch(x) +{ + case 1: + bar(); +} + `, + options: ['allman'], + }, + { + code: `switch(x) {}`, + options: ['allman', { allowSingleLine: true }], + }, + { + code: ` +class Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +(class { +}) + `, + options: ['stroustrup'], + }, + { + code: ` +class Foo +{ +} + `, + options: ['allman'], + }, + { + code: ` +(class +{ +}) + `, + options: ['allman'], + }, + { + code: ` +class +Foo +{ +} + `, + options: ['allman'], + }, + { + code: `class Foo {}`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `class Foo {}`, + options: ['allman', { allowSingleLine: true }], + }, + { + code: `(class {})`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `(class {})`, + options: ['allman', { allowSingleLine: true }], + }, + + // https://github.com/eslint/eslint/issues/7908 + { + code: `{}`, + }, + { + code: ` +if (foo) { +} +{ +} + `, + }, + { + code: ` +switch (foo) { + case bar: + baz(); + { + qux(); + } +} + `, + }, + { + code: ` +{ +} + `, + }, + { + code: ` +{ + { + } +} + `, + }, + + // https://github.com/eslint/eslint/issues/7974 + { + code: ` +class Ball { + throw() {} + catch() {} +} + `, + }, + { + code: ` +({ + and() {}, + finally() {} +}) + `, + }, + { + code: ` +(class { + or() {} + else() {} +}) + `, + }, + { + code: ` +if (foo) bar = function() {} +else baz() + `, + }, + { + code: ` +interface Foo { +} + `, + options: ['1tbs'], + }, + { + code: ` +interface Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +interface Foo +{ +} + `, + options: ['allman'], + }, + { + code: ` +module "Foo" { +} + `, + options: ['1tbs'], + }, + { + code: ` +module "Foo" { +} + `, + options: ['stroustrup'], + }, + { + code: ` +module "Foo" +{ +} + `, + options: ['allman'], + }, + { + code: ` +namespace Foo { +} + `, + options: ['1tbs'], + }, + { + code: ` +namespace Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +namespace Foo +{ +} + `, + options: ['allman'], + }, + ], + + invalid: [ + { + code: ` +if (f) { + bar; +} +else + baz; + `, + output: ` +if (f) { + bar; +} else + baz; + `, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `var foo = () => { return; }`, + output: `var foo = () => {\n return; \n}`, + parserOptions: { ecmaVersion: 6 }, + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `function foo() { return; }`, + output: `function foo() {\n return; \n}`, + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `function foo() \n { \n return; }`, + output: `function foo() { \n return; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `!function foo() \n { \n return; }`, + output: `!function foo() { \n return; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `if (foo) \n { \n bar(); }`, + output: `if (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `if (a) { \nb();\n } else \n { c(); }`, + output: `if (a) { \nb();\n } else {\n c(); \n}`, + errors: [ + { messageId: 'nextLineOpen' }, + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `while (foo) \n { \n bar(); }`, + output: `while (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `for (;;) \n { \n bar(); }`, + output: `for (;;) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `with (foo) \n { \n bar(); }`, + output: `with (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { \n case 'bar': break; }`, + output: `switch (foo) { \n case 'bar': break; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { }`, + output: `switch (foo) { }`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try \n { \n bar(); \n } catch (e) {}`, + output: `try { \n bar(); \n } catch (e) {}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n } catch (e) \n {}`, + output: `try { \n bar(); \n } catch (e) {}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `do \n { \n bar(); \n} while (true)`, + output: `do { \n bar(); \n} while (true)`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo in bar) \n { \n baz(); \n }`, + output: `for (foo in bar) { \n baz(); \n }`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo of bar) \n { \n baz(); \n }`, + output: `for (foo of bar) { \n baz(); \n }`, + parserOptions: { ecmaVersion: 6 }, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n}`, + output: `try { \n bar(); \n } catch (e) {\n}`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n } catch (e) {\n} finally {\n}`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `if (a) { \nb();\n } \n else { \nc();\n }`, + output: `if (a) { \nb();\n } else { \nc();\n }`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n} finally {\n}`, + output: `try { \n bar(); \n }\ncatch (e) {\n}\n finally {\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) { \nb();\n }\n else { \nc();\n }`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + output: `if (foo) {\nbaz();\n}\n else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n}\n else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + output: `try \n{ \n bar(); \n }\n catch (e) \n{\n}\n finally \n{\n}`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen', line: 1 }, + { messageId: 'sameLineOpen', line: 4 }, + { messageId: 'sameLineOpen', line: 6 }, + ], + }, + { + code: `switch(x) { case 1: \nbar(); }\n `, + output: `switch(x) \n{\n case 1: \nbar(); \n}\n `, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen', line: 1 }, + { messageId: 'blockSameLine', line: 1 }, + { messageId: 'singleLineClose', line: 2 }, + ], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) \n{ \nb();\n }\n else \n{ \nc();\n }`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + output: `if (foo) \n{\nbaz();\n}\n else if (bar) \n{\nbaz();\n}\nelse \n{\nqux();\n}`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}`, + options: ['allman'], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo)\n{\n bar(); }`, + output: `if (foo)\n{\n bar(); \n}`, + options: ['allman'], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `try\n{\n somethingRisky();\n} catch (e)\n{\n handleError()\n}`, + output: `try\n{\n somethingRisky();\n}\n catch (e)\n{\n handleError()\n}`, + options: ['allman'], + errors: [{ messageId: 'sameLineClose' }], + }, + + // allowSingleLine: true + { + code: `function foo() { return; \n}`, + output: `function foo() {\n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `function foo() { a(); b(); return; \n}`, + output: `function foo() {\n a(); b(); return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `function foo() { \n return; }`, + output: `function foo() { \n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `function foo() {\na();\nb();\nreturn; }`, + output: `function foo() {\na();\nb();\nreturn; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `!function foo() { \n return; }`, + output: `!function foo() { \n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (a) { b();\n } else { c(); }`, + output: `if (a) {\n b();\n } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `if (a) { b(); }\nelse { c(); }`, + output: `if (a) { b(); } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `while (foo) { \n bar(); }`, + output: `while (foo) { \n bar(); \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `for (;;) { bar(); \n }`, + output: `for (;;) {\n bar(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `with (foo) { bar(); \n }`, + output: `with (foo) {\n bar(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `switch (foo) \n { \n case \`bar\`: break; }`, + output: `switch (foo) { \n case \`bar\`: break; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { }`, + output: `switch (foo) { }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { bar(); }\ncatch (e) { baz(); }`, + output: `try { bar(); } catch (e) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try \n { \n bar(); \n } catch (e) {}`, + output: `try { \n bar(); \n } catch (e) {}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n } catch (e) \n {}`, + output: `try { \n bar(); \n } catch (e) {}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `do \n { \n bar(); \n} while (true)`, + output: `do { \n bar(); \n} while (true)`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo in bar) \n { \n baz(); \n }`, + output: `for (foo in bar) { \n baz(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n}`, + output: `try { \n bar(); \n } catch (e) {\n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n } catch (e) {\n} finally {\n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `if (a) { \nb();\n } \n else { \nc();\n }`, + output: `if (a) { \nb();\n } else { \nc();\n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n} finally {\n}`, + output: `try { \n bar(); \n }\ncatch (e) {\n}\n finally {\n}`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) { \nb();\n }\n else { \nc();\n }`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}`, + options: ['allman', { allowSingleLine: true }], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + + // Comment interferes with fix + { + code: `if (foo) // comment \n{\nbar();\n}`, + output: null, + errors: [{ messageId: 'nextLineOpen' }], + }, + + // https://github.com/eslint/eslint/issues/7493 + { + code: `if (foo) {\n bar\n.baz }`, + output: `if (foo) {\n bar\n.baz \n}`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (foo)\n{\n bar\n.baz }`, + output: `if (foo)\n{\n bar\n.baz \n}`, + options: ['allman'], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (foo) { bar\n.baz }`, + output: `if (foo) {\n bar\n.baz \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `if (foo) { bar\n.baz }`, + output: `if (foo) \n{\n bar\n.baz \n}`, + options: ['allman', { allowSingleLine: true }], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `switch (x) {\n case 1: foo() }`, + output: `switch (x) {\n case 1: foo() \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `class Foo\n{\n}`, + output: `class Foo {\n}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `(class\n{\n})`, + output: `(class {\n})`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `class Foo{\n}`, + output: `class Foo\n{\n}`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: `(class {\n})`, + output: `(class \n{\n})`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: `class Foo {\nbar() {\n}}`, + output: `class Foo {\nbar() {\n}\n}`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `(class Foo {\nbar() {\n}})`, + output: `(class Foo {\nbar() {\n}\n})`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `class\nFoo{}`, + output: `class\nFoo\n{}`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + + // https://github.com/eslint/eslint/issues/7621 + { + code: ` +if (foo) +{ + bar +} +else { + baz +} + `, + output: ` +if (foo) { + bar +} else { + baz +} + `, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'nextLineClose' }], + }, + { + code: ` +interface Foo +{ +} + `, + output: ` +interface Foo { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +interface Foo +{ +} + `, + output: ` +interface Foo { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `interface Foo { \n }`, + output: `interface Foo \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: ` +module "Foo" +{ +} + `, + output: ` +module "Foo" { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +module "Foo" +{ +} + `, + output: ` +module "Foo" { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `module "Foo" { \n }`, + output: `module "Foo" \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: ` +namespace Foo +{ +} + `, + output: ` +namespace Foo { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +namespace Foo +{ +} + `, + output: ` +namespace Foo { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `namespace Foo { \n }`, + output: `namespace Foo \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + ], +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index b400ca057224..664504783f0a 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -22,6 +22,7 @@ const RULE_NAME_PREFIX = '@typescript-eslint/'; const MAX_RULE_NAME_LENGTH = 32; const DEFAULT_RULE_SETTING = 'warn'; const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ + 'brace-style', 'camelcase', 'func-call-spacing', 'indent', diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 9eb02d5cce04..de6545f744d8 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -482,3 +482,30 @@ declare module 'eslint/lib/rules/quotes' { >; export = rule; } + +declare module 'eslint/lib/rules/brace-style' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + | 'nextLineOpen' + | 'sameLineOpen' + | 'blockSameLine' + | 'nextLineClose' + | 'singleLineClose' + | 'sameLineClose', + [ + '1tbs' | 'stroustrup' | 'allman', + { + allowSingleLine?: boolean; + }?, + ], + { + BlockStatement(node: TSESTree.BlockStatement): void; + ClassBody(node: TSESTree.ClassBody): void; + SwitchStatement(node: TSESTree.SwitchStatement): void; + IfStatement(node: TSESTree.IfStatement): void; + TryStatement(node: TSESTree.TryStatement): void; + } + >; + export = rule; +} From e011e90d2b975f70ace8c22e96f08b0a102cdb35 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sat, 7 Sep 2019 03:11:19 +0300 Subject: [PATCH 57/58] fix(eslint-plugin): [prefer-readonly] add handling for destructuring assignments --- .../src/rules/prefer-readonly.ts | 31 +++++++++++- .../tests/rules/prefer-readonly.test.ts | 48 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 2c8ab3671be8..280213dde0f3 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -68,7 +68,7 @@ export default util.createRule({ return; } - if (ts.isDeleteExpression(parent)) { + if (ts.isDeleteExpression(parent) || isDestructuringAssignment(node)) { classScope.addVariableModification(node); return; } @@ -108,6 +108,35 @@ export default util.createRule({ } } + function isDestructuringAssignment( + node: ts.PropertyAccessExpression, + ): boolean { + let current: ts.Node = node.parent; + + while (current) { + const parent = current.parent; + + if ( + ts.isObjectLiteralExpression(parent) || + ts.isArrayLiteralExpression(parent) || + ts.isSpreadAssignment(parent) || + (ts.isSpreadElement(parent) && + ts.isArrayLiteralExpression(parent.parent)) + ) { + current = parent; + } else if (ts.isBinaryExpression(parent)) { + return ( + parent.left === current && + parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ); + } else { + break; + } + } + + return false; + } + function isConstructor(node: TSESTree.Node): boolean { return ( node.type === AST_NODE_TYPES.MethodDefinition && diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index 5b2a6687339a..8d6ffbf0f7a5 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -220,6 +220,54 @@ ruleTester.run('prefer-readonly', rule, { this['computed'] = 1; } }`, + { + code: ` +class Foo { + private value: number = 0 + + bar(newValue: { value: number }) { + ({ value: this.value } = newValue); + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: Record = {}; + + bar(newValue: Record) { + ({ ...this.value } = newValue); + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: number[] = [] + + bar(newValue: number[]) { + [...this.value] = newValue; + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: number = 0; + + bar(newValue: number[]) { + [this.value] = newValue; + return this.value; + } +} + `, + }, ], invalid: [ { From f1059d82eae77e6d78800ed38ac1ce89692a419f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sat, 7 Sep 2019 08:34:38 +0300 Subject: [PATCH 58/58] fix(eslint-plugin): [efrt] allowExpressions - check functions in class field properties (#952) --- .../rules/explicit-function-return-type.ts | 3 +- .../explicit-function-return-type.test.ts | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b050578c189a..43a1cac41fb4 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -335,7 +335,8 @@ export default util.createRule({ options.allowExpressions && node.parent.type !== AST_NODE_TYPES.VariableDeclarator && node.parent.type !== AST_NODE_TYPES.MethodDefinition && - node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && + node.parent.type !== AST_NODE_TYPES.ClassProperty ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 0c67b903ceeb..bd69534089db 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -516,6 +516,57 @@ function test() { }, ], }, + { + filename: 'test.ts', + code: ` +class Foo { + public a = () => {}; + public b = function () {}; + public c = function test() {}; + + static d = () => {}; + static e = function () {}; +} + `, + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 3, + endLine: 3, + column: 14, + endColumn: 19, + }, + { + messageId: 'missingReturnType', + line: 4, + endLine: 4, + column: 14, + endColumn: 25, + }, + { + messageId: 'missingReturnType', + line: 5, + endLine: 5, + column: 14, + endColumn: 29, + }, + { + messageId: 'missingReturnType', + line: 7, + endLine: 7, + column: 14, + endColumn: 19, + }, + { + messageId: 'missingReturnType', + line: 8, + endLine: 8, + column: 14, + endColumn: 25, + }, + ], + }, { filename: 'test.ts', code: "var arrowFn = () => 'test';",