Skip to content

Commit 981099a

Browse files
committed
Adjust lint config to require explicit type modifiers in imports/exports
Different compilers need this info to be able to avoid/drop TS-only imports/exports that aren't for runtime.
1 parent ddb2d04 commit 981099a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.eslintrc.cjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ const restrictedImports = [
8888
path: '@nestjs/platform-fastify',
8989
replacement: { path: '~/core/http' },
9090
},
91+
{
92+
path: 'type-fest',
93+
kind: 'value',
94+
message: 'Be sure to specify the `type` modifier',
95+
},
9196
];
9297

9398
const namingConvention = [
@@ -161,24 +166,20 @@ const namingConvention = [
161166
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
162167
const config = {
163168
root: true,
164-
plugins: [
165-
'@seedcompany',
166-
'typescript-sort-keys',
167-
'no-only-tests',
168-
],
169+
plugins: ['@seedcompany', 'typescript-sort-keys', 'no-only-tests'],
169170
extends: ['plugin:@seedcompany/nestjs'],
170171
rules: {
171172
'no-console': 'error',
172173
'no-only-tests/no-only-tests': 'error',
173174
'@typescript-eslint/naming-convention': ['warn', ...namingConvention],
174-
'no-restricted-imports': ['error', { 'paths': oldRestrictedImports }],
175+
'no-restricted-imports': ['error', { paths: oldRestrictedImports }],
175176
'@seedcompany/no-restricted-imports': ['error', ...restrictedImports],
176177
'no-restricted-syntax': [
177178
'error',
178179
...baseConfig.rules['no-restricted-syntax']?.slice(1),
179180
{
180181
selector: 'NewExpression[callee.name="Logger"]',
181-
'message': `
182+
message: `
182183
Inject a logger instead
183184
184185
constructor(
@@ -187,6 +188,14 @@ const config = {
187188
`,
188189
},
189190
],
191+
'@typescript-eslint/consistent-type-imports': [
192+
'error',
193+
{ fixStyle: 'inline-type-imports' },
194+
],
195+
'@typescript-eslint/consistent-type-exports': [
196+
'error',
197+
{ fixMixedExportsWithInlineTypeSpecifier: true },
198+
],
190199
// TODO Enable this and fix errors (both types & logic changes will be needed)
191200
'@typescript-eslint/no-unnecessary-condition': 'off',
192201
},

0 commit comments

Comments
 (0)