Skip to content

Commit

Permalink
Merge pull request #1754 from alfonsomthd/no-unused-state
Browse files Browse the repository at this point in the history
Enable ESLint rules: no-unused-expressions & react/no-unused-state
  • Loading branch information
openshift-merge-bot[bot] authored Dec 3, 2024
2 parents 2512142 + abb4a93 commit 799dfa6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ module.exports = {
'react/jsx-indent': 'off',
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/jsx-pascal-case': 'error',
// Enable react/no-unused-prop-types once false positives are addressed:
// https://github.com/jsx-eslint/eslint-plugin-react/issues/3209
'react/no-unused-prop-types': 'off',
'consistent-return': 'off',
'default-case': 'off',
Expand Down Expand Up @@ -162,7 +164,10 @@ module.exports = {
'no-underscore-dangle': 'off',
'no-unreachable': 'off',
'no-unsafe-optional-chaining': 'off',
'no-unused-expressions': 'off',
'no-unused-expressions': [
'error',
{ allowShortCircuit: true, allowTernary: true, enforceForJSX: true },
],
'no-use-before-define': 'off',
'no-useless-catch': 'off',
'no-useless-constructor': 'off',
Expand All @@ -175,7 +180,6 @@ module.exports = {
'react/jsx-pascal-case': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-array-index-key': 'off',
'react/no-unused-state': 'off',
'react/require-default-props': 'off',
'react/sort-comp': 'off',
'no-unused-vars': 'off',
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/generic/promise-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class PromiseComponent<
> extends React.Component<P, S> {
constructor(props) {
super(props);
/* eslint-disable react/no-unused-state */
this.state = {
inProgress: false,
errorMessage: '',
Expand Down Expand Up @@ -83,6 +84,7 @@ export class PromiseComponent<
inProgress: false,
errorMessage,
});
/* eslint-enable react/no-unused-state */
return Promise.reject(errorMessage);
}
}
Expand Down

0 comments on commit 799dfa6

Please sign in to comment.