-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix(suggestion): Remove 80001 from cjs/cts files. #46270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good; I might try consolidating these all into a single test file though.
@DanielRosenwasser I did try to consolidate the tests before raising the PR. Without the changes is suggestionDiagnostics.ts, Passes (unexpected)/// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.ts
////const a = 0;
// @Filename: /b.js
////module.exports = 0;
verify.codeFixAvailable([]); Fails (as Expected)/// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /b.js
////module.exports = 0;
verify.codeFixAvailable([]); That is why I wrote 4 separate test files, If someone familiar with the system can point to how I should include tests in a single file, I'll gladly make the changes. |
I think you would need to go to each file with |
Thanks @andrewbranch ! |
|
||
if (sourceFile.commonJsModuleIndicator && | ||
if (!isCommonJSFile && | ||
sourceFile.commonJsModuleIndicator && | ||
(programContainsEs6Modules(program) || compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) && | ||
containsTopLevelCommonjs(sourceFile)) { | ||
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aside: Some time we should change errors to use the term "ES module" not "ES6 module".
* fix(suggestion): Remove 80001 from cjs/cts files. * tests: Cover more cases in a single file. * tests: Cover more cases in a single file.
Removes the "File is a CommonJS module; it may be converted to an ES6 module. ts(80001)" hint in CommonJS Modules, cjs, cts Files.
Fixes #46240