Skip to content

Commit

Permalink
feat: @typescript-eslint/consistent-type-{imports/exports}
Browse files Browse the repository at this point in the history
BREAKING CHANGE: @typescript-eslint/consistent-type-{imports/exports}

Co-authored-by: Rostislav Simonik <[email protected]>
  • Loading branch information
mightyiam and rostislav-simonik committed Jan 24, 2023
1 parent 4c4b7cc commit bf0f96f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/eslint-config-standard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from 'eslint-config-standard/.eslintrc.json'
import { Linter } from 'eslint'
import { type Linter } from 'eslint'

const casted = config as unknown as Linter.Config

Expand Down
14 changes: 10 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import exported from '.'
import configStandard from './eslint-config-standard'
import { rules as typescriptEslintRules } from '@typescript-eslint/eslint-plugin'
import standardPkg from 'eslint-config-standard/package.json'
import { NormalizedPackageJson } from 'read-pkg-up'
import type { NormalizedPackageJson, readPackageUp } from 'read-pkg-up'
import { Linter } from 'eslint'
import { readFile } from 'fs/promises'
import { resolve } from 'path'
Expand All @@ -21,7 +21,7 @@ interface PkgDetails {
}

const getPkgDetails = async (): Promise<PkgDetails> => {
const readPkgUp: typeof import('read-pkg-up')['readPackageUp'] = (await inclusion('read-pkg-up')).readPackageUp
const readPkgUp: typeof readPackageUp = (await inclusion('read-pkg-up')).readPackageUp
const readResult = await readPkgUp()
if (readResult === undefined) { throw new Error() }
const ourPkg = readResult.packageJson
Expand Down Expand Up @@ -162,6 +162,14 @@ test('export', (t): void => {
}
],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-exports': ['error', {
fixMixedExportsWithInlineTypeSpecifier: true
}],
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports'
}],
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
'@typescript-eslint/explicit-function-return-type': ['error', {
allowExpressions: true,
Expand Down Expand Up @@ -421,8 +429,6 @@ test('all plugin rules are considered', (t) => {
// and then fail upon plugin upgrades where new rules are released.
const notYetConsideredRules: string[] = [
'class-literal-property-style',
'consistent-type-exports',
'consistent-type-imports',
'default-param-last',
'explicit-member-accessibility',
'explicit-module-boundary-types',
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import configStandard from './eslint-config-standard'
import { Linter } from 'eslint'
import { type Linter } from 'eslint'

const equivalents = [
'comma-spacing',
Expand Down Expand Up @@ -149,6 +149,14 @@ const config: Linter.Config = {
}
],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-exports': ['error', {
fixMixedExportsWithInlineTypeSpecifier: true
}],
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports'
}],
'@typescript-eslint/explicit-function-return-type': ['error', {
allowExpressions: true,
allowHigherOrderFunctions: true,
Expand Down

0 comments on commit bf0f96f

Please sign in to comment.