Giter VIP home page Giter VIP logo

Comments (4)

bradzacher avatar bradzacher commented on June 8, 2024 2

they require their config file and rely on Node to figure out whether it is CJS or ESM code.

Almost correct they import() it. But same same. They rely on node to figure it out yeah - so if node isn't picking up your package.yaml then that's a node thing. Node defaults to assuming that .js files are cjs if it can't find a package json

An explicit mjs extension will circumvent node's assumption.

There's no bug here! Node just doesn't support a yaml file so you need to be explicit to work around that.

from typescript-eslint.

JoshuaKGoldberg avatar JoshuaKGoldberg commented on June 8, 2024

package.yaml

Well, there's the issue. It's super unusual in the Node ecosystem to use any file other than package.json there. We certainly don't support it.

In fact, the errors you're getting are from Node.js, not us!

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:128:18)

from typescript-eslint.

bradzacher avatar bradzacher commented on June 8, 2024

We are not the ESLint project - they live over at https://github.com/eslint/eslint.

Though this stack trace isn't an ESLint error - it's straight from nodejs. So it isn't eslint's fault - Node is erroring because it is not respecting the package.yaml. AFAIK nodejs doesn't support a yaml file - only a json file.

Regardless. This is nothing to do with our project.

from typescript-eslint.

igorakkerman avatar igorakkerman commented on June 8, 2024

Thank you, @JoshuaKGoldberg and @bradzacher, for looking into this and for the clarification. I'm aware that you're not ESLint ;-) but didn't know on which layer in the stack the issue occurs and didn't dive deep enough to find out, sorry for that and for addressing the issue in the wrong place. I'm also aware that package.json is the default and tried to use package.yaml for the first time myself.

I was hoping for pnpm to be the only layer dealing with package.json/yaml. Since tsc and prettier both work fine and eslint-typescript deals with the module system, I got here.

If I understand correctly, they require their config file and rely on Node to figure out whether it is CJS or ESM code. Do you think it makes sense to recreate this issue in the ESLint repo?

from typescript-eslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.