react-native-webview.git

.eslintrc.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. module.exports = {
  2. // Airbnb is the base, prettier is here so that eslint doesn't conflict with prettier
  3. extends: ['airbnb', 'prettier'],
  4. parser: 'babel-eslint',
  5. plugins: ['react', 'import'],
  6. rules: {
  7. // Parens will be needed for arrow functions
  8. 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
  9. // Lines will be broken before binary operators
  10. 'operator-linebreak': ['error', 'before'],
  11. // Allow imports from dev and peer dependencies
  12. 'import/no-extraneous-dependencies': [
  13. 'error',
  14. { devDependencies: true, peerDependencies: true },
  15. ],
  16. // Allows writing JSX in JS & TS files
  17. // 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.ts'] }],
  18. // This rule doesn't play nice with Prettier
  19. 'react/jsx-one-expression-per-line': 'off',
  20. // This rule doesn't play nice with Prettier
  21. 'react/jsx-wrap-multilines': 'off',
  22. // Remove this rule because we only destructure props, but never state
  23. 'react/destructuring-assignment': 'off',
  24. // Restrict imports that should be used carefully. Usually we have created a wrapper around them
  25. },
  26. overrides: [
  27. {
  28. files: ['*.ts', '*.tsx'],
  29. parser: 'typescript-eslint-parser',
  30. plugins: ['react', 'import', 'typescript'],
  31. rules: {
  32. 'typescript/adjacent-overload-signatures': 'error',
  33. 'typescript/explicit-function-return-type': 'error',
  34. 'typescript/no-angle-bracket-type-assertion': 'error',
  35. 'typescript/no-empty-interface': 'error',
  36. 'typescript/no-explicit-any': 'error',
  37. 'typescript/no-inferrable-types': 'error',
  38. 'typescript/no-namespace': 'error',
  39. 'typescript/no-non-null-assertion': 'error',
  40. 'typescript/no-triple-slash-reference': 'error',
  41. 'typescript/no-type-alias': 'error',
  42. 'typescript/prefer-namespace-keyword': 'error',
  43. 'typescript/type-annotation-spacing': 'error',
  44. },
  45. },
  46. ],
  47. settings: {
  48. 'import/resolver': {
  49. node: { extensions: ['.tsx', '.ts'] },
  50. },
  51. 'import/cache:': {
  52. lifetime: 2,
  53. },
  54. },
  55. };