.eslintrc.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. module.exports = {
  2. env: {
  3. browser: true,
  4. es6: true,
  5. commonjs: true,
  6. node: true,
  7. 'jest/globals': true
  8. },
  9. globals: {
  10. JSX: 'readonly'
  11. },
  12. root: true,
  13. extends: [
  14. 'eslint:recommended',
  15. 'plugin:@typescript-eslint/eslint-recommended',
  16. 'plugin:@typescript-eslint/recommended',
  17. 'prettier/@typescript-eslint',
  18. 'plugin:react/recommended',
  19. 'plugin:jest/recommended'
  20. ],
  21. parser: '@typescript-eslint/parser',
  22. parserOptions: {
  23. project: 'tsconfig.eslint.json'
  24. },
  25. plugins: ['@typescript-eslint', 'jest'],
  26. rules: {
  27. '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
  28. '@typescript-eslint/naming-convention': [
  29. 'error',
  30. {
  31. selector: 'interface',
  32. format: ['PascalCase'],
  33. custom: {
  34. regex: '^I[A-Z]',
  35. match: true
  36. }
  37. }
  38. ],
  39. '@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
  40. '@typescript-eslint/no-use-before-define': 'off',
  41. '@typescript-eslint/camelcase': 'off',
  42. '@typescript-eslint/no-explicit-any': 'off',
  43. '@typescript-eslint/no-non-null-assertion': 'off',
  44. '@typescript-eslint/no-namespace': 'off',
  45. '@typescript-eslint/interface-name-prefix': 'off',
  46. '@typescript-eslint/explicit-function-return-type': 'off',
  47. '@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
  48. '@typescript-eslint/ban-types': 'warn',
  49. '@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
  50. '@typescript-eslint/no-var-requires': 'off',
  51. '@typescript-eslint/no-empty-interface': 'off',
  52. '@typescript-eslint/triple-slash-reference': 'warn',
  53. '@typescript-eslint/no-inferrable-types': 'off',
  54. 'jest/no-conditional-expect': 'warn',
  55. 'jest/valid-title': 'warn',
  56. 'id-match': ['error', '^[a-zA-Z_]+[a-zA-Z0-9_]*$'], // https://certitude.consulting/blog/en/invisible-backdoor/
  57. 'no-inner-declarations': 'off',
  58. 'no-prototype-builtins': 'off',
  59. 'no-control-regex': 'warn',
  60. 'no-undef': 'warn',
  61. 'no-case-declarations': 'warn',
  62. 'no-useless-escape': 'off',
  63. 'prefer-const': 'off',
  64. 'react/prop-types': 'off',
  65. 'sort-imports': [
  66. 'error',
  67. {
  68. ignoreCase: true,
  69. ignoreDeclarationSort: true,
  70. ignoreMemberSort: false,
  71. memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
  72. allowSeparatedGroups: false
  73. }
  74. ]
  75. },
  76. settings: {
  77. react: {
  78. version: 'detect'
  79. }
  80. }
  81. };