.eslintrc.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. module.exports = {
  2. extends: ['prettier'],
  3. parserOptions: {
  4. ecmaVersion: 2021
  5. },
  6. env: {
  7. node: true,
  8. es6: true
  9. },
  10. globals: {
  11. axe: true
  12. },
  13. rules: {
  14. 'no-bitwise': 2,
  15. camelcase: 2,
  16. curly: 2,
  17. eqeqeq: 2,
  18. 'guard-for-in': 2,
  19. 'wrap-iife': [2, 'any'],
  20. 'no-use-before-define': [
  21. 2,
  22. {
  23. functions: false
  24. }
  25. ],
  26. 'new-cap': 2,
  27. 'no-caller': 2,
  28. 'no-empty': 2,
  29. 'no-new': 2,
  30. 'no-plusplus': 0,
  31. 'no-undef': 2,
  32. 'no-unused-vars': 2,
  33. strict: 0,
  34. 'max-params': [2, 6],
  35. 'max-depth': [2, 5],
  36. 'max-len': 0,
  37. semi: 0,
  38. 'no-cond-assign': 0,
  39. 'no-debugger': 2,
  40. 'no-eq-null': 0,
  41. 'no-eval': 2,
  42. 'no-unused-expressions': 0,
  43. 'block-scoped-var': 0,
  44. 'no-iterator': 0,
  45. 'linebreak-style': 0,
  46. 'no-loop-func': 0,
  47. 'no-multi-str': 0,
  48. 'no-proto': 0,
  49. 'no-script-url': 0,
  50. 'dot-notation': 2,
  51. 'no-new-func': 0,
  52. 'no-new-wrappers': 0,
  53. 'no-restricted-syntax': [
  54. 'error',
  55. {
  56. selector: 'MemberExpression[property.name=tagName]',
  57. message: "Don't use node.tagName, use node.nodeName instead."
  58. },
  59. {
  60. // node.attributes can be clobbered so is unsafe to use
  61. // @see https://github.com/dequelabs/axe-core/pull/1432
  62. selector:
  63. 'MemberExpression[object.name=node][property.name=attributes]',
  64. message:
  65. "Don't use node.attributes, use node.hasAttributes() or axe.utils.getNodeAttributes(node) instead."
  66. }
  67. ]
  68. },
  69. overrides: [
  70. {
  71. files: ['lib/**/*.js'],
  72. parserOptions: {
  73. sourceType: 'module'
  74. },
  75. env: {
  76. browser: true,
  77. es6: true
  78. },
  79. globals: {
  80. window: true,
  81. document: true
  82. },
  83. rules: {
  84. 'func-names': [2, 'as-needed'],
  85. 'prefer-const': 2
  86. }
  87. },
  88. {
  89. files: ['test/**/*.js'],
  90. parserOptions: {
  91. ecmaVersion: 5
  92. },
  93. env: {
  94. browser: true,
  95. es6: false,
  96. mocha: true
  97. },
  98. globals: {
  99. assert: true,
  100. helpers: true,
  101. checks: true,
  102. sinon: true
  103. },
  104. plugins: ['mocha-no-only'],
  105. rules: {
  106. 'new-cap': 0,
  107. 'no-use-before-define': 0,
  108. 'mocha-no-only/mocha-no-only': ['error']
  109. }
  110. }
  111. ]
  112. };