adobe/eslint-plugin-twist

Name: eslint-plugin-twist

Owner: Adobe Systems Incorporated

Description: ESLint plugin for Twist

Created: 2017-12-22 02:05:15.0

Updated: 2018-01-22 18:51:47.0

Pushed: 2018-02-05 18:14:28.0

Homepage: null

Size: 67

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ESLint Plugin for Twist

Build Status

Custom rules to support Twist features, such as auto-imports and JSX syntax.

Installation

You'll first need to install ESLint:

install eslint --save-dev
install @twist/eslint-plugin-core --save-dev

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

Usage

Add twist to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:


"plugins": [
    "@twist/core"
]


 add the recommended rules to your `extends` section:

{

"extends": [
    "plugin:@twist/core/recommended"
]

}

rnative, you can configure the rules you want to use individually, under the rules section:

{

"rules": {
    "@twist/core/rule-name": "error"
}

}

upported Rules

twist/core/jsx-member-vars](docs/rules/jsx-member-vars.md): Prevent imported members and variables used in JSX from being marked as unused.
twist/core/no-undef](docs/rules/no-undef.md): Extends the eslint 'no-undef' rule for Twist structural components like `<repeat>` and `using`, and to understand auto-imported decorators.
twist/core/constructor-super](docs/rules/constructor-super.md): Extends the eslint 'constructor-super' rule to understand Twist class decorators that auto-extend a class (e.g. `@Store` and `@Component`).

: This eslint plugin reads your `.twistrc` configuration file to determine which decorators are auto-imported, based on which Twist libraries you use.

roposing a new Rule

ou find that the current set of rules are not enough to handle a specific case in your Twist project, here are the
s for proposing a new one:

ile an issue describing the case with the code snippet that is incorrectly handled by ESLint
ropose in the issue if possible an expected behavior
abel the issue as appropriately as possible, so that it's processed in the correct priority
f you want to fix an issue yourself, first assign it to you so everyone knows it's in progress
hen creating the PR with the fix for the issue make sure you [reference the issue ID](https://help.github.com/articles/closing-issues-using-keywords/)
ave it automatically closed when merged

riting rules

ing a rule requires a non-trivial amount of work and some base boilerplate code. In order to make the task easy you
read our [ESLint How-To Guide](ESLINT_HOWTO.md).

eslintrc sample configuration

's an example of using the Twist ESLint plugin in conjunction with the `eslint:recommended` rules:

{

"parser": "babel-eslint",
"plugins": [
    "babel",
    "@twist/core"
],
"env": {
    "browser": true,
    "es6": true,
    "node": true
},
"extends": [
    "eslint:recommended",
    "plugin:@twist/core/recommended"
],
"parserOptions": {
    "ecmaFeatures": {
        "experimentalObjectRestSpread": true,
        "jsx": true
    },
    "sourceType": "module"
}

}


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.