Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: bump dependencies and align AST (#2007)
  • Loading branch information
bradzacher committed May 11, 2020
1 parent 6987ecc commit 18668b7
Show file tree
Hide file tree
Showing 23 changed files with 2,157 additions and 1,543 deletions.
30 changes: 15 additions & 15 deletions package.json
Expand Up @@ -57,27 +57,27 @@
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/config-lerna-scopes": "^8.3.4",
"@types/jest": "^25.1.0",
"@types/node": "^12.12.7",
"@types/jest": "^25.2.1",
"@types/node": "^13.13.5",
"@types/prettier": "^2.0.0",
"all-contributors-cli": "^6.11.0",
"cspell": "^4.0.43",
"cz-conventional-changelog": "^3.0.2",
"all-contributors-cli": "^6.14.2",
"cspell": "^4.0.61",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^6.7.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-eslint-plugin": "^2.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.4",
"husky": "^3.0.9",
"eslint-plugin-eslint-plugin": "^2.2.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.10.0",
"husky": "^4.2.5",
"isomorphic-fetch": "^2.2.1",
"jest": "^25.1.0",
"jest": "^25.5.4",
"lerna": "^3.20.2",
"lint-staged": "^9.4.3",
"markdownlint-cli": "^0.22.0",
"lint-staged": "^10.2.2",
"markdownlint-cli": "^0.23.0",
"prettier": "^2.0.5",
"ts-jest": "^25.0.0",
"ts-node": "^8.5.0",
"tslint": "^6.1.0",
"ts-jest": "^25.5.1",
"ts-node": "^8.10.1",
"tslint": "^6.1.2",
"typescript": ">=3.2.1 <3.9.0"
},
"resolutions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin/package.json
Expand Up @@ -48,8 +48,8 @@
},
"devDependencies": {
"@types/marked": "^0.7.1",
"chalk": "^3.0.0",
"marked": "^0.7.0",
"chalk": "^4.0.0",
"marked": "^1.0.0",
"prettier": "*",
"typescript": "*"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/configs/README.md
Expand Up @@ -48,4 +48,5 @@ 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 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.**
<!-- prettier-ignore -->
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.**
2 changes: 1 addition & 1 deletion packages/eslint-plugin/tests/docs.test.ts
Expand Up @@ -60,7 +60,7 @@ describe('Validating rule docs', () => {

// Rule title not found.
// Rule title does not match the rule metadata.
expect(tokens[0]).toEqual({
expect(tokens[0]).toMatchObject({
type: 'heading',
depth: 1,
text: `${rule.meta.docs?.description} (\`${ruleName}\`)`,
Expand Down
1 change: 1 addition & 0 deletions packages/experimental-utils/src/json-schema.ts
@@ -1 +1,2 @@
// eslint-disable-next-line import/no-extraneous-dependencies
export * from 'json-schema';
1 change: 1 addition & 0 deletions packages/parser/tests/lib/__snapshots__/comments.ts.snap
Expand Up @@ -571,6 +571,7 @@ Object {
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 1,
Expand Down
50 changes: 50 additions & 0 deletions packages/parser/tests/lib/__snapshots__/typescript.ts.snap
Expand Up @@ -15411,6 +15411,56 @@ Object {
}
`;

exports[`typescript fixtures/basics/export-default-interface.src 1`] = `
Object {
"$id": 1,
"block": Object {
"range": Array [
0,
50,
],
"type": "Program",
},
"childScopes": Array [
Object {
"$id": 0,
"block": Object {
"range": Array [
0,
50,
],
"type": "Program",
},
"childScopes": Array [],
"functionExpressionScope": false,
"isStrict": true,
"references": Array [],
"throughReferences": Array [],
"type": "module",
"upperScope": Object {
"$ref": 1,
},
"variableMap": Object {},
"variableScope": Object {
"$ref": 0,
},
"variables": Array [],
},
],
"functionExpressionScope": false,
"isStrict": false,
"references": Array [],
"throughReferences": Array [],
"type": "global",
"upperScope": null,
"variableMap": Object {},
"variableScope": Object {
"$ref": 1,
},
"variables": Array [],
}
`;

exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = `
Object {
"$id": 4,
Expand Down
@@ -0,0 +1,3 @@
export default interface T {
method1(): void;
}
8 changes: 4 additions & 4 deletions packages/typescript-estree/package.json
Expand Up @@ -44,7 +44,7 @@
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^6.3.0",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
"devDependencies": {
Expand All @@ -56,10 +56,10 @@
"@types/glob": "^7.1.1",
"@types/is-glob": "^4.0.1",
"@types/lodash": "^4.14.149",
"@types/semver": "^6.2.0",
"@types/tmp": "^0.1.0",
"@types/semver": "^7.1.0",
"@types/tmp": "^0.2.0",
"@typescript-eslint/shared-fixtures": "2.31.0",
"tmp": "^0.1.0",
"tmp": "^0.2.1",
"typescript": "*"
},
"peerDependenciesMeta": {
Expand Down
10 changes: 5 additions & 5 deletions packages/typescript-estree/src/convert.ts
Expand Up @@ -170,17 +170,19 @@ export class Converter {
type: AST_NODE_TYPES.ExportDefaultDeclaration,
declaration: result,
range: [exportKeyword.getStart(this.ast), result.range[1]],
exportKind: 'value',
});
} else {
const isType =
result.type === AST_NODE_TYPES.TSInterfaceDeclaration ||
result.type === AST_NODE_TYPES.TSTypeAliasDeclaration;
const isDeclare = result.declare === true;
return this.createNode<TSESTree.ExportNamedDeclaration>(node, {
type: AST_NODE_TYPES.ExportNamedDeclaration,
declaration: result,
specifiers: [],
source: null,
exportKind: isType ? 'type' : 'value',
exportKind: isType || isDeclare ? 'type' : 'value',
range: [exportKeyword.getStart(this.ast), result.range[1]],
});
}
Expand Down Expand Up @@ -588,10 +590,7 @@ export class Converter {
return this.createNode<TSESTree.Program>(node, {
type: AST_NODE_TYPES.Program,
body: this.convertBodyExpressions(node.statements, node),
// externalModuleIndicator is internal field in TSC
sourceType: (node as any).externalModuleIndicator
? 'module'
: 'script',
sourceType: node.externalModuleIndicator ? 'module' : 'script',
range: [node.getStart(this.ast), node.endOfFileToken.end],
});
}
Expand Down Expand Up @@ -1630,6 +1629,7 @@ export class Converter {
return this.createNode<TSESTree.ExportDefaultDeclaration>(node, {
type: AST_NODE_TYPES.ExportDefaultDeclaration,
declaration: this.convertChild(node.expression),
exportKind: 'value',
});
}

Expand Down
1 change: 1 addition & 0 deletions packages/typescript-estree/src/ts-estree/ts-estree.ts
Expand Up @@ -875,6 +875,7 @@ export interface ExportAllDeclaration extends BaseNode {
export interface ExportDefaultDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportDefaultDeclaration;
declaration: ExportDeclaration | Expression;
exportKind: 'type' | 'value';
}

export interface ExportNamedDeclaration extends BaseNode {
Expand Down
Expand Up @@ -285,6 +285,8 @@ tester.addFixturePatternConfig('javascript/modules', {
'export-named-specifier',
'export-named-specifiers-comma',
'export-named-specifiers',
// babel treats declare as not a module
'import-module',
],
});

Expand Down Expand Up @@ -450,6 +452,12 @@ tester.addFixturePatternConfig('typescript/basics', {
'export-assignment',
'import-equal-declaration',
'import-export-equal-declaration',
// babel treats declare and types as not a module
'export-declare-const-named-enum',
'export-declare-named-enum',
'type-alias-declaration-export-function-type',
'type-alias-declaration-export-object-type',
'type-alias-declaration-export',
],
});

Expand Down
40 changes: 0 additions & 40 deletions packages/typescript-estree/tests/ast-alignment/utils.ts
Expand Up @@ -248,46 +248,6 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any {
node.asserts = false;
}
},
/**
* TS 3.8 features
*/
ExportNamedDeclaration(node: any) {
/**
* TS 3.8: export type
*/
if (!node.exportKind) {
if (
node.declaration?.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
node.declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration
) {
node.exportKind = 'type';
} else {
node.exportKind = 'value';
}
}
},
ExportAllDeclaration(node: any) {
/**
* TS 3.8: export type
*/
if (!node.exportKind) {
if (
node.declaration?.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
node.declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration
) {
node.exportKind = 'type';
} else {
node.exportKind = 'value';
}
}
/**
* TS 3.8 export * as namespace
* babel uses a representation that does not match the ESTree spec: https://github.com/estree/estree/pull/205
*/
if (!node.exported) {
node.exported = null;
}
},
ImportDeclaration(node) {
/**
* TS 3.8: import type
Expand Down
Expand Up @@ -571,6 +571,7 @@ Object {
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 1,
Expand Down
Expand Up @@ -108554,6 +108554,7 @@ Object {
],
"type": "Identifier",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 24,
Expand Down Expand Up @@ -109908,6 +109909,7 @@ Object {
],
"type": "ArrayExpression",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 18,
Expand Down Expand Up @@ -110097,6 +110099,7 @@ Object {
],
"type": "FunctionDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 38,
Expand Down Expand Up @@ -110338,6 +110341,7 @@ Object {
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 1,
Expand Down Expand Up @@ -110526,6 +110530,7 @@ Object {
},
"type": "BinaryExpression",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 23,
Expand Down Expand Up @@ -110752,6 +110757,7 @@ Object {
],
"type": "FunctionDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 29,
Expand Down Expand Up @@ -110974,6 +110980,7 @@ Object {
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 1,
Expand Down Expand Up @@ -111181,6 +111188,7 @@ Object {
],
"type": "FunctionDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 32,
Expand Down Expand Up @@ -111386,6 +111394,7 @@ Object {
"type": "Literal",
"value": 42,
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 18,
Expand Down Expand Up @@ -111577,6 +111586,7 @@ Object {
],
"type": "ObjectExpression",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 26,
Expand Down Expand Up @@ -111781,6 +111791,7 @@ Object {
],
"type": "Identifier",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 19,
Expand Down Expand Up @@ -120618,6 +120629,7 @@ Object {
"superClass": null,
"type": "ClassDeclaration",
},
"exportKind": "value",
"loc": Object {
"end": Object {
"column": 23,
Expand Down
Expand Up @@ -1852,6 +1852,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-default-class-with-multiple-generics.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-default-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-class-with-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-class-with-multiple-generics.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down

0 comments on commit 18668b7

Please sign in to comment.