Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinmagrez committed Oct 3, 2023
1 parent a91fa8b commit 1e37e62
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
src/components/charts
setup.js
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": ["./tsconfig.json"],
"ecmaFeatures": {
"jsx": true
}
Expand All @@ -36,7 +35,8 @@
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
]
],
"react/prop-types": "off"
},
"ignorePatterns": ["*/*.config.js", "*.config.js"],
"root": true
Expand Down
1 change: 1 addition & 0 deletions Storybook/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"scripts": {
"test": "jest",
"tsc": "tsc --project tsconfig.build.json",
"lint:check": "prettier --check .",
"lint:fix": "prettier --write ."
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix"
},
"keywords": [
"react-native",
Expand Down
12 changes: 7 additions & 5 deletions src/components/numberField/NumberField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const NumberField = React.forwardRef<TextInput, NumberFieldProps>(
else setCurrentState('prefilled');
}
};
let checkContent = (text: string | undefined) => {
const checkContent = (text: string | undefined) => {
if (text !== undefined && text !== '') {
const cleanNumber = text.replace(/[^0-9]/g, '');
const parsedValue = parseInt(cleanNumber);
Expand All @@ -144,15 +144,15 @@ export const NumberField = React.forwardRef<TextInput, NumberFieldProps>(
}
}
};
let cleanContent = (text: string | undefined) => {
const cleanContent = (text: string | undefined) => {
if (text !== undefined && text !== '') {
const cleanNumber = text.replace(/[^-0-9]/g, '');
const parsedValue = parseInt(cleanNumber);
return parsedValue.toString();
}
return '';
};
let onChangeText = (e: any) => {
const onChangeText = (e: any) => {
if (props?.onChangeText !== undefined) {
props.onChangeText(e);
checkContent(props.value);
Expand All @@ -162,11 +162,11 @@ export const NumberField = React.forwardRef<TextInput, NumberFieldProps>(
checkContent(value);
}
};
let onFocus = (e: any) => {
const onFocus = (e: any) => {
setFocused(true);
if (props?.onFocus !== undefined) props.onFocus(e);
};
let onBlur = (e: any) => {
const onBlur = (e: any) => {
setFocused(false);
if ((value === '' || props.value === '') && firstValue !== '') onChangeText(firstValue);
else if ((value === '' || props.value === '') && lastValue !== '') {
Expand Down Expand Up @@ -194,3 +194,5 @@ export const NumberField = React.forwardRef<TextInput, NumberFieldProps>(
);
},
);

NumberField.displayName = 'NumberField';
2 changes: 1 addition & 1 deletion src/components/numberSelector/NumberSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const NumberSelector = ({
variant = 'outlined',
size = 'm',
}: Props) => {
let refInput = useRef<any>();
const refInput = useRef<any>();

const [tempValue, setTempValue] = useState<string>(value.toString());
const [softInputOnFocus, setSoftInputOnFocus] = useState(false);
Expand Down

0 comments on commit 1e37e62

Please sign in to comment.