0.4.0 • Published 2 years ago

@rindo/eslint-plugin v0.4.0

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

@rindo/eslint-plugin

ESLint rules specific to Rindo JS projects.

Installation

If you're using npm v7+, you only need to install this package. Its peer dependencies will be automatically installed.

npm i --save-dev @rindo/eslint-plugin

If you're using npm v6 or lower, you will need to install this package and its peer dependencies in your rindo project:

npm i --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react @rindo/eslint-plugin typescript

Usage

.eslintrc.json configuration file:

{
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "extends": [
    "plugin:@rindo/recommended"
  ]
}

Add a new lint script to the package.json:

{
  "scripts": {
    "lint": "eslint src/**/*{.ts,.tsx}"
  }
}

By default, ESLint will ignore your node_modules/ directory. Consider adding a .eslintignore file at the root of your project with any output target directories to avoid false positive errors from ESLint.

# place any directories created by the Rindo compilation process here
dist
loader
www

Lint all your project:

npm run lint

Supported Rules

This rule catches Rindo public methods that are not async.

This rule catches Rindo Component banned tag name prefix.

This rule catches Rindo Component class name not matching configurable pattern.

This rule catches Rindo decorators in bad locations.

This rule catches Rindo decorators style usage.

This rule catches Rindo Element decorator have the correct type.

This rule catches Rindo method hostData.

This rule catches Rindo Methods marked as private or protected.

This rule catches Rindo Watchs with non existing Props or States.

This rule catches own class methods marked as public.

This rule catches own class properties marked as public.

This rule catches Rindo Listen with vdom events.

This rule catches Rindo Props marked as private or protected.

This rule catches Rindo Props marked as non readonly, excluding mutable ones.

This rule catches Rindo Render returning array instead of Host tag.

This rule catches Rindo Props, Methods and Events to define jsdoc.

This rule catches Rindo Component required tag name prefix.

This rule catches Rindo Prop names that share names of Global HTML Attributes.

This rule catches modules that expose more than just the Rindo Component itself.

This rule catches Rindo Prop marked as mutable but not changing value in code.

Recommended rules

{
  "@rindo/async-methods": "error",
  "@rindo/ban-prefix": ["error", ["rindo"]],
  "@rindo/decorators-context": "error",
  "@rindo/decorators-style": [
    "error", {
      "prop": "inline",
      "state": "inline",
      "element": "inline",
      "event": "inline",
      "method": "multiline",
      "watch": "multiline",
      "listen": "multiline"
    }],
  "@rindo/element-type": "error",
  "@rindo/host-data-deprecated": "error",
  "@rindo/methods-must-be-public": "error",
  "@rindo/no-unused-watch": "error",
  "@rindo/own-methods-must-be-private": "error",
  "@rindo/own-props-must-be-private": "error",
  "@rindo/prefer-vdom-listener": "error",
  "@rindo/props-must-be-public": "error",
  "@rindo/props-must-be-readonly": "error",
  "@rindo/render-returns-host": "error",
  "@rindo/required-jsdoc": "error",
  "@rindo/reserved-member-names": "error",
  "@rindo/single-export": "error",
  "@rindo/strict-mutable": "error"
}

Licence