Additional fixes for stringified IDs in JSON
These should be the last two. These were identified using eslint to try to identify any plain casts to JavaScript numbers. (Some such casts are legitimate, but these were not.) Adding the following to .eslintrc.yml will identify casts to numbers: ~~~ no-restricted-syntax: - warn - selector: UnaryExpression[operator='+'] > :not(Literal) message: Avoid the use of unary + - selector: CallExpression[callee.name='Number'] message: Casting with Number() may coerce string IDs to numbers ~~~ The remaining three casts appear legitimate: two casts to array indices, one in a server to turn an environment variable into a number.
This commit is contained in:
parent
44a753a6f3
commit
fdca411888
|
@ -128,7 +128,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
onSuggestionClick = (e) => {
|
||||
const suggestion = Number(e.currentTarget.getAttribute('data-index'));
|
||||
const suggestion = e.currentTarget.getAttribute('data-index');
|
||||
e.preventDefault();
|
||||
this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
|
||||
this.textarea.focus();
|
||||
|
|
|
@ -21,7 +21,7 @@ export default class UploadForm extends React.PureComponent {
|
|||
};
|
||||
|
||||
onRemoveFile = (e) => {
|
||||
const id = Number(e.currentTarget.parentElement.getAttribute('data-id'));
|
||||
const id = e.currentTarget.parentElement.getAttribute('data-id');
|
||||
this.props.onRemoveFile(id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue