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

elm/json is special and should not be removed #88

Open
miniBill opened this issue Oct 3, 2023 · 4 comments
Open

elm/json is special and should not be removed #88

miniBill opened this issue Oct 3, 2023 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@miniBill
Copy link

miniBill commented Oct 3, 2023

Describe the bug
NoUnused.Dependencies can remove elm/json from the direct dependencies.

After removing elm/json, elm make gives an error:

I need to see an "elm/json" dependency your elm.json file.

Expected behavior
Never suggest elm/json as unused.

@jfmengels
Copy link
Owner

@miniBill is this a problem for all applications, or only a problem when making use of the implicit port argument and/or init flag conversion?

@miniBill
Copy link
Author

miniBill commented Oct 3, 2023

The main issue is that if you do that elm install stops working

@lydell
Copy link
Contributor

lydell commented Oct 4, 2023

❯ mkdir p elm-json-test

❯ cd elm-json-test

❯ elm init
Hello! Elm projects always start with an elm.json file. I can create them!

Now you may be wondering, what will be in this file? How do I add Elm files to
my project? How do I see it in the browser? How will my code grow? Do I need
more directories? What about tests? Etc.

Check out <https://elm-lang.org/0.19.1/init> for all the answers!

Knowing all that, would you like me to create an elm.json file now? [Y/n]:
Okay, I created it. Now read that link!

❯ printf 'module Main exposing (main)
  import Html
  main = Html.text ""' > src/Main.elm

❯ vim elm.json

❯ cat elm.json
{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "elm/core": "1.0.5",
            "elm/html": "1.0.0"
        },
        "indirect": {
            "elm/virtual-dom": "1.0.3"
        }
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}

❯ elm make src/Main.elm
Dependencies ready!
-- MISSING DEPENDENCY ------------------------------------------------- elm.json

I need to see an "elm/json" dependency your elm.json file. It helps me handle
flags and ports.

If you modified your elm.json by hand, try to change it back! And if you are
having trouble getting back to a working elm.json, it may be easier to delete it
and use `elm init` to start fresh.


❯ elm install elm/regex
-- MISSING DEPENDENCY ------------------------------------------------- elm.json

I need to see an "elm/json" dependency your elm.json file. It helps me handle
flags and ports.

If you modified your elm.json by hand, try to change it back! And if you are
having trouble getting back to a working elm.json, it may be easier to delete it
and use `elm init` to start fresh.


❯ elm install elm/json
-- MISSING DEPENDENCY ------------------------------------------------- elm.json

I need to see an "elm/json" dependency your elm.json file. It helps me handle
flags and ports.

If you modified your elm.json by hand, try to change it back! And if you are
having trouble getting back to a working elm.json, it may be easier to delete it
and use `elm init` to start fresh.

@jfmengels
Copy link
Owner

Hmm alright. The Elm compiler seems to be a bit too cautious here. That sucks, but alright, let's do as you suggested.

I don't think this is a problem for packages though, so let's only ignore reporting elm/json for application projects.

@jfmengels jfmengels added bug Something isn't working help wanted Extra attention is needed labels Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants