devinrhode2

devinrhode2

interested in changing the world (hire me!)

Member Since 11 years ago

Minneapolis, MN

Experience Points
64
follower
Lessons Completed
158
follow
Lessons Completed
338
stars
Best Reply Awards
241
repos

124 contributions in the last year

Pinned
⚡ Easily start apache at any directory from the command line
⚡ Check if you're actually online in javascript
⚡ Tweet from the omnibar! Download here:
⚡ Easily overwrite functions with additional functionality, aka decorators in python
⚡ Some awesome functions for working on chrome extensions, assumes no jQuery
⚡ Update your mustache views in real-time.
Activity
Jan
25
16 hours ago
started
started time in 13 hours ago
Jan
24
1 day ago
Activity icon
issue

devinrhode2 issue comment nextauthjs/next-auth

devinrhode2
devinrhode2

Need to set NEXTAUTH_URL dynamically as an Option for multi-domain/multi-tenant use

Your question How to dynamically work with Passwordless/Email auth, without setting NEXTAUTH_URL.

What are you trying to do I am working on a use-case where NEXTAUTH_URL is not fixed at deploy-time or build-time, but run-time, for a multi-domain (single codebase) scenario. This is to have Email passwordless only.

I have had good success with next-auth other providers for usual scenarios, and absolutely love the simplicity.

Feedback I tried to browse around the code to get a sense of dependency of the deploy-time NEXTAUTH_URL, and it seems that it is use only to define the Url for sendVerificationRequest. If there was a way to pass it as an option, it would do it.

Please advise, whats the best approach.

  • Found the documentation helpful
  • Found documentation but was incomplete
  • Could not find relevant documentation
  • Found the example project helpful
  • Did not find the example project helpful
devinrhode2
devinrhode2

It seems like in latest code, if you set the environment variable VERCEL to "true", then next-auth will use this X-Forwarded-Host header: CleanShot 2022-01-24 at 14 43 48 CleanShot 2022-01-24 at 14 44 07

I'm not sure if this will work.. as we are not actually using Vercel

And if this does work, I think the code should reference an environment variable TRUSTED_HOST or TRUSTED_CLIENT or even TRUST_X_FORWARDED_HOST, and then if that variable is undefined, default it to !!process.env.VERCEL

Jan
23
2 days ago
Activity icon
issue

devinrhode2 issue comment vercel/next.js

devinrhode2
devinrhode2

Clarify conditions under which process.env expressions are inlined

Documentation / Examples

  • Make sure the linting passes by running yarn lint
devinrhode2
devinrhode2

The dynamic usage might work locally or for Serverless Functions, but it doesn't work in browser bundles or in Edge Functions (like Middleware). Yep, found that one out the hard way :( Turns out it doesn't work locally on windows (10 or 11, also tried with cygwin on windows 11) :/

open pull request

devinrhode2 wants to merge mysticatea/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message "use the env wrapper"

This is the first time I've ever touched eslint rule stuff, but I feel pretty good about this change, and was able to maintain the 100% test coverage on this rule.

devinrhode2
devinrhode2

I made this sample message deliberately bad to drive the point that users need to edit it for their use case.

In my case it'll be something like Use safeEnv from 'src/env' instead.

pull request

devinrhode2 merge to mysticatea/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message "use the env wrapper"

This is the first time I've ever touched eslint rule stuff, but I feel pretty good about this change, and was able to maintain the 100% test coverage on this rule.

pull request

devinrhode2 pull request mysticatea/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message "use the env wrapper"

This is the first time I've ever touched eslint rule stuff, but I feel pretty good about this change, and was able to maintain the 100% test coverage on this rule.

push

devinrhode2 push devinrhode2/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message closes #318 (no-process-env: accept a custom error message)

commit sha: 0d18cac577bcbd7a1a4792a7388f74cd81756cbb

push time in 2 days ago
push

devinrhode2 push devinrhode2/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message closes #318 (no-process-env: accept a custom error message)

commit sha: 6a7d560449b1c33c5b96c6c5e51ccd44ca2080d4

push time in 2 days ago
Activity icon
created tag
createdAt 2 days ago
push

devinrhode2 push devinrhode2/eslint-plugin-node

devinrhode2
devinrhode2

no-proc ess-env: support custom error message

commit sha: 6c109a480d308c7947df613a287bfa0c7f57750c

push time in 2 days ago
push

devinrhode2 push devinrhode2/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: support custom error message

commit sha: 18eb0b0594d8ed36a65cc9c84e49fa2993221beb

push time in 2 days ago
Activity icon
created branch

devinrhode2 in devinrhode2/eslint-plugin-node create branch no-process-env-customMessage

createdAt 2 days ago
Activity icon
fork

devinrhode2 forked mysticatea/eslint-plugin-node

⚡ Additional ESLint's rules for Node.js
devinrhode2 MIT License Updated
fork time in 2 days ago
Jan
19
6 days ago
Activity icon
issue

devinrhode2 issue mysticatea/eslint-plugin-node

devinrhode2
devinrhode2

no-process-env: accept a custom error message

I have created a typescript wrapper around process.env which helps alleviates the need for the rest of our codebase to need to check if certain agreed upon environment variables are undefined. (By default, the type for process.env.foo is string | undefined)

I would like to use this rule, but be able to supply a custom error message to this rule. Any thoughts, objections, opinions?

Jan
18
1 week ago
Activity icon
issue

