Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
Merge pull request #60 from lars-reimann/react_linting
Browse files Browse the repository at this point in the history
Add ESLint linting rules for React
  • Loading branch information
lars-reimann authored Jun 20, 2021
2 parents c90b935 + cb351ef commit 31aae91
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
10 changes: 10 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
Expand All @@ -25,5 +26,14 @@ module.exports = {
"allowedNames": ["current"]
}
]
},
// See https://github.com/yannickcr/eslint-plugin-react#configuration
"settings": {
"react": {
"version": "detect"
},
"propWrapperFunctions": [],
"componentWrapperFunctions": [],
"linkComponents": []
}
};
6 changes: 3 additions & 3 deletions client/src/Components/ParameterView/DocumentationText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export default function DocumentationText({inputText = ""}: DocumentationTextPro
}}>
{!readMore && hasMultipleLines && "▶"}
{readMore && hasMultipleLines && "▼"}
<ReactMarkdown className={cssClasses} children={readMore ? inputText : shortenedText}
remarkPlugins={[remarkGfm]}/>

<ReactMarkdown className={cssClasses} remarkPlugins={[remarkGfm]}>
{readMore ? inputText : shortenedText}
</ReactMarkdown>
</div>
);
}
5 changes: 2 additions & 3 deletions client/src/Components/ParameterView/ParameterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export default function ParameterView({inputParameters, selection, selectedFunct
<div className="parameter-view">
<div className="parameter-view-path">
{selection.length > 0 ?
// eslint-disable-next-line
selection.map<React.ReactNode>(n => <a href="#">{n}</a>)
.reduce((p, c) => [p, (<span> / </span>), c]) :
selection.map<React.ReactNode>((n, index) => <a href="#" key={index}>{n}</a>)
.reduce((p, c, index) => [p, (<span key={index}> / </span>), c]) :
""}
</div>
{selectedFunction !== null &&
Expand Down
5 changes: 3 additions & 2 deletions client/src/Components/Tree/ModuleNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {isEmptyList} from "../../util/listOperations";
import classNames from "classnames";
import PythonModule from "../../model/PythonModule";
import PythonFunction from "../../model/PythonFunction";
import PythonParameter from "../../model/PythonParameter";

type ModuleNodeProps = {
parentPath: string[],
pythonModule: PythonModule,
selection: string[],
setSelection: (newValue: string[]) => void,
setParameters: Setter<string[]>,
setSelection: Setter<string[]>,
setParameters: Setter<PythonParameter[]>,
setSelectedFunction: Setter<Nullable<PythonFunction>>
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Nullable<T> = T | null

type Getter<T> = () => T
type Setter<T> = (T) => void
type Setter<T> = (newValue: T) => void

0 comments on commit 31aae91

Please sign in to comment.