Skip to content

Commit a4e7357

Browse files
committed
feat: add react
1 parent 891549f commit a4e7357

File tree

2,083 files changed

+546690
-0
lines changed

Some content is hidden

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

2,083 files changed

+546690
-0
lines changed

react/.circleci/config.yml

Lines changed: 531 additions & 0 deletions
Large diffs are not rendered by default.

react/.codesandbox/ci.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"packages": ["packages/react", "packages/react-dom", "packages/scheduler"],
3+
"buildCommand": "build --type=NODE react/index,react-dom/index,react-dom/server,react-dom/test-utils,scheduler/index,react/jsx-runtime,react/jsx-dev-runtime",
4+
"node": "12",
5+
"publishDirectory": {
6+
"react": "build/node_modules/react",
7+
"react-dom": "build/node_modules/react-dom",
8+
"scheduler": "build/node_modules/scheduler"
9+
},
10+
"sandboxes": ["new"],
11+
"silent": true
12+
}

react/.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false
16+
17+
[COMMIT_EDITMSG]
18+
max_line_length = 0

react/.eslintignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Third party
2+
**/node_modules
3+
4+
# Not written by hand
5+
packages/react-art/npm/lib
6+
7+
# Build products
8+
build/
9+
# TODO: Currently storing artifacts as `./build2` so that it doesn't conflict
10+
# with old build job. Remove once we migrate rest of build/test pipeline.
11+
build2/
12+
coverage/
13+
fixtures/
14+
scripts/bench/benchmarks/**/*.js
15+
16+
# React repository clone
17+
scripts/bench/remote-repo/
18+
19+
packages/react-devtools-core/dist
20+
packages/react-devtools-extensions/chrome/build
21+
packages/react-devtools-extensions/firefox/build
22+
packages/react-devtools-extensions/shared/build
23+
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/
24+
packages/react-devtools-extensions/src/__tests__/__source__/__untransformed__/
25+
packages/react-devtools-extensions/src/ErrorTesterCompiled.js
26+
packages/react-devtools-inline/dist
27+
packages/react-devtools-shell/dist
28+
packages/react-devtools-scheduling-profiler/dist
29+
packages/react-devtools-scheduling-profiler/static

