-
Notifications
You must be signed in to change notification settings - Fork 29
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
(v2.0) Strict mode by default #19
Conversation
) => | ||
allFilePaths.filter( | ||
(filePath) => | ||
!isFileStrictByPath(filePath, configPaths) && !filePathsWithErrors.includes(filePath), |
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.
i think that if we would convert filePathsWithErrors
to set before filtering it could be a littlebit faster, but i dont know if its worth optimizing
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.
Set doesn't have a filter
method unfortunately
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.
I was talking about something like this
export const getFilePathsWithoutErrors = (
allFilePaths: string[],
filePathsWithErrors: string[],
configPaths?: string[],
) => {
const filePathsWithErrorsSet = new Set(filePathsWithErrors);
return allFilePaths.filter(
(filePath) =>
!isFileStrictByPath(filePath, configPaths) && !filePathsWithErrorsSet.has(filePath),
);
}
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.
Really nice PR. Good job!!
Hello @kamkry and @KostkaBrukowa! |
Hi @aleksandrlat, we've just published it with version |
Awesome! Thank you @kamkry! |
We noticed that adding strict mode manually was not enough for project migration due to simply forgetting to add it in new files or in changed ones. The new version will enable strict mode by default (no need for ts-strict comment) and ignore it in a specific file one can add //@ts-strict-ignore at the top of a file. With that design new files automatically come with strict mode enabled and it's easier to notice ignored files when modifying them, encouraging to try to fix those errors.
What about migration?
The 2.0 version will come with a CLI tool that will automatically detect files with strict errors and add ignore comments to them. It will also remove unnecessary strict comments existing in the project.
The PR also introduces a major refactor, unifying the strict file detection between CLI tools and the TS plugin.
Tasks left