eslint-plugin-crisp

1.0.80 • Public • Published

ESLint Plugin Crisp

Build and Release NPM Downloads

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"
    // OR "plugin:crisp/recommended-vue"
  ]
}

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

Name Description 🟠 🟢
eslint:recommended Core ESLint rules 🟢
plugin:jsdoc/recommended JSDoc linting rules 🟠 🟢
plugin:vue/vue3-recommended Vue.js 3 linting rules 🟢
plugin:vue-pug/vue3-recommended Pug templates support for Vue.js linting rules 🟢

Plugins

Name Description 🟠 🟢
eslint-plugin-jsdoc JSDoc linting rules for ESLint 🟠 🟢

Rules

General JS rules

Name Description 🟠 🟢
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) 🟢
keyword-spacing Enforces consistent spacing before and after keywords 🟠 🟢
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-undef Disallows use of undeclared variables 🟠 🟢
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 🟠 🟢
space-infix-ops Enforces spaces around infix operators 🟢

Crisp JS rules

Name Description 🟠 🟢
crisp/align-consecutive-class-assignements Enforces alignment of consecutive assignment statements in a class constructor 🟠
crisp/align-one-var Enforces alignment of variables in 'one-var' statements 🟠
crisp/align-requires Enforces alignment of require statements 🟠
crisp/const Enforces that const variables start with __ or are all uppercase 🟠
crisp/constructor-variables Ensures all class properties in the constructor start with _ 🟠
crisp/enforce-optional Enforces use of optional chaining 🟠 🟢
crisp/header-check Enforces files to start with Crisp header 🟠 🟢
crisp/header-comments-check Enforces different comment blocks before different groups (imports, constants, instances and exports) 🟠 🟢
crisp/import-group-comment Ensures import statements are preceded by a comment stating their type 🟢
crisp/import-group-order Ensures import statements are correctly ordered 🟢
crisp/methods-naming Ensures methods are named according to their access (public, private, protected) 🟠 🟢
crisp/methods-ordering Ensures methods order according to their access: public then protected then private 🟠 🟢
crisp/multiline-comment-end-backslash Enforces multiline comments to end with a backslash 🟠 🟢
crisp/newline-after-switch-case Requires newline between switch cases 🟠 🟢
crisp/no-async Disallows the use of async/syntax, in favor of Promise 🟠 🟢
crisp/no-short-parameters Disallow parameter names shorter than 3 characters 🟠 🟢
crisp/no-space-in-optional-arguments Disallows space before or after = in optional parameters 🟠
crisp/no-useless-template-literals Disallows unnecessary use of template literals 🟢
crisp/no-var-in-blocks Disallows var declarations inside function, method, or class block 🟠 🟢
crisp/one-space-after-operator Enforces at least one space before and one space after = and : operators 🟠 🟢
crisp/regex-in-constructor Ensures regular expressions are defined in the class constructor 🟠 🟢
crisp/ternary-parenthesis Enforces parentheses around conditions with operators in ternary expressions 🟠 🟢
crisp/two-lines-between-class-members Requires exactly two line breaks between class methods 🟠
crisp/variable-names Requires variables defined within a method to start with _ 🟠 🟢

General JSDoc rules

Name Description 🟠 🟢
jsdoc/no-undefined-types Rule is disabled to allow some undefined types 🟠
jsdoc/require-description Requires all functions to have a description in their JSDoc 🟢
jsdoc/require-param-description Rule is disabled as we don't write any description for @param tags 🟠 🟢
jsdoc/require-jsdoc Enforces JSDoc comments on functions and classes 🟠 🟢
jsdoc/sort-tags Enforces specific order for tags 🟠 🟢

Crisp JSDoc rules

