.eslintrc.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. module.exports = {
  2. env: {
  3. browser: true,
  4. commonjs: true,
  5. es2021: true,
  6. node: true,
  7. },
  8. // plugins: ['prettier'], // to be activated
  9. extends: ['eslint:recommended', 'airbnb-base', 'plugin:jsonc/recommended-with-jsonc', 'prettier'],
  10. overrides: [
  11. {
  12. files: ['*.json', '*.json5', '*.jsonc'],
  13. parser: 'jsonc-eslint-parser',
  14. },
  15. {
  16. files: ['package.json'],
  17. parser: 'jsonc-eslint-parser',
  18. rules: {
  19. 'jsonc/sort-keys': [
  20. 'off',
  21. {
  22. pathPattern: '^$',
  23. order: [
  24. 'name',
  25. 'version',
  26. 'private',
  27. 'packageManager',
  28. 'description',
  29. 'type',
  30. 'keywords',
  31. 'homepage',
  32. 'bugs',
  33. 'license',
  34. 'author',
  35. 'contributors',
  36. 'funding',
  37. 'files',
  38. 'main',
  39. 'module',
  40. 'exports',
  41. 'unpkg',
  42. 'jsdelivr',
  43. 'browser',
  44. 'bin',
  45. 'man',
  46. 'directories',
  47. 'repository',
  48. 'publishConfig',
  49. 'scripts',
  50. 'peerDependencies',
  51. 'peerDependenciesMeta',
  52. 'optionalDependencies',
  53. 'dependencies',
  54. 'devDependencies',
  55. 'engines',
  56. 'config',
  57. 'overrides',
  58. 'pnpm',
  59. 'husky',
  60. 'lint-staged',
  61. 'eslintConfig',
  62. ],
  63. },
  64. {
  65. pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
  66. order: { type: 'asc' },
  67. },
  68. ],
  69. },
  70. },
  71. ],
  72. globals: {
  73. $: true,
  74. jQuery: true,
  75. glob: true,
  76. log: true,
  77. EditorWatchdog: true,
  78. React: true,
  79. appState: true,
  80. ExcalidrawLib: true,
  81. elements: true,
  82. files: true,
  83. ReactDOM: true,
  84. // src\public\app\widgets\type_widgets\relation_map.js
  85. jsPlumb: true,
  86. panzoom: true,
  87. logError: true,
  88. // src\public\app\widgets\type_widgets\image.js
  89. WZoom: true,
  90. // \src\public\app\widgets\type_widgets\read_only_text.js
  91. renderMathInElement: true,
  92. // \src\public\app\widgets\type_widgets\editable_text.js
  93. BalloonEditor: true,
  94. FancytreeNode: true,
  95. CKEditorInspector: true,
  96. // \src\public\app\widgets\type_widgets\editable_code.js
  97. CodeMirror: true,
  98. // \src\public\app\services\resizer.js
  99. Split: true,
  100. // \src\public\app\services\content_renderer.js
  101. mermaid: true,
  102. // src\public\app\services\frontend_script_api.js
  103. dayjs: true,
  104. // \src\public\app\widgets\note_map.js
  105. ForceGraph: true,
  106. // \src\public\app\setup.js
  107. ko: true,
  108. syncInProgress: true,
  109. // src\public\app\services\utils.js
  110. logInfo: true,
  111. __non_webpack_require__: true,
  112. describe: true,
  113. it: true,
  114. expect: true
  115. },
  116. parserOptions: {
  117. ecmaVersion: 'latest',
  118. sourceType: 'module',
  119. },
  120. rules: {
  121. // eslint:recommended
  122. 'no-unused-vars': 'off',
  123. 'linebreak-style': 'off',
  124. 'no-useless-escape': 'off',
  125. 'no-empty': 'off',
  126. 'no-constant-condition': 'off',
  127. 'getter-return': 'off',
  128. 'no-cond-assign': 'off',
  129. 'no-async-promise-executor': 'off',
  130. 'no-extra-semi': 'off',
  131. 'no-inner-declarations': 'off',
  132. // prettier
  133. 'prettier/prettier': ['off', { endOfLine: 'auto' }],
  134. // airbnb-base
  135. 'no-console': 'off',
  136. 'no-plusplus': 'off',
  137. 'no-param-reassign': 'off',
  138. 'global-require': 'off',
  139. 'no-use-before-define': 'off',
  140. 'no-await-in-loop': 'off',
  141. radix: 'off',
  142. 'import/order': 'off',
  143. 'import/no-extraneous-dependencies': 'off',
  144. 'prefer-destructuring': 'off',
  145. 'no-shadow': 'off',
  146. 'no-new': 'off',
  147. 'no-restricted-syntax': 'off',
  148. strict: 'off',
  149. 'class-methods-use-this': 'off',
  150. 'no-else-return': 'off',
  151. 'import/no-dynamic-require': 'off',
  152. 'no-underscore-dangle': 'off',
  153. 'prefer-template': 'off',
  154. 'consistent-return': 'off',
  155. 'no-continue': 'off',
  156. 'object-shorthand': 'off',
  157. 'one-var': 'off',
  158. 'prefer-const': 'off',
  159. 'spaced-comment': 'off',
  160. 'no-loop-func': 'off',
  161. 'arrow-body-style': 'off',
  162. 'guard-for-in': 'off',
  163. 'no-return-assign': 'off',
  164. 'dot-notation': 'off',
  165. 'func-names': 'off',
  166. 'import/no-useless-path-segments': 'off',
  167. 'default-param-last': 'off',
  168. 'prefer-arrow-callback': 'off',
  169. 'no-unneeded-ternary': 'off',
  170. 'no-return-await': 'off',
  171. 'import/extensions': 'off',
  172. 'no-var': 'off',
  173. 'import/newline-after-import': 'off',
  174. 'no-restricted-globals': 'off',
  175. 'operator-assignment': 'off',
  176. 'no-eval': 'off',
  177. 'max-classes-per-file': 'off',
  178. 'vars-on-top': 'off',
  179. 'no-bitwise': 'off',
  180. 'no-lonely-if': 'off',
  181. 'no-multi-assign': 'off',
  182. 'no-promise-executor-return': 'off',
  183. 'no-empty-function': 'off',
  184. 'import/no-unresolved': 'off',
  185. camelcase: 'off',
  186. eqeqeq: 'off',
  187. 'lines-between-class-members': 'off',
  188. 'import/no-cycle': 'off',
  189. 'new-cap': 'off',
  190. 'prefer-object-spread': 'off',
  191. 'no-new-func': 'off',
  192. 'no-unused-expressions': 'off',
  193. 'lines-around-directive': 'off',
  194. 'prefer-exponentiation-operator': 'off',
  195. 'no-restricted-properties': 'off',
  196. 'prefer-rest-params': 'off',
  197. 'no-unreachable-loop': 'off',
  198. 'no-alert': 'off',
  199. 'no-useless-return': 'off',
  200. 'no-nested-ternary': 'off',
  201. 'prefer-regex-literals': 'off',
  202. 'import/no-named-as-default-member': 'off',
  203. yoda: 'off',
  204. 'no-script-url': 'off',
  205. 'no-prototype-builtins':'off'
  206. },
  207. };