diff --git a/.eslintrc.js b/.eslintrc.js index 1536f6dee..bbc9fcc46 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,7 @@ module.exports = { browser: true, es6: true }, - plugins: ["@typescript-eslint", "no-null"], + plugins: ["@typescript-eslint", "no-null", "prefer-arrow"], extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], globals: { Atomics: "readonly", @@ -40,6 +40,7 @@ module.exports = { "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-extraneous-class": "error", "no-null/no-null": "error", - "@typescript-eslint/no-explicit-any": "error" + "@typescript-eslint/no-explicit-any": "error", + "prefer-arrow/prefer-arrow-functions": ["error", { allowStandaloneDeclarations: true }] } }; diff --git a/package-lock.json b/package-lock.json index d8811867c..d64976f5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12757,6 +12757,12 @@ "integrity": "sha1-EjaoEjkTkKGHetQAfCbnRTQclR8=", "dev": true }, + "eslint-plugin-prefer-arrow": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.2.tgz", + "integrity": "sha512-C8YMhL+r8RMeMdYAw/rQtE6xNdMulj+zGWud/qIGnlmomiPRaLDGLMeskZ3alN6uMBojmooRimtdrXebLN4svQ==", + "dev": true + }, "eslint-plugin-react": { "version": "7.20.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.20.0.tgz", diff --git a/package.json b/package.json index 614f8e8b7..51ab3b989 100644 --- a/package.json +++ b/package.json @@ -131,6 +131,7 @@ "eslint": "7.3.1", "eslint-cli": "1.1.1", "eslint-plugin-no-null": "1.0.2", + "eslint-plugin-prefer-arrow": "1.2.2", "eslint-plugin-react": "7.20.0", "expose-loader": "0.7.5", "file-loader": "2.0.0", diff --git a/src/Explorer/Panes/PublishNotebookPaneComponent.tsx b/src/Explorer/Panes/PublishNotebookPaneComponent.tsx index 83ca8b5aa..cbb248de7 100644 --- a/src/Explorer/Panes/PublishNotebookPaneComponent.tsx +++ b/src/Explorer/Panes/PublishNotebookPaneComponent.tsx @@ -60,12 +60,12 @@ export class PublishNotebookPaneComponent extends React.Component void) => { const reader = new FileReader(); reader.readAsDataURL(file); - reader.onload = function() { + reader.onload = () => { updateImageSrc(reader.result.toString()); }; const onError = this.props.onError; - reader.onerror = function(error) { + reader.onerror = error => { const formError = `Failed to convert ${file.name} to base64 format`; const formErrorDetail = `${error}`; const area = "PublishNotebookPaneComponent/selectImageFile"; @@ -95,7 +95,7 @@ export class PublishNotebookPaneComponent extends React.Component { context.drawImage(image, 0, 0); updateImageSrcWithScreenshot(canvas.toDataURL()); };