Skip to content

Commit 739e6e8

Browse files
committed
apply typescript functional component and cm upgrade
1 parent a0e1002 commit 739e6e8

File tree

150 files changed

+48658
-58938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+48658
-58938
lines changed

.babelrc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"presets": [
3-
"@babel/preset-react",
4-
"@babel/preset-env"
5-
],
2+
"presets": ["@babel/preset-react", "@babel/preset-env"],
63
"env": {
74
"production": {
85
"plugins": [
@@ -43,16 +40,10 @@
4340
"@babel/plugin-proposal-function-bind",
4441
["@babel/plugin-proposal-private-methods", { "loose": true }]
4542
],
46-
"presets": [
47-
"@babel/preset-env",
48-
"@babel/preset-react"
49-
]
43+
"presets": ["@babel/preset-env", "@babel/preset-react"]
5044
},
5145
"development": {
52-
"plugins": [
53-
"babel-plugin-styled-components",
54-
"react-refresh/babel"
55-
],
46+
"plugins": ["babel-plugin-styled-components", "react-refresh/babel"],
5647
"presets": [
5748
[
5849
"@babel/preset-react",

.eslintrc

Lines changed: 97 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
2-
"extends": ["airbnb", "prettier", "plugin:storybook/recommended"],
3-
"parser": "@babel/eslint-parser",
4-
"env": {
2+
"extends": [
3+
"airbnb",
4+
"prettier",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:storybook/recommended"
7+
],
8+
"parser": "@typescript-eslint/parser",
9+
"parserOptions": {
10+
"project": "./tsconfig.json",
11+
"sourceType": "module",
12+
"ecmaFeatures": {
13+
"jsx": true
14+
}
15+
},
16+
"env": {
517
"browser": true,
618
"node": true,
719
"jest": true
@@ -15,64 +27,73 @@
1527
"import/namespace": 0,
1628
"import/no-unresolved": 0,
1729
"import/no-named-as-default": 2,
18-
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
30+
"comma-dangle": 0,
1931
"indent": 0,
2032
"no-console": 0,
2133
"no-alert": 0,
2234
"no-underscore-dangle": 0,
2335
"no-useless-catch": 2,
24-
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
36+
"max-len": [
37+
1,
38+
120,
39+
2,
40+
{ "ignoreComments": true, "ignoreTemplateLiterals": true }
41+
],
2542
"quote-props": [1, "as-needed"],
26-
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
43+
"no-unused-vars": "off",
44+
"@typescript-eslint/no-unused-vars": [
45+
1,
46+
{ "vars": "local", "args": "none" }
47+
],
2748
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }],
2849
"no-param-reassign": [2, { "props": false }],
29-
"react/self-closing-comp": ["error", {
30-
"component": true,
31-
"html": false
32-
}],
50+
"react/self-closing-comp": [
51+
"error",
52+
{
53+
"component": true,
54+
"html": false
55+
}
56+
],
3357
"newline-per-chained-call": 0,
34-
"react/prefer-stateless-function": [2,
35-
{ "ignorePureComponents": true
36-
}],
58+
"react/prefer-stateless-function": [2, { "ignorePureComponents": true }],
3759
"class-methods-use-this": 0,
38-
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true}],
60+
"react/jsx-no-bind": [
61+
2,
62+
{ "allowBind": true, "allowArrowFunctions": true }
63+
],
3964
"no-return-assign": [2, "except-parens"],
4065
"jsx-a11y/anchor-is-valid": [
4166
"error",
4267
{
43-
"components": [
44-
"Link"
45-
],
46-
"specialLink": [
47-
"to"
48-
]
68+
"components": ["Link"],
69+
"specialLink": ["to"]
4970
}
5071
],
72+
"jsx-a11y/click-events-have-key-events": "off",
73+
"jsx-a11y/no-noninteractive-element-interactions": "off",
5174
"jsx-a11y/label-has-for": [
5275
2,
5376
{
54-
"components": [
55-
"Label"
56-
],
77+
"components": ["Label"],
5778
"required": {
58-
"every": [
59-
"id"
60-
]
79+
"every": ["id"]
6180
},
6281
"allowChildren": false
6382
}
6483
],
65-
"prettier/prettier": [
66-
"error"
67-
]
84+
"prettier/prettier": ["error"],
85+
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }]
6886
},
69-
"plugins": [
70-
"react", "jsx-a11y", "import", "prettier"
71-
],
87+
"plugins": ["react", "jsx-a11y", "import", "prettier", "@typescript-eslint"],
7288
"settings": {
73-
"import/parser": "@babel/eslint-parser",
74-
"import/resolve": {
75-
"moduleDirectory": ["node_modules"]
89+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
90+
"import/parsers": {
91+
"@typescript-eslint/parser": [".ts", ".tsx"]
92+
},
93+
"import/resolver": {
94+
"node": {
95+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
96+
}
7697
}
7798
},
7899
"globals": {
@@ -88,6 +109,47 @@
88109
"rules": {
89110
"import/no-extraneous-dependencies": "off"
90111
}
112+
},
113+
{
114+
"files": ["*.ts", "*.tsx"],
115+
"rules": {
116+
"no-unused-vars": "off",
117+
"@typescript-eslint/no-unused-vars": [
118+
1,
119+
{ "vars": "local", "args": "none" }
120+
],
121+
"import/no-named-as-default": "off",
122+
"import/no-named-as-default-member": "off",
123+
"react/require-default-props": "off",
124+
"react/prop-types": "off",
125+
"@typescript-eslint/ban-ts-comment": "off",
126+
"react/jsx-indent": "off"
127+
}
128+
},
129+
{
130+
"files": ["*.js", "*.jsx"],
131+
"rules": {
132+
"@typescript-eslint/no-empty-function": "off",
133+
"import/no-extraneous-dependencies": "off",
134+
"import/no-named-as-default": "off",
135+
"import/no-named-as-default-member": "off",
136+
"@typescript-eslint/no-var-requires": "off",
137+
"react/jsx-no-bind": "off",
138+
"no-use-before-define": "off",
139+
"react/prop-types": "off",
140+
"react/require-default-props": "off",
141+
"@typescript-eslint/no-this-alias": "off",
142+
"import/extensions": [
143+
"error",
144+
"ignorePackages",
145+
{
146+
"js": "never",
147+
"jsx": "never",
148+
"ts": "never",
149+
"tsx": "never"
150+
}
151+
]
152+
}
91153
}
92154
]
93155
}

.github/CODE_OF_CONDUCT.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,49 @@ We are a community of, and in solidarity with, people from every gender identity
77
We like these hashtags: #noCodeSnobs (because we value community over efficiency), #newKidLove (because we all started somewhere), #unassumeCore (because we don't assume knowledge), and #BlackLivesMatter (because of course).
88

99
In practice:
10-
* We are not code snobs. We do not assume knowledge or imply there are things that somebody should know.
11-
* We insist on actively engaging with requests for feedback regardless of their complexity.
12-
* We welcome newcomers and prioritize the education of others. We strive to approach all tasks with the enthusiasm of a newcomer. Because we believe that newcomers are just as valuable in this effort as experts.
13-
* We consistently make the effort to actively recognize and validate multiple types of contributions.
14-
* We are always willing to offer help or guidance.
10+
11+
- We are not code snobs. We do not assume knowledge or imply there are things that somebody should know.
12+
- We insist on actively engaging with requests for feedback regardless of their complexity.
13+
- We welcome newcomers and prioritize the education of others. We strive to approach all tasks with the enthusiasm of a newcomer. Because we believe that newcomers are just as valuable in this effort as experts.
14+
- We consistently make the effort to actively recognize and validate multiple types of contributions.
15+
- We are always willing to offer help or guidance.
1516

1617
In times of conflict:
17-
* We listen.
18-
* We clearly communicate while acknowledging other's feelings.
19-
* We admit when we're wrong, apologize, and accept responsibility for our actions.
20-
* We are continuously seeking to improve ourselves and our community.
21-
* We keep our community respectful and open.
22-
* We make everyone feel heard.
23-
* We are mindful and kind in our interactions.
18+
19+
- We listen.
20+
- We clearly communicate while acknowledging other's feelings.
21+
- We admit when we're wrong, apologize, and accept responsibility for our actions.
22+
- We are continuously seeking to improve ourselves and our community.
23+
- We keep our community respectful and open.
24+
- We make everyone feel heard.
25+
- We are mindful and kind in our interactions.
2426

2527
In the future:
26-
* The future is now.
2728

29+
- The future is now.
2830

2931
## p5.js Code of Conduct
3032

31-
* **Be mindful of your language.** Any of the following behavior is unacceptable:
32-
* Offensive comments related to gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, or background
33-
* Threats of violence
34-
* Deliberate intimidation
35-
* Sexually explicit or violent material that is not contextualized and preceded by a considerate warning
36-
* Unwelcome sexual attention
37-
* Stalking or following
38-
* Or any other kinds of harassment
33+
- **Be mindful of your language.** Any of the following behavior is unacceptable:
34+
35+
- Offensive comments related to gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, or background
36+
- Threats of violence
37+
- Deliberate intimidation
38+
- Sexually explicit or violent material that is not contextualized and preceded by a considerate warning
39+
- Unwelcome sexual attention
40+
- Stalking or following
41+
- Or any other kinds of harassment
3942

4043
Use your best judgement. If it will possibly make others uncomfortable, do not post it.
4144

42-
* **Be respectful.** Disagreement is not an opportunity to attack someone else's thoughts or opinions. Although views may differ, remember to approach every situation with patience and care.
43-
* **Be considerate.** Think about how your contribution will affect others in the community.
44-
* **Be open minded.** Embrace new people and new ideas. Our community is continually evolving and we welcome positive change.
45+
- **Be respectful.** Disagreement is not an opportunity to attack someone else's thoughts or opinions. Although views may differ, remember to approach every situation with patience and care.
46+
- **Be considerate.** Think about how your contribution will affect others in the community.
47+
- **Be open minded.** Embrace new people and new ideas. Our community is continually evolving and we welcome positive change.
4548

4649
If you believe someone is violating the code of conduct, we ask that you report it by emailing [hello@p5js.org](mailto:hello@p5js.org). Please include your name and a description of the incident, and we will get back to you ASAP.
4750

4851
Sometimes, participants violating the Code of Conduct are unaware that their behavior is harmful, and an open conversation clears things up to move forward. However, if a participant continues with the behavior, the p5.js team may take any action they deem appropriate, up to and including expulsion from all p5.js spaces and identification of the participant as a harasser to other p5.js members or the general public.
4952

5053
---
51-
This statement is licensed under a [Creative Commons license](https://creativecommons.org/licenses/by-sa/4.0/). Please feel free to share and remix with attribution.
54+
55+
This statement is licensed under a [Creative Commons license](https://creativecommons.org/licenses/by-sa/4.0/). Please feel free to share and remix with attribution.

.github/CONTRIBUTING.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Contributing to the p5.js Web Editor
1+
# Contributing to the p5.js Web Editor
22

33
Hello! We welcome community contributions to the p5.js Web Editor. Contributing takes many forms and doesn't have to be **writing code**, it can be **reporting bugs**, **proposing new features**, **creating UI/UX designs**, and **updating documentation**.
44

55
## Table of Contents
6+
67
- [Contributing to the p5.js Web Editor](#contributing-to-the-p5js-web-editor)
78
- [Table of Contents](#table-of-contents)
89
- [Code of Conduct](#code-of-conduct)
@@ -21,38 +22,46 @@ Hello! We welcome community contributions to the p5.js Web Editor. Contributing
2122
Please follow the guidelines in the [Code of Conduct](https://github.com/processing/p5.js-web-editor/blob/develop/.github/CODE_OF_CONDUCT.md).
2223

2324
## How Can I Contribute?
25+
2426
If you're new to open source, [read about how to contribute to open source](https://opensource.guide/how-to-contribute/).
2527

2628
### First Steps
29+
2730
Don't know where to begin? Here are some suggestions to get started:
28-
* Think about what you're hoping to learn by working on open source. The web editor is a full-stack web application, therefore there's tons of different areas to focus on:
31+
32+
- Think about what you're hoping to learn by working on open source. The web editor is a full-stack web application, therefore there's tons of different areas to focus on:
2933
- UI/UX design
3034
- Project management: Organizing tickets, pull requests, tasks
3135
- Front end: React/Redux, CSS/Sass, CodeMirror
3236
- Back end: Node, Express, MongoDB, Jest, AWS
3337
- DevOps: Travis CI, Jest, Docker, Kubernetes, AWS
3438
- Documentation
3539
- Translations: Application and documentation
36-
* Use the [p5.js Web Editor](https://editor.p5js.org)! Find a bug? Think of something you think would add to the project? Open an issue.
37-
* Expand an existing issue. Sometimes issues are missing steps to reproduce, or need suggestions for potential solutions. Sometimes they need another voice saying, "this is really important!"
38-
* Try getting the project running locally on your computer by following the [installation steps](./../contributor_docs/installation.md).
39-
* Look through the documentation in the [developer docs](../contributor_docs/). Is there anything that could be expanded? Is there anything missing?
40-
* Look at the [development guide](./../contributor_docs/development.md).
40+
- Use the [p5.js Web Editor](https://editor.p5js.org)! Find a bug? Think of something you think would add to the project? Open an issue.
41+
- Expand an existing issue. Sometimes issues are missing steps to reproduce, or need suggestions for potential solutions. Sometimes they need another voice saying, "this is really important!"
42+
- Try getting the project running locally on your computer by following the [installation steps](./../contributor_docs/installation.md).
43+
- Look through the documentation in the [developer docs](../contributor_docs/). Is there anything that could be expanded? Is there anything missing?
44+
- Look at the [development guide](./../contributor_docs/development.md).
4145

4246
### Good First Issues
47+
4348
For first-time contributors or those who want to start with a small task, [check out the list of good first issues](https://github.com/processing/p5.js-web-editor/labels/good%20first%20issue), or [issues that need documentation of steps to reproduce](https://github.com/processing/p5.js-web-editor/issues?q=is%3Aissue+is%3Aopen+label%3A%22needs+steps+to+reproduce%22). If the issue has not been assigned to anyone, then you can work on it! It's okay to not know how to fix an issue, and feel free to ask questions about to approach the problem! We are all here to learn and make something awesome. Someone from the community would help you out and these are great issues for learning about the web editor, its file structure and its development process.
4449

4550
### Good Medium Issues
51+
4652
If you're looking for a bigger project to take on, look through the issues tagged [good medium issue](https://github.com/processing/p5.js-web-editor/labels/good%20medium%20issue). These issues are self-contained projects that may take longer to work on, but are great if you're looking to get more deeply involved in contributing!
4753

4854
### Project Board
55+
4956
Many issues are related to each other and fall under bigger projects. To get a bigger picture, look at the [All Projects](https://github.com/processing/p5.js-web-editor/projects/4) board.
5057

5158
### Project Ideas
59+
5260
If you're looking for inspiration for Google Summer of Code or a bigger project, there's a [project list](https://github.com/processing/processing/wiki/Project-List#p5js-web-editor) maintained on the Processing wiki.
5361

5462
### Issue Search and Tagging
55-
If you're looking for issues to work on, a good place to start is with tickets labeled [high priority](https://github.com/processing/p5.js-web-editor/labels/priority%3Ahigh). You can also look for tickets that are [feature enhancements](https://github.com/processing/p5.js-web-editor/labels/type%3Afeature), [bug fixes](https://github.com/processing/p5.js-web-editor/labels/type%3Abug), and a few other tags.
63+
64+
If you're looking for issues to work on, a good place to start is with tickets labeled [high priority](https://github.com/processing/p5.js-web-editor/labels/priority%3Ahigh). You can also look for tickets that are [feature enhancements](https://github.com/processing/p5.js-web-editor/labels/type%3Afeature), [bug fixes](https://github.com/processing/p5.js-web-editor/labels/type%3Abug), and a few other tags.
5665

5766
If you feel like an issue is tagged incorrectly (e.g. it's low priority and you think it should be high), please update the issue!
5867

@@ -64,5 +73,5 @@ Then, look at the [development guide](https://github.com/processing/p5.js-web-ed
6473

6574
### Contribution Guides
6675

67-
* [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/)
68-
* [https://guides.github.com/activities/forking/](https://guides.github.com/activities/forking/)
76+
- [https://guides.github.com/activities/hello-world/](https://guides.github.com/activities/hello-world/)
77+
- [https://guides.github.com/activities/forking/](https://guides.github.com/activities/forking/)

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ contact_links:
99
about: Report issues with the p5.js website here.
1010
- name: 💬 Forum
1111
url: https://discourse.processing.org/c/p5js
12-
about: Have other questions about using p5.js? Ask them here!
12+
about: Have other questions about using p5.js? Ask them here!

.github/ISSUE_TEMPLATE/existing-feature-enhancement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 💡 Existing Feature Enhancement
22
description: Suggest an improvement to an existing feature.
3-
labels: [ Enhancement ]
3+
labels: [Enhancement]
44
body:
55
- type: textarea
66
attributes:

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🌱 New Feature Request
22
description: Request a new feature be added.
3-
labels: [ Feature Request ]
3+
labels: [Feature Request]
44
body:
55
- type: textarea
66
attributes:

0 commit comments

Comments
 (0)