Skip to content

Commit 514e919

Browse files
authored
Merge pull request #2296 from oasisprotocol/lw/refresh-lint
Detect hot-reload issues with eslint (as a warning for now)
2 parents f9005fe + 765545b commit 514e919

11 files changed

Lines changed: 19 additions & 58 deletions

File tree

.changelog/2296.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Detect hot-reload issues with eslint

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const config = {
99
'react-app', // https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
1010
'plugin:prettier/recommended', // See .prettierrc
1111
],
12+
plugins: ['react-refresh'],
13+
1214
parser: '@typescript-eslint/parser',
1315

1416
settings: {},
@@ -68,6 +70,8 @@ const config = {
6870
'react/display-name': 'off', // TODO: Maybe enable
6971
'react/self-closing-comp': ['error', { component: true, html: true }],
7072

73+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true /* vite */ }],
74+
7175
'@typescript-eslint/no-empty-function': 'off', // Allow empty reducers for saga
7276
'@typescript-eslint/no-non-null-assertion': 'off',
7377
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
@@ -77,7 +81,7 @@ const config = {
7781
overrides: [
7882
{
7983
files: ['**/*.ts?(x)'],
80-
rules: { 'prettier/prettier': 'warn' },
84+
rules: { 'prettier/prettier': process.env.CI ? 'error' : 'warn' },
8185
},
8286
{
8387
files: ['internals/**'],

.github/workflows/ci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
if: always()
7878
- name: ESLint
7979
# Disallow warnings and always throw errors.
80-
run: yarn lint --max-warnings 0
80+
run: yarn lint
8181
# Always run this step so that all linting errors can be seen at once.
8282
if: always()
8383
- name: Validate TypeScript

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"eslint-plugin-prettier": "5.2.6",
9999
"eslint-plugin-react": "7.37.4",
100100
"eslint-plugin-react-hooks": "4.6.2",
101+
"eslint-plugin-react-refresh": "^0.4.24",
101102
"events": "^3.1.0",
102103
"jsdom": "^26.1.0",
103104
"markdownlint-cli": "0.44.0",

src/app/components/ConsensusTransactionMethod/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type MethodIconProps = {
3030
truncate?: boolean
3131
}
3232

33-
export const colorMap = {
33+
const colorMap = {
3434
blue: {
3535
primary: COLORS.brandMedium,
3636
secondary: COLORS.brandLightBlue,

src/app/components/ErrorDisplay/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const errorMap: Record<
102102
[AppErrors.InvalidVote]: t => ({ title: t('errors.invalidVote'), message: null }),
103103
}
104104

105-
export const errorFormatter = (t: TFunction, error: ErrorPayload, scope: SearchScope | undefined) => {
105+
const errorFormatter = (t: TFunction, error: ErrorPayload, scope: SearchScope | undefined) => {
106106
return errorMap[error.code](t, error, scope)
107107
}
108108

src/app/components/StatusIcon/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const statusFgColor: Record<TxStatus, string> = {
2929
pending: COLORS.warningColor,
3030
}
3131

32-
export const statusIcon: Record<TxStatus, ReactNode> = {
32+
const statusIcon: Record<TxStatus, ReactNode> = {
3333
unknown: <LockIcon color="inherit" fontSize="inherit" />,
3434
success: <CheckCircleIcon color="inherit" fontSize="inherit" />,
3535
partialsuccess: <CheckCircleIcon color="success" fontSize="inherit" />,

src/app/components/UptimeStatus/__tests__/index.test.tsx

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

src/app/components/UptimeStatus/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const getUptimeItemColor = (value: number | undefined) => {
1818
return COLORS.errorIndicatorBackground
1919
}
2020

21-
export const ensureTwelveElements = (inputArray: number[] = []) => {
21+
const ensureTwelveElements = (inputArray: number[] = []) => {
2222
return [...inputArray, ...new Array(12).fill(undefined)].slice(0, 12)
2323
}
2424

src/app/pages/ParatimeDashboardPage/ActiveAccounts.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '../../utils/chart-utils'
1717
import { SearchScope } from '../../../types/searchScope'
1818

19-
export const getActiveAccountsWindows = (duration: ChartDuration, windows: Windows[]) => {
19+
const getActiveAccountsWindows = (duration: ChartDuration, windows: Windows[]) => {
2020
switch (duration) {
2121
case ChartDuration.TODAY:
2222
return filterHourlyActiveAccounts(windows)
@@ -27,7 +27,7 @@ export const getActiveAccountsWindows = (duration: ChartDuration, windows: Windo
2727
}
2828
}
2929

30-
export const getChartLabelFormatParams = (duration: ChartDuration) => {
30+
const getChartLabelFormatParams = (duration: ChartDuration) => {
3131
switch (duration) {
3232
case ChartDuration.TODAY:
3333
return {

0 commit comments

Comments
 (0)