eslint-config-kms

KMS LH ESLint config

Usage no npm install needed!

<script type="module">
  import eslintConfigKms from 'https://cdn.skypack.dev/eslint-config-kms';
</script>

README

eslint-config-kms

KMS LightHouse settings for ESLint and Prettier

What it does


  • Defines general Lint rules for js and typescript files
  • Uses Google template as a base
  • Sets settings that are same across all KMS LH projects (Note: need to define Vue specific version settings separately in corresponding project eslintrc.js)

Installation


Type following to add settings to your project:

npm i -D eslint-config-kms

Open package.json file, the following line should appear in devDependencies section:

"devDependencies": {

..

"eslint-config-kms": "^1.0.3",

..

}

To use installed settings add following to .eslintrc.js file in the root of your project.

For Vue3 component use:

module.exports = {

extends: ['kms', 'plugin:vue/vue3-essential', '@vue/typescript/recommend'],

}

For Vue1 & 2 component use:

module.exports = {

extends: ['kms', 'plugin:vue/essential', '@vue/typescript/recommend'],

}

To check project run folowing command in console:

npm run lint

With VS Code


Once you've done listed above, you can setup your editor to use lint and prettier. Here are instructions for VS Code:

  1. Run VS Code

  2. Go to extensions, and install:

    1. Prettier
    2. ES Lint
  3. Setup VS Code settings files via "Code/Preferences/Settings" -> Click on the "Open settings.json" icon in the top right corner

  4. Enter following code:

"editor.formatOnSave": true,

"editor.defaultFormatter": "esbednp.prettier-vscode",

"emmet.includeLanguages": {

"javascript": "javascriptreact",

"vue-html": "html",

"vue": "html"

}

Troubleshooting


In case when npm run lint execution ends up with following problem:

ERROR Error: Failed to load config "google" to extend from.

Referenced from: /Users/igorvasiliev/Projects/self-service-admin/node_modules/> eslint-config-kms/index.js

Error: Failed to load config "google" to extend from.

Please install eslint-config-google manually by using:

npm i -D eslint-config-google

You should see following record in package.json after successful install:

"devDependencies": {

..

"eslint-config-google": "^0.14.0",

..

}