.eslintrc.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_NAVIGATOR', 'HAS_OPTIMIZER', 'HAS_WORKLOAD_ANALYTICS',
  6. 'HUE_CONTAINER', 'HUE_I18n', 'HUE_VERSION', 'IS_EMBEDDED', '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', 'Autocompleter', 'CodeMirror', 'Datamap', 'HueGeo', 'impalaDagre', 'less', 'MediumEditor', 'moment',
  11. 'nv', 'Plotly', 'Role', 'sqlStatementsParser', 'trackOnGA',
  12. // jasmine
  13. 'afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'expect', 'fail', 'fdescribe', 'fit', 'it', 'jasmine',
  14. 'spyOn', 'xdescribe', 'xit'
  15. ];
  16. const globals = normalGlobals.concat(hueGlobals).reduce((acc, key) => {
  17. acc[key] = true;
  18. return acc;
  19. }, {});
  20. module.exports = {
  21. env: {
  22. browser: true,
  23. node: true,
  24. es6: 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. rules: {
  39. 'new-cap': 0,
  40. 'no-console': 0,
  41. 'no-extra-boolean-cast': 0,
  42. 'no-invalid-this': 0,
  43. 'no-lonely-if': 2,
  44. 'no-throw-literal': 0,
  45. 'no-unused-vars': [
  46. 'error',
  47. {
  48. vars: 'all',
  49. args: 'none',
  50. ignoreRestSiblings: true,
  51. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  52. }
  53. ],
  54. 'no-useless-constructor': 2,
  55. 'no-var': 1,
  56. 'no-undef': 2,
  57. 'one-var': 0,
  58. 'prefer-arrow-callback': 2,
  59. 'prefer-const': ['warn', { destructuring: 'all' }],
  60. 'require-jsdoc': 0,
  61. strict: 0,
  62. 'valid-jsdoc': 0,
  63. curly: [2, 'all']
  64. },
  65. settings: {
  66. }
  67. };