unicorn.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type { Linter } from 'eslint';
  2. import { interopDefault } from '../util';
  3. export async function unicorn(): Promise<Linter.Config[]> {
  4. const [pluginUnicorn] = await Promise.all([
  5. interopDefault(import('eslint-plugin-unicorn')),
  6. ] as const);
  7. return [
  8. {
  9. plugins: {
  10. unicorn: pluginUnicorn,
  11. },
  12. rules: {
  13. ...pluginUnicorn.configs.recommended.rules,
  14. 'unicorn/better-regex': 'off',
  15. 'unicorn/consistent-destructuring': 'off',
  16. 'unicorn/consistent-function-scoping': 'off',
  17. 'unicorn/expiring-todo-comments': 'off',
  18. 'unicorn/filename-case': 'off',
  19. 'unicorn/import-style': 'off',
  20. 'unicorn/no-array-for-each': 'off',
  21. 'unicorn/no-null': 'off',
  22. 'unicorn/no-useless-undefined': 'off',
  23. 'unicorn/prefer-at': 'off',
  24. 'unicorn/prefer-dom-node-text-content': 'off',
  25. 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
  26. 'unicorn/prefer-global-this': 'off',
  27. 'unicorn/prefer-top-level-await': 'off',
  28. 'unicorn/prevent-abbreviations': 'off',
  29. },
  30. },
  31. {
  32. files: [
  33. 'scripts/**/*.?([cm])[jt]s?(x)',
  34. 'internal/**/*.?([cm])[jt]s?(x)',
  35. ],
  36. rules: {
  37. 'unicorn/no-process-exit': 'off',
  38. },
  39. },
  40. ];
  41. }