diff --git a/.eslintrc b/.eslintrc index df6bc2a2..d3934c4b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,11 +2,24 @@ "extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"], "rules": { "no-tabs": "off", - "@typescript-eslint/indent": ["error", 2], - "max-len": ["error", { - "code": 100 - }], "arrow-body-style": "off", + "comma-dangle": "off", + "@typescript-eslint/no-var-requires": 0, + "operator-linebreak": "off", + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/explicit-function-return-type": 0, + "implicit-arrow-linebreak": "off", + "@typescript-eslint/indent": 0, + "import/extensions": [ + "error", + "ignorePackages", + { + "ts": "never", + "js": "never", + "mjs": "never", + "jsx": "never" + } + ] }, "settings": { "import/resolver": { @@ -18,6 +31,6 @@ "env": { "mocha": true, "node": true, - "browser": true, - }, + "browser": true + } } diff --git a/.gitignore b/.gitignore index e3584bd5..f596c21d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules dist lib -*.log +*.log \ No newline at end of file diff --git a/examples/src/CommentBlock.tsx b/examples/src/CommentBlock.tsx new file mode 100644 index 00000000..c6ab90bd --- /dev/null +++ b/examples/src/CommentBlock.tsx @@ -0,0 +1,86 @@ +import * as React from 'react'; +import { CommentInfo } from '../../lib'; + +interface Props { + updateComment: (commentInfo: CommentInfo, text: string) => void; + removeComment: (lineId: string) => void; + comment: any; + show: boolean; +} + +const CommentBlock: React.FC = ({ + updateComment, + removeComment, + comment, + show +}) => { + const [isComment, setIsComment] = React.useState(show); + const [text, setText] = React.useState( + comment.body ? comment.body.text : '' + ); + + const handleChange = (e: React.ChangeEvent) => { + setText(e.target.value); + }; + + if (!isComment) { + return ( +
+
+