I am getting error:
Parsing error: Expression expected
Here is my code base:
export interface TableRow {
rowKey: string;
rowCells: {[key: string]: any};
rowExpanded?: React.ReactNode;
}
class MvSortTable extends React.Component<Props, State> {
...
toggleAllRows = () => {
const shouldExpand = this.allRowsCollapsed(this.state.expandedRows);
const expandedRows: {[key: string]: boolean} = {};
this.props.rows?.forEach((row) => {
expandedRows[row.rowKey] = shouldExpand;
});
this.setState({ expandedRows, allRowsCollapsed: !shouldExpand });
}
...
Error come from when I add ? into this.props.rows...
How can I fix this error?????
It could be a problem related to:
OR
If anyone else is facing this issue you might want to check the eslint-plugin-prettier in your package.json.
I recently stumbled upon this issue and I found that the project I was working on was on the older version.
Just upgrade eslint-plugin-prettier, at the time of writing this the latest version is 4.0.0
Cheers!!