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

eslint-config-eko

v3.0.0

Published

ESLint configuration for Amity JS apps

Downloads

738

Readme

eslint-config-eko

Defines set of Amity ESLint rules based on Airbnb eslint rules extended by Prettier plugin.

The package provides 2 sets of rules:

  • eko - eslint, import rules
  • eko/react - eko + react, react-hook, jsx-a11y rules

Installation:

Step 1. Mandatory. Copy this configuration to your .prettierrc file:

{
  "tabWidth": 2,
  "printWidth": 100,
  "useTabs": false,
  "singleQuote": true,
  "trailingComma": "all",
  "quoteProps": "as-needed",
  "arrowParens": "avoid",
  "embeddedLanguageFormatting": "auto"
}

Make sure that you do not change configuration or you will run in a bunch of conflicts between Prettier and ESLint.

Step 2. Mandatory. To apply base set of rules.

npm@6

npx install-peerdeps --dev [email protected] --extra-args "--save-exact"

npm@7

npm install --save-dev --save-exact --save-peer  [email protected]

Step 3. Optional. To apply react extended set of rules

npm install --save-dev --save-exact [email protected] [email protected] [email protected] [email protected]

Step 4. In .eslintrc.json extend eko configuration:

Only base set of rules

"extends": ["eko"]

Base + React set of rules

"extends": ["eko/react"]

Step 5. If required. To properly support eslint-plugin-import please check resolvers docs.

(Recommended) Setup project for auto-linting on commit:

npm i --save-dev husky lint-staged

In package.json:

  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "linters": {
      "*.{js,jsx}": [
        "eslint --fix",
        "git add --force"
      ],
      "*.{json,md}": [
        "prettier --write",
        "git add --force"
      ]
    }
  },

Hints

Track performance of individual rules

In case you encounter slow eslint execution on your project try to use ESLint built-in CLI method to track performance of individual rules.

TIMING=1 eslint lib

Root path synonym and import/no-unresolved

If you want to use root synonyms like:

// from
import Example from '../../../some/example.js';

// to
import Example from '~/some/example.js';

Option 1

Install eslint-import-resolver-webpack

npm install --save-dev eslint-import-resolver-webpack

Add this to your webpack configuration:

resolve: {
  alias: {
    // pattern
    '~': '<full_path_to_project_folder>',
    // example 1
    '~': path.resolve(process.cwd(), '<project_folder>'),
    // example 2
    '~': path.resolve(__dirname, '<project_folder>'),
  },
},

Add this to your eslint configuration:

// For more options check https://www.npmjs.com/package/eslint-import-resolver-webpack
settings: {
  'import/resolver': {
    webpack: {
      config: '<path_to_webpack',
    },
  },
},

Option 2 (deprecated)

Run:

npm i --save-dev babel-plugin-root-import eslint-import-resolver-babel-plugin-root-import

Add to .babelrc:

"plugins": [
  [
    "babel-plugin-root-import",
    {
      "rootPathPrefix": "~",
      "rootPathSuffix": "app"
    }
  ]
]

Add to .eslintrc:

  "settings": {
    "import/resolver": "babel-plugin-root-import"
  },

Thumb ups rules of editing this package subset:

  • Make sure that this is not disabled by eslint-config-prettier. If you re-enable it then prettier and eslint might run into conflict.
  • Provide reference to documentation.
  • Provide Airbnb declaration (and they reasoning).
  • Provide explanation why the decision to alter a rule was made.

CHANGELOG