Skip to content

Commit

Permalink
adding an initial 'getify-says' config preset, per #6
Browse files Browse the repository at this point in the history
  • Loading branch information
getify committed Mar 27, 2019
1 parent a5dd430 commit 364aeb9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ The rules defined in this plugin:

To use **proper-ternary**, load it as a plugin into ESLint and configure the rules as desired.

### `extends`

If you'd like to use the **proper-ternary** plugin in a recommended configuration preset, you can add the plugin in the `extends` clause of your ESLint configuration, and pick a preset by name:

```json
"extends": [
// ..
"plugin:@getify/proper-ternary/CONFIG-PRESET-NAME",
// ..
]
```

**Note:** All included configuration presets not only define specific rule configurations but also automatically load the plugin itself, so you *don't* need to list *proper-ternary* in the `plugins` clause.

The available configuration presets to choose from:

* `getify-says`: This is my personal configuration.

* ..TBA..

It's important to note that you can still override any of the preset rule definitions in your configuration. Think of these presets as convenience "defaults" that can still be customized.

### `.eslintrc.json`

To load the plugin and enable its rules via a local or global `.eslintrc.json` configuration file:
Expand Down
10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
"use strict";

module.exports = {
configs: {
"getify-says": {
plugins: [ "@getify/proper-ternary", ],
rules: {
"@getify/proper-ternary/nested": [ "error", { "else": true, "depth": 10, }, ],
"@getify/proper-ternary/parens": [ "error", { "ternary": false, "call": false, "object": false, }, ],
"@getify/proper-ternary/where": [ "error", { "return": false, }, ],
},
},
},
rules: {
"nested": {
meta: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getify/eslint-plugin-proper-ternary",
"version": "2.0.2",
"version": "2.1.0",
"description": "ESLint rules to ensure proper usage of ternary/conditional expressions",
"main": "./lib/index.js",
"scripts": {
Expand Down

0 comments on commit 364aeb9

Please sign in to comment.