Skip to content

Commit

Permalink
chore: Update ESLint rules (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-yakuza authored Jun 15, 2024
1 parent 0531c73 commit f277382
Show file tree
Hide file tree
Showing 17 changed files with 1,278 additions and 504 deletions.
65 changes: 61 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,78 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', 'react-hooks', '@typescript-eslint', 'prettier'],
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
'unused-imports',
'import',
'functional',
'unicorn',
],
rules: {
indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prettier/prettier': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/member-ordering': [
'error',
{
default: ['field', 'signature', 'constructor', 'method'],
},
],
'@typescript-eslint/method-signature-style': ['error', 'method'],
'react/display-name': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-handler-names': [
'error',
{
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
},
],
'unused-imports/no-unused-imports-ts': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
alphabetize: { order: 'asc', caseInsensitive: true },
pathGroups: [
{
pattern: 'react**',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
},
],
'import/exports-last': 'error',
'functional/prefer-readonly-type': [
'error',
{
allowLocalMutation: true,
allowMutableReturnType: true,
ignoreClass: true,
},
],
'unicorn/no-null': 'error',
'require-await': 'off',
eqeqeq: 'error',
'no-empty-function': 'off',
semi: 'off',
// complexity: 'error',
// 'max-depth': 'error',
},
settings: {
react: {
version: 'detect',
},
},
};
}
6 changes: 4 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
tabWidth: 2,
semi: false,
singleQuote: true,
trailingComma: 'all',
jsxSingleQuote: true,
printWidth: 100,
};
}
2 changes: 1 addition & 1 deletion Develop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped

# Getting Started

>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
## Step 1: Start the Metro Server

Expand Down
2 changes: 1 addition & 1 deletion Example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped

# Getting Started

>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
## Step 1: Start the Metro Server

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ npm install --save react-native-image-modal
Import react-native-image-modal.

```js
import ImageModal from 'react-native-image-modal';
import ImageModal from 'react-native-image-modal'
```

Add the source code below to where you want to use it.

```js
return (
<ImageModal
resizeMode="contain"
imageBackgroundColor="#000000"
resizeMode='contain'
imageBackgroundColor='#000000'
style={{
width: 250,
height: 250,
Expand All @@ -60,7 +60,7 @@ return (
uri: 'https://cdn.pixabay.com/photo/2019/07/25/18/58/church-4363258_960_720.jpg',
}}
/>
);
)
```

### Custom Image component
Expand Down
3 changes: 2 additions & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ pre-commit:
parallel: true
commands:
Pretty:
root: "src/"
run: npx prettier --check {staged_files}
ESLint:
exclude: 'Develop|Example'
glob: '*.{ts,tsx}'
glob: 'src/**/*.{js,jsx,ts,tsx}'
run: npx eslint -c .eslintrc.js {staged_files}
CSpell:
run: npx cspell --gitignore --show-suggestions --no-must-find-files {staged_files}
Loading

0 comments on commit f277382

Please sign in to comment.