Hey @tannerlinsley, loving react-table and would love to contribute and make things easier for you and contributors, so I'd like to open a discussion and see if you're happy to work with a checklist of standards and conventions to introduce.
Tasks are ordered by ease of implementation / impact on maintenance and reliability.
prettierrc.js to normalise prettier configs across all contributors setuphusky to automate formatting of code for contributors not using prettier without having to install prettierjest.config.js for more flexibility over test configs (remove react-scripts dep?)@testing-library/react for awesome testingjest-watch-select-projects for switching between watched tests quicklyjest-watch-typeahead for faster selection of test files to runis-ci-cli so that a single npm test script can be run for local _watched_ testing while CI runs through tests oncecommitizen to introduce a standard for commit messages to allow for automated semantic releases and generated changelogsconventional-changelog to save time, automate linking to issues from commitizen-formatted commitssemantic-release and configure Travis to automate semantic versioning based on commit messages. Ensure latest commit is tagged before installing.Let me know what you think about each point; will be happy to get working on the list as soon as you're happy!
I agree full-heartedly with every single point, with the exception of rewriting in typescript. Long story short, I'm not ready to full full typescript on open source code yet, but fully support having definitions.
@tannerlinsley understood - I'll keep the 2nd TS point in there as it's useful for consumers of react-table.
Will update the list, and get cracking on a couple :)
One thing that makes the barrier of entry into typescript a whole lot easier and friendly is using Babel to compile it instead. It's much more forgiving.
https://babeljs.io/docs/en/babel-preset-typescript
@nmccready, Yes. When we bring in TS, we'll probably compile it using babel.
@larrybotha, I've set up some failing tests in master. Not sure why they aren't running correctly. Any ideas?
@tannerlinsley will have a look and get back to you :)
PR here: https://github.com/tannerlinsley/react-table/pull/1417
Required a few small tweaks to babel configs and versions. You'll see useTable passes now on all but one test.
I noticed you've got commit: "git commit" in packages.json. No biggie, but git-cz makes writing conventional commits super easy, but that's up to you :)
I'm using $ $(npm bin)/git-cz directly for the commitizen prompts.
Awesome!
I absolutely want to use git-cz. Still just trying to figure out the workflow we were talking about in #1410, how to enforce it, etc.
Want me to tackle enforcing the commit convention?
I would love that :)
Great, will get on it this evening :)
How can we generate the changelog and do the rest of these awesome things you have on this issue?
@tannerlinsley will get on this this evening. I need to do some evaluation on how alpha releases work with commitizen-changelog and semantic-release. I imagine the complexity has been accounted for, but I'll let you know
Awesome. Thanks for your help man. If I can do anything to help, let me know.
Only a pleasure; I'll let you know.
Wow, you're tearing through those issues and PRs like a monster - 2 issues (this included), and 0 PRs outstanding!
I could help with TypeScript typings - I already have some, because my whole project is written in TypeScript, though they're rather low effort for now (way too many anys); however I think it would be best to wait until at least beta, currently a lot of stuff is changing rather dynamically. I'm also wondering whether they should be in this repo or rather in DefinitelyTyped, generally it's recommended to only have type definitions in library's repo if it's written in TypeScript or if the types are generated automatically (probably based on JSDocs or something like this? not sure). So it would probably make sense to have it on DefinitelyTyped.
@paolostyle I agree; waiting for beta is a good idea. I'm not sure about where is best to host the definitions. I suppose there are a few things to consider, depending on the route taken.
Managed here
Managed on DefinitelyTyped
Issues common to both strategies
I haven't looked into it deeply to determine what other strategies there may be to make this as painless to maintain as possible, while providing the best UX for users, so there may well be better or more reliable tools than what I've listed here.
Alternatively, a smaller benefit with lower overhead may be to use JsDoc and suggest TypeScript users enable checkJs, as per this article. I'm not sure if this works for editors other than VSCode (I don't use VSCode), or if it'll introduce issues with other js libs that have incorrect JsDoc declarations, however.
Just had a discussion about this here: https://spectrum.chat/react-table/general/the-types-for-typescript-are-outdated~79730c66-b5f8-48f0-b8d9-a187c3d2f435
TLDR, I would like the types to be kept over at DefinitelyTyped and distributed via @types/react-table. Then all we need to do is add that as a dependency in React Table and we're good to go.
My reasoning: https://blog.johnnyreilly.com/2019/08/symbiotic-definitely-typed.html, someday RT will be TS, but tomorrow is likely not that day.
On the topic of typescript declarations, there are a handful of github gists out in the wild attempting to provide type declarations for v7, such as this: https://gist.github.com/Grsmto/1ac3a7ddb8ad8288660784a37bff1798 The usefulness of these attempts is limited because of the use of the any type.
I might try writing my own declaration file in my current project that attempts to do better about inferring the types with generics, but it might help if the WIP v7 documentation for the public API were a little more fine grained in terms of the function types.
EDIT:
I'm guessing this will come with the first beta once the public API stabilizes.
I think this can be closed now as long as we track the rest of the items in their own issues like #1467
Most helpful comment
Just had a discussion about this here: https://spectrum.chat/react-table/general/the-types-for-typescript-are-outdated~79730c66-b5f8-48f0-b8d9-a187c3d2f435
TLDR, I would like the types to be kept over at DefinitelyTyped and distributed via
@types/react-table. Then all we need to do is add that as a dependency in React Table and we're good to go.My reasoning: https://blog.johnnyreilly.com/2019/08/symbiotic-definitely-typed.html, someday RT will be TS, but tomorrow is likely not that day.