eslint-plugin-sequel

1.9.10 • Public • Published

eslint-plugin-sequel

ESLint rules for inline SQL within Template Literals.

Coverage Status CircleCI NPM Version Known Vulnerabilities

Installation

Install eslint-plugin-sequel:

$ npm install eslint-plugin-sequel --save-dev

Usage

Add sequel to the plugins section of your .eslintrc configuration file.

{
	"plugins": ["sequel"]
}

Then configure the rules you want to use under the rules section.

{
	"rules": {
		"sequel/function-case": 2,
		"sequel/indent": [2, "tab"],
		"sequel/max-placeholders": [2, {"max": 3}],
		"sequel/no-eol-command": [2, {"allowOnOwnLine": true}],
		"sequel/no-shorthand-all": [
			2,
			{"allowQualified": true, "allowCountAll": true}
		],
		"sequel/no-unsafe-query": 2,
		"sequel/spacing": 2
	}
}

Rules

  • sequel/function-case: Makes SQL function names uppercase, e.g. 'SELECT' fixable
  • sequel/indent: Enforces indentation fixable
    • 'tab'|Number: Defines the characters to use, where Number is given it uses spaces (default 2).
  • sequel/max-placeholders: Placeholders, ? character, can be hard to read if there are many in the same SQL string.
    • max: Maximum number of placeholders allowed (default 3)
  • sequel/no-eol-command: Avoid ending lines with a SQL command which is always followed by a value.
    • allowOnOwnLine: Permits the command to appear if it is not preceeded by anything, allowing commands to be easily read.
  • sequel/no-shorthand-all: Avoid using the ambiguous shorthand all '*'.
    • allowQualified (Boolean, default: false): Permits qualified shorthand all e.g. table.* to get everything from a table.
    • allowCountAll (Boolean, default: false): Permits within COUNT() e.g. COUNT(*).
  • sequel/no-unsafe-query: Checks whether there are potentially any vulnerable SQL'ish template literals, fix by using SQL placeholders or using SQL templating formatter
  • sequel/spacing: Multiple spaces and tabs should only be used for indentation fixable

Package Sidebar

Install

npm i eslint-plugin-sequel

Weekly Downloads

3,266

Version

1.9.10

License

ISC

Unpacked Size

24.8 kB

Total Files

14

Last publish

Collaborators

  • 5app-bot