Name Description 🟠 🟢
crisp/jsdoc-align-params Enforces various alignments 🟠 🟢
crisp/jsdoc-check-indentation Enforces consistent indentation 🟠 🟢
crisp/jsdoc-check-optional-params Requires optional parameters to be surrounded by brackets 🟢
crisp/jsdoc-enforce-access Requires one of @public, @private, or @protected for functions 🟢
crisp/jsdoc-enforce-classdesc Ensures JSDoc for class headers to include a non-empty @classdesc 🟠 🟢

General Vue rules

Name Description 🟠 🟢
vue/attributes-order Enforces order of attributes 🟢
vue/block-lang Allows script blocks to have no lang attribute 🟢
vue/block-order Enforces order of component top-level elements (template, then script, then style) 🟢
vue/block-tag-newline Requires one line break after opening and before closing block-level tags 🟢
vue/comma-dangle Disallows trailing commas in <template> 🟢
vue/component-api-style Enforces Options API style 🟢
vue/component-name-in-template-casing Enforces tag names to kebab case 🟢
vue/component-options-name-casing Enforces component names in components options to pascal case 🟢
vue/custom-event-name-casing Enforces custom event names to camel case 🟢
vue/eqeqeq Requires the use of === and !== in <template> 🟢
vue/html-comment-content-spacing Requires one space before and after HTML comment tags 🟢
vue/html-quotes Rule is disabled in order to allow backticks in HTML attributes 🟢
vue/key-spacing Enforces consistent spacing in object literal properties in <template> (no space between the key and the colon, one space between the colon and the value) 🟢
vue/match-component-import-name Requires the registered component name to match the imported component name 🟢
vue/max-len Enforces a maximum line length of 80 characters (only for <script>) 🟢
vue/new-line-between-multi-line-property Requires new lines between multi-line props 🟢
vue/no-bare-strings-in-template Disallows the use of bare strings in <template> 🟢
vue/no-irregular-whitespace Disallows irregular / invalid whitespaces 🟢
vue/no-multiple-objects-in-class Disallows to pass multiple objects into array to class HTML property 🟢
vue/no-mutating-props Disallows mutation of component props (except shallow mutation) 🟢
vue/no-static-inline-styles Disallows static inline style attributes 🟢
vue/no-use-v-else-with-v-for Disallows using v-else-if/v-else on the same element as v-for (works but confusing) 🟢
vue/no-useless-v-bind Disallows unnecessary v-bind directives 🟢
vue/no-v-html Rule is disabled in order to allow the use of v-html 🟢
vue/padding-line-between-blocks Requires padding lines between blocks 🟢
vue/padding-lines-in-component-definition Requires padding lines in component definition 🟢
vue/prefer-true-attribute-shorthand Requires shorthand form attribute when v-bind value is true 🟢
vue/require-direct-export Requires the component to be directly exported 🟢
vue/v-for-delimiter-style Enforces the use of in delimiter in v-for directive 🟢
vue/v-slot-style Disallows v-slot shorthand style 🟢

Crisp Vue rules

Name Description 🟠 🟢
crisp/vue-computed-order Ensures computed properties are alphabetically ordered 🟢
crisp/vue-emits-order Ensures emits properties are alphabetically ordered 🟢
crisp/vue-header-check Ensures script, template and style tags start with corresponding comment block 🟢
crisp/vue-html-quotes Enforces HTML attributes to be enclosed with double quotes 🟢
crisp/vue-no-regex-data Disallows regular expressions to be declared in Vue data object 🟢
crisp/vue-props-declaration-multiline Enforces props declarations to be multiline 🟢
crisp/vue-props-declaration-order Ensures props declarations are alphabetically ordered 🟢

License

eslint-plugin-crisp is released under the MIT License. See the bundled LICENSE file for details.

Readme

Keywords

Package Sidebar

Install

npm i eslint-plugin-crisp

Weekly Downloads

127

Version

1.0.80

License

MIT

Unpacked Size

108 kB

Total Files

42

Last publish

Collaborators

  • baptistejamin
  • crisp-dev