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

@clicktime/eslint-config

v0.2.1

Published

ESLint preset extending Airbnb, Prettier and Jest

Downloads

21

Readme

Clicktime ESLint config utilizing Airbnb, Flow/TypeScript, Prettier, Jest, React and React Native.

Plugins and configs used:

Installation

1 - Add library to package.json (devDependencies)

npm install @clicktime/eslint-config --save-dev or yarn add @clicktime/eslint-config --dev

Add commands to package.json

    "lint:js": "eslint FOLDER_TO_APPLY_ESLINT --ext .js,.ts,.tsx,.jsx --cache",
    "lint:js:fix": "eslint FOLDER_TO_APPLY_ESLINT --ext .js,.ts,.tsx,.jsx --fix",
    "lint:js:errors": "eslint FOLDER_TO_APPLY_ESLINT --ext .js,.ts,.tsx,.jsx --cache --quiet",

Note: if eslint isn't recognized try using npx eslint, eg: "lint:js": "npx eslint src --ext .js,.ts,.tsx,.jsx --cache", Note: replace FOLDER_TO_APPLY_ESLINT with your source folder, eg: src

Add .eslintcache to the .gitignore file (auto-generated with the --cache option)

2 - ESLint config

Create the file .eslintrc.js or add '@clicktime' to your current ESLint config file (eg: .eslintrc.js, .eslintrc, or eslintConfig)

React and Typescript rules

// .eslintrc.js
module.exports = {
  extends: ['@clicktime'],
  parserOptions: {
    // optional if using Typescript
    project: './tsconfig.json',
    tsconfigRootDir: './',
  },
};

NodeJS and Typescript rules

// .eslintrc.js
module.exports = {
  extends: ['@clicktime/eslint-config/node'],
  parserOptions: {
    // optional if using Typescript
    project: './tsconfig.json',
    tsconfigRootDir: './',
  },
  settings: {
    jest: { version: '99' }, // add this if jest isn't installed
  },
};

AngularJS rules

// .eslintrc.js
module.exports = {
  extends: ['@clicktime/eslint-config/angularJS']
};

3 - VSCode Setup for Prettier and ESLint

Add these extensions to VSCode so it can work well with Prettier and ESLint when saving files:

  • https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
  • https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
  • https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig

Create the following file .editorconfig

# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true

[*]
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
indent_style = tab
indent_size = 2

4 - CI

Bitbucket Pipelines

Create the following file bitbucket-pipelines.yml to run the linters in Bitbucket pipelines

image: node:12

pipelines:
  default:
    - step:
        name: Install and run linter
        caches:
          - node
        script:
          - node -v
          - npm install
          - npm run lint:js
        artifacts:
          - node_modules/**

Note: image: node:12 should be the version of nodejs we are using in the repository, eg: image: node:14, image: node:latest, etc

Gitlab

Create the following file gitlab-ci.yml to run the linters in Gitlab

image: node:latest

stages:
  - linter

linter:
  stage: linter
  script:
    - npm install
    - npm run lint:js

Testing a version before publishing to npm

 "@clicktime/eslint-config": "git+ssh://[email protected]:administrators/eslint-config-clicktime.git#USE_SOME_HASH",