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

Create-react-app should create a jsconfig.json file by default #13663

Open
dpschramm opened this issue Sep 5, 2024 · 0 comments
Open

Create-react-app should create a jsconfig.json file by default #13663

dpschramm opened this issue Sep 5, 2024 · 0 comments

Comments

@dpschramm
Copy link

Is your proposal related to a problem?

When creating a JS project, IDE's like VS Code won't provide import suggestions unless the checkJs compiler option is enabled. However, enabling this option causes VS Code to raise a number of issues with JSX in React JS files.

Version information:

  • VS Code Version: 1.92.2 (Universal)
  • Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
  • Date: 2024-08-14T17:29:30.058Z (3 wks ago)
  • Electron: 30.1.2
  • ElectronBuildId: 9870757
  • Chromium: 124.0.6367.243
  • Node.js: 20.14.0
  • V8: 12.4.254.20-electron.0
  • OS: Darwin arm64 23.5.0
  • React Scripts: 5.0.1

Describe the solution you'd like

Creating a jsconfig.json file within the project, with the following content enables import suggestions in VS Code, and avoids VS Code flagging errors due to JSX.

{
    "compilerOptions": {
        "checkJs": true,
        "jsx": "react-jsx"
    }
}

Describe alternatives you've considered

VS Code has a JS/TS › Implicit Project Config: Check JS setting, which is equivalent to checkJs, but this does not tell VS Code how to handle JSX in JS files, so a jsconfig.json file is still needed.

Additional context

Import suggestions are an important feature for modern IDEs, and having this work out of the box for a popular IDE like VS Code would improve the React developer experience, especially for new developers.

Example Stack Overflow question asking about this: https://stackoverflow.com/questions/77490192/why-am-i-getting-no-import-suggestions-in-my-react-project-in-vs-code/78946476#78946476

My understanding is TypeScript projects do have a tsconfig.json file created. It would be good to have parity for JS.

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

No branches or pull requests

1 participant