Skip to content

Commit dd78771

Browse files
committed
moved combineRules.js to a scripts directory
1 parent d7be38d commit dd78771

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,37 @@ We have a configuration for jsdoc rules that you can use if your team decides th
2020
"@fs/eslint-config-frontier-react/jsdoc"
2121
],
2222
```
23+
24+
## CodeClimate Usage
25+
26+
It is important to note that in order for CodeClimate to use this custom config, we have to work around their limitations a bit.
27+
28+
1. Add a prepare section to your .codeclimate.yml that will download this eslint-config file. [Prepare Docs](https://docs.codeclimate.com/docs/configuring-the-prepare-step)
29+
- It should look like this
30+
```yaml
31+
prepare:
32+
fetch:
33+
- url: 'https://raw.githubusercontent.com/fs-webdev/eslint-config-frontier-react/master/index.js'
34+
path: 'eslint-config-frontier-react.js'
35+
```
36+
- If you also opt into the jsdoc plugin we provide, you'll also need to make a prepare statement for that file.
37+
2. Make a new eslintrc file for codeclimate to use (that way it can point to the `eslint-config-frontier-react.js` file that codeclimate will prepare in Step 1.)
38+
39+
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)
40+
2. Change the `"extends": ["frontier"]` statement to point to the prepared file from Step 1. `"extends": ["./eslint-config-frontier-react.js"]`
41+
(only do this in `.codeclimate.eslintrc.js` file, not your normal eslintrc)
42+
- If you also opt into the jsdoc plugin we provide, you'll also need to add that downloaded file to the extends array
43+
44+
3. Tweak your .codeclimate.yml eslint section to point to the .codeclimate.eslintrc file instead of your default local eslintrc file
45+
- 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.
46+
```yaml
47+
plugins:
48+
eslint:
49+
channel: eslint-4
50+
config: # <- This line and the line below it are the important lines to add/tweak
51+
config: .codeclimate.eslintrc.js # <- this line and the line above it are the important lines to add/tweak
52+
extensions:
53+
- .js
54+
- .html
55+
enabled: true
56+
```

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"test": "echo \"Warning: no test specified\" && exit 0",
88
"publish": "npmPublish",
9-
"combineRules": "node combineRules.js"
9+
"combineRules": "node scripts/combineRules.js"
1010
},
1111
"repository": {
1212
"type": "git",
@@ -51,8 +51,7 @@
5151
"devDependencies": {
5252
"@fs/npm-publisher": "^1.0.0",
5353
"eslint": "^5.10.0",
54-
"husky": "^2.4.1",
55-
"lint-staged": "^8.2.1"
54+
"husky": "^2.4.1"
5655
},
5756
"husky": {
5857
"hooks": {

combineRules.js renamed to scripts/combineRules.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
const fs = require('fs')
22
const path = require('path')
33

4-
const index = require('./index')
4+
const index = require('../index')
55

66
// the order of these configs is important and defined by the order of index.js,
77
// jsdoc is opt-in, and to get that in codeclimate, they'll need to use a prepare statement for the
88
// jsdoc.js file as well, we won't do that automatically here
99
const configsToCombine = [
10-
require('./es6'), // eslint-disable-line
11-
require('./react'), // eslint-disable-line
12-
require('./jest'), // eslint-disable-line
10+
require('../es6'), // eslint-disable-line
11+
require('../react'), // eslint-disable-line
12+
require('../jest'), // eslint-disable-line
1313
]
1414

1515
const codeclimateConfig = {

0 commit comments

Comments
 (0)