ESLint Plugin Crisp
![Downloads](https://img.shields.io/npm/dt/eslint-plugin-crisp.svg)
A set of custom ESLint configurations and rules for Crisp.
😘 Maintainers: @baptistejamin, @eliottvincent
Usage
The plugin provides two configurations:
crisp/recommended
: JS rules targetting backend code (Node.js)crisp/recommended-vue
: JS rules targetting frontend code (Vue.js)
Add the plugin in your ESLint config object, then extend the desired configuration:
{
"plugins": [
"eslint-plugin-crisp"
],
"extends": [
"plugin:crisp/recommended"
]
}
Documentation
This is the list of plugins and rules used by ESLint Plugin Crisp, and what they do.
Each item has emojis denoting:
- 🟠: enabled in
plugin:crisp/recommended
- 🟢: enabled in
plugin:crisp/recommended-vue
Configurations
Plugins
Rules
General JS rules
- arrow-parens (🟠🟢): Requires parentheses around arrow function arguments
- brace-style (🟠🟢): Enforces one true brace style for blocks
- comma-dangle (🟠🟢): Disallows trailing commas
- comma-style (🟠🟢): Requires a comma after and on the same line
- curly (🟠🟢): Ensures block statements are always wrapped in curly braces
- computed-property-spacing (🟢): Disallows spaces inside computed property brackets
- default-param-last (🟠🟢): Enforces default parameters to be last
- default-case-last (🟠🟢): Enforces default clauses in switch statements to be last
- dot-notation (🟠🟢): Enforces dot notation instead of square-bracket notation
- eqeqeq (🟠🟢): Requires the use of
===
and !==
- eol-last (🟠🟢): Requires newline at the end of files
- indent (🟠🟢): Enforces 2-space indentation, and specific indentation levels for some nodes
- for-direction (🟠🟢): Prevents for-loops to have stop condition that can never be reached
- key-spacing (🟢): Enforces consistent spacing in object literal properties (no space between the key and the colon, one space between the colon and the value)
- linebreak-style (🟠🟢): Enforces Unix-style line endings
- max-len (🟠): Enforces a maximum line length of 80 characters
- newline-per-chained-call (🟢): Requires a newline after each call in a method chain
- no-console (🟠🟢): Disallows the use of
console
- no-debugger (🟠🟢): Disallows the use of
debugger
- no-eval (🟠🟢): Disallows the use of
eval
- no-magic-numbers (🟠): Disallows magic numbers (except the ones in the context of array indexes and in default value assignments)
- no-multi-str (🟠🟢): Disallows multiline strings
- no-multiple-empty-lines (🟢): Allows a maximum of 1 consecutive empty lines
- no-mixed-spaces-and-tabs (🟠🟢): Disallows mixed spaces and tabs for indentation
- no-restricted-syntax (🟢): Enforces
switch
case
's content to be enclosed in braces - no-tabs (🟠🟢): Disallows tabs
- no-trailing-spaces (🟠🟢): Disallows trailing whitespace at the end of lines
- no-unused-vars (🟠🟢): Disallows unused variables
- no-unsafe-optional-chaining (🟠🟢): Disallows use of optional chaining in contexts where the
undefined
value is not allowed - object-curly-newline (🟠🟢): Requires line breaks after opening and before closing braces
- object-curly-spacing (🟠🟢): Requires spacing inside of braces
- padded-blocks (🟠🟢): Disallows empty lines at the beginning and ending of blocks
- padding-line-between-statements (🟠🟢): Requires padding lines between various statements
- prefer-arrow-callback (🟢): Requires using arrow functions for callbacks
- quotes (🟠🟢): Enforces the consistent use of double quotes (while allowing single quotes in order to avoid escape, and backticks for template literals)
- quote-props (🟠🟢): Disallows quotes around object literal property names that are not strictly required
- semi (🟠🟢): Requires semicolons at the end of statements
- semi-style (🟠🟢): Enforces that semicolons are at the end of statements
- semi-spacing (🟢): Disallows space before semicolons, enforces spaces after
- space-before-blocks (🟠🟢): Enforces consistent spacing before blocks
- space-in-parens (🟠🟢): Enforces zero spaces inside of parentheses
Crisp JS rules
General JSDoc rules
Crisp JSDoc rules
General Vue rules
Crisp Vue rules
License
eslint-plugin-crisp is released under the MIT License. See the bundled LICENSE file for details.