-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get a list of all non strict packages
- Loading branch information
1 parent
a24334d
commit 5303b75
Showing
3 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
*What:* | ||
We want to step our TS game in the monorepo and enable strict typescript in all packages! | ||
|
||
*Why:* | ||
Having TS track for you if a variable might be null or not, enables us to code with much more confidence, | ||
and also gives us quick in editor feedback, when you make assumptions that are not actually true! | ||
|
||
*How:* | ||
We would like to change as little as possible of the actual runtime behavior in this migration. | ||
However, we also don't want to simply silence the compiler everywhere with `!`, `as` or `ts-ignore` to get this migration in. | ||
As a rule of thumb, if the logic is easy enough, prefer improving the code (e.g. add a null check) over silencing the compiler. | ||
If the change needed to do the right thing, is too risky, and not in your expertise, it is okay to silence the compiler. | ||
It is not ideal, but we still gain the benefit that new code written will have extra typesafety. | ||
|
||
Feel free to contribute too any of packages in the list below! | ||
|
||
- [ ] @storybook/addon-backgrounds | ||
- [ ] @storybook/addon-docs | ||
- [ ] @storybook/addon-highlight | ||
- [ ] @storybook/addon-interactions | ||
- [ ] @storybook/addon-jest | ||
- [ ] @storybook/addon-mdx-gfm | ||
- [ ] @storybook/addon-measure | ||
- [ ] @storybook/addon-outline | ||
- [ ] @storybook/addon-storyshots | ||
- [ ] @storybook/addon-storyshots-puppeteer | ||
- [ ] @storybook/addon-storysource | ||
- [ ] @storybook/addon-viewport | ||
- [ ] @storybook/addons | ||
- [ ] @storybook/angular | ||
- [ ] @storybook/api | ||
- [ ] @storybook/blocks | ||
- [ ] @storybook/channel-postmessage | ||
- [ ] @storybook/channel-websocket | ||
- [ ] @storybook/channels | ||
- [ ] @storybook/cli | ||
- [ ] @storybook/client-api | ||
- [ ] @storybook/codemod | ||
- [ ] @storybook/components | ||
- [ ] @storybook/core-client | ||
- [ ] @storybook/core-events | ||
- [ ] @storybook/core-server | ||
- [ ] @storybook/csf-tools | ||
- [ ] @storybook/docs-tools | ||
- [ ] @storybook/external-docs | ||
- [ ] @storybook/html-vite | ||
- [ ] @storybook/instrumenter | ||
- [ ] @storybook/manager | ||
- [ ] @storybook/manager-api | ||
- [ ] @storybook/postinstall | ||
- [ ] @storybook/preact-vite | ||
- [ ] @storybook/preset-create-react-app | ||
- [ ] @storybook/preset-vue-webpack | ||
- [ ] @storybook/preset-vue3-webpack | ||
- [ ] @storybook/react-vite | ||
- [ ] @storybook/router | ||
- [ ] @storybook/scripts | ||
- [ ] @storybook/server | ||
- [ ] @storybook/source-loader | ||
- [ ] @storybook/svelte-vite | ||
- [ ] @storybook/sveltekit | ||
- [ ] @storybook/theming | ||
- [ ] @storybook/types | ||
- [ ] @storybook/vue3-vite | ||
- [ ] @storybook/vue3-webpack5 | ||
- [ ] @storybook/web-components | ||
- [ ] @storybook/web-components-vite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import glob from 'fast-glob'; | ||
import path from 'path'; | ||
import fsSync from 'node:fs'; | ||
import JSON5 from 'json5'; | ||
|
||
const files = glob.sync('**/*/tsconfig.json', { | ||
absolute: true, | ||
cwd: '..', | ||
}); | ||
|
||
(async function main() { | ||
const packages = files | ||
.filter((file) => !file.includes('node_modules') && !file.includes('dist')) | ||
.map((file) => { | ||
const packageJson = path.join(path.dirname(file), 'package.json'); | ||
let packageName; | ||
if (fsSync.existsSync(packageJson)) { | ||
const json = fsSync.readFileSync(packageJson, { encoding: 'utf-8' }); | ||
packageName = JSON5.parse(json).name; | ||
} | ||
|
||
let strict; | ||
if (fsSync.existsSync(file)) { | ||
const tsconfig = fsSync.readFileSync(file, { encoding: 'utf-8' }); | ||
const tsconfigJson = JSON5.parse(tsconfig); | ||
strict = tsconfigJson?.compilerOptions?.strict ?? false; | ||
} | ||
|
||
if (packageName && strict === false) { | ||
return packageName; | ||
} | ||
return null; | ||
}) | ||
.filter(Boolean) | ||
.sort(); | ||
|
||
console.log(packages.join('\n')); | ||
console.log(packages.length); | ||
|
||
// console.log(files.filter((file) => !file.includes('node_modules') && !file.includes('dist'))); | ||
})(); |