Skip to content

Commit

Permalink
Remove linter support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Totten committed Aug 24, 2019
1 parent c325f46 commit f6ae3f6
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 5,747 deletions.
5 changes: 1 addition & 4 deletions .prettierignore
@@ -1,6 +1,3 @@
package.json
package-lock.json
testEslint/
testProject/
testTslint/
testWorkspaceFolder/
text-fixtures/
7 changes: 5 additions & 2 deletions CHANGELOG.md
Expand Up @@ -4,10 +4,13 @@ All notable changes to the "prettier-vscode" extension will be documented in thi

<!-- Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. -->

## [Unreleased]
## [2.0.0]

- Removed support for ESLint, TSLint, and Stylelint. [See documentation](https://github.com/prettier/prettier-vscode#vscode-eslint-and-tslint-integration)

## [1.12.0]
- Fixed issue where error output was used before inialized (#918)

- Fixed issue where error output was used before inialized (#918)

## [1.11.0]

Expand Down
29 changes: 9 additions & 20 deletions README.md
Expand Up @@ -96,17 +96,21 @@ You can turn on format-on-save on a per-language basis by scoping the setting:
```

### Plugins

This extension support [Prettier plugins](https://prettier.io/docs/en/plugins.html) when you are using a locally resolved version of prettier. If you have Prettier and a plugin registered in your `package.json`, this extension will attempt to register the language and provide automatic code formatting for the built-in and plugin languages.

### VSCode ESLint and TSLint Integration

`prettier-eslint` and `prettier-tslint` are included with the installation of this extension. There is no need for a separate local or global install of either for functionality.
Previous versions of this extension included ESLint, and TSLint integrations out of the box. This functionality was extremely error prone and counter to the best practices of what Prettier is [now recommending for integrating with linters](https://prettier.io/docs/en/integrating-with-linters.html). To continue to use Prettier and your linter we recommend you use the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) or [TSLint](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin) extensions directly.

`eslint`, `tslint`, and all peer dependencies required by your specific configuration must be installed locally. Global installations will not be recognized.
You can enable Auto-Fix on Save for either TSLint or ESLint and still have formatting and quick fixes:

If you have both `"prettier.tslintIntegration"` and `"prettier.eslintIntegration"` enabled in your Visual Studio Code settings, then TSLint will be used to lint your TypeScript code. If you would rather use ESLint, disable the TSLint integration by setting `"prettier.tslintIntegration"` to `false`.
```
"eslint.autoFixOnSave": true,
"tslint.autoFixOnSave": true,
```

> WARNING: Due to a bug in the `prettier-eslint` library, this extension is NOT compatible with ESLint version 6.
> NOTE: If you are seeing conflicts between Prettier and ESLint this is because you don't have the right ESLint or TSLint rules set as explained in the [Prettier documentation](https://prettier.io/docs/en/integrating-with-linters.html).
## Settings

Expand Down Expand Up @@ -191,21 +195,6 @@ Change when properties in objects are quoted. [Learn more here](https://prettier

These settings are specific to VSCode and need to be set in the VSCode settings file. See the [documentation](https://code.visualstudio.com/docs/getstarted/settings) for how to do that.

#### prettier.eslintIntegration (default: false) - JavaScript and TypeScript only

Use _[prettier-eslint](https://github.com/prettier/prettier-eslint)_ instead of _prettier_.
Other settings will only be fallbacks in case they could not be inferred from ESLint rules.

#### prettier.tslintIntegration (default: false) - JavaScript and TypeScript only

Use _[prettier-tslint](https://github.com/azz/prettier-tslint)_ instead of _prettier_.
Other settings will only be fallbacks in case they could not be inferred from TSLint rules.

#### prettier.stylelintIntegration (default: false) - CSS, SCSS and LESS only

Use _[prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint)_ instead of _prettier_.
Other settings will only be fallbacks in case they could not be inferred from stylelint rules.

#### prettier.requireConfig (default: false)

Require a 'prettierconfig' to format
Expand All @@ -222,4 +211,4 @@ _Note: Disabling a language enabled in a parent folder will prevent formatting i

## Prettier resolution

This extension will use prettier from your project's local dependencies. Should prettier not be installed locally with your project's dependencies, a copy will be bundled with the extension.
This extension will use prettier from your project's local dependencies. Should prettier not be installed locally with your project's dependencies, a copy will be bundled with the extension.
25 changes: 2 additions & 23 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "prettier-vscode",
"displayName": "Prettier - Code formatter",
"description": "VS Code plugin for prettier/prettier",
"version": "1.12.0",
"version": "2.0.0",
"publisher": "esbenp",
"author": "Esben Petersen <@esbenp>",
"galleryBanner": {
Expand Down Expand Up @@ -38,7 +38,7 @@
"compile": "yarn clean && tsc -p ./",
"watch": "tsc --watch -p ./",
"lint": "tslint --project .",
"pretest": "yarn compile && cd test-fixtures/eslint && yarn install && cd ../tslint && yarn install && cd ../plugins && yarn install",
"pretest": "yarn compile && yarn install && cd test-fixtures/plugins && yarn install",
"test": "node ./out/test/runTests.js",
"version": "node ./scripts/version.js && git add CHANGELOG.md"
},
Expand All @@ -60,9 +60,6 @@
"dependencies": {
"ignore": "^5.1.4",
"prettier": "^1.18.2",
"prettier-eslint": "^9.0.0",
"prettier-stylelint": "^0.4.2",
"prettier-tslint": "^0.4.2",
"read-pkg-up": "^6.0.0",
"resolve": "^1.10.0",
"typescript": "^3.5.3",
Expand All @@ -84,24 +81,6 @@
"description": "%ext.config.disableLanguages%",
"scope": "window"
},
"prettier.eslintIntegration": {
"type": "boolean",
"default": false,
"description": "%ext.config.eslintIntegration%",
"scope": "resource"
},
"prettier.tslintIntegration": {
"type": "boolean",
"default": false,
"description": "%ext.config.tslintIntegration%",
"scope": "resource"
},
"prettier.stylelintIntegration": {
"type": "boolean",
"default": false,
"description": "%ext.config.stylelintIntegration%",
"scope": "resource"
},
"prettier.requireConfig": {
"type": "boolean",
"default": false,
Expand Down
3 changes: 0 additions & 3 deletions package.nls.json
@@ -1,9 +1,6 @@
{
"ext.config.title": "Prettier - Code formatter configuration",
"ext.config.disableLanguages": "A list of languages IDs to disable this extension on",
"ext.config.eslintIntegration": "Use 'prettier-eslint' instead of 'prettier'. Other settings will only be fallbacks in case they could not be inferred from eslint rules.",
"ext.config.tslintIntegration": "Use 'prettier-tslint' instead of 'prettier'. Other settings will only be fallbacks in case they could not be inferred from tslint rules.",
"ext.config.stylelintIntegration": "Use 'prettier-stylelint' instead of 'prettier'. Other settings will only be fallbacks in case they could not be inferred from stylelint rules.",
"ext.config.requireConfig": "Require a 'prettierconfig' to format",
"ext.config.ignorePath": "Path to a .prettierignore or similar file",
"ext.config.printWidth": "Fit code within this line limit",
Expand Down
3 changes: 0 additions & 3 deletions package.nls.zh-cn.json
@@ -1,9 +1,6 @@
{
"ext.config.title": "Prettier - 代码格式化配置",
"ext.config.disableLanguages": "用于禁用此扩展的语言ID列表",
"ext.config.eslintIntegration": "使用 'prettier-eslint' 而不是 'prettier'。 其他设置只会是备选方案,以防无法从 eslint 规则中推断出来。",
"ext.config.tslintIntegration": "使用 'prettier-tslint' 而不是 'prettier'。 其他设置只会是备选方案,以防无法从 tslint 规则推断出来。",
"ext.config.stylelintIntegration": "使用 'prettier-stylelint' 而不是 'prettier'。 其他设置只会是备选方案,以防无法从 stylelint 规则推断出来。",
"ext.config.requireConfig": "需要 'prettierconfig' 来格式化",
"ext.config.ignorePath": ".prettierignore或类似文件的路径",
"ext.config.printWidth": "指定每行代码的最佳长度, 如果超出长度则换行。",
Expand Down
3 changes: 0 additions & 3 deletions package.nls.zh-tw.json
@@ -1,9 +1,6 @@
{
"ext.config.title": "Prettier - 代碼格式化配置",
"ext.config.disableLanguages": "用於禁用此擴展的語言ID列表",
"ext.config.eslintIntegration": "使用 'prettier-eslint' 而不是 'prettier'。其他設置只會是備選方案,以防無法從 eslint 規則中推斷出來。",
"ext.config.tslintIntegration": "使用 'prettier-tslint' 而不是 'prettier'。其他設置只會是備選方案,以防無法從 tslint 規則推斷出來。",
"ext.config.stylelintIntegration": "使用 'prettier-stylelint' 而不是 'prettier'。其他設置只會是備選方案,以防無法從 stylelint 規則推斷出來。",
"ext.config.requireConfig": "需要 'prettierconfig' 來格式化",
"ext.config.ignorePath": ".prettierignore或類似文件的路徑",
"ext.config.printWidth": "指定每行代碼的最佳長度, 如果超出長度則換行。",
Expand Down
65 changes: 2 additions & 63 deletions src/PrettierEditProvider.ts
Expand Up @@ -11,17 +11,10 @@ import {
import { addToOutput, safeExecution, setUsedModule } from './errorHandler';
import { requireLocalPkg } from './requirePkg';
import {
PrettierEslintFormat,
PrettierStylelint,
PrettierTslintFormat,
PrettierVSCodeConfig
} from './types.d';
import { getConfig, getParsersFromLanguageId } from './utils';

/**
* HOLD style parsers (for stylelint integration)
*/
const STYLE_PARSERS: string[] = ['postcss', 'css', 'less', 'scss'];
/**
* Check if a given file has an associated prettierconfig.
* @param filePath file's path
Expand Down Expand Up @@ -133,13 +126,6 @@ async function format(
} else {
parser = dynamicParsers[0];
}
const doesParserSupportEslint = [
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'vue'
].includes(languageId);

const hasConfig = await checkHasPrettierConfig(fileName);

Expand Down Expand Up @@ -179,56 +165,9 @@ async function format(
quoteProps: vscodeConfig.quoteProps
}
);


if (vscodeConfig.tslintIntegration && parser === 'typescript') {
return safeExecution(
() => {
const prettierTslint = require('prettier-tslint')
.format as PrettierTslintFormat;
setUsedModule('prettier-tslint', 'Unknown', true);

return prettierTslint({
text,
filePath: fileName,
fallbackPrettierOptions: prettierOptions
});
},
text,
fileName
);
}

if (vscodeConfig.eslintIntegration && doesParserSupportEslint) {
return safeExecution(
() => {
const prettierEslint = require('prettier-eslint') as PrettierEslintFormat;
setUsedModule('prettier-eslint', 'Unknown', true);

return prettierEslint({
text,
filePath: fileName,
fallbackPrettierOptions: prettierOptions
});
},
text,
fileName
);
}

if (vscodeConfig.stylelintIntegration && STYLE_PARSERS.includes(parser)) {
const prettierStylelint = require('prettier-stylelint') as PrettierStylelint;
return safeExecution(
prettierStylelint.format({
text,
filePath: fileName,
prettierOptions
}),
text,
fileName
);
}

if (!doesParserSupportEslint && useBundled) {
if (useBundled) {
return safeExecution(
() => {
const warningMessage =
Expand Down
17 changes: 0 additions & 17 deletions src/test/suite/eslint.test.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/suite/tslint.test.ts

This file was deleted.

0 comments on commit f6ae3f6

Please sign in to comment.