react-native-webview.git

.eslintrc.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. module.exports = {
  2. // Airbnb is the base, prettier is here so that eslint doesn't conflict with prettier
  3. extends: ['airbnb', 'prettier', 'prettier/react'],
  4. parser: '@typescript-eslint/parser',
  5. plugins: ['react', 'react-native', 'import', '@typescript-eslint'],
  6. rules: {
  7. 'no-console': 'off',
  8. // Lines will be broken before binary operators
  9. 'operator-linebreak': ['error', 'before'],
  10. // Allow imports from dev and peer dependencies
  11. 'import/no-extraneous-dependencies': [
  12. 'error',
  13. { devDependencies: true, peerDependencies: true },
  14. ],
  15. 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
  16. // This rule doesn't play nice with Prettier
  17. 'react/jsx-one-expression-per-line': 'off',
  18. // This rule doesn't play nice with Prettier
  19. 'react/jsx-wrap-multilines': 'off',
  20. // Remove this rule because we only destructure props, but never state
  21. 'react/destructuring-assignment': 'off',
  22. 'react/prop-types': 'off',
  23. '@typescript-eslint/adjacent-overload-signatures': 'error',
  24. '@typescript-eslint/array-type': ['error', 'array'],
  25. '@typescript-eslint/generic-type-naming': ['error', '^[a-zA-Z]+$'],
  26. '@typescript-eslint/no-angle-bracket-type-assertion': 'error',
  27. '@typescript-eslint/no-array-constructor': 'error',
  28. '@typescript-eslint/no-empty-interface': 'error',
  29. '@typescript-eslint/no-explicit-any': 'error',
  30. '@typescript-eslint/no-extraneous-class': 'error',
  31. '@typescript-eslint/no-inferrable-types': 'error',
  32. '@typescript-eslint/no-misused-new': 'error',
  33. '@typescript-eslint/no-namespace': 'error',
  34. '@typescript-eslint/no-non-null-assertion': 'error',
  35. '@typescript-eslint/no-object-literal-type-assertion': 'error',
  36. '@typescript-eslint/no-parameter-properties': 'error',
  37. '@typescript-eslint/no-this-alias': 'error',
  38. '@typescript-eslint/no-triple-slash-reference': 'error',
  39. '@typescript-eslint/no-type-alias': [
  40. 'error',
  41. {
  42. allowAliases: 'always',
  43. allowCallbacks: 'always',
  44. allowMappedTypes: 'always',
  45. },
  46. ],
  47. '@typescript-eslint/no-unused-vars': [
  48. 'error',
  49. { ignoreRestSiblings: true },
  50. ],
  51. '@typescript-eslint/prefer-interface': 'error',
  52. '@typescript-eslint/prefer-namespace-keyword': 'error',
  53. '@typescript-eslint/type-annotation-spacing': 'error',
  54. },
  55. settings: {
  56. 'import/resolver': {
  57. node: {
  58. extensions: [
  59. '.js',
  60. '.android.js',
  61. '.ios.js',
  62. '.jsx',
  63. '.android.jsx',
  64. '.ios.jsx',
  65. '.tsx',
  66. '.ts',
  67. '.android.tsx',
  68. '.android.ts',
  69. '.ios.tsx',
  70. '.ios.ts',
  71. ],
  72. },
  73. },
  74. },
  75. };