react/.eslintrc.js

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
'use strict';
2+
3+
const {
4+
es5Paths,
5+
esNextPaths,
6+
} = require('./scripts/shared/pathsByLanguageVersion');
7+
8+
const restrictedGlobals = require('confusing-browser-globals');
9+
10+
const OFF = 0;
11+
const ERROR = 2;
12+
13+
module.exports = {
14+
extends: ['fbjs', 'prettier'],
15+
16+
// Stop ESLint from looking for a configuration file in parent folders
17+
root: true,
18+
19+
plugins: [
20+
'jest',
21+
'no-for-of-loops',
22+
'no-function-declare-after-return',
23+
'react',
24+
'react-internal',
25+
],
26+
27+
parser: 'babel-eslint',
28+
parserOptions: {
29+
ecmaVersion: 8,
30+
sourceType: 'script',
31+
ecmaFeatures: {
32+
experimentalObjectRestSpread: true,
33+
},
34+
},
35+
36+
// We're stricter than the default config, mostly. We'll override a few rules
37+
// and then enable some React specific ones.
38+
rules: {
39+
'accessor-pairs': OFF,
40+
'brace-style': [ERROR, '1tbs'],
41+
'consistent-return': OFF,
42+
'dot-location': [ERROR, 'property'],
43+
// We use console['error']() as a signal to not transform it:
44+
'dot-notation': [ERROR, {allowPattern: '^(error|warn)$'}],
45+
'eol-last': ERROR,
46+
eqeqeq: [ERROR, 'allow-null'],
47+
indent: OFF,
48+
'jsx-quotes': [ERROR, 'prefer-double'],
49+
'keyword-spacing': [ERROR, {after: true, before: true}],
50+
'no-bitwise': OFF,
51+
'no-console': OFF,
52+
'no-inner-declarations': [ERROR, 'functions'],
53+
'no-multi-spaces': ERROR,
54+
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
55+
'no-restricted-syntax': [ERROR, 'WithStatement'],
56+
'no-shadow': ERROR,
57+
'no-unused-expressions': ERROR,
58+
'no-unused-vars': [ERROR, {args: 'none'}],
59+
'no-use-before-define': OFF,
60+
'no-useless-concat': OFF,
61+
quotes: [ERROR, 'single', {avoidEscape: true, allowTemplateLiterals: true}],
62+
'space-before-blocks': ERROR,
63+
'space-before-function-paren': OFF,
64+
'valid-typeof': [ERROR, {requireStringLiterals: true}],
65+
// Flow fails with with non-string literal keys
66+
'no-useless-computed-key': OFF,
67+
68+
// We apply these settings to files that should run on Node.
69+
// They can't use JSX or ES6 modules, and must be in strict mode.
70+
// They can, however, use other ES6 features.
71+
// (Note these rules are overridden later for source files.)
72+
'no-var': ERROR,
73+
strict: ERROR,
74+
75+
// Enforced by Prettier
76+
// TODO: Prettier doesn't handle long strings or long comments. Not a big
77+
// deal. But I turned it off because loading the plugin causes some obscure
78+
// syntax error and it didn't seem worth investigating.
79+
'max-len': OFF,
80+
// Prettier forces semicolons in a few places
81+
'flowtype/object-type-delimiter': OFF,
82+
83+
// React & JSX
84+
// Our transforms set this automatically
85+
'react/jsx-boolean-value': [ERROR, 'always'],
86+
'react/jsx-no-undef': ERROR,
87+
// We don't care to do this
88+
'react/jsx-sort-prop-types': OFF,
89+
'react/jsx-space-before-closing': ERROR,
90+
'react/jsx-uses-react': ERROR,
91+
'react/no-is-mounted': OFF,
92+
// This isn't useful in our test code
93+
'react/react-in-jsx-scope': ERROR,
94+
'react/self-closing-comp': ERROR,
95+
// We don't care to do this
96+
'react/jsx-wrap-multilines': [
97+
ERROR,
98+
{declaration: false, assignment: false},
99+
],
100+
101+
// Prevent for...of loops because they require a Symbol polyfill.
102+
// You can disable this rule for code that isn't shipped (e.g. build scripts and tests).
103+
'no-for-of-loops/no-for-of-loops': ERROR,
104+
105+
// Prevent function declarations after return statements
106+
'no-function-declare-after-return/no-function-declare-after-return': ERROR,
107+
108+
// CUSTOM RULES
109+
// the second argument of warning/invariant should be a literal string
110+
'react-internal/no-primitive-constructors': ERROR,
111+
'react-internal/no-to-warn-dev-within-to-throw': ERROR,
112+
'react-internal/invariant-args': ERROR,
113+
'react-internal/warning-args': ERROR,
114+
'react-internal/no-production-logging': ERROR,
115+
'react-internal/no-cross-fork-imports': ERROR,
116+
'react-internal/no-cross-fork-types': [
117+
ERROR,
118+
{
119+
old: [],
120+
new: [],
121+
},
122+
],
123+
},
124+
125+
overrides: [
126+
{
127+
// We apply these settings to files that we ship through npm.
128+
// They must be ES5.
129+
files: es5Paths,
130+
parser: 'espree',
131+
parserOptions: {
132+
ecmaVersion: 5,
133+
sourceType: 'script',
134+
},
135+
rules: {
136+
'no-var': OFF,
137+
strict: ERROR,
138+
},
139+
},
140+
{
141+
// We apply these settings to the source files that get compiled.
142+
// They can use all features including JSX (but shouldn't use `var`).
143+
files: esNextPaths,
144+
parser: 'babel-eslint',
145+
parserOptions: {
146+
ecmaVersion: 8,
147+
sourceType: 'module',
148+
},
149+
rules: {
150+
'no-var': ERROR,
151+
'prefer-const': ERROR,
152+
strict: OFF,
153+
},
154+
},
155+
{
156+
files: ['**/__tests__/*.js'],
157+
rules: {
158+
// https://github.com/jest-community/eslint-plugin-jest
159+
'jest/no-focused-tests': ERROR,
160+
'jest/valid-expect': ERROR,
161+
'jest/valid-expect-in-promise': ERROR,
162+
},
163+
},
164+
{
165+
files: [
166+
'**/__tests__/**/*.js',
167+
'scripts/**/*.js',
168+
'packages/*/npm/**/*.js',
169+
'packages/dom-event-testing-library/**/*.js',
170+
'packages/react-devtools*/**/*.js',
171+
],
172+
rules: {
173+
'react-internal/no-production-logging': OFF,
174+
'react-internal/warning-args': OFF,
175+
176+
// Disable accessibility checks
177+
'jsx-a11y/aria-role': OFF,
178+
'jsx-a11y/no-noninteractive-element-interactions': OFF,
179+
'jsx-a11y/no-static-element-interactions': OFF,
180+
'jsx-a11y/role-has-required-aria-props': OFF,
181+
'jsx-a11y/no-noninteractive-tabindex': OFF,
182+
'jsx-a11y/tabindex-no-positive': OFF,
183+
},
184+
},
185+
{
186+
files: [
187+
'packages/react-native-renderer/**/*.js',
188+
'packages/react-server-native-relay/**/*.js',
189+
],
190+
globals: {
191+
nativeFabricUIManager: true,
192+
},
193+
},
194+
{
195+
files: ['packages/react-server-dom-webpack/**/*.js'],
196+
globals: {
197+
__webpack_chunk_load__: true,
198+
__webpack_require__: true,
199+
},
200+
},
201+
{
202+
files: ['packages/scheduler/**/*.js'],
203+
globals: {
204+
TaskController: true,
205+
},
206+
},
207+
],
208+
209+
globals: {
210+
spyOnDev: true,
211+
spyOnDevAndProd: true,
212+
spyOnProd: true,
213+
__EXPERIMENTAL__: true,
214+
__EXTENSION__: true,
215+
__PROFILE__: true,
216+
__TEST__: true,
217+
__UMD__: true,
218+
__VARIANT__: true,
219+
gate: true,
220+
trustedTypes: true,
221+
},
222+
};

react/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: "🐛 Bug Report"
3+
about: Report a reproducible bug or regression.
4+
title: 'Bug: '
5+
labels: 'Status: Unconfirmed'
6+
7+
---
8+
9+
<!--
10+
Please provide a clear and concise description of what the bug is. Include
11+
screenshots if needed. Please test using the latest version of the relevant
12+
React packages to make sure your issue has not already been fixed.
13+
-->
14+
15+
React version:
16+
17+
## Steps To Reproduce
18+
19+
1.
20+
2.
21+
22+
<!--
23+
Your bug will get fixed much faster if we can run your code and it doesn't
24+
have dependencies other than React. Issues without reproduction steps or
25+
code examples may be immediately closed as not actionable.
26+
-->
27+
28+
Link to code example:
29+
30+
<!--
31+
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a
32+
repository on GitHub, or provide a minimal code example that reproduces the
33+
problem. You may provide a screenshot of the application if you think it is
34+
relevant to your bug report. Here are some tips for providing a minimal
35+
example: https://stackoverflow.com/help/mcve.
36+
-->
37+
38+
## The current behavior
39+
40+
41+
## The expected behavior
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
contact_links:
2+
- name: 📃 Documentation Issue
3+
url: https://github.com/reactjs/reactjs.org/issues/new
4+
about: This issue tracker is not for documentation issues. Please file documentation issues here.
5+
- name: 🤔 Questions and Help
6+
url: https://reactjs.org/community/support.html
7+
about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums.

0 commit comments

Comments
 (0)