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

@patrikvalkovic/eslint-config

v1.0.1

Published

Opinionated eslint config

Downloads

311

Readme

Eslint configs

Prepared strict and opinionated eslint configurations.

Contains also formatting rules and is supposed to work without prettier.

In general contains everything from plugins recommended configs and many more optional rules enable.

Configured for eslint 9.0.0 and above using flat config.

The package is primarily typescript focused.

Includes many plugins build-in, like @typescript-eslint, eslint-plugin-react, eslint-plugin-import, no-only-tests, etc.

Installation

Just install the package. You will also need the eslint plugin itself.

npm install -D eslint @patrikvalkovic/eslint-config

The package currently has 3 configurations, imported from within the package

  • @patrikvalkovic/eslint-config/javascript for JavaScript code,
  • @patrikvalkovic/eslint-config/typescript for TypeScript,
  • @patrikvalkovic/eslint-config/react for React.

There is also tsconfig with preconfigured strict compiler options.

  • @patrikvalkovic/eslint-config/tsconfig.base.json

Usage

Require the desired configuration and spread it into eslint config.

The package generates rules and configurations, for most cases you just need to provide path to tsconfig file.

const typescript = require('@patrikvalkovic/eslint-config/typescript');

module.exports = [
    ...typescript('./tsconfig.json'),
];

The function generates the necessary configuration. Alternatively, you may pass your own configuration and either replace the generated configuration (when passed as first parameter), or merge it with the generated one (when passed as second parameter).

const react = require('@patrikvalkovic/eslint-config/react');
const globals = require('globals')

module.exports = [
    ...react('./tsconfig.json', {
        languageOptions: {
            globals: {
                ...globals.browser,
            }
        }
    }),
];

tsconfig

Package has also tsconfig.base.json file prepared with strict options enabled. You can extend your tsconfig directly using the package name.

{
  "extends": "@patrikvalkovic/eslint-config/tsconfig.base.json",
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    // ...
  }
}

Ignore files

When you specify config blog with just ignores property (no rules defined), these ignored rules will be ignored across all the rules.

const typescript = require('@patrikvalkovic/eslint-config/javascript');

module.exports = [
    ...javascript(),
    {
        ignores: [
            'eslint.config.js',
            'build/**/*',
        ],
    },
];

Disable rules

If some rule doesn't suite you, you can turn it off in separate config block.

const typescript = require('@patrikvalkovic/eslint-config/typescript');

module.exports = [
    ...typescript('tsconfig.base.json'),
    {
        rules: {
            'no-await-in-loop': 'off',
            '@typescript-eslint/ban-ts-comment': 'off',
        },
    },
];

Further development

The rules and plugins included in the package may evolve over time if I see room for improvements, collisions with my notion, or I find new plugins or rules.

As mentioned, this collection is opinionated, but if you would like to see some further rules, send an issue.

More configs may be created over time when I will find the need. If you would expect config for some case that is not present, don't hesitate to send a merge request or raise an issue.


License: MIT