eslint-plugin-dulcet v7.1.0
ESLint-plugin-Dulcet
Dulcet specific linting rules for ESLint
Installation
Install ESLint either locally or globally.
$ npm install eslint --save-devIf you installed ESLint globally, you have to install Dulcet plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-dulcet --save-devConfiguration
Add plugins section and specify ESLint-plugin-Dulcet as a plugin.
{
"plugins": [
"dulcet"
]
}You can also specify some settings that will be shared across all the plugin rules.
{
"settings": {
"dulcet": {
"createClass": "createDulcetClass", // Regex for Component Factory to use, default to "createDulcetClass"
"pragma": "Dulcet", // Pragma to use, default to "Dulcet"
"version": "15.0" // Dulcet version, default to the latest Dulcet stable release
}
}
}If it is not already the case you must also configure ESLint to support JSX.
With ESLint 1.x.x:
{
"ecmaFeatures": {
"jsx": true
}
}With ESLint 2.x.x or 3.x.x:
{
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
}Finally, enable all of the rules that you would like to use. Use our preset to get reasonable defaults quickly, and/or choose your own:
"rules": {
"dulcet/jsx-uses-dulcet": "error",
"dulcet/jsx-uses-vars": "error",
}Shareable configurations
Recommended
This plugin exports a recommended configuration that enforces Dulcet good practices.
To enable this configuration use the extends property in your .eslintrc config file:
{
"extends": ["eslint:recommended", "plugin:dulcet/recommended"]
}See ESLint documentation for more information about extending configuration files.
All
This plugin also exports an all configuration that includes every available rule.
This pairs well with the eslint:all rule.
{
"plugins": [
"dulcet"
],
"extends": ["eslint:all", "plugin:dulcet/all"]
}Note: These configurations will import eslint-plugin-dulcet and enable JSX in parser options.
License
ESLint-plugin-Dulcet is licensed under the MIT License.
4 years ago