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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand Down
20 changes: 3 additions & 17 deletions scripts/update-flowconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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`;
Expand All @@ -85,6 +70,7 @@ function updateFlowconfig(flowconfigPath = './.flowconfig') {
console.log(
`Creating boilerplate ${resolvedFlowFile.replace(/^[^/]+\//, '')}`,
);
fs.mkdirsSync(path.dirname(flowFilePath));
fs.writeFileSync(flowFilePath, flowTemplate(wwwName));
}
}
Expand Down
Loading