unicorn.ts 1.1 KB

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