Allow transpiling all js files inside yoastseo/src and allow import with asterisk * #21971
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
src
andvendor
into TypeScript and allows importing modules with an asterisk*
.Relevant technical choices:
moduleResolution
option in the config allows using import statement with an asterisk*
. For example,import * as assessments from "./scoring/assessments";
. Reference: moduleResolution"src/**.js"
to"src/**/*.js"
ininclude
allows the transpiling of all Javascript files inside thesrc
folder. Previously, not all JS files were transpiled. By using**/
now we should be able to match nested directory to any level. Reference: includevendor
is added to theinclude
array insidetsconfig.json
. This is because the Turkish external stemmer is stored in this folder. We also need to transpile the stemmer since we also use it insidesrc
folderyarn clean
script has also been changed to clean the generatedtypes
folder.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
checkJs
option insidepackages/yoastseo/tsconfig.json
totrue
to be able to build types (yarn build:types
insideyoastseo
packageAllows transpiling all JavaScript files inside
src
andvendor
into TypeScripttypes
folder inside the root ofyoastseo
directorytypes
folder, you see bothsrc
andvendor
folderssrc
are transpiledAllows importing modules with an asterisk
*
packages/yoastseo/src/index.js
. This file previously had errors in the import syntax with an asteriskpackages/yoastseo/types/src/index.d.ts
and confirm that the following modules are imported correctly:Removes
types
folder whenyarn clean
is executedtypes
folder insideyoastseo
withrm -rf types
yoastseo
package, runyarn build
build
andtypes
folder insideyoastseo
yarn clean
build
andtypes
folder insideyoastseo
are removedRelevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/lingo-other-tasks/issues/510