Skip to content
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

[Lexical] Add flow for eslint #6127

Merged
merged 2 commits into from
May 17, 2024
Merged

[Lexical] Add flow for eslint #6127

merged 2 commits into from
May 17, 2024

Conversation

Sahejkm
Copy link
Contributor

@Sahejkm Sahejkm commented May 17, 2024

add flow for eslint

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 17, 2024
Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 2:24pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 2:24pm

Copy link

github-actions bot commented May 17, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 23.91 KB (0%) 479 ms (0%) 482 ms (+50.92% 🔺) 960 ms
packages/lexical-rich-text/dist/LexicalRichText.js 34.6 KB (0%) 693 ms (0%) 790 ms (-2.34% 🔽) 1.5 s
packages/lexical-plain-text/dist/LexicalPlainText.js 34.51 KB (0%) 691 ms (0%) 841 ms (-2.95% 🔽) 1.6 s

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is the fix for the script that generated this incorrectly if you want to add that as well (diff updated with correct regex)

diff --git a/scripts/update-flowconfig.js b/scripts/update-flowconfig.js
index be35f36d..81c82d4c 100644
--- a/scripts/update-flowconfig.js
+++ b/scripts/update-flowconfig.js
@@ -23,7 +23,7 @@ const BLOCK_REGEX =
 
 function flowTemplate(wwwName) {
   return (
-    headerTemplate.replace(/^( \*\/)$/m, '* @flow strict\n$1') +
+    headerTemplate.replace(/^( \*\/)$/m, ' * @flow strict\n$1') +
     `
 /**
  * ${wwwName}
@@ -59,22 +59,7 @@ function updateFlowconfig(flowconfigPath = './.flowconfig') {
     const resolveRelative = (...subPaths) =>
       '<PROJECT_ROOT>/' +
       path.relative(configDir, pkg.resolve(...subPaths)).replace(/^(?!\.)/, '');
-    if (pkg.isPrivate()) {
-      if (pkg.getDirectoryName() !== 'shared') {
-        continue;
-      }
-      if (process.env.TODO_DOES_WWW_NEED_SHARED_FILES === '1') {
-        // Do these even work? These .js files aren't on disk and `npm run flow`
-        // passes without them. Code is left in for demonstration purposes if
-        // this is needed for www.
-        for (const {name, sourceFileName} of pkg.getPrivateModuleEntries()) {
-          emit(
-            name,
-            resolveRelative('src', sourceFileName.replace(/\.tsx?$/, '.js')),
-          );
-        }
-      }
-    } else {
+    if (!pkg.isPrivate()) {
       for (const name of pkg.getExportedNpmModuleNames()) {
         const wwwName = npmToWwwName(name);
         const flowFile = `${wwwName}.js.flow`;
@@ -85,6 +70,7 @@ function updateFlowconfig(flowconfigPath = './.flowconfig') {
           console.log(
             `Creating boilerplate ${resolvedFlowFile.replace(/^[^/]+\//, '')}`,
           );
+          fs.mkdirsSync(path.dirname(flowFilePath));
           fs.writeFileSync(flowFilePath, flowTemplate(wwwName));
         }
       }

@etrepum
Copy link
Collaborator

etrepum commented May 17, 2024

er, hold off on that diff, I just tested it again and the regex is wrong 🤦 will post the correct tested diff shortly

@etrepum
Copy link
Collaborator

etrepum commented May 17, 2024

Just updated the diff above with the corrected regex, sorry about that! Early here :)

@Sahejkm
Copy link
Contributor Author

Sahejkm commented May 17, 2024

thanks Bob for the update on the script :)

@github-actions github-actions bot added the extended-tests Run extended e2e tests on a PR label May 17, 2024
@Sahejkm Sahejkm added this pull request to the merge queue May 17, 2024
Merged via the queue into main with commit 68f0592 May 17, 2024
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants