Skip to content

Commit a7ab3c6

Browse files
authored
Merge pull request #30 from piashcse/configure-eslint
- Configure ESLint
2 parents 364556b + 6dfc715 commit a7ab3c6

File tree

29 files changed

+2074
-733
lines changed

29 files changed

+2074
-733
lines changed

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
android/
3+
ios/
4+
build/

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"bracketSpacing": true,
8+
"jsxBracketSameLine": false,
9+
"useTabs": false
10+
}

App.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
* @flow strict-local
77
*/
88

9-
109
import React from 'react';
1110
import configureAppStore from './src/redux';
12-
import {Provider} from 'react-redux';
11+
import { Provider } from 'react-redux';
1312
import Navigation from './src/navigations/AppNavigation';
14-
import {PersistGate} from 'redux-persist/integration/react'
15-
13+
import { PersistGate } from 'redux-persist/integration/react';
1614

17-
const {store, persistor} = configureAppStore();
15+
const { store, persistor } = configureAppStore();
1816
const App = () => {
19-
return (
20-
<Provider store={store}>
21-
<PersistGate loading={null} persistor={persistor}>
22-
<Navigation/>
23-
</PersistGate>
24-
</Provider>
25-
);
17+
return (
18+
<Provider store={store}>
19+
<PersistGate loading={null} persistor={persistor}>
20+
<Navigation />
21+
</PersistGate>
22+
</Provider>
23+
);
2624
};
2725

2826
export default App;

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# React-Native Boilerplate
2+
23
[![React Native](https://img.shields.io/badge/React%20Native-v0.76.1-green.svg)](https://facebook.github.io/react-native/)
34
![badge-Android](https://img.shields.io/badge/Platform-Android-brightgreen)
45
![badge-iOS](https://img.shields.io/badge/Platform-iOS-lightgray)
@@ -27,6 +28,7 @@ src/
2728
```
2829

2930
## Built With 🛠
31+
3032
- [React-Native](https://reactnative.dev/) - React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform..
3133
- [React-Navigation](https://reactnavigation.org/) - Routing and navigation for your React Native apps.
3234
- [netinfo](https://github.com/react-native-netinfo/react-native-netinfo) - React Native Network Info API for Android, iOS, macOS, Windows & Web
@@ -38,8 +40,7 @@ src/
3840
- [Redux Persist](https://www.npmjs.com/package/redux-persist) - Redux Persist is a staple project for Redux developers, both on mobile and on the web.
3941
- [react-native-paper](https://github.com/callstack/react-native-paper) - Material Design for React Native (Android & iOS).
4042
- [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons)- Customizable Icons for React Native with support for image source and full styling.
41-
- [patch-package](https://github.com/ds300/patch-package) - Fix broken node modules instantly
42-
43+
- [patch-package](https://github.com/ds300/patch-package) - Fix broken node modules instantly
4344

4445
## Requirements
4546

@@ -48,7 +49,7 @@ src/
4849

4950
## How to run
5051

51-
- `git clone git@github.com:piashcse/react-native-boilerplate.git`
52+
- `git clone git@github.com:piashcse/react-native-boilerplate.git`
5253
- `yarn install`
5354

5455
Now, you can choose a command to run the project:
@@ -71,6 +72,7 @@ Now, you can choose a command to run the project:
7172
[![Blog](https://img.shields.io/badge/-Blog-0077B5?logo=readme&logoColor=white&style=for-the-badge)](https://piashcse.blogspot.com)
7273

7374
# License
75+
7476
```
7577
Copyright 2023 piashcse (Mehedi Hassan Piash)
7678
@@ -86,4 +88,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8688
See the License for the specific language governing permissions and
8789
limitations under the License.
8890
```
89-

babel.config.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3-
overrides: [{
4-
"plugins": [
5-
["@babel/plugin-transform-private-methods", {
6-
"loose": true
7-
}]
8-
]
9-
}]
3+
overrides: [
4+
{
5+
plugins: [
6+
[
7+
'@babel/plugin-transform-private-methods',
8+
{
9+
loose: true,
10+
},
11+
],
12+
],
13+
},
14+
],
1015
};

eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import pluginReact from 'eslint-plugin-react';
5+
import prettierConfig from 'eslint-config-prettier';
6+
import prettierPlugin from 'eslint-plugin-prettier';
7+
import jestPlugin from 'eslint-plugin-jest';
8+
9+
export default [
10+
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
11+
{ languageOptions: { globals: { ...globals.browser, ...globals.jest } } }, // Add Jest globals here
12+
pluginJs.configs.recommended,
13+
...tseslint.configs.recommended,
14+
pluginReact.configs.flat.recommended,
15+
prettierConfig, // Disables conflicting ESLint rules with Prettier
16+
{
17+
ignores: ['node_modules/', 'android/', 'ios/', 'build/'],
18+
plugins: { prettier: prettierPlugin, jest: jestPlugin }, // Register Jest and Prettier plugins
19+
rules: {
20+
'react/react-in-jsx-scope': 'off',
21+
'no-unused-vars': 'warn',
22+
'react-native/no-inline-styles': 'off',
23+
'prettier/prettier': 'error', // Enforce Prettier rules
24+
// Jest-specific rules (optional)
25+
'jest/no-disabled-tests': 'warn',
26+
'jest/no-focused-tests': 'error',
27+
'jest/no-identical-title': 'error',
28+
'jest/prefer-to-have-length': 'warn',
29+
'jest/valid-expect': 'error',
30+
},
31+
settings: {
32+
react: {
33+
version: 'detect', // Automatically detect React version
34+
},
35+
},
36+
},
37+
];

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @format
33
*/
44

5-
import {AppRegistry} from 'react-native';
5+
import { AppRegistry } from 'react-native';
66
import App from './App';
7-
import {name as appName} from './app.json';
7+
import { name as appName } from './app.json';
88

99
AppRegistry.registerComponent(appName, () => App);

0 commit comments

Comments
 (0)