diff --git a/.eslintrc.js b/.eslintrc.js index 4b9d86e4be3..7c71dc01c22 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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: {}, @@ -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', + }, + }, ], }