.eslintrc.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. rigwild's personal ESLint configuration
  3. Using modern JavaScript syntax, very restrictive.
  4. Preferably use with autofix on save.
  5. https://github.com/rigwild
  6. */
  7. // prettier-ignore
  8. module.exports = {
  9. parserOptions: {
  10. parser: 'babel-eslint',
  11. ecmaVersion: 2019,
  12. sourceType: 'module'
  13. },
  14. root: true,
  15. env: {
  16. node: true,
  17. es6: true
  18. },
  19. rules: {
  20. // Possible Errors
  21. // The following rules point out areas where you might have made mistakes.
  22. 'comma-dangle': 1,
  23. 'no-cond-assign': 2,
  24. 'no-constant-condition': 2,
  25. 'no-control-regex': 2,
  26. 'no-debugger': 2,
  27. 'no-dupe-args': 2,
  28. 'no-dupe-keys': 2,
  29. 'no-duplicate-case': 2,
  30. 'no-empty': 2,
  31. 'no-ex-assign': 2,
  32. 'no-extra-boolean-cast': 2,
  33. 'no-extra-parens': 0,
  34. 'no-extra-semi': 2,
  35. 'no-func-assign': 2,
  36. 'no-inner-declarations': 2,
  37. 'no-invalid-regexp': 2,
  38. 'no-irregular-whitespace': 2,
  39. 'no-negated-in-lhs': 2,
  40. 'no-obj-calls': 2,
  41. 'no-regex-spaces': 2,
  42. 'no-sparse-arrays': 2,
  43. 'no-unreachable': 2,
  44. 'use-isnan': 2,
  45. 'valid-jsdoc': 2,
  46. 'valid-typeof': 2,
  47. // Best Practices
  48. // These are rules designed to prevent you from making mistakes.
  49. 'block-scoped-var': 0,
  50. 'complexity': 0,
  51. 'curly': 'off',
  52. 'default-case': 2,
  53. 'dot-notation': 2,
  54. 'eqeqeq': 2,
  55. 'guard-for-in': 2,
  56. 'no-alert': 2,
  57. 'no-caller': 2,
  58. 'no-div-regex': 2,
  59. 'no-else-return': 2,
  60. 'no-eq-null': 2,
  61. 'no-eval': 2,
  62. 'no-extend-native': 2,
  63. 'no-extra-bind': 2,
  64. 'no-fallthrough': 2,
  65. 'no-floating-decimal': 2,
  66. 'no-implied-eval': 2,
  67. 'no-iterator': 2,
  68. 'no-labels': 2,
  69. 'no-lone-blocks': 2,
  70. 'no-loop-func': 2,
  71. 'no-multi-spaces': 2,
  72. 'no-multi-str': 2,
  73. 'no-native-reassign': 2,
  74. 'no-new': 2,
  75. 'no-new-func': 2,
  76. 'no-new-wrappers': 2,
  77. 'no-octal': 2,
  78. 'no-octal-escape': 2,
  79. 'no-proto': 2,
  80. 'no-redeclare': 2,
  81. 'no-script-url': 2,
  82. 'no-self-compare': 2,
  83. 'no-sequences': 2,
  84. 'no-throw-literal': 2,
  85. 'no-void': 2,
  86. 'no-warning-comments': [0, { terms: ['todo', 'fixme'], location: 'start' }],
  87. 'no-with': 2,
  88. 'radix': 2,
  89. 'vars-on-top': 2,
  90. 'wrap-iife': 2,
  91. 'yoda': 2,
  92. // Strict Mode
  93. // These rules relate to using strict mode.
  94. 'strict': 0,
  95. // Variables
  96. // These rules have to do with variable declarations.
  97. 'no-catch-shadow': 2,
  98. 'no-delete-var': 2,
  99. 'no-label-var': 2,
  100. 'no-shadow': 2,
  101. 'no-shadow-restricted-names': 2,
  102. 'no-undef': 2,
  103. 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
  104. 'no-use-before-define': 2,
  105. // Stylistic Issues
  106. // These rules are purely matters of style and are quite subjective.
  107. 'indent': [1, 2],
  108. 'brace-style': ['error', 'stroustrup'],
  109. 'camelcase': 1,
  110. 'comma-spacing': [1, { before: false, after: true }],
  111. 'comma-style': [1, 'last'],
  112. 'consistent-this': [1, '_this'],
  113. 'eol-last': 1,
  114. 'key-spacing': [1, { beforeColon: false, afterColon: true }],
  115. 'new-cap': [1, { newIsCap: true, capIsNew: false }],
  116. 'new-parens': 1,
  117. 'newline-after-var': 0,
  118. 'no-array-constructor': 1,
  119. 'no-mixed-spaces-and-tabs': 1,
  120. 'no-multiple-empty-lines': [1, { max: 2 }],
  121. 'no-trailing-spaces': 1,
  122. 'no-underscore-dangle': 1,
  123. 'quote-props': [1, 'consistent'],
  124. 'quotes': [1, 'single'],
  125. 'semi': ['error', 'never'],
  126. 'keyword-spacing': 'warn',
  127. 'space-before-function-paren': [1, { anonymous: 'always', named: 'never' }],
  128. 'space-in-parens': [1, 'never'],
  129. 'spaced-comment': 'warn',
  130. // ECMAScript 6
  131. // These rules are only relevant to ES6 environments and are off by default.
  132. 'no-var': 2
  133. }
  134. }