Skip to content

Commit

Permalink
eslint: Address no-use-before-define violations
Browse files Browse the repository at this point in the history
There is only one, and it is because a function expression is used
before it is defined. Changing to a function declaration solves this
because those are hoisted to the top-level (function expressions are
not).

Rule doc page: https://eslint.org/docs/latest/rules/no-use-before-define
  • Loading branch information
victorlin committed May 4, 2023
1 parent 71c0709 commit 9fc42f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ globals:
rules:
# Code quality rules
no-unused-vars: ["error", { "argsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_" }]
# no-use-before-define: ["error", { "functions": false }]
no-use-before-define: ["error", { "functions": false }]
# prefer-const: ["error", {"destructuring": "all"}]
react/prop-types: off # Remove this override once all props have been typed using PropTypes or TypeScript.

Expand Down
4 changes: 2 additions & 2 deletions src/util/getGenotype.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export const decodeColorByGenotype = (colorBy, geneLengths) => {
return null;
};

export const decodePositions = (positions, geneLength = 'Infinity') => {
export function decodePositions(positions, geneLength = 'Infinity') {
return positions
.split(",")
.map((x) => parseInt(x, 10))
.filter((x) => x > 0 && x <= Math.floor(geneLength));
};
}

/**
* Encode genotype filters for storage in URL query state.
Expand Down

0 comments on commit 9fc42f0

Please sign in to comment.