Skip to content

Commit

Permalink
chore(mono): Enforce notification hooks in the app (#15010)
Browse files Browse the repository at this point in the history
Closes EXEC-419

Enforces the usage of the notification wrapper for the equivalent HTTP hook if the wrapper exists. We need this, so we don't accidentally poll in the app/ODD when we can use notifications instead.
  • Loading branch information
mjhuff authored and Carlos-fernandez committed May 20, 2024
1 parent 74eeaf3 commit ca0f428
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ module.exports = {
'no-case-declarations': 'warn',
'prefer-regex-literals': 'warn',
'react/prop-types': 'warn',

// Enforce notification hooks
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@opentrons/react-api-client',
importNames: [
'useAllRunsQuery',
'useRunQuery',
'useLastRunCommandKey',
'useCurrentMaintenanceRun',
'useDeckConfigurationQuery',
],
message:
'The HTTP hook is deprecated. Utilize the equivalent notification wrapper (useNotifyX) instead.',
},
],
},
],
},

globals: {},
Expand Down Expand Up @@ -137,5 +158,12 @@ module.exports = {
'cypress/unsafe-to-chain-command': 'warn',
},
},
// Allow HTTP hooks in notification wrappers and tests
{
files: ['app/src/resources/**', '**/__tests__/**test**'],
rules: {
'no-restricted-imports': 'off',
},
},
],
}

0 comments on commit ca0f428

Please sign in to comment.