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

ESM config w/ .mjs not loadable? #2453

Closed
maxfierke opened this issue Apr 8, 2022 · 2 comments
Closed

ESM config w/ .mjs not loadable? #2453

maxfierke opened this issue Apr 8, 2022 · 2 comments

Comments

@maxfierke
Copy link

maxfierke commented Apr 8, 2022

According to the v4 migration guide, because the app I'm working on directly imports rules, I need to convert it to ESM. However, when I do so, it doesn't seem like it can find the config? (.template-lintrc.mjs)

Does this only work if "type": "module" is specified in package.json? I don't seem to be able to turn that on without infecting everything and running into other packages (or ember-cli) that cannot find a corresponding .cjs file when their configuration is still CommonJS.

$ yarn lint
yarn run v1.22.18
$ npm-run-all --aggregate-output --continue-on-error --parallel "lint:!(fix)"
(node:74494) UnhandledPromiseRejectionWarning: Error: The configuration file specified (.template-lintrc.js) could not be found. Aborting.
    at resolveProjectConfig (file:///Users/mfierke/src/MY_APP/node_modules/ember-template-lint/lib/get-config.js:68:13)
    at getProjectConfig (file:///Users/mfierke/src/MY_APP/node_modules/ember-template-lint/lib/get-config.js:407:41)
    at Linter.loadConfig (file:///Users/mfierke/src/MY_APP/node_modules/ember-template-lint/lib/linter.js:45:25)
    at Linter.verify (file:///Users/mfierke/src/MY_APP/node_modules/ember-template-lint/lib/linter.js:301:18)
    at run (file:///Users/mfierke/src/MY_APP/node_modules/ember-template-lint/bin/ember-template-lint.js:215:34)
(node:74494) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:74494) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What are my options here? I seem to need 4.x to fix parsing issues when trying to address the argument-less-helper-paren-less-invocation deprecation in Ember 3.27+ (ref #2163), otherwise I would just avoid upgrading until a point where I could ESM-ify everything.

To be clear, I'm able to workaround my underlying issue on 3.x by using Yarn resolutions for ember-template-lint/ember-template-recast but that feels icky.

@lifeart
Copy link
Collaborator

lifeart commented Apr 12, 2022

@maxfierke #2339 may fix it, could you create minimal test case for it?

@maxfierke
Copy link
Author

Closing this out. I ended up abandoning whatever effort I was doing here and someone was able to get it working fine on v5 last week, so 🤷

@maxfierke maxfierke closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants