diff --git a/.eslintrc.js b/.eslintrc.js index 67e4fdad1..c986deb0f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,13 +21,23 @@ module.exports = { }, parser: '@typescript-eslint/parser', parserOptions: { + warnOnUnsupportedTypeScriptVersion: false, + project: true, ecmaFeatures: { jsx: true, }, - ecmaVersion: 2021, + ecmaVersion: 2022, sourceType: 'module', }, - plugins: ['react', 'react-hooks', '@typescript-eslint', 'import', 'unused-imports', 'prettier'], + plugins: [ + 'react', + 'react-hooks', + '@typescript-eslint', + 'import', + 'unused-imports', + 'prettier', + 'unicorn', + ], rules: { 'import/named': 'warn', 'import/no-unresolved': 'warn', @@ -55,14 +65,17 @@ module.exports = { 'react/no-unescaped-entities': 'off', 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', - 'react/react-in-jsx-scope': 'warn', + 'react/react-in-jsx-scope': 'error', 'react/no-unused-prop-types': 'warn', 'unused-imports/no-unused-imports': 'error', 'no-console': 'error', + 'no-empty': 'error', + 'unicorn/no-empty-file': 'error', '@typescript-eslint/no-unused-vars': 'warn', '@typescript-eslint/ban-ts-comment': 'warn', '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/consistent-type-imports': [ 'error', { @@ -101,5 +114,5 @@ module.exports = { }, }, ], - ignorePatterns: ['node_modules/**/*', 'build/**/*', 'out/**/*'], + ignorePatterns: ['node_modules/**/*', 'build/**/*', 'out/**/*', '*.js'], }; diff --git a/.gitignore b/.gitignore index d482723ac..63bfeabfc 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ build .env.test.local .env.production.local .eslintcache +.envrc **/data diff --git a/common/components/alerts/AlertNotice.tsx b/common/components/alerts/AlertNotice.tsx index 802f20692..3d42e8dd4 100644 --- a/common/components/alerts/AlertNotice.tsx +++ b/common/components/alerts/AlertNotice.tsx @@ -6,11 +6,11 @@ export const AlertNotice: React.FC = () => { return ( <>
setAlertsOpen(!alertsOpen)} title="Alerts" > -

+

⚠️

diff --git a/common/components/alerts/PastAlertModal.tsx b/common/components/alerts/PastAlertModal.tsx index 5ae84737f..b7d45f2d4 100644 --- a/common/components/alerts/PastAlertModal.tsx +++ b/common/components/alerts/PastAlertModal.tsx @@ -43,7 +43,7 @@ export const PastAlertModal: React.FC = ({ alertsOpen, setA

⚠️

@@ -54,8 +54,8 @@ export const PastAlertModal: React.FC = ({ alertsOpen, setA
{ alertStore.changeAlertApplied(alertStore.alerts, index); diff --git a/common/components/buttons/DonateButton.tsx b/common/components/buttons/DonateButton.tsx index 41a879103..242b88a6c 100644 --- a/common/components/buttons/DonateButton.tsx +++ b/common/components/buttons/DonateButton.tsx @@ -13,8 +13,8 @@ export const DonateButton: React.FC = () => { onMouseLeave={() => setHovered(false)} className="rounded-mdring-white group flex w-full cursor-pointer justify-start gap-x-2 rounded-md bg-tm-red hover:bg-white focus:outline-none focus:ring-1 md:justify-start" > -
-
+
+

Make a donation

diff --git a/common/components/charts/AggregateLineChart.tsx b/common/components/charts/AggregateLineChart.tsx index 8a8e15951..6af32ad82 100644 --- a/common/components/charts/AggregateLineChart.tsx +++ b/common/components/charts/AggregateLineChart.tsx @@ -172,7 +172,7 @@ export const AggregateLineChart: React.FC = ({ ]} /> -
+
{showLegend && } {startDate && ( = ({ children }) => { - return
{children}
; + return
{children}
; }; diff --git a/common/components/charts/Legend.tsx b/common/components/charts/Legend.tsx index e42280ab8..cf66bf823 100644 --- a/common/components/charts/Legend.tsx +++ b/common/components/charts/Legend.tsx @@ -14,7 +14,7 @@ export const LegendSingleDay: React.FC = ({ showUnderRatio = false
-

Legend

+

Legend

diff --git a/common/components/charts/SingleDayLineChart.tsx b/common/components/charts/SingleDayLineChart.tsx index d44607024..34eb2966c 100644 --- a/common/components/charts/SingleDayLineChart.tsx +++ b/common/components/charts/SingleDayLineChart.tsx @@ -251,7 +251,7 @@ export const SingleDayLineChart: React.FC = ({
{alerts && } -
+
{showLegend && benchmarkField ? ( ) : ( diff --git a/common/components/controls/MobileControlPanel.tsx b/common/components/controls/MobileControlPanel.tsx index 52509ca26..3cfffaaf9 100644 --- a/common/components/controls/MobileControlPanel.tsx +++ b/common/components/controls/MobileControlPanel.tsx @@ -30,7 +30,7 @@ export const MobileControlPanel: React.FC = ({
diff --git a/common/components/general/AlertsDisclaimer.tsx b/common/components/general/AlertsDisclaimer.tsx index b830e3c15..bd029b5f3 100644 --- a/common/components/general/AlertsDisclaimer.tsx +++ b/common/components/general/AlertsDisclaimer.tsx @@ -11,7 +11,7 @@ export const AlertsDisclaimer: React.FC = ({ alerts }) =>
{alerts?.map((alert, index) => (
-

+

⚠️ {getDateString(alert.valid_from, alert.valid_to)} diff --git a/common/components/general/ButtonGroup.tsx b/common/components/general/ButtonGroup.tsx index b657f6b46..9d0af5e9a 100644 --- a/common/components/general/ButtonGroup.tsx +++ b/common/components/general/ButtonGroup.tsx @@ -54,7 +54,7 @@ export const ButtonGroup: ( ? `${lineColorBackground[line ?? 'DEFAULT']} text-white hover:bg-opacity-90` : `hover:${ lineColorBackground[line ?? 'DEFAULT'] - } bg-white text-stone-900 hover:bg-opacity-70 ` + } bg-white text-stone-900 hover:bg-opacity-70` )} >

{option[1]}

diff --git a/common/components/inputs/Button.tsx b/common/components/inputs/Button.tsx index 7314ea2aa..e43898298 100644 --- a/common/components/inputs/Button.tsx +++ b/common/components/inputs/Button.tsx @@ -23,7 +23,7 @@ export const Button: React.FC = ({ children, additionalClasses, ...