From ebd96572ddf44579c1f4b7e34fc5861c0fa9b765 Mon Sep 17 00:00:00 2001 From: JounQin Date: Tue, 14 Apr 2020 02:50:37 +0800 Subject: [PATCH] fix: exports of eslint-plugin-prettier changed (#43817) --- .../eslint-plugin-prettier-tests.ts | 30 ++--------------- types/eslint-plugin-prettier/index.d.ts | 32 ++++++------------- 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/types/eslint-plugin-prettier/eslint-plugin-prettier-tests.ts b/types/eslint-plugin-prettier/eslint-plugin-prettier-tests.ts index a6b02c6afd..f844a6cdf7 100644 --- a/types/eslint-plugin-prettier/eslint-plugin-prettier-tests.ts +++ b/types/eslint-plugin-prettier/eslint-plugin-prettier-tests.ts @@ -1,28 +1,4 @@ -import * as utils from 'eslint-plugin-prettier'; +import { configs, rules } from 'eslint-plugin-prettier'; -declare function log(...args: Array): void; - -utils.showInvisibles(' some string '); - -utils.generateDifferences('abc', 'def').forEach(difference => { - const { - operation, - offset, - deleteText = '', - insertText = '', - } = difference; - - switch (operation) { - case 'delete': - log('delete', offset, deleteText); - break; - case 'insert': - log('insert', offset, insertText); - break; - case 'replace': - log('replace', offset, insertText, deleteText); - break; - default: - throw new Error(`Unexpected operation: '${operation}'`); - } -}); +configs.recommended; +rules.prettier; diff --git a/types/eslint-plugin-prettier/index.d.ts b/types/eslint-plugin-prettier/index.d.ts index b91558d6e4..c2a0592327 100644 --- a/types/eslint-plugin-prettier/index.d.ts +++ b/types/eslint-plugin-prettier/index.d.ts @@ -1,29 +1,15 @@ -// Type definitions for eslint-plugin-prettier 2.2 +// Type definitions for eslint-plugin-prettier 3.1 // Project: https://github.com/prettier/eslint-plugin-prettier // Definitions by: Ika +// JounQin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Converts invisible characters to a commonly recognizable visible form. - * @param str The string with invisibles to convert. - */ -export function showInvisibles(str: string): string; +import { Linter, Rule } from 'eslint'; -/** - * Generate results for differences between source code and formatted version. - * @param source The original source. - * @param formatted The formatted source. - */ -export function generateDifferences( - source: string, - formatted: string, -): Difference[]; +export const configs: { + recommended: Linter.Config; +}; -export interface Difference { - operation: 'insert' | 'delete' | 'replace'; - offset: number; - insertText?: string; - deleteText?: string; -} - -export const rules: any; +export const rules: { + prettier: Rule.RuleModule; +};