Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR to resolve remaining warnings left in eslint #116

Merged
merged 16 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />
<script src="config.js"></script>
blcham marked this conversation as resolved.
Show resolved Hide resolved
<script type="module" src="/config.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
70 changes: 47 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"redux": "^4.1.0",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.3.0",
"url-parse": "^1.5.10",
"vite": "^5.1.4",
"vite-plugin-eslint": "^1.8.1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Input = forwardRef(function InputWithRef(props, ref) {
return (
<FormGroup size="sm">
{renderLabel()}
<FormControl as="select" {...props}>
<FormControl as="select" ref={ref} {...props}>
{props.children}
</FormControl>
{props.validation && <FormControl.Feedback />}
Expand All @@ -57,7 +57,7 @@ const Input = forwardRef(function InputWithRef(props, ref) {
return (
<FormGroup size="sm">
{renderLabel()}
<FormControl as="textarea" style={{ height: "auto" }} ref={props} {...props} />
<FormControl as="textarea" style={{ height: "auto" }} ref={ref} {...props} />
{props.validation && <FormControl.Feedback />}
{renderHelp()}
</FormGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const LoaderCard = (props) => (
);

LoaderCard.propTypes = {
header: PropTypes.elementType,
header: PropTypes.object,
};

export const LoaderSmall = () => <div className="loader align-self-center" />;
2 changes: 1 addition & 1 deletion src/components/institution/InstitutionTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PropTypes from "prop-types";

class InstitutionTable extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
institutions: PropTypes.array.isRequired,
handlers: PropTypes.object.isRequired,
institutionDeleted: PropTypes.object,
Expand Down
4 changes: 2 additions & 2 deletions src/components/institution/InstitutionsController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ InstitutionsController.propTypes = {
currentUser: PropTypes.shape({
role: PropTypes.string.isRequired,
}).isRequired,
institutionsLoaded: PropTypes.bool.isRequired,
institutionDeleted: PropTypes.bool.isRequired,
institutionsLoaded: PropTypes.object,
institutionDeleted: PropTypes.object,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(InstitutionsController)));
Expand Down
2 changes: 1 addition & 1 deletion src/components/login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Login.propTypes = {
login: PropTypes.func,
error: PropTypes.object,
isLogging: PropTypes.bool,
i18n: PropTypes.object.isRequired, // Or whichever type 'i18n' is
i18n: PropTypes.func,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(Login)));
Expand Down
16 changes: 8 additions & 8 deletions src/components/record/RecordController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,22 @@ class RecordController extends React.Component {
RecordController.propTypes = {
match: PropTypes.shape({
params: PropTypes.shape({
key: PropTypes.string.isRequired,
key: PropTypes.string,
}).isRequired,
}).isRequired,
loadRecord: PropTypes.func.isRequired,
recordSaved: PropTypes.shape({
actionFlag: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
actionFlag: PropTypes.string,
status: PropTypes.string,
record: PropTypes.shape({
key: PropTypes.string.isRequired,
}).isRequired,
key: PropTypes.string,
}),
}).isRequired,
recordLoaded: PropTypes.shape({
status: PropTypes.string.isRequired,
status: PropTypes.string,
record: PropTypes.shape({
state: PropTypes.string.isRequired,
}).isRequired,
state: PropTypes.object,
}),
}).isRequired,
unloadSavedRecord: PropTypes.func.isRequired,
transitionToWithOpts: PropTypes.func.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RecordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class RecordForm extends React.Component {
}

RecordForm.propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
record: PropTypes.object.isRequired,
currentUser: PropTypes.object.isRequired,
loadFormgen: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RecordTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RecordTable extends React.Component {
formatMessage: PropTypes.func,
locale: PropTypes.string,
}),
i18n: PropTypes.object,
i18n: PropTypes.func,
recordsLoaded: PropTypes.object.isRequired,
formTemplate: PropTypes.string,
formTemplatesLoaded: PropTypes.object.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/Records.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const STUDY_CREATE_AT_MOST_ONE_RECORD = false;

class Records extends React.Component {
static propTypes = {
i18n: PropTypes.object.isRequired,
i18n: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
recordsLoaded: PropTypes.object,
recordDeleted: PropTypes.object,
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/RequiredAttributes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { isAdmin } from "../../utils/SecurityUtils";

class RequiredAttributes extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
record: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
completed: PropTypes.bool.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions src/components/record/filter/DateIntervalFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ const DateIntervalFilter = ({ minDate, maxDate, sort, onChange }) => {
};

DateIntervalFilter.propTypes = {
minDate: PropTypes.instanceOf(Date).isRequired,
maxDate: PropTypes.instanceOf(Date).isRequired,
minDate: PropTypes.instanceOf(Date),
maxDate: PropTypes.instanceOf(Date),
sort: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/filter/InstitutionFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const InstitutionFilter = ({ value, onChange }) => {
};

InstitutionFilter.propTypes = {
value: PropTypes.string.isRequired,
value: PropTypes.string,
onChange: PropTypes.func.isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/record/filter/PhaseFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PhaseFilter = ({ value, onChange }) => {
};

PhaseFilter.propTypes = {
value: PropTypes.string.isRequired,
value: PropTypes.string,
onChange: PropTypes.func.isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/user/UserTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IfInternalAuth from "../misc/oidc/IfInternalAuth";

class UserTable extends React.Component {
static propTypes = {
i18n: PropTypes.object,
i18n: PropTypes.func,
users: PropTypes.array.isRequired,
handlers: PropTypes.object.isRequired,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/user/UsersController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ UsersController.propTypes = {
currentUser: PropTypes.shape({
role: PropTypes.string.isRequired,
}).isRequired,
usersLoaded: PropTypes.bool.isRequired,
userDeleted: PropTypes.bool.isRequired,
usersLoaded: PropTypes.object,
userDeleted: PropTypes.object,
};

export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(withI18n(UsersController)));
Expand Down
22 changes: 21 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,34 @@ export default defineConfig({
plugins: [
react(),
eslintPlugin({
cache: false, // disable eslint cache to avoid conflicts
cache: false,
}),
],
build: {
sourcemap: true,
emptyOutDir: true,
rollupOptions: {
onwarn: (warning, defaultHandler) => {
// TODO: workaround for dangerous use of eval method that should be solved in SForms library issue https://github.com/kbss-cvut/s-forms/issues/283 const isFromKbssCvutPackageWarning =
blcham marked this conversation as resolved.
Show resolved Hide resolved
warning.code === "EVAL" && warning.message.includes("node_modules/store/plugins/lib/json2.js");
// TODO: Rollup Pure Annotation warning should be resolved by https://github.com/kbss-cvut/s-forms/issues/282
const isRollupPureAnnotationWarning =
blcham marked this conversation as resolved.
Show resolved Hide resolved
blcham marked this conversation as resolved.
Show resolved Hide resolved
warning.code === "INVALID_ANNOTATION" && warning.message.includes("*#__PURE__*");
if (isFromKbssCvutPackageWarning || isRollupPureAnnotationWarning) {
return;
}
defaultHandler(warning);
},
},
cssMinify: false, // TODO: workaround for CSS syntax error from SForms library that should be resolved by https://github.com/kbss-cvut/s-forms/issues/283
},
define: {
"process.env": process.env, // workaround for parse-link-header library that depends on 2 vars defined in `process.env`, see https://github.com/thlorenz/parse-link-header/issues/31
},
resolve: {
alias: {
querystring: "querystring-es3", // workaround for parse-link-header library that replaces nodejs builtin module with the module adapted for browser
url: "url-parse", // workaround for parse-link-header library that replaces nodejs builtin module with the module adapted for browser
},
},
});
Loading