🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@ken0x0a/eslint-config

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ken0x0a/eslint-config

Examples of eslint configuration

latest
npmnpm
Version
8.2.5
Version published
Maintainers
1
Created
Source

Install

yarn add @ken0x0a/eslint-config

# if you use `react` configuration, also need to install `@ken0x0a/eslint-config-react-deps`
yarn add @ken0x0a/eslint-config @ken0x0a/eslint-config-react-deps # optional

Usage

module.exports = require('@ken0x0a/eslint-config')

module.exports = {
  extends: ['@ken0x0a/eslint-config'],
}
module.exports = {
  extends: ['@ken0x0a/eslint-config', '@ken0x0a/eslint-config/autofix'],
}

// or if you prefer to pick only what you want ( the following is default )
module.exports = {
  /**
   * NOTE: The **order is important**, to properly override rules by later one
   */
  extends: [
    '@ken0x0a/eslint-config/base',
    '@ken0x0a/eslint-config/import',
    '@ken0x0a/eslint-config/jest',
    // '@ken0x0a/eslint-config/autofix', // DO NOT USE WITH TypeScript, as it doesn't care about `interface` & `type` and remove them.
    // '@ken0x0a/eslint-config/graphql', // requires to install `eslint-plugin-graphql`
    /**
     * if you need to use `react` related configs like following,
     * you need to install optional dependency "@ken0x0a/eslint-config-react-deps" by
     * `yarn add -D "@ken0x0a/eslint-config-react-deps"`
     */
    '@ken0x0a/eslint-config/react',
    // '@ken0x0a/eslint-config/react-native',
    '@ken0x0a/eslint-config/expo', // extends "./react-native"
    '@ken0x0a/eslint-config/typescript',
  ],
}

Command

https://eslint.org/docs/user-guide/command-line-interface

yarn --silent eslint -c .eslintrc.js --ext .ts,.tsx .
yarn --silent eslint --ext .ts,.tsx .
yarn --silent eslint --ext .ts,.tsx --report-unused-disable-directives .
# "--no-error-on-unmatched-pattern" from 3.8.0
yarn --silent eslint --ext .ts,.tsx --report-unused-disable-directives --no-error-on-unmatched-pattern .
yarn --silent eslint --ext .ts,.tsx --ignore-pattern '**/*.d.ts' --report-unused-disable-directives
yarn --silent eslint '**/*.ts{,x}'
yarn --silent eslint '*.ts{,x}'
yarn --silent eslint --report-unused-disable-directives '*.ts'
yarn --silent eslint --cache '*.ts'
yarn --silent eslint --no-inline-config some-file.ts

husky config

module.exports = {
  '*.{ts,tsx}': [
    /**
     * https://eslint.org/docs/user-guide/command-line-interface#--ignore-pattern
     */
    "eslint --fix --ext .ts,.tsx --ignore-pattern '**/*.d.ts' --report-unused-disable-directives",
    'git add',
  ],
}

NOTE

eslint-plugin-autofix doesn't care interface & type. Thus, really useless with TypeScript

FAQs

Package last updated on 28 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts