Skip to content

Commit

Permalink
Merge pull request #27 from Neha/feat/implement-pre-commit-hooks
Browse files Browse the repository at this point in the history
feat: implementation of pre commit hooks
  • Loading branch information
giolaq authored Nov 12, 2024
2 parents 6228d5b + 8529ada commit 615240e
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 4 deletions.
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": true
}
2 changes: 2 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// commitlint.config.js
module.exports = { extends: ['@commitlint/config-conventional'] };
45 changes: 45 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const prettier = require('eslint-plugin-prettier');

module.exports = [
{
files: ['**/*.ts', '**/*.tsx'],
ignores: ['node_modules/**', 'build/**', 'dist/**'],
languageOptions: {
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true, // Enable JSX support
},
},
globals: {
React: 'readonly',
},
},
plugins: {
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
react: require('eslint-plugin-react'),
'react-native': require('eslint-plugin-react-native'),
prettier: prettier,
},
rules: {
semi: ['warn', 'always'],
'prefer-const': 'error',
'react-native/no-unused-styles': 'warn',
'react-native/split-platform-components': 'warn',
'react-native/no-inline-styles': 'error',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/colon-trailing-spacing': ['off'],
'prettier/prettier': [
'warn',
{
endOfLine: 'auto',
usePrettierrc: true, // Use .prettierrc file for configuration
},
],
},
},
];
29 changes: 25 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"web": "expo start --web",
"test": "jest --watchAll",
"lint": "expo lint",
"prebuild": "EXPO_TV=1 expo prebuild --clean"
"prebuild": "EXPO_TV=1 expo prebuild --clean",
"prepare": "husky install"
},
"jest": {
"preset": "jest-expo"
Expand All @@ -19,16 +20,20 @@
"@expo/vector-icons": "^14.0.0",
"@react-navigation/drawer": "^6.6.15",
"@react-navigation/native": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"expo": "~51.0.13",
"expo-build-properties": "~0.12.3",
"expo-constants": "~16.0.2",
"expo-font": "~12.0.7",
"expo-linear-gradient": "~13.0.2",
"expo-linking": "~6.3.1",
"expo-router": "~3.5.16",
"expo-splash-screen": "~0.27.5",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.6",
"expo-web-browser": "~13.0.3",
"lint-staged": "^15.2.10",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "npm:react-native-tvos@~0.74.2-0",
Expand All @@ -38,22 +43,38 @@
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-web": "~0.19.10",
"react-tv-space-navigation": "^3.6.1",
"expo-linear-gradient": "~13.0.2"
"react-tv-space-navigation": "^3.6.1"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"babel-plugin-module-resolver": "^4.1.0",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@react-native-tvos/config-tv": "^0.0.10",
"@types/jest": "^29.5.12",
"@types/react": "~18.2.45",
"@types/react-test-renderer": "^18.0.7",
"babel-plugin-module-resolver": "^4.1.0",
"eslint": "^9.13.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-native": "^4.1.0",
"husky": "^9.1.6",
"jest": "^29.2.1",
"jest-expo": "~51.0.1",
"prettier": "^3.3.3",
"react-native-pixel-perfect": "^1.0.2",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.3"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.tsx": [
"prettier --write"
]
},
"expo": {
"install": {
"exclude": [
Expand Down

0 comments on commit 615240e

Please sign in to comment.