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

@kaspersky/dev-tools

v2.9.3

Published

Development tools and configs for Babel, ESLint and TypeScript

Downloads

17

Readme

KL Dev Tools

ESLint

@kaspersky/dev-tools contains a set of common configuration files, plugins and extensions for ESLint.

Additional installation of eslint plugins/configs is not required in your project.

ESLint configuration

1. Add .eslintrc.js

To configure ESLint, you need to create a file .eslintrc.js in the root of the project and connect the necessary set of configs:

const { getConfigPath } = require('@kaspersky/dev-tools/src/configs/eslint/patch')

module.exports = {
  extends: [
    getConfigPath('base'),
    getConfigPath('typescript'),
    getConfigPath('react'),
    getConfigPath('storybook'),
    getConfigPath('tags'),
  ],
  parserOptions: { tsconfigRootDir: __dirname } // for TS projects only
}
  • Option parserOptions: { tsconfigRootDir: __dirname } it is only needed for projects where Typescript is used and there is tsconfig.json.

  • Patch require('@kaspersky/dev-tools/src/configs/eslint/patch') is required for plugins and configs to resolve within this package (eslint by default searches for plugins relative to .eslintrc.js in project).

**2. Install dependencies **

For ESLint you need to add only 2 dependencies - @kaspersky/dev-tools greater than 2.4.0 and eslint (6-8 ver), for example:

{
  "devDependencies": {
    "@kaspersky/dev-tools": "^2.4.0",
    "eslint": "7.14.0",
    ...
  }
}

Adding new shared configs ESLint

New configs can be added to the folder /src/configs/eslint, for example, these can be configs for the framework (angular, vue, etc.).

At the same time, the necessary packages with eslint plugins and configs need to be added to dependencies in package.json, so that when installing the package @kaspersky/dev-tools consists in node_modules.

Config extension

If you need to add new rules or expand the current config, it is better to do it through this package @kaspersky/dev-tools, by extending the current configuration or adding a new one, as described in the paragraph above. Exceptions may be rules that apply only to your project, but do not change the rules of general configs (rules), for ex:s env, globals, ignorePatterns

FAQ

  • After installing the package Eslint does not work in IDE

Restart the IDE after updating the package @kaspersky/dev-tools. If in the console ESlint writes that he does not find any modules, then try to delete node_modules and do the installation of dependencies again. Check that there are no syntax errors in .eslintrc.js file, there is parserOptions: { tsconfigRootDir: __dirname } for TS project. It is mandatory to have a patch import eslint/patch and usage getConfigPath to specify the config name.

Support for different Node.js versions

To support different versions of Node.js sometimes needs to be installed NODE_OPTIONS, for example, to run certain versions TS and Webpack > 17 version you may need to install options NODE_OPTIONS=\"--openssl-legacy-provider --no-experimental-fetch\".

To make backward compatible with Node.js 16 (which does not support these options) you can use the script utils/get-node-options.js, which returns the desired NODE_OPTIONS depending on the installed version.

To set the env variable NODE_OPTIONS is used env-cmd.

Adding a script to a project

In your project, you will need to add to package.json next script:

"set-env": "./node_modules/@kaspersky/dev-tools/node_modules/.bin/env-cmd -f ./node_modules/@kaspersky/dev-tools/src/utils/get-node-options.js"

and then into the scripts build, release and other add yarn set-env before the command, for ex.:

"release": "yarn set-env gulp release",

This script will add to gulp release installation of the necessary NODE_OPTIONS depending on the Node version.js before launching it.