diff --git a/.eslintrc.js b/.eslintrc.js index 163042f6..beec5526 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,6 +8,7 @@ module.exports = { __non_webpack_require__: 'readonly', }, rules: { - indent: 'off' + 'prettier/prettier': 2, + indent: 'off', } }; diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/package.json b/package.json index cb9f23ce..02caef6a 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.7", "eslint": "^8.28.0", + "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-webpack": "^0.13.2", "eslint-plugin-import": "^2.26.0", diff --git a/src/main/webapp/components/BaseFormView.jsx b/src/main/webapp/components/BaseFormView.jsx index 08673ed2..6b73a32c 100644 --- a/src/main/webapp/components/BaseFormView.jsx +++ b/src/main/webapp/components/BaseFormView.jsx @@ -715,13 +715,13 @@ class BaseFormView extends PureComponent { } /* - * Custom logic to handle the dropdown's reset value by clicking "X" button. - * DO NOT CHANGE: value of targetValue to null or any other value. Keep it as blank string only. - * Reason: We are sending a blank string value in the API, and this validation is inside the saveData(). - */ + * Custom logic to handle the dropdown's reset value by clicking "X" button. + * DO NOT CHANGE: value of targetValue to null or any other value. Keep it as blank string only. + * Reason: We are sending a blank string value in the API, and this validation is inside the saveData(). + */ - const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue; - changes[field] = { value: { $set: target_value } }; + const updatedTargetValue = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue; + changes[field] = { value: { $set: updatedTargetValue } }; const newFields = update(this.state, { data: changes }); const tempState = this.clearAllErrorMsg(newFields); diff --git a/src/main/webapp/components/ControlWrapper.jsx b/src/main/webapp/components/ControlWrapper.jsx index b4c2b470..50a0e5ff 100644 --- a/src/main/webapp/components/ControlWrapper.jsx +++ b/src/main/webapp/components/ControlWrapper.jsx @@ -28,7 +28,6 @@ const ControlGroupWrapper = styled(ControlGroup).attrs((props) => ({ `; class ControlWrapper extends React.PureComponent { - static isString = (str) => !!(typeof str === 'string' || str instanceof String); constructor(props) { diff --git a/src/main/webapp/components/CustomControl.jsx b/src/main/webapp/components/CustomControl.jsx index ae0798b1..e8dfe38b 100644 --- a/src/main/webapp/components/CustomControl.jsx +++ b/src/main/webapp/components/CustomControl.jsx @@ -6,7 +6,6 @@ import { getUnifiedConfigs } from '../util/util'; import { getBuildDirPath } from '../util/script'; class CustomControl extends Component { - static loadCustomControl = (module, type, appName) => new Promise((resolve) => { if (type === 'external') { @@ -22,7 +21,7 @@ class CustomControl extends Component { }); } }); - + constructor(props) { super(props); this.state = { diff --git a/src/main/webapp/context/TableContext.jsx b/src/main/webapp/context/TableContext.jsx index 17c5612b..c344c739 100644 --- a/src/main/webapp/context/TableContext.jsx +++ b/src/main/webapp/context/TableContext.jsx @@ -15,7 +15,7 @@ export function TableContextProvider({ children }) { return ( (typeof res.data === 'object' ? res.data : yaml.load(res.data)));