Skip to content

Commit

Permalink
Added info for formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
glat authored Nov 21, 2019
1 parent 58bddba commit add91d7
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# MultiLinter
VisualStudio multiple and customizable linting made easy
VisualStudio multiple and customizable linting and formatting made easy

#### Short Description
MultiLinter allows you to use in VS2019 several standard linters available by Node.js such as (but not only) ESLint, JSLint, JSHint, Stylelint, CssLint, sass-lint.
MultiLinter allows you to use in VS2019 several standard linters and formatters available by Node.js such as (but not only) ESLint, JSLint, JSHint, Stylelint, CssLint, sass-lint, prettier, beautify.

#### Why Multilinter?
It was born because the linting integrated in VS2019 is now old. It features old version of linters and no way to change them.
Expand Down Expand Up @@ -30,6 +30,8 @@ If you installed MultiLinter before November 16th, 2019 you'll get no further up

#### Changelog

**v1.0.42**: Implemented formatters. Preconfigured are Prettier and Beautify. Can be present some bugs.

**v1.0.40**: Tested extension updating on VS MarketPlace.

**v1.0.35**: Implemented stdin usage for linters who support it (eslint and stylelint). Other linters in Real Time mode will continue to use a shadow copy of buffer on disk.
Expand All @@ -42,6 +44,7 @@ MultiLinter has few options in VS2019. You'll find a MultiLinter page in the Vis
1. Enable a verbose debug window to find some configuration error.
2. Switch linting time. You can lint the file at save time or in real time (with favourite delay).
3. Enable multiple linting. Yes! You can lint same file with several linters, if you want.
4. Switch formatting time. You can format the file manually (Use context menu on text or Visual Studio Edit Menu) or at save time.

First step is to configure it by editing the default config file which is placed (usually) in "%USERPROFILE%\\.multilinterrc.json" path. This is a Json file which overrides the internal configuration you can find here in repository. That file is in this repo to allow you to read and inherit.

Expand All @@ -59,20 +62,23 @@ Usually you need to override at least three properties for preconfigured linters

It enables the eslint linter with no additional arguments other than the required ones and enables it to be used on .js files. Inherited internal config will provide all other settings to make eslint work.

MultiLinter allows only to interface VS2019 to Node.js linters. It does not install Node.js or linters.
MultiLinter allows only to interface VS2019 to Node.js linters and formatters. It does not install Node.js or linters/formatters.

**You must set up the environment by properly installing Node.js and your favorite linters in global or local mode in your project. Then, you must create a MultiLinter config file to enable linters on needed file extensions**.
**If you are using linters in global mode be sure that $PATH% env var contains the right path to access global npm folder**
**You must set up the environment by properly installing Node.js and your favorite linters/formatters in global or local mode in your project. Then, you must create a MultiLinter config file to enable linters/formatters on needed file extensions**.
**If you are using linters/formatters in global mode be sure that $PATH% env var contains the right path to access global npm folder**
**You should also disable internal VS2019 linting**.

#### Can I use only the preconfigured linters?
The answer is **no**. If you add new linters in your json configuration file you can use other ones. This requires to understand each json property and a bit of troubleshooting. See advanced section for this.
#### Can I use only the preconfigured linters/formatters?
The answer is **no**. If you add new linters/formatters in your json configuration file you can use other ones. This requires to understand each json property and a bit of troubleshooting. See advanced section for this.

#### What is multiple linting?
If you enables multiple linting in VisualStudio preferences page and associates two or more linters to a single file extension MultiLinter will lint that files with every linter and will show you all results in errors windows of VS2019. This is disabled by default. Enable it in MultiLinter page of VisualStudio preferences.

#### What is multiple formatting?
Same as above for formatters. Of course it is not so much useful.

#### Where to place MultiLinter configuration file?
Configuration file is found in same ways Node.js linters do. Search starts from the directory where is placed the file to be lint and then up to parent till the disk root. Last resort to find it is in %USERPROFILE%.
Configuration file is found in same ways Node.js linters/formatters do. Search starts from the directory where is placed the file to be linted/formatted and then up to parent till the disk root. Last resort to find it is in %USERPROFILE%.

The configuration file must be named ".multilinterrc.json" or ".multilinterrc", same way as several linters.

Expand All @@ -92,6 +98,10 @@ You can use npm global installed linters or local installed linters. If you are

Linters who support stdin input are: **eslint** and **stylelint**. So, if you are using **only** eslint and stylelint you do **not** need to insert the above lines in your .csproj file. If you're using even one of the other integrated linter (jslint,jshint,csslint,sass-lint) you need to.

#### Notes on formatters

MultiLinter needs to format a file within the editor, so formatters must support stdin/stdout to be formatted. Integrated formatters are Prettier and Beautify. They supports stdin/stdout.

#### Advanced
You can modify behaviour of MultiLinter, enable or disable preconfigured linters or add new ones by changing its json configuration.

Expand Down

0 comments on commit add91d7

Please sign in to comment.