mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-26 00:21:36 +01:00
Merge branch 'shared-lint-configs' into 'dev'
Shared lint configs See merge request turris/reforis/foris-js!37
This commit is contained in:
commit
0f5b35a3ba
64
.eslintrc.js
64
.eslintrc.js
|
@ -1,66 +1,6 @@
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
extends: "eslint-config-reforis",
|
||||||
"browser": true,
|
rules: {
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"airbnb",
|
|
||||||
"airbnb/hooks"
|
|
||||||
],
|
|
||||||
"globals": {
|
|
||||||
"_": "readonly",
|
|
||||||
"babel": "readonly",
|
|
||||||
"ForisTranslations": "readonly",
|
|
||||||
"ngettext": "readonly",
|
|
||||||
"ForisPlugins": "readonly"
|
|
||||||
},
|
|
||||||
"parser": "babel-eslint",
|
|
||||||
"rules": {
|
|
||||||
"quotes": ["error", "double"],
|
|
||||||
"indent": ["error", 4],
|
|
||||||
"react/jsx-indent": ["error", 4],
|
|
||||||
"react/jsx-indent-props": ["error", 4],
|
|
||||||
"react/prop-types": "warn",
|
|
||||||
"react/no-array-index-key": "warn",
|
|
||||||
"react/button-has-type": "warn",
|
|
||||||
"import/prefer-default-export": "off",
|
"import/prefer-default-export": "off",
|
||||||
"import/no-unresolved": [
|
|
||||||
"error",
|
|
||||||
// Ignore imports used only in tests
|
|
||||||
{ ignore: ["customTestRender"] }
|
|
||||||
],
|
|
||||||
"import/no-cycle": "warn",
|
|
||||||
"no-console": "error",
|
|
||||||
"no-use-before-define": ["error", {
|
|
||||||
functions: false,
|
|
||||||
classes: true,
|
|
||||||
variables: true
|
|
||||||
}],
|
|
||||||
"no-restricted-syntax": "warn",
|
|
||||||
// Should be enabled in the future
|
|
||||||
"camelcase": "off",
|
|
||||||
"no-param-reassign": "off",
|
|
||||||
"react/jsx-props-no-spreading": "off",
|
|
||||||
"react/require-default-props": "off",
|
|
||||||
"react/default-props-match-prop-types": "off",
|
|
||||||
"react/forbid-prop-types": "off",
|
|
||||||
// Permanently disabled
|
|
||||||
"react/jsx-filename-extension": "off",
|
|
||||||
"no-plusplus": "off",
|
|
||||||
"consistent-return": "off",
|
|
||||||
"radix": "off",
|
|
||||||
"no-continue": "off",
|
|
||||||
"react/no-danger": "off",
|
|
||||||
},
|
},
|
||||||
"settings": {
|
|
||||||
"import/resolver": {
|
|
||||||
"node": {
|
|
||||||
"paths": ["src"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
94
package-lock.json
generated
94
package-lock.json
generated
|
@ -3001,9 +3001,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"confusing-browser-globals": {
|
"confusing-browser-globals": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz",
|
||||||
"integrity": "sha512-lI7asCibVJ6Qd3FGU7mu4sfG4try4LX3+GVS+Gv8UlrEf2AeW57piecapnog2UHZSbcX/P/1UDWVaTsblowlZg==",
|
"integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"connect-history-api-fallback": {
|
"connect-history-api-fallback": {
|
||||||
|
@ -4098,6 +4098,20 @@
|
||||||
"object.entries": "^1.1.0"
|
"object.entries": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"eslint-config-reforis": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-config-reforis/-/eslint-config-reforis-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-c0IgYlGfFMfhXmGilDVgkFIcUU34/i6wUiOzdRmg0CRi2Ko5LgmW/jRT5vdiXlFKYOk5WK1UWFbC19KBdGQEig==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"babel-eslint": "^9.0.0",
|
||||||
|
"eslint-config-airbnb": "^18.0.1",
|
||||||
|
"eslint-plugin-import": "^2.18.2",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||||
|
"eslint-plugin-react": "^7.14.3",
|
||||||
|
"eslint-plugin-react-hooks": "^1.7.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"eslint-import-resolver-node": {
|
"eslint-import-resolver-node": {
|
||||||
"version": "0.3.2",
|
"version": "0.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",
|
||||||
|
@ -4356,20 +4370,20 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-react": {
|
"eslint-plugin-react": {
|
||||||
"version": "7.14.3",
|
"version": "7.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.16.0.tgz",
|
||||||
"integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==",
|
"integrity": "sha512-GacBAATewhhptbK3/vTP09CbFrgUJmBSaaRcWdbQLFvUZy9yVcQxigBNHGPU/KE2AyHpzj3AWXpxoMTsIDiHug==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"array-includes": "^3.0.3",
|
"array-includes": "^3.0.3",
|
||||||
"doctrine": "^2.1.0",
|
"doctrine": "^2.1.0",
|
||||||
"has": "^1.0.3",
|
"has": "^1.0.3",
|
||||||
"jsx-ast-utils": "^2.1.0",
|
"jsx-ast-utils": "^2.2.1",
|
||||||
"object.entries": "^1.1.0",
|
"object.entries": "^1.1.0",
|
||||||
"object.fromentries": "^2.0.0",
|
"object.fromentries": "^2.0.0",
|
||||||
"object.values": "^1.1.0",
|
"object.values": "^1.1.0",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"resolve": "^1.10.1"
|
"resolve": "^1.12.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"doctrine": {
|
"doctrine": {
|
||||||
|
@ -7546,9 +7560,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jsx-ast-utils": {
|
"jsx-ast-utils": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.3.tgz",
|
||||||
"integrity": "sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ==",
|
"integrity": "sha512-EdIHFMm+1BPynpKOpdPqiOsvnIrInRGJD7bzPZdPkjitQEqpdpUuFpq4T0npZFKTiB3RhWFdGN+oqOJIdhDhQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"array-includes": "^3.0.3",
|
"array-includes": "^3.0.3",
|
||||||
|
@ -8345,6 +8359,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"object-inspect": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
|
||||||
|
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"object-is": {
|
"object-is": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.1.tgz",
|
||||||
|
@ -8391,15 +8411,35 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"object.fromentries": {
|
"object.fromentries": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.1.tgz",
|
||||||
"integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==",
|
"integrity": "sha512-PUQv8Hbg3j2QX0IQYv3iAGCbGcu4yY4KQ92/dhA4sFSixBmSmp13UpDLs6jGK8rBtbmhNNIK99LD2k293jpiGA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"define-properties": "^1.1.2",
|
"define-properties": "^1.1.3",
|
||||||
"es-abstract": "^1.11.0",
|
"es-abstract": "^1.15.0",
|
||||||
"function-bind": "^1.1.1",
|
"function-bind": "^1.1.1",
|
||||||
"has": "^1.0.1"
|
"has": "^1.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"es-abstract": {
|
||||||
|
"version": "1.16.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.0.tgz",
|
||||||
|
"integrity": "sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"es-to-primitive": "^1.2.0",
|
||||||
|
"function-bind": "^1.1.1",
|
||||||
|
"has": "^1.0.3",
|
||||||
|
"has-symbols": "^1.0.0",
|
||||||
|
"is-callable": "^1.1.4",
|
||||||
|
"is-regex": "^1.0.4",
|
||||||
|
"object-inspect": "^1.6.0",
|
||||||
|
"object-keys": "^1.1.1",
|
||||||
|
"string.prototype.trimleft": "^2.1.0",
|
||||||
|
"string.prototype.trimright": "^2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"object.getownpropertydescriptors": {
|
"object.getownpropertydescriptors": {
|
||||||
|
@ -11163,6 +11203,26 @@
|
||||||
"strip-ansi": "^4.0.0"
|
"strip-ansi": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"string.prototype.trimleft": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"define-properties": "^1.1.3",
|
||||||
|
"function-bind": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string.prototype.trimright": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"define-properties": "^1.1.3",
|
||||||
|
"function-bind": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
"@babel/preset-react": "^7.0.0",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"@fortawesome/fontawesome-free": "^5.11.2",
|
"@fortawesome/fontawesome-free": "^5.11.2",
|
||||||
"@testing-library/react": "^8.0.9",
|
"@testing-library/react": "^8.0.9",
|
||||||
"babel-eslint": "^9.0.0",
|
|
||||||
"babel-jest": "^24.8.0",
|
"babel-jest": "^24.8.0",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-plugin-module-resolver": "^3.2.0",
|
"babel-plugin-module-resolver": "^3.2.0",
|
||||||
|
@ -48,11 +47,7 @@
|
||||||
"copy-webpack-plugin": "^5.0.4",
|
"copy-webpack-plugin": "^5.0.4",
|
||||||
"css-loader": "^3.2.0",
|
"css-loader": "^3.2.0",
|
||||||
"eslint": "^6.1.0",
|
"eslint": "^6.1.0",
|
||||||
"eslint-config-airbnb": "^18.0.1",
|
"eslint-config-reforis": "^1.0.0",
|
||||||
"eslint-plugin-import": "^2.18.2",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
|
||||||
"eslint-plugin-react": "^7.14.3",
|
|
||||||
"eslint-plugin-react-hooks": "^1.7.0",
|
|
||||||
"file-loader": "^4.2.0",
|
"file-loader": "^4.2.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
"jest-mock-axios": "^3.0.0",
|
"jest-mock-axios": "^3.0.0",
|
||||||
|
|
|
@ -12,7 +12,6 @@ import { Input } from "./Input";
|
||||||
|
|
||||||
export const EmailInput = ({ ...props }) => <Input type="email" {...props} />;
|
export const EmailInput = ({ ...props }) => <Input type="email" {...props} />;
|
||||||
|
|
||||||
|
|
||||||
EmailInput.propTypes = {
|
EmailInput.propTypes = {
|
||||||
/** Field label. */
|
/** Field label. */
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -37,7 +37,6 @@ export function Modal({ shown, setShown, children }) {
|
||||||
};
|
};
|
||||||
}, [setShown]);
|
}, [setShown]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Portal containerId="modal-container">
|
<Portal containerId="modal-container">
|
||||||
<div className={`modal fade ${shown ? "show" : ""}`} role="dialog">
|
<div className={`modal fade ${shown ? "show" : ""}`} role="dialog">
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { useUID } from "react-uid";
|
||||||
|
|
||||||
import { formFieldsSize } from "./constants";
|
import { formFieldsSize } from "./constants";
|
||||||
|
|
||||||
|
|
||||||
RadioSet.propTypes = {
|
RadioSet.propTypes = {
|
||||||
/** Name attribute of the input HTML tag. */
|
/** Name attribute of the input HTML tag. */
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -9,7 +9,6 @@ import React from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useUID } from "react-uid";
|
import { useUID } from "react-uid";
|
||||||
|
|
||||||
|
|
||||||
Select.propTypes = {
|
Select.propTypes = {
|
||||||
/** Select field Label. */
|
/** Select field Label. */
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -10,10 +10,8 @@ import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { Input } from "./Input";
|
import { Input } from "./Input";
|
||||||
|
|
||||||
|
|
||||||
export const TextInput = ({ ...props }) => <Input type="text" {...props} />;
|
export const TextInput = ({ ...props }) => <Input type="text" {...props} />;
|
||||||
|
|
||||||
|
|
||||||
TextInput.propTypes = {
|
TextInput.propTypes = {
|
||||||
/** Field label. */
|
/** Field label. */
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -48,7 +48,6 @@ export function useForm(validator, dataPreprocessor) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function formReducer(state, action) {
|
function formReducer(state, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FORM_ACTIONS.updateValue: {
|
case FORM_ACTIONS.updateValue: {
|
||||||
|
|
|
@ -29,7 +29,6 @@ const REs = {
|
||||||
MultipleEmails: /^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)( *, *[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)*$/,
|
MultipleEmails: /^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)( *, *[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)*$/,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const createValidator = (fieldType) => (value) => {
|
const createValidator = (fieldType) => (value) => {
|
||||||
if (value && value !== "") return REs[fieldType].test(value) ? undefined : ERROR_MESSAGES[fieldType];
|
if (value && value !== "") return REs[fieldType].test(value) ? undefined : ERROR_MESSAGES[fieldType];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user