Comments (4)
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.
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.
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.
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)
- Repo (eslint-plugin) [consistent-type-assertions] test case missing output assertion
- Try out v8 beta on various important community repos HOT 4
- Bug: ESlint v9 server does lint in typescript monorepo HOT 5
- Repo: Weekly release flow is failing on changelogRenderer again HOT 5
- Bug: no-magic-numbers Doesn't apply ignore to type definitions HOT 5
- Enhancement: [prefer-nullish-coalescing] Ignore env vars HOT 1
- Enhancement: [no-useless-template-literals] Delete in v8
- Bug: Missing `src/util` import in `@typescript-eslint/eslint-plugin@rc-v8` with skipLibCheck: false HOT 1
- Enhancement: [prefer-literal-enum-member] Allow nested bitwise when using the `allowBitwiseExpressions` option HOT 5
- Enhancement: [no-non-null-assertion] Optionally exempt contexts where null would immediately throw at runtime HOT 12
- Bug: incorrect peer dependency "eslint@^8.56.0" HOT 2
- Bug: [explicit-function-return-type] false invalid case when using allowTypedFunctionExpressions option HOT 5
- Enhancement: [await-thenable] Should check chained method calls HOT 2
- Bug: @typescript-eslint/no-unused-vars false positive when using "using" declaration statement HOT 7
- 🐛 Bug: RuleTester updates reverted in v8 branch HOT 2
- Bug: [prefer-nullish-coalescing] should consider the difference between null and undefined with strict equality HOT 2
- Bug: 8.0.0.alpha24 shared configuration with type checking fail to start HOT 1
- Bug: `no-floating-promises` should not fire on `Promise.resolve()` HOT 2
- Rule proposal: Prevent unnecessary `| undefined` for optional parameters HOT 3
- Bug(typescript-estree): Project services not working with (tsconfig) extends, project references, and extraFileExtensions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-eslint.