Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 3798312

Browse files
committed
optimized cra templates
1 parent 9b1289b commit 3798312

File tree

23 files changed

+417
-181
lines changed

23 files changed

+417
-181
lines changed

packages/cra-template-agile-typescript/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"preview": "npm pack"
1818
},
1919
"devDependencies": {
20+
"@agile-ts/core": "^0.1.2",
21+
"@agile-ts/react": "^0.1.2",
2022
"react": "^17.0.2",
2123
"react-dom": "^17.0.2",
2224
"react-scripts": "4.0.3",
2325
"@types/react": "^17.0.3",
24-
"@types/react-dom": "^17.0.3",
25-
"@agile-ts/core": "^0.1.0",
26-
"@agile-ts/react": "^0.1.0"
26+
"@types/react-dom": "^17.0.3"
2727
},
2828
"publishConfig": {
2929
"access": "public"

packages/cra-template-agile-typescript/template.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"package": {
3+
"scripts": {
4+
"prettier": "prettier --config .prettierrc --write \"**/*.{js,ts}\"",
5+
"lint": "eslint --cache \"**/*.{js,jsx,ts,tsx}\""
6+
},
37
"dependencies": {
48
"@agile-ts/core": "^0.1.2",
59
"@agile-ts/react": "^0.1.2",
@@ -8,10 +12,6 @@
812
"react-scripts": "^4.0.3"
913
},
1014
"devDependencies": {
11-
"@testing-library/jest-dom": "^5.11.4",
12-
"@testing-library/react": "^11.1.0",
13-
"@testing-library/user-event": "^12.1.10",
14-
"@types/jest": "^26.0.15",
1515
"@types/node": "^12.0.0",
1616
"@types/react": "^17.0.0",
1717
"@types/react-dom": "^17.0.0",

packages/cra-template-agile-typescript/template/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ const WARNING = 1;
33
const ERROR = 2;
44

55
module.exports = {
6-
plugins: ['@typescript-eslint'],
76
extends: ['airbnb-typescript', 'prettier'],
7+
plugins: ['@typescript-eslint', 'prettier'],
88
parser: '@typescript-eslint/parser',
99
parserOptions: {
1010
project: ['./tsconfig.json'],
1111
},
1212
ignorePatterns: ['.eslintrc.js'], // https://stackoverflow.com/questions/63002127/parsing-error-parseroptions-project-has-been-set-for-typescript-eslint-parser
1313
rules: {
1414
'react/prop-types': OFF,
15+
'import/prefer-default-export': OFF,
1516
},
1617
};

packages/cra-template-agile-typescript/template/.gitignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/cra-template-agile-typescript/template/package.json

Lines changed: 0 additions & 57 deletions
This file was deleted.

packages/cra-template-agile-typescript/template/src/components/Stopwatch/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Button from './components/Button';
55

66
import styles from './Stopwatch.module.css';
77

8-
const Stopwatch = () => {
8+
const Stopwatch: React.FC = () => {
99
const [time, state] = useAgile([StopwatchCore.TIME, StopwatchCore.STATE]);
1010

1111
// Restart Stopwatch when the persisted value has been loaded

packages/cra-template-agile-typescript/template/src/pages/Home/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Stopwatch from '../../components/Stopwatch';
33

44
import styles from './Home.module.css';
55

6-
function Home() {
6+
const Home: React.FC = () => {
77
return (
88
<div className={styles.container}>
99
{/* Header */}
@@ -43,6 +43,6 @@ function Home() {
4343
</div>
4444
</div>
4545
);
46-
}
46+
};
4747

4848
export default Home;

packages/cra-template-agile/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"preview": "npm pack"
1818
},
1919
"devDependencies": {
20+
"@agile-ts/core": "^0.1.2",
21+
"@agile-ts/react": "^0.1.2",
2022
"react": "^17.0.2",
2123
"react-dom": "^17.0.2",
22-
"react-scripts": "4.0.3",
23-
"@agile-ts/core": "^0.1.0",
24-
"@agile-ts/react": "^0.1.0"
24+
"react-scripts": "4.0.3"
2525
},
2626
"publishConfig": {
2727
"access": "public"
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
{
22
"package": {
3+
"scripts": {
4+
"prettier": "prettier --config .prettierrc --write \"**/*.{js,ts}\"",
5+
"lint": "eslint --cache \"**/*.{js,jsx,ts,tsx}\""
6+
},
37
"dependencies": {
48
"@agile-ts/core": "^0.1.2",
59
"@agile-ts/react": "^0.1.2",
6-
"web-vitals": "^1.0.1"
10+
"react": "^17.0.2",
11+
"react-dom": "^17.0.2",
12+
"react-scripts": "4.0.3"
713
},
814
"devDependencies": {
9-
"@testing-library/jest-dom": "^5.11.4",
10-
"@testing-library/react": "^11.1.0",
11-
"@testing-library/user-event": "^12.1.10"
12-
},
13-
"eslintConfig": {
14-
"extends": ["react-app", "react-app/jest"]
15+
"eslint": "^7.31.0",
16+
"eslint-config-airbnb": "^18.2.1",
17+
"eslint-config-prettier": "^8.3.0",
18+
"eslint-plugin-import": "^2.23.4",
19+
"eslint-plugin-jsx-a11y": "^6.4.1",
20+
"eslint-plugin-prettier": "^3.4.0",
21+
"eslint-plugin-react": "^7.24.0",
22+
"eslint-plugin-react-hooks": "^4.2.0",
23+
"prettier": "^2.3.2"
1524
}
1625
}
1726
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const OFF = 0;
2+
const WARNING = 1;
3+
const ERROR = 2;
4+
5+
module.exports = {
6+
extends: ['airbnb', 'airbnb/hooks', 'prettier'],
7+
plugins: ['prettier'],
8+
ignorePatterns: ['.eslintrc.js'],
9+
rules: {
10+
'react/prop-types': OFF,
11+
'import/prefer-default-export': OFF,
12+
},
13+
};

0 commit comments

Comments
 (0)