Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 792623f

Browse files
authored
test: update ast alignment tests and simplify shared fixtures (typescript-eslint#3045)
update babel to 7.12.16
1 parent 5e5d9b9 commit 792623f

13 files changed

+49
-95
lines changed

packages/parser/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"devDependencies": {
5353
"@types/glob": "*",
5454
"@typescript-eslint/experimental-utils": "4.15.0",
55-
"@typescript-eslint/shared-fixtures": "4.15.0",
5655
"glob": "*",
5756
"typescript": "*"
5857
},

packages/parser/tsconfig.build.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"references": [
1111
{ "path": "../experimental-utils/tsconfig.build.json" },
1212
{ "path": "../scope-manager/tsconfig.build.json" },
13-
{ "path": "../shared-fixtures/tsconfig.build.json" },
1413
{ "path": "../types/tsconfig.build.json" },
1514
{ "path": "../typescript-estree/tsconfig.build.json" }
1615
]

packages/parser/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"references": [
1010
{ "path": "../experimental-utils/tsconfig.build.json" },
1111
{ "path": "../scope-manager/tsconfig.build.json" },
12-
{ "path": "../shared-fixtures/tsconfig.build.json" },
1312
{ "path": "../types/tsconfig.build.json" },
1413
{ "path": "../typescript-estree/tsconfig.build.json" }
1514
]

packages/shared-fixtures/jsx-known-issues.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/shared-fixtures/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{
22
"name": "@typescript-eslint/shared-fixtures",
33
"version": "4.15.0",
4-
"private": true,
5-
"scripts": {
6-
"build": "tsc -b tsconfig.build.json",
7-
"clean": "tsc -b tsconfig.build.json --clean",
8-
"postclean": "rimraf dist",
9-
"typecheck": "tsc -p tsconfig.json --noEmit"
10-
}
4+
"private": true
115
}

packages/shared-fixtures/tsconfig.build.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/shared-fixtures/tsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/typescript-estree/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"devDependencies": {
5353
"@babel/code-frame": "^7.12.13",
54-
"@babel/parser": "^7.12.15",
54+
"@babel/parser": "^7.12.16",
5555
"@babel/types": "^7.12.13",
5656
"@types/babel__code-frame": "^7.0.2",
5757
"@types/debug": "*",

packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import jsxKnownIssues from '@typescript-eslint/shared-fixtures/dist/jsx-known-issues';
21
import fs from 'fs';
32
import glob from 'glob';
43
import path from 'path';
@@ -109,20 +108,6 @@ class FixturesTester {
109108
*/
110109
const tester = new FixturesTester();
111110

112-
/**
113-
* JSX fixtures which have known issues for typescript-estree
114-
*/
115-
const jsxFilesWithKnownIssues = jsxKnownIssues.map(f => f.replace('jsx/', ''));
116-
117-
/**
118-
* Current random error difference on jsx/invalid-no-tag-name.src.js
119-
* ts-estree - SyntaxError
120-
* Babel - RangeError
121-
*
122-
* Reported here: https://github.com/babel/babel/issues/6680
123-
*/
124-
jsxFilesWithKnownIssues.push('invalid-no-tag-name');
125-
126111
tester.addFixturePatternConfig('javascript/basics');
127112

128113
tester.addFixturePatternConfig('comments');
@@ -166,8 +151,8 @@ tester.addFixturePatternConfig('javascript/arrowFunctions', {
166151
* TS1100: "Invalid use of '{0}' in strict mode."
167152
* TODO: do we want TS1100 error code?
168153
*/
169-
'error-strict-eval', // babel parse errors
170154
'error-strict-default-param-eval',
155+
'error-strict-eval',
171156
'error-strict-eval-return',
172157
'error-strict-param-arguments',
173158
'error-strict-param-eval',
@@ -308,7 +293,30 @@ tester.addFixturePatternConfig('javascript/unicodeCodePointEscapes');
308293
/* ================================================== */
309294

310295
tester.addFixturePatternConfig('jsx', {
311-
ignore: jsxFilesWithKnownIssues,
296+
ignore: [
297+
/**
298+
* JSX fixtures which have known issues for typescript-estree
299+
* https://github.com/Microsoft/TypeScript/issues/7410
300+
*/
301+
'embedded-tags',
302+
/**
303+
* JSX fixtures which have known issues for typescript-estree
304+
* @see https://github.com/Microsoft/TypeScript/issues/7411
305+
*/
306+
'namespaced-attribute-and-value-inserted',
307+
/**
308+
* JSX fixtures which have known issues for typescript-estree
309+
* @see https://github.com/Microsoft/TypeScript/issues/7411
310+
*/
311+
'namespaced-name-and-attribute',
312+
/**
313+
* Current random error difference on jsx/invalid-no-tag-name.src.js
314+
* ts-estree - SyntaxError
315+
* Babel - RangeError
316+
* @see https://github.com/babel/babel/issues/6680
317+
*/
318+
'invalid-no-tag-name',
319+
],
312320
});
313321
tester.addFixturePatternConfig('jsx-useJSXTextNode');
314322

@@ -342,13 +350,14 @@ tester.addFixturePatternConfig('typescript/basics', {
342350
*/
343351
'interface-with-extends-member-expression',
344352
/**
345-
* https://github.com/typescript-eslint/typescript-eslint/issues/2998
353+
* @see https://github.com/typescript-eslint/typescript-eslint/issues/2998
346354
*/
347355
'type-import-type',
348356
'type-import-type-with-type-parameters-in-type-reference',
349357
/**
350-
* Not yet supported in Babel https://github.com/babel/babel/issues/9228
358+
* Not yet supported in Babel
351359
* Directive field is not added to module and namespace
360+
* @see https://github.com/babel/babel/issues/9228
352361
*/
353362
'directive-in-module',
354363
'directive-in-namespace',
@@ -368,12 +377,6 @@ tester.addFixturePatternConfig('typescript/basics', {
368377
* https://github.com/babel/babel/issues/12683
369378
*/
370379
'export-named-enum-computed-string',
371-
/**
372-
* Babel: TSTypePredicate does not include `asserts` statement in range
373-
* ts-estree: TSTypePredicate does include `asserts` statement in range
374-
* https://github.com/babel/babel/pull/12763
375-
*/
376-
'type-assertion-with-guard-in-method',
377380
/**
378381
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
379382
* This is intentional; we don't error on semantic problems for these cases
@@ -387,16 +390,11 @@ tester.addFixturePatternConfig('typescript/basics', {
387390
* TODO: report this to babel
388391
*/
389392
'catch-clause-with-invalid-annotation',
390-
/**
391-
* babel does not take into account leading character into union and intersection
392-
* https://github.com/babel/babel/pull/12758
393-
*/
394-
'union-intersection',
395393
],
396394
ignoreSourceType: [
397395
/**
398396
* Babel reports sourceType script
399-
* https://github.com/babel/babel/issues/9213
397+
* @see https://github.com/babel/babel/issues/9213
400398
*/
401399
'export-assignment',
402400
'import-equal-declaration',
@@ -493,6 +491,4 @@ tester.addFixturePatternConfig('typescript/namespaces-and-modules', {
493491
],
494492
});
495493

496-
const fixturesToTest = tester.getFixtures();
497-
498-
export { fixturesToTest };
494+
export const fixturesToTest = tester.getFixtures();

packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { readFileSync } from 'fs';
22
import glob from 'glob';
3+
import path from 'path';
34
import * as parser from '../../src';
4-
import { extname } from 'path';
55
import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils';
66

77
/**
88
* Process all fixtures, we will only snapshot the ones that have semantic errors
99
* which are ignored by default parsing logic.
1010
*/
11-
const FIXTURES_DIR =
12-
'../../node_modules/@typescript-eslint/shared-fixtures/fixtures';
11+
const FIXTURES_DIR = path.join(__dirname, '../../../shared-fixtures/fixtures');
12+
1313
const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.*`);
1414

1515
describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled', () => {
1616
testFiles.forEach(filename => {
1717
const code = readFileSync(filename, 'utf8');
18-
const fileExtension = extname(filename);
18+
const fileExtension = path.extname(filename);
1919
const config: parser.TSESTreeOptions = {
2020
loc: true,
2121
range: true,

packages/typescript-estree/tsconfig.build.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"include": ["src", "typings"],
1010
"references": [
11-
{ "path": "../shared-fixtures/tsconfig.build.json" },
1211
{ "path": "../types/tsconfig.build.json" },
1312
{ "path": "../visitor-keys/tsconfig.build.json" }
1413
]

packages/typescript-estree/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"include": ["src", "typings", "tests", "tools"],
88
"exclude": ["tests/fixtures/**/*"],
99
"references": [
10-
{ "path": "../shared-fixtures/tsconfig.build.json" },
1110
{ "path": "../types/tsconfig.build.json" },
1211
{ "path": "../visitor-keys/tsconfig.build.json" }
1312
]

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"@babel/highlight" "^7.12.13"
1111

1212
"@babel/core@^7.1.0", "@babel/core@^7.7.5":
13-
version "7.12.13"
14-
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.13.tgz#b73a87a3a3e7d142a66248bf6ad88b9ceb093425"
15-
integrity sha512-BQKE9kXkPlXHPeqissfxo0lySWJcYdEP0hdtJOH/iJfDdhOCcgtNCjftCJg3qqauB4h+lz2N6ixM++b9DN1Tcw==
13+
version "7.12.16"
14+
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.16.tgz#8c6ba456b23b680a6493ddcfcd9d3c3ad51cab7c"
15+
integrity sha512-t/hHIB504wWceOeaOoONOhu+gX+hpjfeN6YRBT209X/4sibZQfSF1I0HFRRlBe97UZZosGx5XwUg1ZgNbelmNw==
1616
dependencies:
1717
"@babel/code-frame" "^7.12.13"
18-
"@babel/generator" "^7.12.13"
18+
"@babel/generator" "^7.12.15"
1919
"@babel/helper-module-transforms" "^7.12.13"
2020
"@babel/helpers" "^7.12.13"
21-
"@babel/parser" "^7.12.13"
21+
"@babel/parser" "^7.12.16"
2222
"@babel/template" "^7.12.13"
2323
"@babel/traverse" "^7.12.13"
2424
"@babel/types" "^7.12.13"
@@ -30,7 +30,7 @@
3030
semver "^5.4.1"
3131
source-map "^0.5.0"
3232

33-
"@babel/generator@^7.12.13":
33+
"@babel/generator@^7.12.13", "@babel/generator@^7.12.15":
3434
version "7.12.15"
3535
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.15.tgz#4617b5d0b25cc572474cc1aafee1edeaf9b5368f"
3636
integrity sha512-6F2xHxBiFXWNSGb7vyCUTBF8RCLY66rS0zEPcP8t/nQyXjha5EuK4z7H5o7fWG8B4M7y6mqVWq1J+1PuwRhecQ==
@@ -56,9 +56,9 @@
5656
"@babel/types" "^7.12.13"
5757

5858
"@babel/helper-member-expression-to-functions@^7.12.13":
59-
version "7.12.13"
60-
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.13.tgz#c5715695b4f8bab32660dbdcdc2341dec7e3df40"
61-
integrity sha512-B+7nN0gIL8FZ8SvMcF+EPyB21KnCcZHQZFczCxbiNGV/O0rsrSBlWGLzmtBJ3GMjSVMIm4lpFhR+VdVBuIsUcQ==
59+
version "7.12.16"
60+
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.16.tgz#41e0916b99f8d5f43da4f05d85f4930fa3d62b22"
61+
integrity sha512-zYoZC1uvebBFmj1wFAlXwt35JLEgecefATtKp20xalwEK8vHAixLBXTGxNrVGEmTT+gzOThUgr8UEdgtalc1BQ==
6262
dependencies:
6363
"@babel/types" "^7.12.13"
6464

@@ -143,10 +143,10 @@
143143
chalk "^2.0.0"
144144
js-tokens "^4.0.0"
145145

146-
"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.12.15":
147-
version "7.12.15"
148-
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.15.tgz#2b20de7f0b4b332d9b119dd9c33409c538b8aacf"
149-
integrity sha512-AQBOU2Z9kWwSZMd6lNjCX0GUgFonL1wAM1db8L8PMk9UDaGsRCArBkU4Sc+UCM3AE4hjbXx+h58Lb3QT4oRmrA==
146+
"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.12.16":
147+
version "7.12.16"
148+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.16.tgz#cc31257419d2c3189d394081635703f549fc1ed4"
149+
integrity sha512-c/+u9cqV6F0+4Hpq01jnJO+GLp2DdT63ppz9Xa+6cHaajM9VFzK/iDXiKK65YtpeVwu+ctfS6iqlMqRgQRzeCw==
150150

151151
"@babel/plugin-syntax-async-generators@^7.8.4":
152152
version "7.8.4"

0 commit comments

Comments
 (0)