0.1.6 • Published 8 months ago

@component-hook/eslint-plugin v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@component-hook/eslint-plugin

A opinionated ESLint config preset for JavaScript, TypeScript, Vue, and Prettier.

Features

  • Support TypeScript, Vue and React out-of-box.
  • Built-in Markdown, Prettier, Sonarjs, Security, Playwright and Testing-library configs can be referenced for respective needs.
  • Format with Prettier.
  • Ignores common files like dist, node_modules, coverage, and files in .gitignore.
  • Reasonable defaults, best practices, and just a few lines of configuration.

Installation

$ npm install @component-hook/eslint-plugin --save-dev

# or use yarn
$ yarn add @component-hook/eslint-plugin --dev

# or use pnpm
$ pnpm install @component-hook/eslint-plugin --save-dev

Require ESLint >= 9.0.0

Basic Usage

import componentHookPlugin from '@component-hook/eslint-plugin';

export default [
  ...componentHookPlugin.configs.basic,
  ...componentHookPlugin.configs.vue,
  ...componentHookPlugin.configs.markdown,
  componentHookPlugin.configs.prettier,
  ...componentHookPlugin.configs.sonarjs,
  componentHookPlugin.configs.security,
  {
    files: ['**/__tests__/unit/**/*.test.[jt]s?(x)'],
    ...componentHookPlugin.configs['testing-library/vue'],
  },
  {
    files: ['**/__tests__/e2e/**/*.spec.[jt]s?(x)'],
    ...componentHookPlugin.configs.playwright,
  },
  // ...your custom config
];

See basic and ignores for more details.

Presets Usage

import {
  reactPreset, // Includes basic, react, markdown, prettier, sonarjs, security configs
} from '@component-hook/eslint-plugin';

export default reactPreset;
import {
  vuePreset, // Includes basic, vue, markdown, prettier, sonarjs, security configs
} from '@component-hook/eslint-plugin';

export default vuePreset;

Configs

NameTypeReference
basicLinter.Config[]eslint-recommended, typescript-eslint, eslint-plugin-eslint-comments, eslint-plugin-import, eslint-plugin-unicorn, eslint-plugin-regexp
vueLinter.Config[]eslint-plugin-vue, typescript-eslint
reactLinter.Config[]eslint-plugin-react/recommended, eslint-plugin-react-hooks/recommended, eslint-plugin-jsx-a11y/recommended
markdownLinter.Config[]eslint-plugin-markdown/recommended
prettierLinter.Configeslint-plugin-prettier/recommended, eslint-config-prettier
sonarjsLinter.Config[]eslint-plugin-sonarjs/recommended
securityLinter.Configeslint-plugin-security/recommended
playwrightLinter.Configeslint-plugin-playwright/flat/recommended
testing-library/domLinter.Configeslint-plugin-testing-library/dom
testing-library/vueLinter.Configeslint-plugin-testing-library/vue
testing-library/reactLinter.Configeslint-plugin-testing-library/react
testing-library/angularLinter.Configeslint-plugin-testing-library/angular
testing-library/markoLinter.Configeslint-plugin-testing-library/marko

Reference eslint plugin