Merge pull request #5297 from mabashian/eslint-plugin-react-hooks

Adds eslint-plugin-react-hooks as a dev dep

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-11-11 21:05:27 +00:00
committed by GitHub
8 changed files with 18 additions and 6 deletions

View File

@@ -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"
} }
} }

View File

@@ -6523,6 +6523,12 @@
"prop-types": "^15.6.2" "prop-types": "^15.6.2"
} }
}, },
"eslint-plugin-react-hooks": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.2.0.tgz",
"integrity": "sha512-jSlnBjV2cmyIeL555H/FbvuSbQ1AtpHjLMHuPrQnt1eVA6lX8yufdygh7AArI2m8ct7ChHGx2uOaCuxq2MUn6g==",
"dev": true
},
"eslint-restricted-globals": { "eslint-restricted-globals": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz",

View File

@@ -43,6 +43,7 @@
"eslint-plugin-import": "^2.14.0", "eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1", "eslint-plugin-react": "^7.11.1",
"eslint-plugin-react-hooks": "^2.2.0",
"file-loader": "^2.0.0", "file-loader": "^2.0.0",
"history": "^4.9.0", "history": "^4.9.0",
"jest": "^24.7.1", "jest": "^24.7.1",

View File

@@ -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

View File

@@ -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);

View File

@@ -108,7 +108,7 @@ function ProjectForm({ project, ...props }) {
} }
fetchData(); fetchData();
}, []); }, [summary_fields.credential]);
const scmFormFields = { const scmFormFields = {
scm_url: '', scm_url: '',

View File

@@ -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

View File

@@ -39,7 +39,7 @@ function PlaybookSelect({
onError(contentError); onError(contentError);
} }
})(); })();
}, [projectId]); }, [projectId, i18n, onError]);
return ( return (
<AnsibleSelect <AnsibleSelect