mevsum / config-eslint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESLint Configuration

Installation

npm i @alexlit/config-eslint -D

Connection

// .eslintrc.js
module.exports = {
  extends: [
    './node_modules/@alexlit/config-eslint',

    /* optional */
    // './node_modules/@alexlit/config-eslint/plugins/optional/jest',
    // './node_modules/@alexlit/config-eslint/plugins/optional/jest-formatting',
    // './node_modules/@alexlit/config-eslint/plugins/optional/react',
    // './node_modules/@alexlit/config-eslint/plugins/optional/react-hooks',
    // './node_modules/@alexlit/config-eslint/plugins/optional/svelte',
    // './node_modules/@alexlit/config-eslint/plugins/optional/vuetify',
  ],
};

Recipes

Vue

  • If you use vue.js with options api syntax you need to turn off sort-keys rule for *.vue files

    // .eslintrc.js
    overrides: [
      {
        files: ['*.vue'],
        rules: {
          'sort-keys': 'off',
        },
      },
    ];

Spell check

  • Skip some words

    // .eslintrc.js
    const SPELLCHECK_RULES = require('@alexlit/config-eslint/plugins/spellcheck')
      .rules['spellcheck/spell-checker'][1];
    
    module.exports = {
      rules: {
        'spellcheck/spell-checker': [
          'warn',
          {
            ...SPELLCHECK_RULES,
    
            skipWords: [...SPELLCHECK_RULES.skipWords, 'word1', 'word2'],
          },
        ],
      },
    };
  • Disable spell checking

    // .eslintrc.js
    module.exports = {
      rules: {
        'spellcheck/spell-checker': 'off',
      },
    };

About

License:MIT License


Languages

Language:JavaScript 99.7%Language:TypeScript 0.3%Language:Vue 0.0%Language:Svelte 0.0%