Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Eslint #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["plugin:react/recommended", "airbnb"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,

"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
// Who doesn't have an ultra-wide these days?
"max-len": ["error", 120],
"import/no-extraneous-dependencies":[
"error",
{
"devDependencies":[
"**/*.test.ts",
"**/*.test.tsx",
"vite.config.*"
]
}
]
}
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"eslint.format.enable": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.enable": false,
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
44,544 changes: 7,534 additions & 37,010 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
"lint": "eslint .",
"preview": "vite preview"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand All @@ -40,7 +34,18 @@
},
"homepage": "https://judilsteve.github.io/asx_cgt",
"devDependencies": {
"@eslint/js": "^9.9.1",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"typescript-eslint": "^8.4.0",
"vite": "^5.4.2"
}
}
131 changes: 68 additions & 63 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,80 @@
/* eslint-disable react/no-unescaped-entities */
/* eslint-disable react/jsx-one-expression-per-line */
/* eslint-disable max-len */
import React from 'react';
import { Container, Typography } from '@material-ui/core';
import ParcelList from './components/parcelList';
import AdjustmentList from './components/adjustmentList';
import ImportExport from './components/importExport'
import ImportExport from './components/importExport';
import SaleList from './components/saleList';
import DonateButton from './components/donateButton';
import SaveFailedSnackbar from './components/saveFailedSnackbar';

function App() {
const repoUrl = 'https://github.com/judilsteve/asx-cgt-calculator-optimiser';
return (<Container maxWidth="xl">
<br/>
<Typography variant="h2">ASX CGT Calculator/Optimiser</Typography>
<br/>
<Typography variant="h6">
This is a simple calculator that helps with record-keeping for your ASX holdings,
and calculation of CGT when selling.
<br/><br/>
All care has been taken to ensure that the calculations made here are correct and that they
conform to ATO requirements (as at 2021-07-10). I trust this calculator enough to use it for record-keeping
and CGT calculations of my own portfolio. However, I make no guarantee that the calculator is free from defects and accept
no liability for any consequences incurred by you of issues herein. Always check any values calculated here against
your own calculations.
<br/><br/>
If you find any issues with the calculator, please raise them <a href={`${repoUrl}/issues`}>here</a>.
<br/><br/>
If you find this calculator useful, and you want to show your appreciation, you can use the donation link below to shout me a coffee.
<br/><br/>
<DonateButton/>
<br/>
This calculator is a Single Page Application, or SPA. This means you can save the entire application to your computer
right now (press Ctrl+S on your keyboard) so that you still have access to the calculator even if this website
disappears from the internet.
<br/><br/>
This calculator is also free software licensed under the <a href={`${repoUrl}/blob/master/COPYING.md`}>Affero GPL</a>. You may view the source code <a href={repoUrl}>here</a>.
If you wish to use the source code as a basis for your own work, you may do so, but you must
adhere to the terms of the original license if you distribute your work.
<br/><br/>
Portfolio data is auto-saved to your browser's local storage: Your data does not leave your computer.
It is highly recommended that you export a backup of your portfolio data using the buttons below so that your
records are not lost if uninstall your browser, clear the local storage, lose your laptop, etc.
</Typography>
<br/>
<ImportExport/>
<br/><br/>
<Typography variant="h3">Parcels</Typography>
<br/>
<Typography variant="h6">
Enter details of all holdings (past and present) below, including dividend reinvestments.
</Typography>
<br/>
<ParcelList/>
<br/><br/>
<Typography variant="h3">Cost Base Adjustments</Typography>
<br/>
<Typography variant="h6">
Enter details of all cost base adjustments below (e.g. AMIT net adjustments from your annual tax statements).
</Typography>
<br/>
<AdjustmentList/>
<br/><br/>
<Typography variant="h3">Sales</Typography>
<br/>
<Typography variant="h6">
Enter details of all sale events below.
</Typography>
<br/>
<SaleList/>
<div style={{ height: '75vh' }}/>{/* Bit of dead space to let the user scroll content up higher for convenience */}
<SaveFailedSnackbar/>
</Container>);
const repoUrl = 'https://github.com/judilsteve/asx-cgt-calculator-optimiser';
return (
<Container maxWidth="xl">
<br />
<Typography variant="h2">ASX CGT Calculator/Optimiser</Typography>
<br />
<Typography variant="h6">
This is a simple calculator that helps with record-keeping for your ASX holdings,
and calculation of CGT when selling.
<br /><br />
All care has been taken to ensure that the calculations made here are correct and that they
conform to ATO requirements (as at 2021-07-10). I trust this calculator enough to use it for record-keeping
and CGT calculations of my own portfolio. However, I make no guarantee that the calculator is free from defects and accept
no liability for any consequences incurred by you of issues herein. Always check any values calculated here against
your own calculations.
<br /><br />
If you find any issues with the calculator, please raise them <a href={`${repoUrl}/issues`}>here</a>.
<br /><br />
If you find this calculator useful, and you want to show your appreciation, you can use the donation link below to shout me a coffee.
<br /><br />
<DonateButton />
<br />
This calculator is a Single Page Application, or SPA. This means you can save the entire application to your computer
right now (press Ctrl+S on your keyboard) so that you still have access to the calculator even if this website
disappears from the internet.
<br /><br />
This calculator is also free software licensed under the <a href={`${repoUrl}/blob/master/COPYING.md`}>Affero GPL</a>. You may view the source code <a href={repoUrl}>here</a>.
If you wish to use the source code as a basis for your own work, you may do so, but you must
adhere to the terms of the original license if you distribute your work.
<br /><br />
Portfolio data is auto-saved to your browser's local storage: Your data does not leave your computer.
It is highly recommended that you export a backup of your portfolio data using the buttons below so that your
records are not lost if uninstall your browser, clear the local storage, lose your laptop, etc.
</Typography>
<br />
<ImportExport />
<br /><br />
<Typography variant="h3">Parcels</Typography>
<br />
<Typography variant="h6">
Enter details of all holdings (past and present) below, including dividend reinvestments.
</Typography>
<br />
<ParcelList />
<br /><br />
<Typography variant="h3">Cost Base Adjustments</Typography>
<br />
<Typography variant="h6">
Enter details of all cost base adjustments below (e.g. AMIT net adjustments from your annual tax statements).
</Typography>
<br />
<AdjustmentList />
<br /><br />
<Typography variant="h3">Sales</Typography>
<br />
<Typography variant="h6">
Enter details of all sale events below.
</Typography>
<br />
<SaleList />
<div style={{ height: '75vh' }} />{/* Bit of dead space to let the user scroll content up higher for convenience */}
<SaveFailedSnackbar />
</Container>
);
}

export default App;
Loading