Skip to content

Commit a3e82f4

Browse files
authored
Merge pull request #2 from BetterTyped/documentation
New version
2 parents eee0e79 + ea59c11 commit a3e82f4

File tree

358 files changed

+328478
-9482
lines changed

Some content is hidden

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

358 files changed

+328478
-9482
lines changed

.babelrc.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const styleXPlugin = require("@stylexjs/babel-plugin");
2+
3+
module.exports = {
4+
presets: ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"],
5+
plugins: [
6+
[
7+
styleXPlugin,
8+
{
9+
// We use the babelrc only for testing
10+
test: true,
11+
// Required for CSS variable support
12+
unstable_moduleResolution: {
13+
// type: 'commonJS' | 'haste'
14+
// default: 'commonJS'
15+
type: "commonJS",
16+
// The absolute path to the root directory of your project
17+
rootDir: __dirname,
18+
},
19+
},
20+
],
21+
],
22+
};

.bin/jest.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Extract working directory based on jest config file
2+
3+
# Path to Jest config file supplied by VSCode Jest Runner
4+
jest_config=$3
5+
6+
# Remove part after last slash
7+
cwd=$(echo "$jest_config" | sed 's|\(.*\)/.*|\1|')
8+
9+
cd "$cwd"
10+
11+
command="yarn jest '$1' -c $jest_config -t '$5' $6"
12+
13+
eval "$command"
14+
15+
cd ../..

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NX_SKIP_NX_CACHE=true

.eslintignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
dist
22
node_modules
3+
jest.config.js
34
jest.config.ts
5+
jest.setup.ts
6+
**/jest.setup.ts
47
babel.config.js
58
rollup.config.js
6-
jest.setup.ts
79
tsconfig.json
810
coverage
911
temp
10-
commitlint.config.js
11-
*lib*
12+
release.config.js

.eslintrc.json

Lines changed: 150 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,77 +19,165 @@
1919
"version": "detect"
2020
}
2121
},
22-
"plugins": ["react", "react-hooks"],
23-
"extends": [
24-
"eslint:recommended",
25-
"plugin:react-hooks/recommended",
26-
"prettier",
27-
"plugin:react/recommended",
28-
"plugin:@typescript-eslint/recommended",
29-
"plugin:import/typescript",
30-
"airbnb",
31-
"airbnb-typescript",
32-
"plugin:prettier/recommended"
33-
],
34-
"rules": {
35-
"react-hooks/rules-of-hooks": "error",
36-
"react-hooks/exhaustive-deps": "warn",
37-
"react/prop-types": "off",
38-
"react/jsx-uses-react": "error",
39-
"react/jsx-uses-vars": "error",
40-
"no-console": ["error", { "allow": ["warn", "error"] }],
41-
"react/react-in-jsx-scope": "off",
42-
"react/display-name": 0,
43-
"import/no-extraneous-dependencies": 0,
44-
"import/prefer-default-export": 0,
45-
"import/no-cycle": 0,
46-
"@typescript-eslint/no-explicit-any": 0,
47-
"@typescript-eslint/lines-between-class-members": "off",
48-
"prettier/prettier": ["error"],
49-
"consistent-return": 0,
50-
"@typescript-eslint/no-throw-literal": 0,
51-
"no-underscore-dangle": 0,
52-
"react/function-component-definition": 0,
53-
"react/no-unused-prop-types": 0,
54-
"react/no-array-index-key": 0,
55-
"react/jsx-no-useless-fragment": 0,
56-
"react/jsx-props-no-spreading": 0,
57-
"react/require-default-props": 0,
58-
"react/no-unknown-property": 0,
59-
"testing-library/render-result-naming-convention": "off",
60-
"import/order": [
61-
"error",
62-
{
63-
"groups": [
64-
["builtin", "external"],
65-
["internal", "parent", "sibling", "index"]
22+
23+
"overrides": [
24+
{
25+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
26+
"plugins": ["react", "react-hooks", "eslint-plugin-prettier", "tree-shaking"],
27+
"extends": [
28+
"eslint:recommended",
29+
"plugin:react-hooks/recommended",
30+
"prettier",
31+
"plugin:react/recommended",
32+
"plugin:@typescript-eslint/recommended",
33+
"plugin:import/typescript",
34+
"airbnb",
35+
"airbnb-typescript",
36+
"plugin:prettier/recommended"
37+
],
38+
"rules": {
39+
"react-hooks/rules-of-hooks": "error",
40+
"react-hooks/exhaustive-deps": "warn",
41+
"react/prop-types": "off",
42+
"react/jsx-uses-react": "error",
43+
"react/jsx-uses-vars": "error",
44+
"no-console": ["error", { "allow": ["warn", "error"] }],
45+
"react/react-in-jsx-scope": "off",
46+
"no-continue": "off",
47+
"react/display-name": 0,
48+
"import/no-extraneous-dependencies": 0,
49+
"import/prefer-default-export": 0,
50+
"import/no-cycle": 0,
51+
"import/no-default-export": ["error"],
52+
"max-lines": ["error", 400],
53+
"@typescript-eslint/no-explicit-any": "error",
54+
"@typescript-eslint/lines-between-class-members": "off",
55+
"prettier/prettier": ["error"],
56+
"consistent-return": 0,
57+
"@typescript-eslint/no-throw-literal": 0,
58+
"no-underscore-dangle": 0,
59+
"react/jsx-props-no-spreading": 0,
60+
"react/function-component-definition": 0,
61+
"react/require-default-props": 0,
62+
"testing-library/render-result-naming-convention": "off",
63+
"max-params": ["error", 3],
64+
"no-param-reassign": [
65+
"error",
66+
{
67+
"props": true,
68+
"ignorePropertyModificationsFor": ["draft", "acc"]
69+
}
6670
],
67-
"pathGroups": [
68-
{ "pattern": "assets/**", "group": "sibling", "position": "after" },
71+
"tree-shaking/no-side-effects-in-initialization": [
72+
2,
6973
{
70-
"pattern": "@external/**/*.css",
71-
"group": "sibling",
72-
"position": "after"
73-
},
74+
"noSideEffectsWhenCalled": [
75+
{ "function": "Object.freeze" },
76+
{
77+
"module": "react",
78+
"functions": ["createContext", "createRef", "forwardRef", "memo"]
79+
}
80+
]
81+
}
82+
],
83+
"import/order": [
84+
"error",
7485
{
75-
"pattern": "*.css",
76-
"group": "index",
77-
"patternOptions": { "matchBase": true },
78-
"position": "after"
86+
"groups": [
87+
["builtin", "external"],
88+
["internal", "parent", "sibling", "index"]
89+
],
90+
"pathGroups": [
91+
{ "pattern": "assets/**", "group": "sibling", "position": "after" },
92+
{
93+
"pattern": "*.style{s,x}",
94+
"group": "sibling",
95+
"patternOptions": { "matchBase": true },
96+
"position": "after"
97+
}
98+
],
99+
"warnOnUnassignedImports": true,
100+
"pathGroupsExcludedImportTypes": ["css"],
101+
"newlines-between": "always"
79102
}
80103
],
81-
"warnOnUnassignedImports": true,
82-
"pathGroupsExcludedImportTypes": ["css"],
83-
"newlines-between": "always"
104+
"@typescript-eslint/naming-convention": [
105+
"error",
106+
// destructured variables come from other places so no format is enforced
107+
{
108+
"selector": "variable",
109+
"modifiers": ["destructured"],
110+
"format": null
111+
},
112+
// functions defined as constants must be constants (not var/let)
113+
{
114+
"selector": "variable",
115+
"types": ["function"],
116+
"modifiers": ["const"],
117+
"format": ["camelCase", "PascalCase"]
118+
},
119+
// Constants can also be camelCase apart from UPPER_CASE
120+
// - functional components (PascalCase)
121+
{
122+
"selector": "variable",
123+
"modifiers": ["const"],
124+
"format": ["UPPER_CASE", "camelCase", "PascalCase"]
125+
},
126+
// functions can be:
127+
// - regular functions (camelCase)
128+
{
129+
"selector": "function",
130+
"format": ["camelCase"]
131+
},
132+
// forbid lower case
133+
{
134+
"selector": "typeLike",
135+
"format": ["PascalCase"]
136+
},
137+
// forbid lower case
138+
{
139+
"selector": "typeParameter",
140+
"format": ["PascalCase"]
141+
},
142+
// Uppercase enums
143+
{
144+
"selector": "enumMember",
145+
"format": ["UPPER_CASE"]
146+
}
147+
]
84148
}
85-
]
86-
},
87-
"overrides": [
149+
},
88150
{
89-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
151+
"files": ["*.mdx"],
152+
"rules": {
153+
"react/jsx-filename-extension": "off"
154+
}
155+
},
156+
{
157+
"files": ["**/__tests__/**/*"],
90158
"rules": {
91-
"testing-library/render-result-naming-convention": "off"
159+
"max-lines": "off",
160+
"tree-shaking/no-side-effects-in-initialization": 0
92161
}
162+
},
163+
{
164+
// IMPORTANT: DO NOT ADD `*styles.{ts,tsx}` or `contexts.{ts,tsx}` here, we should keep all styles in stylex files!
165+
// File naming must be consistent across the whole project
166+
"files": [
167+
"*theme.ts",
168+
"*context.ts",
169+
"**/__stories__/**/*",
170+
"**/__docs__/**/*",
171+
"*.stylex.{ts,tsx}",
172+
"**/jest.setup.ts"
173+
],
174+
"rules": {
175+
"tree-shaking/no-side-effects-in-initialization": 0
176+
}
177+
},
178+
{
179+
"files": ["*.md", "*.mdx"],
180+
"extends": "plugin:mdx/recommended"
93181
}
94182
]
95183
}

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: [prc5]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [prc5] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Documentation 📖
2+
3+
> [!NOTE]
4+
> This is a friendly reminder of the steps needed to release documentation. Fill in the data in the next steps so that
5+
> the reviewer can take care of the rest.
6+
7+
## Changes overview
8+
9+
Summary of the changes and the related issue if applicable.
10+
11+
- Added documentation for xyz
12+
- Documented x, y, z
13+
14+
## Additional comments
15+
16+
N/A
17+
18+
---
19+
20+
## Checklist
21+
22+
### Reviewer responsibilities
23+
24+
- [ ] No commented-out code in the PR
25+
- [ ] Documentation changes reflect the functionality in readable way

0 commit comments

Comments
 (0)