Skip to content

Commit 40d1f6b

Browse files
committed
improve project setup
1 parent 85e214a commit 40d1f6b

9 files changed

+1694
-844
lines changed

.eslintrc.json

+55-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,70 @@
11
{
2+
"root": true,
23
"env": {
34
"browser": true,
45
"es2021": true,
56
"jest": true
67
},
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/recommended",
10-
"plugin:react/recommended",
11-
"prettier"
12-
],
8+
"extends": ["eslint:recommended", "airbnb", "plugin:@typescript-eslint/recommended", "plugin:react/jsx-runtime", "plugin:jsx-a11y/recommended", "plugin:react/recommended", "prettier"],
139
"parser": "@typescript-eslint/parser",
1410
"parserOptions": {
1511
"ecmaVersion": "latest",
1612
"sourceType": "module"
1713
},
18-
"ignorePatterns": [
19-
"dist/**.*",
20-
"node_modules/**",
21-
".git/**",
22-
"webpack.config.js"
23-
],
24-
"plugins": [
25-
"@typescript-eslint",
26-
"react"
14+
"ignorePatterns": ["dist", "node_modules", ".git", "webpack.config.js"],
15+
"plugins": ["@typescript-eslint", "react", "jsx-a11y"],
16+
"rules": {
17+
"arrow-parens": [
18+
"error",
19+
"as-needed",
20+
{
21+
"requireForBlockBody": true
22+
}
23+
],
24+
"no-invalid-this": "error",
25+
"react/function-component-definition": [
26+
"error",
27+
{
28+
"namedComponents": "function-declaration",
29+
"unnamedComponents": "arrow-function"
30+
}
31+
],
32+
"no-restricted-syntax": [
33+
"error",
34+
// The following four selectors prevent the usage of async/await
35+
{
36+
"selector": "AwaitExpression",
37+
"message": "async/await is not allowed"
38+
},
39+
{
40+
"selector": "FunctionDeclaration[async=true]",
41+
"message": "async functions are not allowed"
42+
},
43+
{
44+
"selector": "FunctionExpression[async=true]",
45+
"message": "async functions are not allowed"
46+
},
47+
{
48+
"selector": "ArrowFunctionExpression[async=true]",
49+
"message": "async functions are not allowed"
50+
},
51+
{
52+
"selector": "MethodDefinition[async=true]",
53+
"message": "async methods are not allowed"
54+
}
55+
]
56+
},
57+
"overrides": [
58+
{
59+
"files": ["*.ts", "*.tsx"],
60+
"plugins": ["@typescript-eslint"],
61+
"extends": ["plugin:@typescript-eslint/recommended-type-checked", "airbnb-typescript", "prettier"],
62+
"parser": "@typescript-eslint/parser",
63+
"parserOptions": {
64+
"project": "./tsconfig.json"
65+
}
66+
}
2767
],
28-
"rules": {},
2968
"settings": {
3069
"react": {
3170
"version": "detect"

.gitignore

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
node_modules
2-
dist
1+
# OSX
2+
.DS_Store
3+
4+
# node.js
5+
node_modules/
6+
npm-debug.log
7+
dist/
8+
9+
# NPM file created by GitHub actions
10+
.npmrc

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# The GH actions don't seem to compile and verify themselves well when Prettier is applied to them
12
dist
23
package.json
34
package-lock.json
45
*.html
56
*.css
67
*.scss
78
*.md
9+
*.yml
10+
*.yaml

babel.config.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
[
5+
"@babel/preset-react",
6+
{
7+
"runtime": "automatic"
8+
}
9+
],
10+
"@babel/preset-typescript"
11+
],
12+
"sourceMaps": true
13+
}

0 commit comments

Comments
 (0)