Skip to content

Commit

Permalink
Merge pull request #173 from Leomotors/export-config-option-types
Browse files Browse the repository at this point in the history
feat: export plugin config types
  • Loading branch information
ayusharma authored Oct 20, 2022
2 parents d2e68d0 + 2982ccf commit b71b8b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "3.3.1",
"description": "A prettier plugins to sort imports in provided RegEx order",
"main": "lib/src/index.js",
"types": "types/index.d.ts",
"repository": {
"url": "https://github.com/trivago/prettier-plugin-sort-imports",
"type": "git"
Expand Down
12 changes: 3 additions & 9 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { ExpressionStatement, ImportDeclaration } from '@babel/types';
import { RequiredOptions } from 'prettier';

export interface PrettierOptions extends RequiredOptions {
importOrder: string[];
importOrderCaseInsensitive: boolean;
// should be of type ParserPlugin from '@babel/parser' but prettier does not support nested arrays in options
importOrderParserPlugins: string[];
importOrderSeparation: boolean;
importOrderGroupNamespaceSpecifiers: boolean;
importOrderSortSpecifiers: boolean;
}
import { PluginConfig } from '../types';

export interface PrettierOptions extends PluginConfig, RequiredOptions {}

export type ImportGroups = Record<string, ImportDeclaration[]>;
export type ImportOrLine = ImportDeclaration | ExpressionStatement;
Expand Down
13 changes: 13 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Config } from 'prettier';

export interface PluginConfig {
importOrder: string[];
importOrderCaseInsensitive: boolean;
// should be of type ParserPlugin from '@babel/parser' but prettier does not support nested arrays in options
importOrderParserPlugins: string[];
importOrderSeparation: boolean;
importOrderGroupNamespaceSpecifiers: boolean;
importOrderSortSpecifiers: boolean;
}

export type PrettierConfig = PluginConfig & Config;

0 comments on commit b71b8b4

Please sign in to comment.