.eslintrc.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. const normalGlobals = [];
  2. const hueGlobals = [
  3. // global_js_constants.mako
  4. 'AUTOCOMPLETE_TIMEOUT',
  5. 'CACHEABLE_TTL',
  6. 'CSRF_TOKEN',
  7. 'DOCUMENT_TYPES',
  8. 'DROPZONE_HOME_DIR',
  9. 'ENABLE_SQL_SYNTAX_CHECK',
  10. 'HAS_MULTI_CLUSTER',
  11. 'HAS_CATALOG',
  12. 'HAS_OPTIMIZER',
  13. 'HAS_WORKLOAD_ANALYTICS',
  14. 'HUE_I18n',
  15. 'HUE_VERSION',
  16. 'IS_K8S_ONLY',
  17. 'IS_NEW_INDEXER_ENABLED',
  18. 'IS_S3_ENABLED',
  19. 'isIE11',
  20. 'KO_DATERANGEPICKER_LABELS',
  21. 'LOGGED_USERGROUPS',
  22. 'LOGGED_USERNAME',
  23. 'METASTORE_PARTITION_LIMIT',
  24. 'USER_HOME_DIR',
  25. 'WorkerGlobalScope',
  26. // other misc
  27. 'ace',
  28. 'CodeMirror',
  29. 'impalaDagre',
  30. 'less',
  31. 'MediumEditor',
  32. 'moment',
  33. 'Role',
  34. 'trackOnGA',
  35. '__webpack_public_path__',
  36. // jest
  37. 'afterAll',
  38. 'afterEach',
  39. 'beforeAll',
  40. 'beforeEach',
  41. 'describe',
  42. 'expect',
  43. 'fail',
  44. 'fdescribe',
  45. 'fit',
  46. 'it',
  47. 'jest',
  48. 'spyOn',
  49. 'xdescribe',
  50. 'xit'
  51. ];
  52. const globals = normalGlobals.concat(hueGlobals).reduce((acc, key) => {
  53. acc[key] = true;
  54. return acc;
  55. }, {});
  56. module.exports = {
  57. env: {
  58. browser: true,
  59. node: true,
  60. es6: true,
  61. jasmine: true
  62. },
  63. extends: ['plugin:prettier/recommended'],
  64. globals: globals,
  65. parser: 'babel-eslint',
  66. parserOptions: {
  67. ecmaVersion: 2017,
  68. sourceType: 'module',
  69. ecmaFeatures: {}
  70. },
  71. plugins: ['jest'],
  72. rules: {
  73. 'jest/no-focused-tests': 'error',
  74. 'jest/valid-expect': 'error',
  75. 'new-cap': 0,
  76. 'no-console': 0,
  77. 'no-restricted-syntax': [
  78. 'error',
  79. {
  80. selector:
  81. 'CallExpression[callee.object.name="console"][callee.property.name!=/^(warn|error|info|trace)$/]',
  82. message: 'Unexpected property on console object was called'
  83. }
  84. ],
  85. 'no-extra-boolean-cast': 0,
  86. 'no-invalid-this': 0,
  87. 'no-lonely-if': 2,
  88. 'no-throw-literal': 0,
  89. 'no-unused-vars': [
  90. 'error',
  91. {
  92. vars: 'all',
  93. args: 'none',
  94. ignoreRestSiblings: true,
  95. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  96. }
  97. ],
  98. 'no-useless-constructor': 2,
  99. 'no-var': 1,
  100. 'no-undef': 2,
  101. 'one-var': 0,
  102. 'prefer-arrow-callback': 2,
  103. 'prefer-const': ['warn', { destructuring: 'all' }],
  104. 'require-jsdoc': 0,
  105. strict: 0,
  106. 'valid-jsdoc': 0,
  107. curly: [2, 'all']
  108. },
  109. settings: {}
  110. };