Skip to content

Commit d6d2ea4

Browse files
committed
feat(eslint-config): allow abbreviations in dts files¨
1 parent 9ea8ac8 commit d6d2ea4

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

.changeset/poor-stingrays-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apitree.cz/eslint-config': patch
3+
---
4+
5+
Allow abbreviations in `.d.ts` files (often auto-generated).

packages/eslint-config/src/base/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,8 @@ export const config: ConfigArray = tsEslint.config(
9696
...rules.tests,
9797
},
9898
},
99+
{
100+
files: ['**/*.d.ts'],
101+
rules: rules.dts,
102+
},
99103
);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { Linter } from 'eslint';
2+
3+
export const dts: Linter.RulesRecord = {
4+
'unicorn/prevent-abbreviations': 'off', // Allow abbreviations in TypeScript definitions (often auto-generated)
5+
};

packages/eslint-config/src/base/rules/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from './common.js';
2+
export * from './dts.js';
23
export * from './imports.js';
34
export * from './tests.js';
45
export * from './typescript.js';

packages/eslint-config/src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const extraneousDependenciesPatterns = [
1111
'**/test/**/*',
1212
'**/tests/**/*',
1313
'**/types/*.d.ts',
14-
'**/vite.config.ts',
1514
] as const;
1615

1716
export const importExtensions = ['.ts', '.tsx'] as const;

packages/eslint-config/src/nextjs/config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ export const config = (apps = ['.']): Linter.Config[] => {
2020

2121
return [
2222
next,
23-
{
24-
files: apps.map((app) => `${app}/next-env.d.ts`),
25-
rules: {
26-
'unicorn/prevent-abbreviations': 'off', // next-env.d.ts is a Next.js convention
27-
},
28-
},
2923
{
3024
files: apps.map((app) => [`${app}/src/**/layout.tsx`, `${app}/src/**/layouts/**/*.tsx`]).flat(),
3125
rules: {

0 commit comments

Comments
 (0)