Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better options default #263

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"standard.enable": true,
"standard.engine": "ts-standard",
"standard.usePackageJson": true,
"standard.workingDirectories": ["client", "server"]
"standard.workingDirectories": ["client", "server"],
"standard.autoFixOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 2.0.0

- **Feature**: Better options default to reduce configurations overhead for users so that they can use the extension fast without too much configurations and still following "best practices" by encouraging local installation per project. ([#263](https://github.com/standard/vscode-standard/pull/263))

Now the extension will be automatically be enabled in projects that has one of the engines (`standard`, `semistandard`, `standardx` or `ts-standard`) installed in `devDependencies` in `package.json`.

**Note**: This feature is only working if you have only **one** open folder in your VSCode workspace.
**Note 2**: If you still want to enable the extension globally you can set the new option : `"standard.enableGlobally": true` (by default it is set to `false`).

**BREAKING CHANGE**: This feature changed the default settings, before: `"standard.usePackageJson": false`, after: `"standard.usePackageJson": true`
**BREAKING CHANGE**: By default (if you don't set `"standard.enableGlobally": true`), the extension will not lint your files if you haven't got a `package.json` containing one of the engines installed in `devDependencies`.

## 1.5.1

- **Fix**: Find babel config files with `@babel/eslint-parser` ([#207](https://github.com/standard/vscode-standardjs/pull/207))
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,39 @@

## How to use

1. **Install the 'JavaScript Standard Style' extension**
1. **Install the 'StandardJS - JavaScript Standard Style' extension**

If you don't know how to install extensions in VSCode, take a look at the [documentation](https://code.visualstudio.com/docs/editor/extension-gallery#_browse-and-install-extensions).
Launch VSCode Quick Open (⌘+P), paste the following command, and press enter.

You will need to reload VSCode before new extensions can be used.
```text
ext install standard.vscode-standard
```

For more information, take a look at the [documentation](https://code.visualstudio.com/docs/editor/extension-gallery#_browse-and-install-extensions).

2. **Install `standard`, `semistandard`, `standardx` or `ts-standard`**
2. **Install the engine `standard`, `semistandard`, `standardx` or `ts-standard`**

This can be done globally or locally. We recommend that you install them locally (i.e. saved in your project's `devDependencies`), to ensure that other developers have it installed when working on the project.

3. **Disable the built-in VSCode validator**
3. **Enable the extension**

To do this, set `"javascript.validate.enable": false` in your VSCode `settings.json`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to disable this setting while using this extension, and I would encourage to enable it so you can get both linting and javascript errors.

That's it! The extension will automatically be enabled in projects that has one of the engines installed in `devDependencies` in `package.json`.

## Plugin options
## Extension options
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it consistent, we use the word Extension instead of Plugin, it means the same thing in this context.


We give you some options to customize vscode-standard in your VSCode [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings).
We give you some options to customize `vscode-standard` in your VSCode [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings).

| Option | Description | Default |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| `standard.enable` | enable or disable JavaScript Standard Style | `true` |
| `standard.enableGlobally` | enable or disable JavaScript Standard Style globally | `false` |
| `standard.run` | run linter `onSave` or `onType` | `onType` |
| `standard.autoFixOnSave` | enable or disable auto fix on save. It is only available when VSCode's `files.autoSave` is either `off`, `onFocusChange` or `onWindowChange`. It will not work with `afterDelay`. | `false` |
| `standard.nodePath` | use this setting if an installed `standard` package can't be detected. | `null` |
| `standard.validate` | an array of language identifiers specify the files to be validated | `["javascript", "javascriptreact", "typescript", "typescriptreact]` |
| `standard.workingDirectories` | an array for working directories to be used. | `[]` |
| `standard.engine` | You can use `semistandard`, `standardx` or `ts-standard` instead of `standard`. **Just make sure you've installed the `semistandard`, the `standardx` or the `ts-standard` package, instead of `standard`.** | `standard` |
| `standard.usePackageJson` | if set to `true`, JavaScript Standard Style will use project's `package.json` settings, otherwise globally installed `standard` module is used | `false` |
| `standard.usePackageJson` | if set to `true`, JavaScript Standard Style will use project's `package.json` settings, otherwise globally installed `standard` module is used | `true` |
| `standard.treatErrorsAsWarnings` | Any linting error reported by Standard will instead be displayed as a warning within VS Code. | `false` |

## Configuring Standard
Expand Down
59 changes: 46 additions & 13 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading