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

ko-lint-config

v2.2.21

Published

lint configs about eslint stylelint and prettier

Downloads

53

Readme

[ko-lint-config] npm downloads

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 pnpm 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

pnpm add ko-lint-config -D

Usage

  How to get Code Style Guide: 如何引入 Code Style Guide

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

module.exports = {
  extends: [require.resolve('ko-lint-config')],
}
const prettier = require('ko-lint-config/.prettierrc')

module.exports = {
  ...prettier,
}
module.exports = {
  extends: [require.resolve('ko-lint-config/.stylelintrc')],
}

You should not override settings. Because this is a Code Style Guide for group.

2、Add script to package.json:

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

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

How do I disable a eslint rule?

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

ko-lint-config uses ESLint under-the-hood and you can hide errors as you normally would if you used ESLint directly. stylelint is same to eslint.

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 pnpm lint script and install eslint plugin for vscode.

Learn more

Code-Style-Guide

License

MIT. Copyright (c) 2022 dt-insight