eslint.config.mjs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import antfu from '@antfu/eslint-config'
  2. import eslintPluginJsonSchemaValidator from 'eslint-plugin-json-schema-validator'
  3. export default antfu(
  4. {
  5. formatters: true,
  6. typescript: true,
  7. },
  8. ...eslintPluginJsonSchemaValidator.configs['flat/recommended'],
  9. {
  10. rules: {
  11. 'new-cap': [
  12. 'error',
  13. { newIsCapExceptions: ['iFrame'], capIsNew: false, newIsCap: true, properties: true },
  14. ],
  15. 'jsonc/sort-keys': [
  16. 'error',
  17. {
  18. pathPattern: '^$',
  19. order: [
  20. '$schema',
  21. 'apiVersion',
  22. 'author',
  23. 'contributors',
  24. 'service',
  25. 'altnames',
  26. 'description',
  27. 'url',
  28. 'regExp',
  29. 'version',
  30. 'logo',
  31. 'thumbnail',
  32. 'color',
  33. 'category',
  34. 'tags',
  35. 'iframe',
  36. 'iFrameRegExp',
  37. 'readLogs',
  38. 'settings',
  39. 'mobile',
  40. ],
  41. },
  42. {
  43. pathPattern: '^settings$',
  44. order: ['id', 'title', 'icon', 'value', 'placeholder', 'if'],
  45. },
  46. {
  47. pathPattern: '^settings\\.if$',
  48. order: { type: 'asc' },
  49. },
  50. {
  51. pathPattern: '^description$',
  52. order: { type: 'asc' },
  53. },
  54. ],
  55. 'json-schema-validator/no-invalid': 'error',
  56. },
  57. },
  58. {
  59. files: ['websites/**/*.ts'],
  60. languageOptions: {
  61. parser: await import('@typescript-eslint/parser'),
  62. parserOptions: {
  63. project: './tsconfig.base.json',
  64. },
  65. },
  66. rules: {
  67. 'ts/no-deprecated': 'error',
  68. },
  69. },
  70. )