npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zebrains/eslint

v2.5.0

Published

Базовая конфигурация JS ESLint, соответствующая нашему стайлгайду

Downloads

2

Readme

@zebrains/eslint

Инструмент для генерации конфигурационного файла ESlint (.eslintrc.js или .eslintrc.cjs для модульного репозитория) и файла .prettierrc

Использование

Пакет представляет собой исполняемый файл, который вызывает в командной строке ряд вопросов, для определения особенностей проекта.

example

Вы можете использовать pnpm или npx для запуска

# use pnpm
pnpm dlx @zebrains/eslint@latest
# use npx
npx @zebrains/eslint@latest

в случае возникновения проблемы на любом из этапов работы пакета, заведите issue здесь

На текущий момент, пакет содержит на выбор следующие расширения:

Далее представлены части конфигурационного файла eslint, которые будут автоматически сгенерированы по завершению исполнения, копировать и самостоятельно вставлять их в конфиг не нужно

Основная конфигурация (применяется вне зависимости от выбранных ответов)

{
  root: true,
  env: {
    node: true,
    browser: true,
    jest: true,
  },
  parserOptions: {
    ecmaVersion: 2020,
  },
  plugins: ['import', 'promise'],
  extends: [
    'eslint:recommended',
    'plugin:import/recommended',
    'plugin:promise/recommended',
  ],
}

React

{
  extends: ['airbnb'],
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
  },
}

React Hooks

{
  extends: ['airbnb/hooks'],
}

React 18

{
  rules: {
    // Prevent React to be incorrectly marked as unused
    // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
    'react/jsx-uses-react': 'off',

    // Prevent missing React when using JSX
    // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
    'react/react-in-jsx-scope': 'off',
  },
}

Typescript

{
  extends: [
    'plugin:import/typescript',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
  ],
  plugins: ['@typescript-eslint'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: './tsconfig.json',
  },
  settings: {
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx'],
    },
    'import/resolver': {
      typescript: true,
      node: true,
    },
  },
  rules: {
    // Disable 'no-use-before-define' on function declaration
    // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
    '@typescript-eslint/no-use-before-define': [
      'error',
      { functions: false, classes: true, variables: true },
    ],
  },
}

React Typescript

Расширяет основную конфигурацию typescript следующим конфигом

{
  extends: ['airbnb-typescript'],
  rules: {
    'react/require-default-props': 'off',
  }
}

Sort Imports

Добавляет в проект сортировку импортов

{
  plugins: ['simple-import-sort'],
  rules: {
    'simple-import-sort/imports': ['error', { groups: [] }],
    'simple-import-sort/exports': 'error',
  },
}

Конфигурация сортировки:

const groups = [
  // Side effect imports.
  ['^\\u0000'],

  // Node.js builtins prefixed with `node:`.
  ['^node:'],

  // if use react, added next import `^react` or `^@react`.
  ['^react', '^@react', '^'],

  // if use vue, added next import `^vue` or `^@vue`.
  ['^vue', '^@vue', '^'],

  // Packages.
  // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
  ['^@?\\w'],

  // Absolute imports and other imports such as Vue-style `@/foo`.
  // Anything not matched in another group.
  ['^'],

  // Relative imports.
  // Anything that starts with a dot.
  ['^\\.'],
];

Jest

{
  extends: ['plugin:jest/recommended'],
  plugins: ['jest'],
}

Prettier

{
  extends: ['prettier'],
}

Конфигурация prettier

При подтверждении использования prettier, помимо конфигурации eslint, будет сгенерирован .prettierrc следующего содержания:

{
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2
}