eslint.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2019-2024 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. import globals from 'globals'
  5. import eslint from '@eslint/js'
  6. import prettierConfig from 'eslint-config-prettier'
  7. import securityPlugin from 'eslint-plugin-security'
  8. import tseslint from 'typescript-eslint'
  9. /** @type {import('eslint').Linter.FlatConfig[]} */
  10. export default [
  11. eslint.configs.recommended,
  12. prettierConfig,
  13. securityPlugin.configs.recommended,
  14. ...tseslint.configs.recommendedTypeChecked,
  15. {
  16. languageOptions: {
  17. globals: {
  18. ...globals.node,
  19. ...globals.jest,
  20. __statics: true,
  21. process: true
  22. },
  23. parserOptions: {
  24. project: true,
  25. tsconfigRootDir: import.meta.dirname
  26. }
  27. },
  28. rules: {
  29. 'no-console': 'error',
  30. 'no-debugger': 'error',
  31. 'no-process-exit': 'off',
  32. 'security/detect-non-literal-fs-filename': 'warn',
  33. 'security/detect-unsafe-regex': 'error',
  34. 'security/detect-buffer-noassert': 'error',
  35. 'security/detect-child-process': 'warn',
  36. 'security/detect-disable-mustache-escape': 'error',
  37. 'security/detect-eval-with-expression': 'error',
  38. 'security/detect-no-csrf-before-method-override': 'error',
  39. 'security/detect-non-literal-regexp': 'error',
  40. 'security/detect-non-literal-require': 'warn',
  41. 'security/detect-object-injection': 'warn',
  42. 'security/detect-possible-timing-attacks': 'error',
  43. 'security/detect-pseudoRandomBytes': 'error',
  44. 'space-before-function-paren': 'off',
  45. '@typescript-eslint/default-param-last': 'off',
  46. '@typescript-eslint/strict-boolean-expressions': 0,
  47. 'no-return-await': 'warn',
  48. '@typescript-eslint/return-await': 'off'
  49. }
  50. }
  51. ]