.eslintrc.js 2.4 KB

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