.eslintrc.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. parser: '@typescript-eslint/parser'
  2. parserOptions:
  3. ecmaFeatures:
  4. jsx: true
  5. ecmaVersion: 2020
  6. sourceType: module
  7. env:
  8. browser: true
  9. es6: true
  10. node: true
  11. jest: true
  12. plugins:
  13. - import
  14. - sonarjs
  15. extends:
  16. - eslint:recommended
  17. - plugin:sonarjs/recommended
  18. - plugin:prettier/recommended
  19. rules:
  20. # 0 = off, 1 = warn, 2 = error
  21. 'space-before-function-paren': 0
  22. 'no-useless-constructor': 0
  23. 'no-undef': 2
  24. 'no-console': [2, { allow: ['error', 'warn', 'info', 'assert'] }]
  25. 'comma-dangle': ['error', 'only-multiline']
  26. 'no-unused-vars': 0
  27. 'no-var': 2
  28. 'one-var-declaration-per-line': 2
  29. 'prefer-const': 2
  30. 'no-const-assign': 2
  31. 'no-duplicate-imports': 2
  32. 'no-use-before-define': [2, { 'functions': false, 'classes': false }]
  33. 'eqeqeq': [2, 'always', { 'null': 'ignore' }]
  34. 'no-case-declarations': 0
  35. 'no-restricted-syntax':
  36. [
  37. 2,
  38. {
  39. 'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
  40. 'message': Don't compare for equality against boolean literals,
  41. },
  42. ]
  43. 'import/first': 2
  44. 'import/newline-after-import': 2
  45. 'sonarjs/cognitive-complexity': 0
  46. 'sonarjs/no-duplicate-string': 0
  47. 'sonarjs/no-big-function': 0
  48. 'sonarjs/no-identical-functions': 0
  49. 'sonarjs/no-small-switch': 0
  50. overrides:
  51. - files:
  52. - ./**/*.{ts,tsx}
  53. rules:
  54. 'no-unused-vars': [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
  55. - files:
  56. - ./**/*{.ts,.tsx}
  57. plugins:
  58. - '@typescript-eslint'
  59. parserOptions:
  60. project: ./tsconfig.json
  61. rules:
  62. # eslint will treat TS type as undefined stuff
  63. 'no-undef': 0
  64. # conflict function override
  65. 'no-dupe-class-members': 0
  66. '@typescript-eslint/no-unused-vars':
  67. [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
  68. '@typescript-eslint/member-ordering':
  69. [
  70. 2,
  71. {
  72. default:
  73. [
  74. 'public-static-field',
  75. 'protected-static-field',
  76. 'private-static-field',
  77. 'public-static-method',
  78. 'protected-static-method',
  79. 'private-static-method',
  80. 'public-instance-field',
  81. 'protected-instance-field',
  82. 'private-instance-field',
  83. 'public-constructor',
  84. 'protected-constructor',
  85. 'private-constructor',
  86. 'public-instance-method',
  87. 'protected-instance-method',
  88. 'private-instance-method',
  89. ],
  90. },
  91. ]