mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Adds react-hooks eslint rules and fixes a few warnings
This commit is contained in:
@@ -8,6 +8,9 @@
|
|||||||
"modules": true
|
"modules": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react-hooks"
|
||||||
|
],
|
||||||
"extends": ["airbnb", "prettier", "prettier/react"],
|
"extends": ["airbnb", "prettier", "prettier/react"],
|
||||||
"settings": {
|
"settings": {
|
||||||
"import/resolver": {
|
"import/resolver": {
|
||||||
@@ -56,6 +59,8 @@
|
|||||||
"react/prop-types": "off",
|
"react/prop-types": "off",
|
||||||
"react/sort-comp": ["error", {}],
|
"react/sort-comp": ["error", {}],
|
||||||
"jsx-a11y/label-has-for": "off",
|
"jsx-a11y/label-has-for": "off",
|
||||||
"jsx-a11y/label-has-associated-control": "off"
|
"jsx-a11y/label-has-associated-control": "off",
|
||||||
|
"react-hooks/rules-of-hooks": "error",
|
||||||
|
"react-hooks/exhaustive-deps": "warn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function ExpandingContainer({ isExpanded, children }) {
|
|||||||
});
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setContentHeight(ref.current.scrollHeight);
|
setContentHeight(ref.current.scrollHeight);
|
||||||
});
|
}, [setContentHeight]);
|
||||||
const height = isExpanded ? contentHeight : '0';
|
const height = isExpanded ? contentHeight : '0';
|
||||||
return (
|
return (
|
||||||
<Container
|
<Container
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ function HostEventModal({ onClose, hostEvent = {}, isOpen = false, i18n }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setHostStatus(processEventStatus(hostEvent));
|
setHostStatus(processEventStatus(hostEvent));
|
||||||
}, []);
|
}, [setHostStatus, hostEvent]);
|
||||||
|
|
||||||
const handleTabClick = (event, tabIndex) => {
|
const handleTabClick = (event, tabIndex) => {
|
||||||
setActiveTabKey(tabIndex);
|
setActiveTabKey(tabIndex);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ function ProjectForm({ project, ...props }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}, []);
|
}, [summary_fields.credential]);
|
||||||
|
|
||||||
const scmFormFields = {
|
const scmFormFields = {
|
||||||
scm_url: '',
|
scm_url: '',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function LabelSelect({ value, onChange, onError }) {
|
|||||||
const [options, setOptions] = useState([]);
|
const [options, setOptions] = useState([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadLabelOptions(setOptions, onError);
|
loadLabelOptions(setOptions, onError);
|
||||||
}, []);
|
}, [onError]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function PlaybookSelect({
|
|||||||
onError(contentError);
|
onError(contentError);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}, [projectId]);
|
}, [projectId, i18n, onError]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnsibleSelect
|
<AnsibleSelect
|
||||||
|
|||||||
Reference in New Issue
Block a user