devinrhode2 issue comment microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

devinrhode2
devinrhode2

https://www.typescriptlang.org/tsconfig#allowUnreachableCode

So if code is probably unreachable base on JavaScript syntax, we can get errors. But if.. some code is unreachable based on type analysis, then TS doesn't say anything.

If you haven't handled both the undefined and defined (string | number | ...), TS will correctly complain that some value could be undefined. So, you add type guards, it statements, optional chaining, to help you avoid errors.

But, when an underlying library is refactored to guarantee that a value is always defined... You can delete the code TS told you to add.

In a way, typescript is only telling you to add code.

Perhaps we could adjust tsconfig compilerOptions.

  • Gauranteed unreachable based on JavaScript syntax. These are very likely coding errors.
  • Unreachable based on type analysis.

The in-editor warning vs cli aspect could easily be solved by taking from eslint, warnings only appear in-editor, errors are both. And of course you can just turn it completely off. Being conceptually aligned with eslint here I think could help in the long term

Activity icon
issue

devinrhode2 issue microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

Activity icon
issue

devinrhode2 issue microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

Activity icon
issue

devinrhode2 issue comment microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

devinrhode2
devinrhode2

If there was a really nice cli wizard to setup a tsconfig or jsconfig, we may be able to ask users to run it. Then they get rich type info inside their ide, and type errors. Cli wizard could even add a husky pre-commit hook to check for type errors

Activity icon
issue

devinrhode2 issue comment vercel/next.js

devinrhode2
devinrhode2

Clarify conditions under which process.env expressions are inlined

Documentation / Examples

  • Make sure the linting passes by running yarn lint
devinrhode2
devinrhode2

@styfle @jameshfisher would this be a good place for the docs to mention how development-only checks can be stripped out of production builds?

open pull request

devinrhode2 wants to merge vercel/next.js

devinrhode2
devinrhode2

Clarify conditions under which process.env expressions are inlined

Documentation / Examples

  • Make sure the linting passes by running yarn lint
devinrhode2
devinrhode2

Linguistics are easy to bike shed on - I think the original is maybe slightly better linguistically. But I think the key thing that @jameshfisher is trying to emphasize here is that the build process will look for process.env.NEXT_PUBLIC_FOO. We could also write process.env.NEXT_PUBLIC_* or something like that.

pull request

devinrhode2 merge to vercel/next.js

devinrhode2
devinrhode2

Clarify conditions under which process.env expressions are inlined

Documentation / Examples

  • Make sure the linting passes by running yarn lint
Activity icon
issue

devinrhode2 issue comment vercel/next.js

devinrhode2
devinrhode2

Clarify conditions under which process.env expressions are inlined

Documentation / Examples

  • Make sure the linting passes by running yarn lint
devinrhode2
devinrhode2

The current docs gave me the impression that I HAVE to write process.env.FOO or process.env.NEXT_PUBLIC_FOO. But.. I'm able to basically do process.env[envVarParam] and it'll still work.

I think the inlining is important for process.env.NODE_ENV - I'm not certain but I'd assume something in the build process will strip out if (false) {/* development-only logs */}

Jan
16
1 week ago
Activity icon
issue

devinrhode2 issue comment vercel/next.js

devinrhode2
devinrhode2

next.config.ts

Feature request

Is it possible to use next.config.ts instead of next.config.js? Currently none of the typescript examples use typescript in the config file. Is it even possible?

@resir014

devinrhode2
devinrhode2

@floroz

However, the jsdoc solution does not solve the problem when you have to import a utility or function from a .ts file into the next.config.js

You can convert said .ts utility to jsdoc+js, and then const foo = require('foo') inside of next.config.js

As an example, I did this so that only 1 file in our app repo references process.env.FOO: https://gist.github.com/devinrhode2/e033cf8ec4653cfb70d34389db86cb72

Activity icon
commit_comment

nextauthjs/next-auth

Jan
13
1 week ago
Activity icon
issue

devinrhode2 issue comment microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

devinrhode2
devinrhode2

I know it's important to gradually migrate a js project to ts, but that's just a transitional period. Eventually codebases are pure TS, and writing this extra defensive code is just wasting bandwidth.

Activity icon
issue

devinrhode2 issue comment microsoft/TypeScript

devinrhode2
devinrhode2

Not getting "Unreachable code" error in: a = true; if (a) { throw; }; console.log(a);

What should happen: CleanShot 2022-01-12 at 10 45 32 What does happen: (no error) CleanShot 2022-01-12 at 10 47 41 I also tried adding as const, still no error: CleanShot 2022-01-12 at 10 44 38

devinrhode2
devinrhode2

Bad is caller... Ok.. but maybe the tide has turned. Maybe your code snippet should require a @ts-expect-error? I think it's a good example 6 years ago, idk.

Activity icon
issue

devinrhode2 issue comment typicode/husky

devinrhode2
devinrhode2

add `husky -` prefix to logged global error messages

Hiya,

Spent some time today debugging an issue that I eventually traced back to husky, would have been nice to have the error message identified as such.

Admit this is probably more a yarn issue as all yarn gave me to go on was:

➤ YN0000: │ [email protected]:. STDERR fatal: not a git repository (or any of the parent directories): .git

But would appreciate this workaround being added, as it also bring it in line with your other logging.

Cheers!

devinrhode2
devinrhode2

Yarn 2 logs are ducking trash

Previous