Geen omschrijving

.eslintrc.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. 'react/jsx-props-no-spreading': 'off',
  24. 'react/static-property-placement': 'off',
  25. 'react/state-in-constructor': 'off',
  26. '@typescript-eslint/adjacent-overload-signatures': 'error',
  27. '@typescript-eslint/array-type': [
  28. 'error',
  29. {
  30. default: 'array',
  31. },
  32. ],
  33. '@typescript-eslint/generic-type-naming': ['error', '^[a-zA-Z]+$'],
  34. '@typescript-eslint/no-array-constructor': 'error',
  35. '@typescript-eslint/no-empty-interface': 'error',
  36. '@typescript-eslint/no-explicit-any': 'error',
  37. '@typescript-eslint/no-extraneous-class': 'error',
  38. '@typescript-eslint/no-inferrable-types': 'error',
  39. '@typescript-eslint/no-misused-new': 'error',
  40. '@typescript-eslint/no-namespace': 'error',
  41. '@typescript-eslint/no-non-null-assertion': 'error',
  42. '@typescript-eslint/consistent-type-assertions': [
  43. 'error',
  44. {
  45. assertionStyle: 'as',
  46. },
  47. ],
  48. '@typescript-eslint/no-parameter-properties': 'error',
  49. '@typescript-eslint/no-this-alias': 'error',
  50. '@typescript-eslint/triple-slash-reference': [
  51. 'error',
  52. { path: 'never', types: 'never', lib: 'never' },
  53. ],
  54. '@typescript-eslint/no-type-alias': [
  55. 'error',
  56. {
  57. allowAliases: 'always',
  58. allowCallbacks: 'always',
  59. allowMappedTypes: 'always',
  60. },
  61. ],
  62. '@typescript-eslint/no-unused-vars': [
  63. 'error',
  64. { ignoreRestSiblings: true },
  65. ],
  66. '@typescript-eslint/consistent-type-definitions': [
  67. 'error',
  68. 'interface',
  69. ],
  70. '@typescript-eslint/prefer-namespace-keyword': 'error',
  71. '@typescript-eslint/type-annotation-spacing': 'error',
  72. },
  73. settings: {
  74. 'import/resolver': {
  75. node: {
  76. extensions: [
  77. '.js',
  78. '.android.js',
  79. '.ios.js',
  80. '.jsx',
  81. '.android.jsx',
  82. '.ios.jsx',
  83. '.tsx',
  84. '.ts',
  85. '.android.tsx',
  86. '.android.ts',
  87. '.ios.tsx',
  88. '.ios.ts',
  89. ],
  90. },
  91. },
  92. },
  93. };