Skip to content

Commit 067fc57

Browse files
committed
feat: more fixes to get it to a stable, modern point
1 parent 2134313 commit 067fc57

20 files changed

+876
-679
lines changed

.eslintrc.json

+69-75
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,69 @@
1-
{
2-
"env": {
3-
"browser": true,
4-
"es2021": true,
5-
"node": true
6-
},
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:react/recommended",
10-
"plugin:react-hooks/recommended",
11-
"plugin:jsx-a11y/recommended",
12-
"plugin:@typescript-eslint/recommended",
13-
"plugin:prettier/recommended",
14-
"plugin:import/typescript",
15-
"plugin:import/recommended",
16-
"next",
17-
"prettier"
18-
],
19-
"settings": {
20-
"react": {
21-
"version": "detect"
22-
}
23-
},
24-
"parser": "@typescript-eslint/parser",
25-
"parserOptions": {
26-
"ecmaFeatures": {
27-
"jsx": true
28-
},
29-
"ecmaVersion": 12,
30-
"sourceType": "module"
31-
},
32-
"plugins": [
33-
"react",
34-
"@typescript-eslint/eslint-plugin",
35-
"react-hooks"
36-
],
37-
"rules": {
38-
"prettier/prettier": [
39-
"error",
40-
{
41-
"endOfLine": "auto"
42-
}
43-
],
44-
"@typescript-eslint/ban-ts-comment": [
45-
"error",
46-
{
47-
"ts-ignore": "allow-with-description",
48-
"minimumDescriptionLength": 10
49-
}
50-
], "@typescript-eslint/no-explicit-any": "off",
51-
"@typescript-eslint/no-unused-vars": "off",
52-
"@typescript-eslint/no-var-requires": "off",
53-
"@typescript-eslint/no-non-null-assertion": "off",
54-
"@typescript-eslint/explicit-module-boundary-types": "off",
55-
"@typescript-eslint/member-delimiter-style": "off",
56-
"@typescript-eslint/no-empty-function": "off",
57-
"@typescript-eslint/no-shadow": "error",
58-
"@typescript-eslint/no-magic-numbers": "off",
59-
"@typescript-eslint/no-use-before-define": "error",
60-
"@typescript-eslint/semi": [
61-
"error",
62-
"always",
63-
{
64-
"omitLastInOneLineBlock": true
65-
}
66-
],
67-
"@typescript-eslint/ban-types": [
68-
"warn"
69-
],
70-
"no-empty-pattern": "off",
71-
"react/prop-types": "off",
72-
"react/react-in-jsx-scope": "off",
73-
"next/no-html-link-for-pages": "off"
74-
}
75-
}
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:react/recommended",
10+
"plugin:react-hooks/recommended",
11+
"plugin:jsx-a11y/recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"plugin:prettier/recommended",
14+
"plugin:import/recommended",
15+
"plugin:import/typescript",
16+
"prettier"
17+
],
18+
"settings": {
19+
"react": {
20+
"version": "detect"
21+
}
22+
},
23+
"parser": "@typescript-eslint/parser",
24+
"parserOptions": {
25+
"ecmaFeatures": {
26+
"jsx": true
27+
},
28+
"ecmaVersion": 12,
29+
"sourceType": "module"
30+
},
31+
"plugins": ["react", "@typescript-eslint/eslint-plugin", "react-hooks"],
32+
"rules": {
33+
"prettier/prettier": [
34+
"error",
35+
{
36+
"endOfLine": "auto"
37+
}
38+
],
39+
"@typescript-eslint/ban-ts-comment": [
40+
"error",
41+
{
42+
"ts-ignore": "allow-with-description",
43+
"minimumDescriptionLength": 10
44+
}
45+
],
46+
"@typescript-eslint/no-explicit-any": "off",
47+
"@typescript-eslint/no-unused-vars": "off",
48+
"@typescript-eslint/no-var-requires": "off",
49+
"@typescript-eslint/no-non-null-assertion": "off",
50+
"@typescript-eslint/explicit-module-boundary-types": "off",
51+
"@typescript-eslint/member-delimiter-style": "off",
52+
"@typescript-eslint/no-empty-function": "off",
53+
"@typescript-eslint/no-shadow": "error",
54+
"@typescript-eslint/no-magic-numbers": "off",
55+
"@typescript-eslint/no-use-before-define": "error",
56+
"@typescript-eslint/semi": [
57+
"error",
58+
"always",
59+
{
60+
"omitLastInOneLineBlock": true
61+
}
62+
],
63+
"@typescript-eslint/ban-types": ["warn"],
64+
"no-empty-pattern": "off",
65+
"react/prop-types": "off",
66+
"react/react-in-jsx-scope": "off",
67+
"next/no-html-link-for-pages": "off"
68+
}
69+
}

CODE_OF_CONDUCT.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
88

99
Examples of behavior that contributes to creating a positive environment include:
1010

11-
- Using welcoming and inclusive language
12-
- Being respectful of differing viewpoints and experiences
13-
- Gracefully accepting constructive criticism
14-
- Focusing on what is best for the community
15-
- Showing empathy towards other community members
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
1616

1717
Examples of unacceptable behavior by participants include:
1818

19-
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20-
- Trolling, insulting/derogatory comments, and personal or political attacks
21-
- Public or private harassment
22-
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23-
- Other conduct which could reasonably be considered inappropriate in a professional setting
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
2424

2525
## Our Responsibilities
2626

CONTRIBUTING.md

+70-33
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,94 @@
11
# Contributing
22

3-
We are open to, and grateful for, any contributions made by the community.
3+
Thank you for contributing, we accept all types of contributions from typo fixes to new features.
44

5-
## Reporting Issues
5+
### Reporting Issues
66

7-
Before opening an issue, please search the [issue tracker](https://github.com/braposo/react-text-loop/issues) to make sure your issue hasn't already been reported.
7+
Before submitting an issue, make sure your issue hasn't already been reported by checking the [issue tracker](https://github.com/samarmohan/react-text-loop-next/issues).
88

99
## Development
1010

11-
Visit the [Issue tracker](https://github.com/braposo/react-text-loop/issues) to find a list of open issues that need attention.
11+
##### We follow the [GitHub Flow](https://guides.github.com/introduction/flow/)
1212

13-
Fork, then clone the repo:
14-
```
15-
git clone https://github.com/your-username/react-text-loop-next.git
16-
```
13+
### Setup
1714

18-
Run the examples, which will automatically watch any changes in `src/` folder:
15+
1. Fork, then clone the repo:
16+
`git clone https://github.com/YOUR_USERNAME/react-text-loop-next.git`
17+
2. Run `yarn install` in the project root
1918

20-
```
21-
yarn start
22-
```
19+
3. Run `yarn quality` to make sure your copy of the codebase is clean
2320

24-
### Building and testing
21+
### Fixing issues
2522

26-
Build package:
27-
```
28-
yarn build
29-
```
23+
1. Find an [issue](https://github.com/samarmohan/react-text-loop-next/issues) that you'd like to work on
3024

31-
To run the tests:
32-
```
33-
yarn test
34-
```
25+
2. Create a branch, e.g. `patch-#`, `fixes-issue-#`, `feature/description`
3526

36-
To perform linting with `eslint`, run the following:
37-
```
38-
yarn lint
39-
```
27+
3. Make your changes. The entry point is [src/index.ts](./src/index.ts)
28+
29+
4. See [Submitting Changes](#submitting-changes) below
4030

4131
### New Features
4232

43-
Please open an issue with a proposal for a new feature or refactoring before starting on the work. We don't want you to waste your efforts on a pull request that we won't want to accept.
33+
Please create an issue before starting something big, we do not want to waste your time implementing a feature we won't merge.
34+
35+
### Submitting Changes
4436

45-
## Submitting Changes
37+
- Run `yarn quality` to make sure your changes follow our style guide.
4638

47-
* Open a new issue in the [Issue tracker](https://github.com/braposo/react-text-loop/issues).
48-
* Fork the repo.
49-
* Create a new feature branch based off the `master` branch.
50-
* Make sure all tests pass and there are no linting errors.
51-
* Submit a pull request, referencing any issues it addresses.
39+
- Run `yarn commit` or `yarn commit:signed` to generate a commit message using [commitizen](http://commitizen.github.io/cz-cli/)
40+
41+
- The commit hooks using [husky](https://typicode.github.io/husky/#/) will run `yarn quality` (just to make sure), `git add -A` (to re-add the files in case the previous command changed anything), check your commit message using [commitlint](https://commitlint.js.org/#/), and then push your changes to your fork.
42+
43+
- Submit a PR
5244

5345
Please try to keep your pull request focused in scope and avoid including unrelated commits.
5446

5547
After you have submitted your pull request, we'll try to get back to you as soon as possible. We may suggest some changes or improvements.
5648

57-
Thank you for contributing!
49+
Thank you for contributing!
50+
51+
## Codebase reference
52+
53+
Committing: We use commitizen, commitlint, and husky to make the commit process easy and fast.
54+
55+
Building: We have a [commonjs tsconfig](./tsconfig.cjs.json) and an [es modules tsconfig](./tsconfig.esm.json) for different build targets. The [base tsconfig](./tsconfig.base.json) is used for generating types.
56+
57+
Quality: ESLint, Prettier, and Jest, are use to maintain codebase quality.
58+
59+
Structure: The structure of the codebase is very simple.
60+
61+
- [\_\_tests\_\_](./__tests__/): [Jest](https://facebook.github.io/jest/) tests.
62+
- [TextLoop.test.tsx](./__tests__/TextLoop.test.tsx): Tests for the [TextLoop](./src/TextLoop.tsx) component.
63+
- [src](./src/): The source code
64+
- [index.ts](./src/index.ts): exports the main [TextLoop](./src/TextLoop.tsx) component.
65+
- [utils.ts](./src/utils.ts): Random utils that [TextLoop](./src/TextLoop.tsx) uses.
66+
- [TextLoop.tsx](./src/index.ts): This is the one and only component. All the magic happens here.
67+
68+
Build scripts:
69+
70+
```json
71+
"build": "npm-run-all build:*", // build everything
72+
"build:watch": "npm-run-all build:watch:*", // watch build everything
73+
"build:esm": "tsc -p tsconfig.esm.json",
74+
"build:cjs": "tsc -p tsconfig.cjs.json",
75+
"build:types": "tsc -p tsconfig.base.json --declaration --emitDeclarationOnly --declarationDir dist/types",
76+
"build:esm:watch": "tsc -w -p tsconfig.esm.json",
77+
"build:cjs:watch": "tsc -w -p tsconfig.cjs.json",
78+
"build:types:watch": "tsc -w -p tsconfig.base.json --declaration --emitDeclarationOnly --declarationDir dist/types",
79+
```
80+
81+
Test scripts:
82+
83+
```json
84+
"test": "jest",
85+
"test:coverage": "jest --coverage",
86+
```
87+
88+
Lint scripts:
89+
90+
```json
91+
"lint": "npm-run-all lint:*",
92+
"lint:src": "eslint src --fix", // uses eslint
93+
"lint:types": "tsc -p tsconfig.base.json --noEmit", //uses tsc but doesn't emit
94+
```

0 commit comments

Comments
 (0)