From 91e4c303091e1c805da938e9982cefcef29be3e1 Mon Sep 17 00:00:00 2001 From: sahejkm Date: Fri, 17 May 2024 21:42:49 +0800 Subject: [PATCH 1/2] Add flow for eslint --- packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow b/packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow index 3b23ff98ce6..55f418a0d83 100644 --- a/packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow +++ b/packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @flow strict */ /** From 68761712e86eaa201c6957a13284eb02f05019ec Mon Sep 17 00:00:00 2001 From: sahejkm Date: Fri, 17 May 2024 22:22:04 +0800 Subject: [PATCH 2/2] update script --- scripts/update-flowconfig.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/scripts/update-flowconfig.js b/scripts/update-flowconfig.js index be35f36d393..81c82d4c6c6 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) => '/' + 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)); } }