Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Added new eslint plugin #1514

Merged
merged 13 commits into from
Nov 28, 2023

Conversation

Angelelz
Copy link
Collaborator

This PR will close #1361, close #1462 and close #1463.

Added new plugin

eslint-plugin-drizzle

eslint plugin for drizzle users to avoid common pitfalls

Install

[ npm | yarn | pnpm | bun ] install eslint eslint-plugin-drizzle

Usage

Use a preset config or configure each rule in package.json or eslint.config.js.

If you don't use the preset, ensure you use the same env and parserOptions config as below.

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "env": {
      "es2024": true
    },
    "parserOptions": {
      "ecmaVersion": "latest",
      "sourceType": "module"
    },
    "plugins": ["drizzle"],
    "rules": {
      "drizzle/enforce-delete-with-where": "error",
      "drizzle/enforce-update-with-where": "error"
    }
  }
}

Rules

enforce-delete-with-where: Enforce using delete with where in DELETE statement

enforce-update-with-where: Enforce using update with where in UPDATE statement

Preset configs

Recommended config

This plugin exports a recommended config that enforces good practices.

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "extends": "plugin:drizzle/recommended"
  }
}

All config

This plugin exports an all config that makes use of all rules (except for deprecated ones).

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "extends": "plugin:drizzle/all"
  }
}

At the moment, all is equivalent to recommended.

@AndriiSherman AndriiSherman changed the base branch from main to beta November 27, 2023 19:09
@AndriiSherman AndriiSherman merged commit 89a2300 into drizzle-team:beta Nov 28, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants