.eslintrc.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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', '__webpack_public_path__',
  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-restricted-syntax": [
  41. "error",
  42. {
  43. "selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(warn|error|info|trace)$/]",
  44. "message": "Unexpected property on console object was called"
  45. }
  46. ],
  47. 'no-extra-boolean-cast': 0,
  48. 'no-invalid-this': 0,
  49. 'no-lonely-if': 2,
  50. 'no-throw-literal': 0,
  51. 'no-unused-vars': [
  52. 'error',
  53. {
  54. vars: 'all',
  55. args: 'none',
  56. ignoreRestSiblings: true,
  57. varsIgnorePattern: '_[a-zA-Z0-9_]+'
  58. }
  59. ],
  60. 'no-useless-constructor': 2,
  61. 'no-var': 1,
  62. 'no-undef': 2,
  63. 'one-var': 0,
  64. 'prefer-arrow-callback': 2,
  65. 'prefer-const': ['warn', { destructuring: 'all' }],
  66. 'require-jsdoc': 0,
  67. strict: 0,
  68. 'valid-jsdoc': 0,
  69. curly: [2, 'all']
  70. },
  71. settings: {
  72. }
  73. };