Skip to content

Commit

Permalink
added legacy linter warning logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ntotten committed Apr 13, 2020
1 parent 0000397 commit 875b9d6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to the "prettier-vscode" extension will be documented in thi

- Removed AppInsights telemetry as its no longer needed
- Updated instructions on how to use linters
- Added log warning about legacy linter integrations

## [4.2.0]

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,7 @@ When a `package.json` is present in your project and it contains prettier, plugi
**Your project is configured to use an outdated version of prettier that cannot be used by this extension. Upgrade to the latest version of prettier.**

You must upgrade to a newer version of prettier.

**You are using a legacy linter integration that will be removed in the future.**

Support for prettier-eslint, prettier-tslint, and prettier-stylelint will be removed in a future version of this extension. You should switch to one of the [supported and recommended ways of integrating Prettier with linters](https://github.com/prettier/prettier-vscode#linter-integration).
5 changes: 4 additions & 1 deletion src/PrettierEditService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ConfigResolver, RangeFormattingOptions } from "./ConfigResolver";
import { IgnorerResolver } from "./IgnorerResolver";
import { LanguageResolver } from "./LanguageResolver";
import { LoggingService } from "./LoggingService";
import { INVALID_PRETTIER_CONFIG } from "./message";
import { INVALID_PRETTIER_CONFIG, LEGACY_LINTER_INTEGRATION } from "./message";
import { ModuleResolver } from "./ModuleResolver";
import { NotificationService } from "./NotificationService";
import { PrettierEditProvider } from "./PrettierEditProvider";
Expand Down Expand Up @@ -326,6 +326,7 @@ export default class PrettierEditService implements Disposable {

if (prettierTslintModule) {
this.loggingService.logInfo("Formatting using 'prettier-tslint'");
this.loggingService.logWarning(LEGACY_LINTER_INTEGRATION);
return this.safeExecution(() => {
const prettierTslintFormat = prettierTslintModule.format as PrettierTslintFormat;

Expand All @@ -345,6 +346,7 @@ export default class PrettierEditService implements Disposable {
);
if (prettierEslintModule) {
this.loggingService.logInfo("Formatting using 'prettier-eslint'");
this.loggingService.logWarning(LEGACY_LINTER_INTEGRATION);
return this.safeExecution(() => {
const prettierEslintFormat = prettierEslintModule as PrettierEslintFormat;

Expand All @@ -364,6 +366,7 @@ export default class PrettierEditService implements Disposable {
);
if (prettierStylelintModule) {
this.loggingService.logInfo("Formatting using 'prettier-stylelint'");
this.loggingService.logWarning(LEGACY_LINTER_INTEGRATION);
const prettierStylelint = prettierStylelintModule as IPrettierStylelint;
return this.safeExecution(
prettierStylelint.format({
Expand Down
2 changes: 2 additions & 0 deletions src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export const FAILED_TO_LOAD_MODULE_MESSAGE =
"Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`";
export const INVALID_PRETTIER_CONFIG =
"Invalid prettier configuration file detected. See log for details.";
export const LEGACY_LINTER_INTEGRATION =
"You are using a legacy linter integration that will be removed in the future. See the documentation on setting up linters: https://github.com/prettier/prettier-vscode#linter-integration";

0 comments on commit 875b9d6

Please sign in to comment.