Skip to content

Commit

Permalink
feat: initial TypeScript rewrite
Browse files Browse the repository at this point in the history
BREAKING CHANGES:
- Remove Form and FormList components
- Importing is now done as named imports from package main
  • Loading branch information
aldeed committed May 10, 2021
1 parent 04830a1 commit 5de16e8
Show file tree
Hide file tree
Showing 73 changed files with 45,841 additions and 24,492 deletions.
9 changes: 6 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cjs
esm
node_modules
node_modules/**
typings/**
.vscode/**
.eslintrc.js
jest.config.js
.storybook/**
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: "module",
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ["@typescript-eslint", "jest", "simple-import-sort"],
extends: [
"standard-with-typescript",
"plugin:react/recommended",
"plugin:jest/recommended",
],
globals: {
FormData: false,
fetch: false,
},
rules: {
// note you must disable the base rule as it can report incorrect errors
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react/prop-types": "off",
"simple-import-sort/imports": "error",
},
settings: {
react: {
version: "detect",
},
},
ignorePatterns: ["!.storybook"],
};
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [longshotlabs]
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---

<!--
If you benefit from this package and would like to see more of our time devoted to it,
you can help by sponsoring: https://github.com/sponsors/longshotlabs
You may delete this text or leave it. It is invisible.
-->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Feature Requests
url: https://github.com/longshotlabs/reacto-form/discussions
about: Request new features and product improvements on GitHub Discussions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Task
about: Core maintainers use this type of issue to track planned tasks. It is not for requesting features.
title: ""
labels: enhancement
assignees: ""
---
64 changes: 64 additions & 0 deletions .github/workflows/lint-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Lint, Test, and (Maybe) Publish

on:
pull_request:
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out files
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install package dependencies
run: npm ci
- name: Lint code
run: npm run lint --if-present

test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out files
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install package dependencies
run: npm ci
- name: Test code
run: npm run test --if-present

publish:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository_owner == 'longshotlabs' && github.ref == 'refs/heads/main' }}
needs: [lint, test]
defaults:
run:
shell: bash
steps:
- name: Check out files
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install package dependencies
run: npm ci
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/new-issue-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Add immediate comment on new issues

on:
issues:
types: [opened]

jobs:
createComment:
runs-on: ubuntu-latest
steps:
- name: Create Comment
uses: peter-evans/[email protected]
with:
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for submitting an issue!
If this is a bug report, please be sure to include, at minimum, example code that will reproduce the issue. Even better, you can link to a saved online code editor example, where anyone can immediately run the code and see the issue.
If you are requesting a feature, it is better to discuss it in the Discussions area first.
If you need to edit your issue description, click the [**...**] and choose Edit.
Be patient. This is a free and freely licensed package that we maintain in our spare time. You may get a response in a day, but it could also take a month. If you benefit from this package and would like to see more time devoted to it, you can help by [sponsoring](https://github.com/sponsors/longshotlabs).
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
dist
cjs
esm
.DS_Store
npm-debug.log*

# Dependencies
node_modules
npm-debug.log
.idea

# Transpiled files
build/

# Misc
.DS_Store
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"line-length": false,
"no-bare-urls": false,
"no-emphasis-as-header": false,
"no-inline-html": false
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.15.1
14.16.1
10 changes: 10 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"stories": [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
]
}
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
21 changes: 21 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"chenxsan.vscode-standardjs",
"christian-kohler.npm-intellisense",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"eg2.vscode-npm-script",
"redhat.vscode-yaml",
"wix.vscode-import-cost",
"xabikos.javascriptsnippets"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
"dbaeumer.jshint",
"hookyqr.beautify"
]
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"prettier.enable": false,
"editor.formatOnSave": true,
"editor.detectIndentation": false,
"editor.tabSize": 2,
"eslint.format.enable": true,
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.defaultFormatter": "vscode.typescript-language-features",
"standard.autoFixOnSave": true
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# reacto-form CHANGELOG
# CHANGELOG

## Recent Releases

Release notes can be found at https://github.com/longshotlabs/reacto-form

## 1.5.1

Expand Down
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->

# Contribute

## Introduction

First, thank you for considering contributing to reacto-form! It's people like you that make the open source community such a great community! 😊

We welcome any type of contribution, not only code. You can help with

- **QA**: file [bug reports](https://github.com/longshotlabs/reacto-form/issues), the more details you can give the better (e.g. screenshots with the console open)
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community
- **Code**: take a look at the [open issues](https://github.com/longshotlabs/reacto-form/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
- **Money**: we [welcome financial contributions](https://github.com/sponsors/longshotlabs).

## Your First Contribution

Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).

## Submitting code

Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.

## Code review process

The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.

It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?

## Questions

If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).

## Credits

### Contributors

[View our contributors here](https://github.com/longshotlabs/reacto-form/graphs/contributors)
27 changes: 14 additions & 13 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
The MIT License (MIT)
MIT License

Copyright (c) 2017-2020 Eric Dobbertin
Copyright (c) 2017-2021 Eric Dobbertin

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 5de16e8

Please sign in to comment.