withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.82k stars 2.49k forks source link

💡 RFC: Add `snowpack.config.mjs` and `astro.config.mjs` schemas to https://www.schemastore.org/json/ #765

Closed jasikpark closed 3 years ago

jasikpark commented 3 years ago

Background & Motivation

I want my editor to be able to provide feedback about whether I have invalid configs for these files.

Proposed Solution

Possible solutions

Submit a schema to https://www.schemastore.org/json/ via https://github.com/SchemaStore/schemastore/blob/master/CONTRIBUTING.md

Alternatives considered

Risks, downsides, and/or tradeoffs

Open Questions

Detailed Design

No response

Help make it happen!

FredKSchott commented 3 years ago

How does this work with versioning? This config will probably go through a few more iterations as it grows.

Also, I don't believe that the schema works for JS, only JSON.

Instead, you can add a comment above your config, which works in VSCode and any TS-enabled editors (even if you are just using JS):

+/** @type {import("snowpack").SnowpackUserConfig } */
export default {
  plugins: [
    /* ... */
  ],
};
jasikpark commented 3 years ago

:0 true I totally forgot that this is meant for json and that we don't use json whoops

jasikpark commented 3 years ago

Maybe an RFC for adding that line to the examples? 🤔 Probably not though...