@episerver/eslint-plugin-cms
Helps you use the Episerver CMS API's correctly.
Last updated 2 months ago by barteksekula .
Apache-2.0 · Repository · Original npm · Tarball · package.json
$ cnpm install @episerver/eslint-plugin-cms 
SYNC missed versions from official npm registry.

NPM version Build status

@episerver/eslint-plugin-cms

Makes sure only public non-deprecated Episerver CMS API's are used.

If you work on multiple Episerver projects and want to help us improve our public API, we could use your help.

Screenshot of summary output

Installation

First, install ESLint:

$ npm i eslint --save-dev
# or
$ yarn add eslint -D

Next, install @episerver/eslint-plugin-cms:

$ npm i @episerver/eslint-plugin-cms --save-dev
# or
$ yarn add @episerver/eslint-plugin-cms -D

Note: If you installed ESLint globally (using the -g flag) then you must also install @episerver/eslint-plugin-cms globally.

Usage

Add @episerver/eslint-plugin-cms to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "@episerver/cms"
    ]
}

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

{
    "rules": {
        "@episerver/cms/no-internal-episerver-apis": "error",
        "@episerver/cms/no-deprecated-episerver-apis": "warn"
    }
}

Recommended config

This plugin exports a recommended config that enforces good practices.

Enable it in your .eslintrc.json with the extends option:

{
    "extends": "plugin:@episerver/cms/recommended"
}

Analyzing multiple projects

Install globally (see instructions above), and then run this for any project:

$ eslint C:/YourEpiserverProject/ --output-file=YourEpiserverProject.json --plugin=episerver-cms --format=episerver-cms --ignore-pattern="node_modules" --ignore-pattern="dtk" --rule="{ \"@episerver/cms/no-internal-episerver-apis\": error, \"@episerver/cms/no-deprecated-episerver-apis\": warn }"

Supported Rules

Formatters

There are several formatters you can use to get a clearer overview of what Episerver API's are being used but shouldn't be. They are installed separately, with @episerver/eslint-formatter-cms.

$ npm i @episerver/eslint-formatter-cms --save-dev
# or
$ yarn add @episerver/eslint-formatter-cms -D

Then you can get a summary view with:

$ eslint . --format=episerver-cms

Current Tags

  • 2.1.1                                ...           latest (2 months ago)

3 Versions

  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 2
Dependencies (1)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |