Skip to content

Commit 948ce47

Browse files
authored
feat!: define rules for consistent type import style (#263)
Prefer: ```ts import type { Foo } from 'bar' ``` over ```ts import { type Foo } from 'bar' ``` After compilation it doesn't make any difference but it would be good to settle on one style or the other. BREAKING CHANGE: type import style is now specified, re-run linting with `--fix` to patch up any rule violations
1 parent da5bd5a commit 948ce47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030
'@typescript-eslint/return-await': ['error', 'in-try-catch'], // require awaiting thenables returned from try/catch
3131
'jsdoc/require-param': 'off', // do not require jsdoc for params
3232
'jsdoc/require-param-type': 'off', // allow compiler to derive param type
33-
'no-undef': 'off' // typescript already checks for undefined variables so this is redundant - https://typescript-eslint.io/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
33+
'no-undef': 'off', // typescript already checks for undefined variables so this is redundant - https://typescript-eslint.io/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
34+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'] // prefer `import type { Foo }` over `import { type Foo }`
3435
}
3536
}

0 commit comments

Comments
 (0)