eslint-plugin-annotation

1.1.6 • Public • Published

eslint-plugin-annotation

NPM version Build Status

An ESLint plugin that collects rules to exceptionally validate and autocorrect code with annotations in comments.

annotation/sort annotation/sort-keys
sort sort-keys

Installation

You’ll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-annotation:

npm i eslint-plugin-annotation --save-dev

Usage

Here’s a suggested ESLint configuration that:

{
  "parserOptions": { ... }, // Nothing changed
  "plugins": [..., "annotation"], // Add 'annotation' next to old plugins
  "rules": {
    ...
    // Add below rules next to old rules 
    'annotation/format-date': 'error',
    'annotation/sort-keys': 'error',
    'annotation/sort': 'error',
    'annotation/unique': 'error',
  }
}

Supported Rules

Rule Description Autofix
format-date Ensure dates in strings match the specified @format-date annotation
sort-keys Sort interface properties or object keys if has @sort-keys annotation ✔️
sort Sort array values if has @sort annotation ✔️
unique Ensure array values are unique if annotated with @unique ✔️

License

BSD License

Package Sidebar

Install

npm i eslint-plugin-annotation

Weekly Downloads

2,437

Version

1.1.6

License

MIT

Unpacked Size

82 kB

Total Files

43

Last publish

Collaborators

  • ronpark