1.2.1 • Published 2 months ago

@we-are-singular/eslint-config v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@we-are-singular/eslint-config

npm version

This package provides a shared ESLint configuration for Singular projects.

Installation

npm install --save-dev @we-are-singular/eslint-config

Usage

config()

This function is used to create an ESLint configuration object. it just deeply merges the provided arguments.

extend()

This function is used to create an ESLint configuration object. it extends the presets.all configuration and merge the provided arguments.

presets

list of presets that can be used to create an ESLint configuration object.

overrides

list of override factories that can be used to create an ESLint overwrite rule.

Example

// .eslintrc.js

const { config, overrides, presets } = require("@we-are-singular/eslint-config")

module.exports = config(
  // some presets
  presets.react,
  presets.typescript,
  // your rules
  {
    rules: {
      "no-console": "warn",
    },
    overrides: [
      // some overrides
      overrides.vitestNode(["apps/backend", "packages/logger"]),

      // your rules
      {
        files: ["*.test.ts", "*.test.tsx"],
        rules: {
          "no-console": "off",
        },
      },
    ],
  }
)

Example using extend()

// .eslintrc.js

const { extend, overrides } = require("@we-are-singular/eslint-config")

module.exports = extend({
  rules: {
    "no-console": "warn",
  },
  overrides: [
    // some overrides
    overrides.vitestNode(["apps/backend", "packages/logger"]),

    // your rules
    {
      files: ["*.test.ts", "*.test.tsx"],
      rules: {
        "no-console": "off",
      },
    },
  ],
})

Example as ESLint preset

// .eslintrc.js

/** @type {import("eslint").Linter.Config} */
module.exports = {
  root: true,
  extends: ["@we-are-singular/eslint-config/all"],
  overrides: [
    // your rules
    {
      files: ["*.test.ts", "*.test.tsx"],
      rules: {
        "no-console": "off",
      },
    },
  ],
}

Releasing a new version

To release a new version, you need to have access to the @we-are-singular npm organization.

  1. Make sure you are logged in to the @we-are-singular npm organization by running npm login and following the instructions.
  2. Run npm run release to trigger the release process.
  3. Follow the instructions and make sure to select the correct version type.
  4. The release will be published to npm and github automatically.