eslint-plugin-strudel
v1.0.2
Published
ESLint plugin for Strudel.js
Downloads
5
Readme
eslint-plugin-strudel
Official ESLint plugin for Strudel.js
Requirements
- ESLint
^5.0.0
- Node.js
>=6.10.0
Installation
Install ESLint either locally or globally.
$ npm i eslint eslint-plugin-strudel -D
Usage
Create .eslintrc.*
file to configure rules. See: http://eslint.org/docs/user-guide/configuring
Example .eslintrc.js
:
{
"extends": [
"plugin:strudel/recommended"
]
}
Configs
This plugin provides two predefined configs:
plugin:strudel/base
: Settings and rules to enable correct ESLint parsingplugin:strudel/recommended
: Above, plus rules to prevent errors and ensure consistency
Rules
- strudel/element-import: enforce importing
element
as$
- strudel/single-line-el: enforce using
@El
with it's property in one line - strudel/no-useless-init: prevent useless
init
method - strudel/first-method-init: enforce
init
being first method if used - strudel/oninit-on-top: enforces methods decorated with
@OnInit
to be first methods of class - strudel/element-on-top: enforces properties decorated with
@El
to be on top of class body
Contribution
Before you start writing new rule, please read the official ESLint guide.
Next you need to get an idea how the AST looks like - use astexplorer.net to inspect ASTs.
When writing tests for rules Debugging Mocha guide for Visual Studio Code may become helpful.
License
Copyright (c) 2017-present, Mateusz Łuczak