mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add more ESLint rules and change the formatting scripts (#626)
* Add curly rule in ESLint for consistency * Fix rules * More rules * REturn * Push * no else return * prefer const * destructing
This commit is contained in:
parent
814299321e
commit
53994e71e5
21 changed files with 201 additions and 77 deletions
|
@ -109,7 +109,9 @@ const Picker = function({
|
|||
<div
|
||||
className="colors-gallery"
|
||||
ref={el => {
|
||||
if (el) gallery.current = el;
|
||||
if (el) {
|
||||
gallery.current = el;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{colors.map((_color, i) => (
|
||||
|
@ -124,8 +126,12 @@ const Picker = function({
|
|||
style={{ backgroundColor: _color }}
|
||||
key={_color}
|
||||
ref={el => {
|
||||
if (el && i === 0) firstItem.current = el;
|
||||
if (el && _color === color) activeItem.current = el;
|
||||
if (el && i === 0) {
|
||||
firstItem.current = el;
|
||||
}
|
||||
if (el && _color === color) {
|
||||
activeItem.current = el;
|
||||
}
|
||||
}}
|
||||
onFocus={() => {
|
||||
onChange(_color);
|
||||
|
@ -186,7 +192,7 @@ const ColorInput = React.forwardRef(
|
|||
onChange={e => {
|
||||
const value = e.target.value.toLowerCase();
|
||||
if (value.match(colorRegex)) {
|
||||
onChange(value === "transparent" ? "transparent" : "#" + value);
|
||||
onChange(value === "transparent" ? "transparent" : `#${value}`);
|
||||
}
|
||||
setInnerValue(value);
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue