.eslintrc.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. const normalGlobals = [
  2. 'ko', 'jQuery', '$', '_', 'Promise'
  3. ];
  4. const hueGlobals = [
  5. // global_js_constants.mako
  6. 'AUTOCOMPLETE_TIMEOUT', 'CACHEABLE_TTL', 'CSRF_TOKEN', 'DOCUMENT_TYPES', 'DROPZONE_HOME_DIR',
  7. 'ENABLE_SQL_SYNTAX_CHECK', 'HAS_MULTI_CLUSTER', 'HAS_NAVIGATOR', 'HAS_OPTIMIZER', 'HAS_WORKLOAD_ANALYTICS',
  8. 'HUE_CONTAINER', 'HUE_I18n', 'HUE_VERSION', 'IS_EMBEDDED', 'IS_K8S_ONLY', 'IS_NEW_INDEXER_ENABLED', 'IS_S3_ENABLED',
  9. 'isIE11', 'KO_DATERANGEPICKER_LABELS', 'LOGGED_USERGROUPS', 'LOGGED_USERNAME', 'METASTORE_PARTITION_LIMIT',
  10. 'USER_HOME_DIR', 'WorkerGlobalScope',
  11. // other misc
  12. 'ace', 'Autocompleter', 'CodeMirror', 'Datamap', 'd3v3', 'HueGeo', 'impalaDagre', 'less', 'MediumEditor', 'moment',
  13. 'nv', 'Plotly', 'Role', 'sqlStatementsParser', 'trackOnGA',
  14. // jasmine
  15. 'afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'expect', 'fail', 'fdescribe', 'fit', 'it', 'jasmine',
  16. 'spyOn', 'xdescribe', 'xit'
  17. ];
  18. const globals = normalGlobals.concat(hueGlobals).reduce((acc, key) => {
  19. acc[key] = true;
  20. return acc;
  21. }, {});
  22. module.exports = {
  23. env: {
  24. browser: true,
  25. node: true,
  26. es6: true
  27. },
  28. extends: [
  29. 'plugin:prettier/recommended'
  30. ],
  31. globals: globals,
  32. parser: 'babel-eslint',
  33. parserOptions: {
  34. ecmaVersion: 2017,
  35. sourceType: 'module',
  36. ecmaFeatures: {
  37. }
  38. },
  39. plugins: [],
  40. rules: {
  41. 'new-cap': 0,
  42. 'no-console': 0,
  43. 'no-extra-boolean-cast': 0,
  44. 'no-invalid-this': 0,
  45. 'no-lonely-if': 2,
  46. 'no-throw-literal': 0,
  47. 'no-unused-vars': [
  48. 'error',
  49. {
  50. vars: 'all',
  51. args: 'none',
  52. ignoreRestSiblings: true,
  53. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  54. }
  55. ],
  56. 'no-useless-constructor': 2,
  57. 'no-var': 1,
  58. 'no-undef': 2,
  59. 'one-var': 0,
  60. 'prefer-arrow-callback': 2,
  61. 'prefer-const': ['warn', { destructuring: 'all' }],
  62. 'require-jsdoc': 0,
  63. strict: 0,
  64. 'valid-jsdoc': 0,
  65. curly: [2, 'all']
  66. },
  67. settings: {
  68. }
  69. };