.eslintrc.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. module.exports = {
  2. 'extends': 'airbnb-base',
  3. 'parserOptions': {
  4. 'ecmaVersion': 11,
  5. 'sourceType': 'module'
  6. },
  7. 'env': {
  8. 'browser': true,
  9. 'es6': true,
  10. 'node': true
  11. },
  12. 'plugins': [
  13. 'chai-friendly',
  14. 'import'
  15. ],
  16. 'globals': { // TODO are all these necessary?
  17. 'globalThis': true,
  18. 'console': true,
  19. 'Promise': true,
  20. 'importScripts': true,
  21. 'process': true,
  22. 'Event': true,
  23. 'describe': true,
  24. 'it': true,
  25. 'mocha': true,
  26. 'before': true,
  27. 'beforeEach': true,
  28. 'after': true,
  29. 'afterEach': true,
  30. 'escape': true,
  31. 'unescape': true,
  32. 'resolves': true,
  33. 'rejects': true,
  34. 'TransformStream': true,
  35. 'BigInt': true
  36. },
  37. 'rules': {
  38. 'arrow-body-style': 'off',
  39. 'arrow-parens': ['error','as-needed'],
  40. 'class-methods-use-this': 'off',
  41. 'comma-dangle': ['error', 'never'],
  42. 'comma-spacing': 'off',
  43. 'consistent-return': 'off',
  44. 'default-case': 'off',
  45. 'default-param-last': 'off',
  46. 'eol-last': ['error', 'always'],
  47. 'function-call-argument-newline': 'off',
  48. 'func-names': ['error', 'never'],
  49. 'function-paren-newline': 'off',
  50. 'global-require': 'off',
  51. 'key-spacing': 'off',
  52. 'keyword-spacing': 'error',
  53. 'max-classes-per-file': 'off',
  54. 'max-len': 'off',
  55. 'newline-per-chained-call': 'off',
  56. 'no-bitwise': 'off',
  57. 'no-continue': 'off',
  58. 'no-else-return': 'off',
  59. 'no-empty': ['error', { 'allowEmptyCatch': true }],
  60. 'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 1, 'maxBOF':0 }],
  61. 'no-nested-ternary': 'off',
  62. 'no-param-reassign': 'off', // TODO get rid of this
  63. 'no-plusplus': 'off',
  64. 'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
  65. 'object-curly-newline': 'off',
  66. 'no-shadow': 'off', // TODO get rid of this
  67. 'object-property-newline': [
  68. 'error',
  69. {
  70. 'allowMultiplePropertiesPerLine': true
  71. }
  72. ],
  73. 'object-shorthand': 'off',
  74. 'operator-assignment': 'off',
  75. 'operator-linebreak': [
  76. 'error',
  77. 'after'
  78. ],
  79. 'padded-blocks': 'off',
  80. 'prefer-arrow-callback': 'off',
  81. 'prefer-destructuring': 'off',
  82. 'prefer-rest-params': 'off', // TODO get rid of this
  83. 'prefer-spread': 'off', // TODO get rid of this
  84. 'prefer-template': 'off',
  85. 'quote-props': 'off',
  86. 'quotes': ['error', 'single', { 'avoidEscape': true }],
  87. 'space-before-function-paren': 'off',
  88. 'spaced-comment': 'off',
  89. 'indent': ['error', 2, { 'SwitchCase': 1 }],
  90. 'no-unused-vars': 'error',
  91. // eslint-plugin-import rules:
  92. 'import/named': 'error',
  93. 'import/extensions': 'error',
  94. 'import/no-extraneous-dependencies': ['error', { 'devDependencies': true, 'optionalDependencies': false, 'peerDependencies': false }],
  95. 'import/no-unassigned-import': 'error',
  96. 'import/prefer-default-export': 'off',
  97. // Custom silencers:
  98. 'camelcase': 'off', // used in tests, need to fix separately
  99. 'no-multi-assign': 'off',
  100. 'no-underscore-dangle': 'off',
  101. 'no-await-in-loop': 'off',
  102. // Custom errors:
  103. 'no-use-before-define': [2, { 'functions': false, 'classes': true, 'variables': false }],
  104. 'no-constant-condition': [2, { 'checkLoops': false }],
  105. 'new-cap': [2, { 'properties': false, 'capIsNewExceptionPattern': 'EAX|OCB|GCM|CMAC|CBC|OMAC|CTR', 'newIsCapExceptionPattern': 'type|hash*' }],
  106. 'max-lines': [2, { 'max': 620, 'skipBlankLines': true, 'skipComments': true }],
  107. 'no-unused-expressions': 0,
  108. 'chai-friendly/no-unused-expressions': [2, { 'allowShortCircuit': true }],
  109. // Custom warnings:
  110. 'no-console': 1
  111. }
  112. };