1
0

eslint.config.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import js from '@eslint/js';
  2. import globals from 'globals';
  3. import mdcs from 'eslint-config-mdcs';
  4. import compat from 'eslint-plugin-compat';
  5. import html from 'eslint-plugin-html';
  6. import importPlugin from 'eslint-plugin-import';
  7. import jsdoc from 'eslint-plugin-jsdoc';
  8. export default [
  9. // files to ignore
  10. {
  11. name: 'files to ignore',
  12. ignores: [
  13. '**/node_modules/**',
  14. '**/build/**',
  15. '**/libs/**',
  16. '**/ifc/**',
  17. '**/prettify.js',
  18. '**/prettify/**',
  19. '**/3rdparty/**',
  20. '**/shapefile.js',
  21. '**/vendor/**',
  22. '**/fuse/**'
  23. ]
  24. },
  25. // recommended
  26. js.configs.recommended,
  27. // jsdoc.configs['flat/recommended'],
  28. // base rules
  29. {
  30. name: 'base rules',
  31. files: [ '**/*.js', '**/*.html' ],
  32. plugins: {
  33. html,
  34. import: importPlugin,
  35. compat,
  36. jsdoc
  37. },
  38. languageOptions: {
  39. ecmaVersion: 2018,
  40. sourceType: 'module',
  41. globals: {
  42. ...globals.browser,
  43. ...globals.node,
  44. ...globals.es2017,
  45. __THREE_DEVTOOLS__: 'readonly',
  46. potpack: 'readonly',
  47. fflate: 'readonly',
  48. Stats: 'readonly',
  49. XRWebGLBinding: 'readonly',
  50. XRWebGLLayer: 'readonly',
  51. GPUShaderStage: 'readonly',
  52. GPUBufferUsage: 'readonly',
  53. GPUTextureUsage: 'readonly',
  54. GPUTexture: 'readonly',
  55. GPUMapMode: 'readonly',
  56. QUnit: 'readonly',
  57. Ammo: 'readonly',
  58. XRRigidTransform: 'readonly',
  59. XRMediaBinding: 'readonly',
  60. CodeMirror: 'readonly',
  61. esprima: 'readonly',
  62. jsonlint: 'readonly',
  63. VideoFrame: 'readonly',
  64. VideoDecoder: 'readonly',
  65. Float16Array: 'readonly',
  66. BigInt: 'readonly',
  67. BigUint64Array: 'readonly'
  68. },
  69. },
  70. settings: {
  71. polyfills: [
  72. 'WebGL2RenderingContext'
  73. ],
  74. jsdoc: {
  75. preferredTypes: {
  76. Any: 'any',
  77. Boolean: 'boolean',
  78. Number: 'number',
  79. object: 'Object',
  80. String: 'string'
  81. },
  82. tagNamePreference: {
  83. returns: 'return',
  84. extends: 'augments'
  85. },
  86. },
  87. },
  88. rules: {
  89. ...mdcs.rules,
  90. ...compat.configs.recommended.rules,
  91. 'no-throw-literal': 'error',
  92. 'quotes': [ 'error', 'single' ],
  93. 'prefer-const': [ 'error', {
  94. destructuring: 'any',
  95. ignoreReadBeforeAssign: false
  96. } ],
  97. 'no-irregular-whitespace': 'error',
  98. 'no-duplicate-imports': 'error',
  99. 'prefer-spread': 'error',
  100. 'no-useless-escape': 'off',
  101. 'no-case-declarations': 'off',
  102. 'no-cond-assign': 'off',
  103. 'getter-return': 'off',
  104. 'no-async-promise-executor': 'off',
  105. 'no-empty': 'off',
  106. // 'jsdoc/check-types': 'error',
  107. 'jsdoc/require-returns': 'off',
  108. 'jsdoc/require-returns-type': 'error',
  109. 'jsdoc/require-param-description': 'off',
  110. 'jsdoc/require-returns-description': 'off',
  111. 'jsdoc/require-param-type': 'error'
  112. }
  113. }
  114. ];
粤ICP备19079148号