unicorn.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/filename-case': 'off',
  18. 'unicorn/import-style': 'off',
  19. 'unicorn/no-array-for-each': 'off',
  20. 'unicorn/no-null': 'off',
  21. 'unicorn/no-useless-undefined': 'off',
  22. 'unicorn/prefer-at': 'off',
  23. 'unicorn/prefer-dom-node-text-content': 'off',
  24. 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
  25. 'unicorn/prefer-global-this': 'off',
  26. 'unicorn/prefer-top-level-await': 'off',
  27. 'unicorn/prevent-abbreviations': 'off',
  28. },
  29. },
  30. {
  31. files: [
  32. 'scripts/**/*.?([cm])[jt]s?(x)',
  33. 'internal/**/*.?([cm])[jt]s?(x)',
  34. ],
  35. rules: {
  36. 'unicorn/no-process-exit': 'off',
  37. },
  38. },
  39. ];
  40. }