scor32k

Untitled

Aug 24th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. npm install --save-dev eslint prettier eslint-plugin-react eslint-plugin-react-native eslint-config-prettier eslint-plugin-prettier
  2.  
  3. .eslintrc.js
  4. module.exports = {
  5. env: {
  6. browser: true,
  7. es2021: true,
  8. },
  9. extends: [
  10. 'eslint:recommended',
  11. 'plugin:react/recommended',
  12. 'plugin:react-native/all',
  13. 'prettier',
  14. ],
  15. parserOptions: {
  16. ecmaFeatures: {
  17. jsx: true,
  18. },
  19. ecmaVersion: 12,
  20. sourceType: 'module',
  21. },
  22. plugins: ['react', 'react-native', 'prettier'],
  23. rules: {
  24. 'prettier/prettier': 'error',
  25. 'react/react-in-jsx-scope': 'off', // Not needed with React 17+
  26. 'react/prop-types': 'off', // Optional if not using PropTypes
  27. 'react-native/no-inline-styles': 'warn', // Warning for inline styles
  28. },
  29. };
  30.  
  31. .prettierrc
  32. {
  33. "singleQuote": true,
  34. "trailingComma": "es5",
  35. "tabWidth": 2,
  36. "semi": true,
  37. "jsxSingleQuote": false,
  38. "bracketSpacing": true
  39. }
  40.  
  41. .prettierignore
  42. node_modules
  43. build
  44.  
  45. package.json
  46. "scripts": {
  47. "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
  48. "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\""
  49. }
  50.  
  51. npx husky-init && npm install
  52. npm install --save-dev lint-staged
  53.  
  54. "husky": {
  55. "hooks": {
  56. "pre-commit": "lint-staged"
  57. }
  58. },
  59. "lint-staged": {
  60. "*.{js,jsx,ts,tsx}": "eslint --fix",
  61. "*.{js,jsx,ts,tsx,json,css,md}": "prettier --write"
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment