49 Commits

Author SHA1 Message Date
Isabel Duan
52eaa7b02f
Enable --isolatedDeclarations on TS codebase (#59635)
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2024-09-15 18:10:52 -07:00
Ron Buckton
6f530cc4ce
Add TReturn/TNext to Iterable et al (#58243) 2024-07-19 13:14:00 -04:00
Jake Bailey
16beff101a
Use explicit extensions for imports within src (#58421) 2024-05-06 17:07:54 -07:00
Wesley Wigham
f76727d17a
Add noCheck API option (#57934) 2024-04-26 13:21:15 -07:00
Jake Bailey
17e420daf6
Use built-in no-restricted-syntax to ban null instead of plugin, ban null type too (#58095) 2024-04-18 09:06:32 -07:00
Jake Bailey
756c0c3aa2
Use noTypesAndSymbols for API tests (#57799) 2024-03-15 18:39:45 -07:00
Ron Buckton
5e8f900afa
Report grammar errors for invalid decorator grammar (#57749) 2024-03-13 14:50:04 -04:00
Titian Cernicova-Dragomir
9a0c7b1c3b
Reduce file system calls during test setup. (#56791) 2024-01-11 11:08:55 -08:00
Andrew Branch
a6367977d4
isolatedModules error on alias merging with local value (#56354) 2023-11-15 14:11:12 -08:00
Sampo Kivistö
ec2bd4e252
perf: replace String and Array indexOf method calls with includes method call (#55482) 2023-08-25 11:27:55 -07:00
Jake Bailey
5e8c261b6a
dprint the codebase (#54820) 2023-08-16 14:26:38 -07:00
Andrew Branch
2f4962a89f
Remove implicit tests/cases/compiler path prefix from VFS test files (#54557) 2023-06-09 09:23:21 -07:00
Andrew Branch
d5a6c8edc6
Test harness fixes (#54556) 2023-06-06 17:22:33 -07:00
Andrew Branch
160d1b7d0a
Process only tsconfig-referenced files in compiler tests with tsconfig files (#54506) 2023-06-05 15:05:50 -07:00
Jake Bailey
a6be79d535
Remove old test262 and dt runner infra (#53125) 2023-03-07 11:59:47 -08:00
Jake Bailey
2a8436c529
Use eslint-plugin-simple-import-sort (#52090) 2023-02-02 14:36:21 -08:00
Wesley Wigham
89e928e8b4
Add --allowArbitraryExtensions, a flag for allowing arbitrary extensions on import paths (#51435) 2023-01-09 17:12:42 -08:00
Andrew Branch
a5dde88dce
--moduleResolution bundler (formerly known as hybrid) (#51669)
* WIP

* Add extension error back unless noEmit is set

* Add non-relative tests

* Add error for importing from declaration file

* Update unit test

* Add explicit flag for importing from .ts extensions

* Add module specifier resolution changes

* Add auto-import tests

* Disallow relative imports into node_modules

* Ensure auto-imports don’t suggest ./node_modules;

* Test a non-portable declaration emit issue

* Test auto-importing TSX file

* Update path completions

* Fix lint due to merge

* Remove minimal-specific stuff

* Remove minimal tests

* Update unit tests

* Add options

* Add customConditions option

* Add first tests

* CJS constructs are not allowed

* Add another test

* Fix extension adding/replacing priority

* Update test to reflect the choice not to block on unrecognized extensions

* Add auto-imports and string completions tests

* Revamp string completions ending preferences

* Comment test

* Auto-imports of declaration files cannot use .ts extension

* Have declaration file auto imports default to extensionless instead

* Add test for custom conditions

* Fix indentation

* Add baseline showing resolvePackageJsonImports/Exports compatibility

* Fix test and prevent CJS require from resolving

* Update unit test baselines

* Fix bad merge conflict resolution

* Make resolvedUsingTsExtension optional

* Update missed baselines

* Revert now-unnecessary API implementation changes

* Clean up

* Update baselines to es5 emit

* Rename to `bundler`
2022-12-13 13:35:16 -08:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.

The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Oleksandr T
164dddc48e
feat(7481): Operator to ensure an expression is contextually typed by, and satisfies, some type (#46827)
* feat(7481): add explicit type compatibility check with 'satisfies' expression

* Add failing test for lack of intersectioned contextual type

* Implement the behavior

* Add test corresponding to the 'if'

* Add test based on defined scenarios

* remove isExpression in favor of using type casting

* move tests from compiler to conformance folder

* update baseline

* add missing contextFlags argument

* use asserted type

* accept baseline

Co-authored-by: Ryan Cavanaugh <ryanca@microsoft.com>
2022-08-26 10:05:52 -07:00
Oleksandr T
5702941c2f
fix(49719): Incorrect error 2301 when using ES standard class properties (#49725)
* fix(49719): omit TS2301 error with enabled usedefineforclassfields

* show error for target lower than esnext with useddefineforclassfields enabled

* change target from esnext to es2022
2022-07-20 14:36:35 -07:00
Wesley Wigham
d1fa945261
Add moduleDetection compiler flag to allow for changing how modules are parsed (#47495)
* Add moduleDetection compiler flag to allow for changing how modules are parsed

The default setting is 'auto', where JSX containing files under react-jsx and react-jsxdev are
always parsed as modules, and esm-format files under module: node12+ are always parsed as modules,
in addition to the 'legacy' detection mode's conditions for other files. (Declaration files are exempt from
these new conditions)

The 'legacy' mode preserves TS's behavior prior to the introduction of this flag - a file is
parsed as a module if it contains an import, export, or import.meta expression.

In addition, there is a 'force' mode that forces all non-declaration files to be parsed as modules.
(Declaration files are still only modules if they contain a top-level import or export.)

This technically breaks the parser API, but it's kinda-sorta backwards compatible so long
as you don't need the functionality associated with more recent compiler flags.

* Fix post-merge lint

* Rename function

* Update default value documentation

* PR feedback

* Fix lint and typo
2022-03-11 10:36:00 -08:00
Wesley Wigham
ed9c522fd6
Accept new moduleResolution options on commandline (#46239) 2021-10-06 13:17:27 -07:00
Andrew Branch
e160bc8c0d
Type-only import specifiers (#45998)
* Parse type-only import specifiers

* Add type-only export specifiers

* Update transform and emit

* Update checking

* Fix elision when combined with importsNotUsedAsValues=preserve

* Accept baselines

* Add test

* WIP auto imports updates

* First auto-imports test working

* More auto-import tests

* Fix auto imports of type-only exports

* Add test for promoting type-only import

* Sort import/export specifiers by type-onlyness

* Update completions for `import { type |`

* Update other completions tests

* Respect organize imports sorting when promoting type-only to regular while adding a specifier

* Fix comment mistakes

* Update src/services/codefixes/importFixes.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Rearrange some order of assignments in parser

* Split huge if statement

* Remove redundant check

* Update new transformer

* Fix import statement completions

* Fix type keyword completions good grief

* Fix last tests

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-09-27 12:38:30 -07:00
Oleksandr T
40fa0c9f11
fix(44880): allow narrowing aliased conditions for catch variables (#45797) 2021-09-14 10:05:36 -07:00
Ryan Cavanaugh
e00b5ecd40
Enable max-statements-per-line lint rule (#45475)
* Enable the rule

* Fix all the violations
2021-08-16 13:53:51 -07:00
Oleksandr T
5c8d76347c
fix(44448): disallow 'delete' operator for optional properties (#44612) 2021-06-29 16:56:45 -07:00
Ron Buckton
5c5f180f8e Fix namespace import/export helper usage 2020-07-07 17:36:59 -07:00
Wesley Wigham
a78342a160
Move most harness globals into namespaces (#35530)
* Move most harness globals into namespaces

* Remove forward declaration from `createMapShim` and move all `Map` declarations into one file

* A small pile of more changes to get the harness transforming
2019-12-06 15:20:49 -08:00
Ron Buckton
6c59dc34ac
More tests for super.method call chain, improve vary-by (#35013) 2019-11-18 18:03:37 -08:00
Alexander T
034ba9fd25 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-06 09:07:48 +03:00
Ron Buckton
e3f4979736
Fix emit for object rest on a module export (#32699)
* Fix emit for object rest on a module export

* Add tests for exports of empty object/array binding patterns

* Add delay for exec to ensure diff tool has enough time to start
2019-08-05 16:53:21 -07:00
Alexander T
2c32308f35 no-null/no-null 2019-07-18 10:50:38 +03:00
Alexander T
769bb0b475 remove tslint configuration 2019-06-27 13:49:35 +03:00
Alexander T
810303542d Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-06-27 11:51:20 +03:00
Wesley Wigham
a150d55592
Explicitly error when an exclude is provided by a test as it will be unused (#32014) 2019-06-24 15:29:02 -07:00
Alexander T
62119ec9cc @typescript-eslint/no-unnecessary-type-assertion 2019-06-19 18:45:02 +03:00
Andy Hanson
dc7c9bad3d Avoid eagerly computing test payload (#27851) 2019-04-25 13:26:19 -07:00
Andy
12f3d0d54c
Enable --strictPropertyInitialization (#27558)
* Enable --strictPropertyInitialization

* Code review
2018-11-16 16:02:23 -08:00
Ron Buckton
5d79704931 Sanitize module resolution logs for typesVersions entries 2018-09-11 14:19:28 -07:00
Wesley Wigham
d58b1f664b
mark error type in baselines very not-aggressively (#26346) 2018-08-17 15:45:14 -07:00
Andy
60b8f8c206
Remove unnecessary callback in runBaseline (#26500) 2018-08-17 12:51:30 -07:00
Wesley Wigham
61fb222cd2
Use symlinks when looking for module names for declaration emit (#24874)
* fix symlink tag, support arbitrary (ie, directory) links via @link

Introduce indirect symlink lookup to specifier deriver

Use fileset, move exec

vfs path resolution :shakes fist:

Apply files symlink relative to dirname

Use directory function

* Accept really bad baseline updates
2018-06-12 12:52:44 -07:00
Ryan Cavanaugh
336c37662d Projzilla phase 1 2018-06-09 16:48:08 -07:00