Skip to content

musement/eslint-plugin

Repository files navigation

@musement/eslint-plugin

shared eslint config for musement projects

Installation

You'll first need to install ESLint and Prettier:

$ npm i eslint@7.16 prettier@2.2 --save-dev

Next, install @musement/eslint-plugin:

$ npm install @musement/eslint-plugin --save-dev

Usage

Add plugin:@musement/SELECTED_CONFIG to the extends section of your .eslintrc.* configuration file.

Library (TS/JS):

{
  "extends": ["plugin:@musement/library"]
}

Vue.js (TS/JS):

{
  "extends": ["plugin:@musement/vue"]
}

Nuxt 3 (TS):

{
  "extends": ["plugin:@musement/nuxt3"]
}

Nuxt.js (TS/JS):

{
  "extends": ["plugin:@musement/nuxt"]
}

If your app supports Server Side Rendering (ssr: true in nuxt.config.js), enable node environment.

{
  "extends": [
    "plugin:@musement/nuxt"
  ],
  "env": {
    "browser": true,
    "node": true
  }
}

If your app implements custom server middleware, you can disable browser environment for that directory by using override option.

{
  "extends": [
    "plugin:@musement/nuxt"
  ],
  "env": {
    "browser": true,
    "node": true
  },
  "overrides": [
    {
      "files": ["server-middleware/**"],
      "env": {
        "browser": false,
        "node": true
      }
    }
  ]
}

React (TS/JS):

{
  "extends": ["plugin:@musement/react"]
}

Visual Studio Code

VSCode developers can add these settings to the project's settings (.vscode/settings.json) to use this plugin correctly and to avoid conflicts with other user's settings:

{
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}