Ei kuvausta

eslint.config.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* eslint-disable n/no-unpublished-import */
  2. import cspellConfigs from '@cspell/eslint-plugin/configs'
  3. import js from '@eslint/js'
  4. import jsdoc from 'eslint-plugin-jsdoc'
  5. import perfectionist from 'eslint-plugin-perfectionist'
  6. import pluginVue from 'eslint-plugin-vue'
  7. import { defineConfig } from 'eslint/config'
  8. import neostandard, { plugins } from 'neostandard'
  9. export default defineConfig([
  10. {
  11. ignores: ['**/dist/**'],
  12. },
  13. cspellConfigs.recommended,
  14. {
  15. rules: {
  16. '@cspell/spellchecker': [
  17. 'warn',
  18. {
  19. autoFix: true,
  20. cspell: {
  21. words: [
  22. 'DECI',
  23. 'CENTI',
  24. 'MILLI',
  25. 'Benoit',
  26. 'chargingstations',
  27. 'ctrlr',
  28. 'csms',
  29. 'idtag',
  30. 'idtags',
  31. 'iccid',
  32. 'imsi',
  33. 'ocpp',
  34. 'onconnection',
  35. 'evse',
  36. 'evses',
  37. 'kvar',
  38. 'kvarh',
  39. 'varh',
  40. 'rfid',
  41. 'workerset',
  42. 'logform',
  43. 'mnemonist',
  44. 'poolifier',
  45. 'rambda',
  46. 'measurand',
  47. 'measurands',
  48. 'mikro',
  49. 'neostandard',
  50. 'recurrency',
  51. 'shutdowning',
  52. 'VCAP',
  53. 'workerd',
  54. ],
  55. },
  56. },
  57. ],
  58. },
  59. },
  60. js.configs.recommended,
  61. plugins.promise.configs['flat/recommended'],
  62. ...plugins.n.configs['flat/mixed-esm-and-cjs'],
  63. jsdoc.configs['flat/recommended-typescript'],
  64. {
  65. rules: {
  66. 'jsdoc/check-tag-names': [
  67. 'warn',
  68. {
  69. definedTags: ['defaultValue', 'experimental', 'typeParam'],
  70. typed: true,
  71. },
  72. ],
  73. },
  74. },
  75. ...pluginVue.configs['flat/recommended'],
  76. {
  77. files: ['**/*.vue'],
  78. languageOptions: {
  79. parserOptions: {
  80. parser: '@typescript-eslint/parser',
  81. },
  82. },
  83. },
  84. ...plugins['typescript-eslint'].config(
  85. {
  86. extends: [
  87. ...plugins['typescript-eslint'].configs.strictTypeChecked,
  88. ...plugins['typescript-eslint'].configs.stylisticTypeChecked,
  89. ],
  90. files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '*/**.vue'],
  91. languageOptions: {
  92. parserOptions: {
  93. projectService: true,
  94. tsconfigRootDir: import.meta.dirname,
  95. },
  96. },
  97. },
  98. {
  99. files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
  100. ...plugins['typescript-eslint'].configs.disableTypeChecked,
  101. }
  102. ),
  103. perfectionist.configs['recommended-natural'],
  104. {
  105. files: ['**/*.vue'],
  106. rules: {
  107. 'perfectionist/sort-vue-attributes': 'off',
  108. },
  109. },
  110. ...neostandard({
  111. ts: true,
  112. }),
  113. {
  114. files: [
  115. 'src/charging-station/Bootstrap.ts',
  116. 'src/charging-station/ChargingStation.ts',
  117. 'src/charging-station/Helpers.ts',
  118. 'src/charging-station/ocpp/OCPPServiceUtils.ts',
  119. 'src/charging-station/ocpp/1.6/OCPP16ResponseService.ts',
  120. 'src/performance/PerformanceStatistics.ts',
  121. ],
  122. rules: {
  123. '@stylistic/operator-linebreak': 'off',
  124. },
  125. },
  126. {
  127. files: ['src/scripts/*.cjs'],
  128. rules: {
  129. '@typescript-eslint/no-require-imports': 'off',
  130. },
  131. },
  132. {
  133. files: ['tests/utils/Utils.test.ts'],
  134. rules: {
  135. '@typescript-eslint/no-unsafe-member-access': 'off',
  136. },
  137. },
  138. {
  139. files: ['ui/web/src/components/Container.vue', 'ui/web/src/components/buttons/Button.vue'],
  140. rules: {
  141. 'vue/multi-word-component-names': 'off',
  142. },
  143. },
  144. ])