eslint.config.mjs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import createConfig from '@antfu/eslint-config'
  2. import sonarjs from 'eslint-plugin-sonarjs'
  3. import autoImport from './.eslint-auto-import.mjs'
  4. export default createConfig(
  5. {
  6. stylistic: true,
  7. ignores: ['**/version.json', 'tsconfig.json', 'tsconfig.node.json', '.eslint-auto-import.mjs', '**/china.json', '**/world.json'],
  8. languageOptions: {
  9. globals: {
  10. ...autoImport.globals,
  11. ApexCharts: 'readonly',
  12. NodeJS: 'readonly',
  13. JSX: 'readonly',
  14. },
  15. },
  16. },
  17. sonarjs.configs.recommended,
  18. {
  19. name: '@nginx-ui/eslint-config',
  20. rules: {
  21. 'no-console': 'warn',
  22. 'no-alert': 'warn',
  23. 'ts/no-explicit-any': 'warn',
  24. 'vue/no-unused-refs': 'warn',
  25. 'vue/prop-name-casing': 'warn',
  26. 'node/prefer-global/process': 'off',
  27. 'unused-imports/no-unused-vars': 'warn',
  28. // Prevent redundant manual imports for auto-imported globals
  29. 'import/no-duplicates': 'error',
  30. 'no-undef': 'error',
  31. // https://eslint.org/docs/latest/rules/dot-notation
  32. 'style/dot-notation': 'off',
  33. // https://eslint.org/docs/latest/rules/arrow-parens
  34. 'style/arrow-parens': ['error', 'as-needed'],
  35. // https://eslint.org/docs/latest/rules/prefer-template
  36. 'prefer-template': 'error',
  37. // https://eslint.style/rules/js/arrow-spacing
  38. 'style/arrow-spacing': ['error', { before: true, after: true }],
  39. // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
  40. 'import/prefer-default-export': 'off',
  41. // https://eslint.vuejs.org/rules/require-typed-ref
  42. 'vue/require-typed-ref': 'warn',
  43. // https://eslint.vuejs.org/rules/require-prop-types
  44. 'vue/require-prop-types': 'warn',
  45. // https://eslint.vuejs.org/rules/no-ref-as-operand.html
  46. 'vue/no-ref-as-operand': 'error',
  47. // https://eslint.vuejs.org/rules/component-name-in-template-casing
  48. 'vue/component-name-in-template-casing': ['error', 'PascalCase', {
  49. registeredComponentsOnly: false,
  50. }],
  51. // -- Sonarlint
  52. 'sonarjs/no-duplicate-string': 'off',
  53. 'sonarjs/no-nested-template-literals': 'off',
  54. 'sonarjs/pseudo-random': 'warn',
  55. 'sonarjs/no-nested-functions': 'off',
  56. 'eslint-comments/no-unlimited-disable': 'off',
  57. },
  58. },
  59. )