.eslintrc.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_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', 'CodeMirror', 'impalaDagre', 'less', 'MediumEditor', 'moment', 'Role', 'trackOnGA',
  11. // jasmine
  12. 'afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'expect', 'fail', 'fdescribe', 'fit', 'it', 'jasmine',
  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. },
  25. extends: [
  26. 'plugin:prettier/recommended'
  27. ],
  28. globals: globals,
  29. parser: 'babel-eslint',
  30. parserOptions: {
  31. ecmaVersion: 2017,
  32. sourceType: 'module',
  33. ecmaFeatures: {
  34. }
  35. },
  36. plugins: [],
  37. rules: {
  38. 'new-cap': 0,
  39. 'no-console': 0,
  40. 'no-extra-boolean-cast': 0,
  41. 'no-invalid-this': 0,
  42. 'no-lonely-if': 2,
  43. 'no-throw-literal': 0,
  44. 'no-unused-vars': [
  45. 'error',
  46. {
  47. vars: 'all',
  48. args: 'none',
  49. ignoreRestSiblings: true,
  50. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  51. }
  52. ],
  53. 'no-useless-constructor': 2,
  54. 'no-var': 1,
  55. 'no-undef': 2,
  56. 'one-var': 0,
  57. 'prefer-arrow-callback': 2,
  58. 'prefer-const': ['warn', { destructuring: 'all' }],
  59. 'require-jsdoc': 0,
  60. strict: 0,
  61. 'valid-jsdoc': 0,
  62. curly: [2, 'all']
  63. },
  64. settings: {
  65. }
  66. };