fix: exports of eslint-plugin-prettier changed (#43817)

This commit is contained in:
JounQin 2020-04-14 02:50:37 +08:00 committed by GitHub
parent f5ad8554cd
commit ebd96572dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 50 deletions

View File

@ -1,28 +1,4 @@
import * as utils from 'eslint-plugin-prettier';
import { configs, rules } from 'eslint-plugin-prettier';
declare function log(...args: Array<string | number>): 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;

View File

@ -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 <https://github.com/ikatyang>
// JounQin <https://github.com/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;
};