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

@superkoders/eslint-typescript-config

v0.2.6

Published

SUPERKODERS eslint Typescript configuration

Downloads

2

Readme

@superkoders/eslint-config

Instalation

In case you have a Typescript project, use this package instead of @superkoders/eslint-config. This package is extending it with some rules for Typescript.

1. Install the package

npm i -D @superkoders/eslint-typescript-config

2. Add .eslintrc.js

This tells linter where to locate our rules. You can also override the rules here, if you have some exception on a given project.

module.exports = {
	'extends': ['@superkoders/eslint-typescript-config']
};

3. Add .eslintignore

Package.json and package-lock.json is generated automatically. It might be problematic to enforce styling on this one. Use your own config, which might contain things like those:

# Of particular note is that like .gitignore files, all paths used as patterns for both .eslintignore and --ignore-pattern must use forward slashes as their path separators.
# /node_modules/* and /bower_components/* in the project root are ignored by default
web/**/*
src/js/static/**/*

4. Add Prettier

Prettier comes with some opinions by default, which can conflict with other linters' settings. This will make sure they're in sync. Docs on how to download and setup SK Prettier config.

5. Add lint script to the package.json

And adjust the paths to your project needs.

{
	"scripts": {
		"lint:js": "eslint .; exit 0",
		"lint:js:fix": "eslint . --fix",
	},
}

6. Optional: Install git hooks utility

If you want to prevent commiting bad code, you can let it check before commiting. If not right, it will notify the developer. When the code is correct, it will get a green light to the repo.

npm i -D husky lint-staged

7. Set up the pre-commit hook

Add to the package.json

"husky": {
	"hooks": {
		"pre-commit": "lint-staged"
	}
},
"lint-staged": {
	"*.js": [
		"eslint"
	]
},

Running npm run lint-js will check the code and output list of errors and warnings to the console. Running npm run lint-js:fix will check and fix the code. This is omst useful when introducing linter to existing codebase.

8. Optional: Live error/warning highlightning with editor extension

Download an extension, which will highlight problematic code and give you options how to fix it or which will auto format it as you save. Prettier do VS Code ESLint do VS Code

9. Update VS Code settings for autoformatting

Ideally, save those settings in .vscode/settings.json so it lives with the project, if it isn't there already.

"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
	"source.fixAll.eslint": true,
},
"prettier.requireConfig": true, // Only format configured projects