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

Codemod unnamed default exports to have names #117

Merged
merged 2 commits into from
Mar 5, 2021

Conversation

akx
Copy link
Contributor

@akx akx commented Mar 5, 2021

This makes debugging that much easier when functions have names instead of just being anonymous. This is a prelude for an, ahem, slightly larger changeset.

Also, many files had been left untouched by pretty-quick/Prettier before, so the first commit runs that so the diff for the codemod commit is smaller.

The jscodeshift script I used was facebook/create-react-app#8924 (comment)

@danburzo
Copy link
Collaborator

danburzo commented Mar 5, 2021

Also, many files had been left untouched by pretty-quick/Prettier before, so the first commit runs that so the diff for the codemod commit is smaller.

Yeah, I might have accidentally bumped up the prettier version in one of the dependency upgrade batches. No worries!

src/random.js Outdated Show resolved Hide resolved
src/round.js Outdated Show resolved Hide resolved
@danburzo
Copy link
Collaborator

danburzo commented Mar 5, 2021

Should we also add the eslint plugin to enforce this rule going forward?

This makes debugging that much easier when functions have names instead of just being <anonymous>.

Using facebook/create-react-app#8924 (comment)
@akx
Copy link
Contributor Author

akx commented Mar 5, 2021

@danburzo Fixed the FIXMEs, I honestly hadn't even noticed them. Might've been a bug in the codemod script – good catch anyway!

Re the Eslint plugin, yeah, sounds like a good idea... I tried looking through https://github.com/benmosher/eslint-plugin-import 's readme but couldn't find a matching rule. I can set the tooling up if you give me a pointer as to what plugin/rule to set up:)

@danburzo danburzo merged commit 8006343 into Evercoder:master Mar 5, 2021
@danburzo
Copy link
Collaborator

danburzo commented Mar 5, 2021

Thanks! I'll take a stab at it with the eslint plugin, many of the rules there may be useful.

@danburzo
Copy link
Collaborator

danburzo commented Mar 5, 2021

I've enabled a couple of rules from the import plugin here: 36c9598

@danburzo
Copy link
Collaborator

danburzo commented Mar 5, 2021

this is a prelude for an, ahem, slightly larger changeset.

Just to make sure you're not doing too much work upfront: if the changes are related to TypeScript, please be aware that culori is intentionally a JavaScript, not a TypeScript, project. (One TypeScripty thing we can do in this repository is maintain a t.ds typedef file, if that is helpful.)

@akx
Copy link
Contributor Author

akx commented Mar 6, 2021

this is a prelude for an, ahem, slightly larger changeset.

Just to make sure you're not doing too much work upfront: if the changes are related to TypeScript, please be aware that culori is intentionally a JavaScript, not a TypeScript, project. (One TypeScripty thing we can do in this repository is maintain a t.ds typedef file, if that is helpful.)

You may have guessed right... 😅 What's the reason for not being (or allowing being) TypeScript? The built umd/cjs library would be (nearly - I checked) exactly the same, and compiled ESM modules could also be shipped in NPM packages with no sweat.

@danburzo
Copy link
Collaborator

danburzo commented Mar 9, 2021

What's the reason for not being (or allowing being) TypeScript?

In a nutshell: the various trade-offs of a change in tech/tooling do not currently offer a net benefit to this project. We made the aesthetic choice of keeping everything as simple as possible, with minimal tooling.

@akx
Copy link
Contributor Author

akx commented Mar 9, 2021

@danburzo Okay, I can dig that, no worries. If you want to take a peek, there's a mostly-complete conversion over at master...akx:ts :)

I'll see if I could neatly extract .d.ts out of that – I originally started this to get better Culori interop for my https://github.com/akx/gradient project (and there's a small partial .d.ts in there).

@bijela-gora bijela-gora mentioned this pull request Jan 8, 2023
2 tasks
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

Successfully merging this pull request may close these issues.

2 participants