Skip to content

Commit

Permalink
chore(linting): enable one-var rule (#7528)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

Enables [`one-var`](https://eslint.org/docs/latest/rules/one-var) to
prevent consecutive variable declarations. This should make it easier to
vertically scan (both the variable and type).

`one-var` to rule them all,
   `one-var` to find them,
`one-var` to bring them all
   and in the darkness bind them.
  • Loading branch information
jcfranco authored Aug 18, 2023
1 parent bc1777d commit df2b911
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/calcite-components/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module.exports = {
],
"no-new-func": "error",
"no-unneeded-ternary": "error",
"one-var": ["error", "never"],
"react/forbid-component-props": [
"warn",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export function hexToRGB(hex: string, hasAlpha = false): RGB | RGBA {

hex = hex.replace("#", "");

let r: number, g: number, b: number, a: number;
let r: number;
let g: number;
let b: number;
let a: number;
const isShorthand = hex.length === 3 || hex.length === 4;

if (isShorthand) {
Expand Down

0 comments on commit df2b911

Please sign in to comment.