Skip to content

Commit

Permalink
moving jsdoc rules and usage of the plugin to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
joeycozza committed Jun 14, 2019
1 parent 7299633 commit 20cab12
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 20 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
1. Run `npm install fs-webdev/eslint-config-frontier --save-dev`
2. Add `"extends": ["frontier"]` to your eslint config.

## Opt in Rules
### Opt in for linting jsdoc rules

We have a way for you to opt in to additional rules. Right now the only plugin we have this way is the jsdoc plugin.
We have set the rules, all you need to do if you want to opt in is add "jsdoc" to the plugins section of your eslint config
We have a configuration for jsdoc rules that you can use if your team decides they want to be more consistent with jsdocs

```
"plugins": ["jsdoc"]
```
1. Add a new entry to the `extends` field of your eslint config.
```
"extends": [
"eslint-config-frontier",
"eslint-config-frontier/jsdoc"
],
```
## CodeClimate Usage
Expand All @@ -34,11 +37,13 @@ It is important to note that in order for CodeClimate to use this custom config,
- url: 'https://raw.githubusercontent.com/fs-webdev/eslint-config-frontier/master/index.js'
path: 'eslint-config-frontier.js'
```
- If you also opt into the jsdoc plugin we provide, you'll also need to make a prepare statement for that file.
2. Make a new eslintrc file for codeclimate to use (that way it can point to the `eslint-config-frontier.js` file that codeclimate will prepare in Step 1.)
1. Copy your existing local eslintrc file and rename the copy to `.codeclimate.eslintrc.js` (or .json or .yml if you are using those filetypes)
2. Change the `"extends": ["frontier"]` statement to point to the prepared file from Step 1. `"extends": ["./eslint-config-frontier.js"]`
(only do this in `.codeclimate.eslintrc.js` file, not your normal eslintrc)
- If you also opt into the jsdoc plugin we provide, you'll also need to add that downloaded file to the extends array
3. Tweak your .codeclimate.yml eslint section to point to the .codeclimate.eslintrc file instead of your default local eslintrc file
- Your plugin section in your .codeclimate.yml may be larger and more complicated, but the `config:` part should point to the new eslintrc file you made in step 2.
Expand Down
13 changes: 0 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,5 @@ module.exports = {
'no-undefined': 'off',
'no-unused-vars': 'warn',
'no-use-before-define': ['error', {functions: false}],

//jsdoc Section
'jsdoc/check-param-names': 2,
'jsdoc/check-tag-names': 2,
'jsdoc/check-types': 2,
'jsdoc/newline-after-description': 0,
'jsdoc/require-description-complete-sentence': 2,
'jsdoc/require-hyphen-before-param-description': 2,
'jsdoc/require-param': 2,
'jsdoc/require-param-description': 2,
'jsdoc/require-param-type': 2,
'jsdoc/require-returns-description': 2,
'jsdoc/require-returns-type': 2
}
};
31 changes: 31 additions & 0 deletions jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
plugins: ['jsdoc'],
rules: {
'jsdoc/check-alignment': 'warn',
'jsdoc/check-examples': 'warn',
'jsdoc/check-indentation': 'off',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-syntax': 'warn',
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-types': 'warn',
'jsdoc/implements-on-classes': 'warn',
'jsdoc/match-description': 'warn',
'jsdoc/newline-after-description': 'off',
'jsdoc/no-types': 'off',
'jsdoc/no-undefined-types': 'warn',
'jsdoc/require-description-complete-sentence': 'off',
'jsdoc/require-description': 'warn',
'jsdoc/require-example': 'off',
'jsdoc/require-hyphen-before-param-description': 'warn',
'jsdoc/require-jsdoc': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-param-name': 'warn',
'jsdoc/require-param-type': 'warn',
'jsdoc/require-param': 'warn',
'jsdoc/require-returns-check': 'warn',
'jsdoc/require-returns-description': 'warn',
'jsdoc/require-returns-type': 'warn',
'jsdoc/require-returns': 'warn',
'jsdoc/valid-types': 'warn',
},
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-frontier",
"version": "3.0.0",
"version": "3.1.0",
"description": "A common ESLint configuration setup for frontier apps to base off of.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 20cab12

Please sign in to comment.