.eslintrc.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. // \src\share\canvas_share.js
  79. React: true,
  80. appState: true,
  81. ExcalidrawLib: true,
  82. elements: true,
  83. files: true,
  84. ReactDOM: true,
  85. // src\public\app\widgets\type_widgets\relation_map.js
  86. jsPlumb: true,
  87. panzoom: true,
  88. logError: true,
  89. // src\public\app\widgets\type_widgets\image.js
  90. WZoom: true,
  91. // \src\public\app\widgets\type_widgets\read_only_text.js
  92. renderMathInElement: true,
  93. // \src\public\app\widgets\type_widgets\editable_text.js
  94. BalloonEditor: true,
  95. FancytreeNode: true,
  96. CKEditorInspector: true,
  97. // \src\public\app\widgets\type_widgets\editable_code.js
  98. CodeMirror: true,
  99. // \src\public\app\services\resizer.js
  100. Split: true,
  101. // \src\public\app\services\content_renderer.js
  102. mermaid: true,
  103. // src\public\app\services\frontend_script_api.js
  104. dayjs: true,
  105. // \src\public\app\widgets\note_map.js
  106. ForceGraph: true,
  107. // \src\public\app\setup.js
  108. ko: true,
  109. syncInProgress: true,
  110. // src\public\app\services\utils.js
  111. logInfo: true,
  112. __non_webpack_require__: true,
  113. //
  114. },
  115. parserOptions: {
  116. ecmaVersion: 'latest',
  117. sourceType: 'module',
  118. },
  119. rules: {
  120. // eslint:recommended
  121. 'no-unused-vars': 'off',
  122. 'linebreak-style': 'off',
  123. 'no-useless-escape': 'off',
  124. 'no-empty': 'off',
  125. 'no-constant-condition': 'off',
  126. 'getter-return': 'off',
  127. 'no-cond-assign': 'off',
  128. 'no-async-promise-executor': 'off',
  129. 'no-extra-semi': 'off',
  130. 'no-inner-declarations': 'off',
  131. // prettier
  132. 'prettier/prettier': ['off', { endOfLine: 'auto' }],
  133. // airbnb-base
  134. 'no-console': 'off',
  135. 'no-plusplus': 'off',
  136. 'no-param-reassign': 'off',
  137. 'global-require': 'off',
  138. 'no-use-before-define': 'off',
  139. 'no-await-in-loop': 'off',
  140. radix: 'off',
  141. 'import/order': 'off',
  142. 'import/no-extraneous-dependencies': 'off',
  143. 'prefer-destructuring': 'off',
  144. 'no-shadow': 'off',
  145. 'no-new': 'off',
  146. 'no-restricted-syntax': 'off',
  147. strict: 'off',
  148. 'class-methods-use-this': 'off',
  149. 'no-else-return': 'off',
  150. 'import/no-dynamic-require': 'off',
  151. 'no-underscore-dangle': 'off',
  152. 'prefer-template': 'off',
  153. 'consistent-return': 'off',
  154. 'no-continue': 'off',
  155. 'object-shorthand': 'off',
  156. 'one-var': 'off',
  157. 'prefer-const': 'off',
  158. 'spaced-comment': 'off',
  159. 'no-loop-func': 'off',
  160. 'arrow-body-style': 'off',
  161. 'guard-for-in': 'off',
  162. 'no-return-assign': 'off',
  163. 'dot-notation': 'off',
  164. 'func-names': 'off',
  165. 'import/no-useless-path-segments': 'off',
  166. 'default-param-last': 'off',
  167. 'prefer-arrow-callback': 'off',
  168. 'no-unneeded-ternary': 'off',
  169. 'no-return-await': 'off',
  170. 'import/extensions': 'off',
  171. 'no-var': 'off',
  172. 'import/newline-after-import': 'off',
  173. 'no-restricted-globals': 'off',
  174. 'operator-assignment': 'off',
  175. 'no-eval': 'off',
  176. 'max-classes-per-file': 'off',
  177. 'vars-on-top': 'off',
  178. 'no-bitwise': 'off',
  179. 'no-lonely-if': 'off',
  180. 'no-multi-assign': 'off',
  181. 'no-promise-executor-return': 'off',
  182. 'no-empty-function': 'off',
  183. 'import/no-unresolved': 'off',
  184. camelcase: 'off',
  185. eqeqeq: 'off',
  186. 'lines-between-class-members': 'off',
  187. 'import/no-cycle': 'off',
  188. 'new-cap': 'off',
  189. 'prefer-object-spread': 'off',
  190. 'no-new-func': 'off',
  191. 'no-unused-expressions': 'off',
  192. 'lines-around-directive': 'off',
  193. 'prefer-exponentiation-operator': 'off',
  194. 'no-restricted-properties': 'off',
  195. 'prefer-rest-params': 'off',
  196. 'no-unreachable-loop': 'off',
  197. 'no-alert': 'off',
  198. 'no-useless-return': 'off',
  199. 'no-nested-ternary': 'off',
  200. 'prefer-regex-literals': 'off',
  201. 'import/no-named-as-default-member': 'off',
  202. yoda: 'off',
  203. 'no-script-url': 'off',
  204. 'no-prototype-builtins':'off'
  205. },
  206. };