.eslintrc.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. const normalGlobals = [
  2. 'ko', 'jQuery', '$', '_', 'Promise'
  3. ];
  4. const hueGlobals = [
  5. // global_js_constants.mako
  6. 'IS_HUE_4', 'AUTOCOMPLETE_TIMEOUT','CSRF_TOKEN','HAS_MULTI_CLUSTER',
  7. 'DROPZONE_HOME_DIR', 'ENABLE_SQL_SYNTAX_CHECK', 'HAS_NAVIGATOR', 'HAS_OPTIMIZER', 'HAS_WORKLOAD_ANALYTICS',
  8. 'HUE_CONTAINER', 'IS_EMBEDDED', 'IS_K8S_ONLY', 'HUE_VERSION', 'IS_NEW_INDEXER_ENABLED',
  9. 'IS_S3_ENABLED', 'DOCUMENT_TYPES', 'LOGGED_USERNAME', 'USER_HOME_DIR', 'LOGGED_USERGROUPS', 'METASTORE_PARTITION_LIMIT',
  10. // other misc, TODO
  11. 'huePubSub', 'ApiHelper', 'SqlUtils', 'ContextCatalog', 'DataCatalog'
  12. ];
  13. const globals = normalGlobals.concat(hueGlobals).reduce((acc, key) => {
  14. acc[key] = true;
  15. return acc;
  16. }, {});
  17. module.exports = {
  18. env: {
  19. browser: true,
  20. node: true,
  21. es6: true
  22. },
  23. extends: [
  24. 'plugin:prettier/recommended'
  25. ],
  26. globals: globals,
  27. parser: 'babel-eslint',
  28. parserOptions: {
  29. ecmaVersion: 2017,
  30. sourceType: 'module',
  31. ecmaFeatures: {
  32. }
  33. },
  34. plugins: [],
  35. rules: {
  36. 'new-cap': 0,
  37. 'no-console': 0,
  38. 'no-extra-boolean-cast': 0,
  39. 'no-invalid-this': 0,
  40. 'no-lonely-if': 2,
  41. 'no-throw-literal': 0,
  42. 'no-unused-vars': [
  43. 'error',
  44. {
  45. vars: 'all',
  46. args: 'none',
  47. ignoreRestSiblings: true,
  48. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  49. }
  50. ],
  51. 'no-useless-constructor': 2,
  52. 'no-var': 1,
  53. 'no-undef': 2,
  54. 'one-var': 0,
  55. 'prefer-arrow-callback': 2,
  56. 'prefer-const': ['warn', { destructuring: 'all' }],
  57. 'require-jsdoc': 0,
  58. strict: 0,
  59. 'valid-jsdoc': 0,
  60. curly: [2, 'all']
  61. },
  62. settings: {
  63. }
  64. };