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-dt-insight

v0.0.9

Published

an eslint shareable config for dt-insight

Downloads

5

Readme

eslint-config-dt-insight CI npm downloads

An eslint shareable config for dt-insight Code Style Guide

This module saves time in three ways for you:

  • No configuration - The easier way to enforce code quality in your project. No configuration rules. It just works.
  • Automatically format code - Just run yarn lint-fix and say goodbye to messy or inconsistent code.
  • Catch style issues & programmer errors early - Reduce manual review in the code review process, and leave simple things to tools to save time.

No hesitation. No more maintenance .eslintrc. Give it a try right now!

Detailed rules

  • four spaces are required – indent
  • single quotation marks are required for string – except where escape is need
  • require keyword followed by space - if (condition) {...}
  • requires no spaces after the function name - function name (arg) {...} except anonymous functions and async function (arg) {...} `` async () { ... }
  • semicolons are not mandatory
  • not mandatory = = = - the field type returned by the backend cannot be guaranteed
  • do not force ternary operators to wrap
  • allow but do not require trailing commas - when the last element or attribute is on a different line from the end or attribute
  • function content is allowed to be empty
  • allow this alias - alias optional self _this `that', cannot be deconstructed from this
  • no debugger required
  • no console is recommended

Install

yarn add eslint-config-dt-insight -D

Usage

Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ESLint website.

1、Then, add this to your .eslintrc file:

{
  "extends": "dt-insight"
}

Note: We omitted the eslint-config- prefix since it is automatically assumed by ESLint.

You can not override settings. Because this is a Code Style Guide for dt-insight's project.

2、Add script to package.json:

"scripts": {
  "lint": "npx eslint './src/**/*.ts' './src/**/*.tsx'",
  "lint-fix": "npx eslint './src/**/*.ts' './src/**/*.tsx' --fix"
},

You can use yarn lint-fix to correct most code style problems.

How do I disable a rule?

In rare cases, you'll need to break a rule and hide the error generated by Code Style Guide.

eslint-config-dt-insight uses ESLint under-the-hood and you can hide errors as you normally would if you used ESLint directly.

Disable all rules on a specific line:

file = 'I know what I am doing' // eslint-disable-line

Or, disable only the "no-use-before-define" rule:

file = 'I know what I am doing' // eslint-disable-line no-use-before-define

Or, disable the "no-use-before-define" rule for multiple lines:

/* eslint-disable no-use-before-define */
console.log('offending code goes here...')
console.log('offending code goes here...')
console.log('offending code goes here...')
/* eslint-enable no-use-before-define */

Looking for something easier than this?

You can add to your yarn lint script and install eslint plugin for vscode.

Learn more

Code-Style-Guide

License

MIT. Copyright (c) 2022 dt-insight