# @cbeard87/eslint-config-vue

> ESLint and Prettier Config for Vue Projects

Latest version **1.0.2** (published 2020-01-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install @cbeard87/eslint-config-vue
pnpm add @cbeard87/eslint-config-vue
yarn add @cbeard87/eslint-config-vue
bun add @cbeard87/eslint-config-vue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-01-21 |
| First published | 2019-05-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christopher Beard |
| Maintainers | cbeard87 |
| Keywords | javascript, ecmascript, eslint, lint, config, prettier, vue |

## Links

- npm: https://www.npmjs.com/package/@cbeard87/eslint-config-vue
- Repository: https://github.com/cbeard87/eslint-config-vue
- Homepage: https://github.com/cbeard87/eslint-config-vue#readme
- Issues: https://github.com/cbeard87/eslint-config-vue/issues
- npm.io page: https://npm.io/package/@cbeard87/eslint-config-vue

## Recent versions

- 1.0.2 (latest) — 2020-01-21
- 1.0.0 — 2019-05-20

## README

# eslint-config-vue

ESLint and Prettier Config for Vue Projects

## Local / Per Project Install

1. If you don't already have a `package.json` file, create one with `npm init`.

2. Then we need to install everything needed by the config:

```
npx install-peerdeps --dev @cbeard87/eslint-config-vue
```

3. You can see in your package.json there are now a big list of devDependencies.

4. Create a `.eslintrc` file in the root of your project's directory (it should live where package.json does). Your `.eslintrc` file should look like this:

```json
{
  "extends": ["@cbeard87/eslint-config-vue"]
}
```

Tip: You can alternatively put this object in your `package.json` under the property `"eslintConfig":`. This makes one less file in your project.

5. You can add two scripts to your package.json to lint and/or fix:

```json
"scripts": {
  "lint": "eslint .",
  "lint:fix": "eslint . --fix"
},
```

6. Now you can manually lint your code by running `npm run lint` and fix all fixable issues with `npm run lint:fix`. You probably want your editor to do this though.

## Global Install

1. First install everything needed:

```
npx install-peerdeps --global @cbeard87/eslint-config-vue
```

(**note:** npx is not a spelling mistake of **npm**. `npx` comes with when `node` and `npm` are installed and makes script running easier 😃)

2. Then you need to make a global `.eslintrc` file:

ESLint will look for one in your home directory

- `~/.eslintrc` for mac
- `C:\Users\username\.eslintrc` for windows

In your `.eslintrc` file, it should look like this:

```json
{
  "extends": ["@cbeard87/eslint-config-vue"]
}
```

3. To use from the CLI, you can now run `eslint .` or configure your editor as we show next.

## Settings

If you'd like to overwrite eslint or prettier settings, you can add the rules in your `.eslintrc` file. The [ESLint rules](https://eslint.org/docs/rules/) go directly under `"rules"` while [prettier options](https://prettier.io/docs/en/options.html) go under `"prettier/prettier"`. Note that prettier rules overwrite anything in my config (trailing comma, and single quote), so you'll need to include those as well.

```js
{
  "extends": [
    "@cbeard87/eslint-config-vue"
  ],
  "rules": {
    "no-console": 2,
    "prettier/prettier": [
      "error",
      {
        "trailingComma": "es5",
        "singleQuote": true,
        "printWidth": 120,
        "tabWidth": 8,
      }
    ]
  }
}
```

## With VS Code

Once you have done one, or both, of the above installs. You probably want your editor to lint and fix for you. Here are the instructions for VS Code:

1. Install the [ESLint package](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Vetur package](https://marketplace.visualstudio.com/items?itemName=octref.vetur)
2. Now we need to setup some VS Code settings via `Code/File` → `Preferences` → `Settings`. It's easier to enter these settings while editing the `settings.json` file, so click the `{}` icon in the top right corner:

```js
"editor.formatOnSave": true,
// turn it off for JS, JSX, and Vue, we will do this via eslint
"[javascript]": {
  "editor.formatOnSave": false
},
"[javascriptreact]": {
  "editor.formatOnSave": false
},
"[vue]": {
  "editor.formatOnSave": false
},
// tell the ESLint plugin to run on save
"eslint.autoFixOnSave": true,
"vetur.validation.template": false
```

---
_Source: https://npm.io/package/@cbeard87/eslint-config-vue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
