Skip to content

feat(strictest): add noUncheckedSideEffectImports option#276

Open
zanminkian wants to merge 1 commit intotsconfig:mainfrom
zanminkian:noUncheckedSideEffectImports
Open

feat(strictest): add noUncheckedSideEffectImports option#276
zanminkian wants to merge 1 commit intotsconfig:mainfrom
zanminkian:noUncheckedSideEffectImports

Conversation

@zanminkian
Copy link
Contributor

Closes #275.

This flag was introduced in TS 5.6

@orta
Copy link
Member

orta commented Oct 31, 2024

I don't think this should be in strictest, I think it's something that a lot of people use for .css files etc - its useful as a linter but not something I'd say should be in strictest

@zanminkian
Copy link
Contributor Author

If people import .css files, they usually add a shims.d.ts file in there project.

// shims.d.ts
declare module "*.css" {
  declare const css: unknown;
  export default css;
}

As for me, personally, I use triple slash directive at the beginning of the app entrance file.

// main.tsx
/// <reference types="vite/client" />
import "tailwindcss/tailwind.css";
import ReactDOM from "react-dom/client";
import { App } from "./App.jsx";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);

@jakebailey
Copy link
Collaborator

Yeah, this is what vite generates for you.

I'd really like to make this flag enabled by default in strict mode at some point.

@zanminkian
Copy link
Contributor Author

zanminkian commented Nov 26, 2024

Is it possible that we enable this flag when strict: true in TS 6.0? @jakebailey

@jakebailey
Copy link
Collaborator

I'll try to see if it can be enabled in 6.0 but I don't quite know for sure. It's a very breaky flag for many people.

@jakebailey
Copy link
Collaborator

jakebailey commented Dec 18, 2024

It's unlikely we're going to try and have it enabled by default for 6.0; but having it be recommended is another story (and maybe we'll make tsc --init suggest it).

@zanminkian
Copy link
Contributor Author

microsoft/TypeScript#62443 TypeScript enable this flag by default in 6.0. Do we need this PR now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

noUncheckedSideEffectImports needs to be added to strictest

3 participants