Skip to content

Commit cff4110

Browse files
authored
Merge pull request #10 from fs-webdev/codeClimateSingleFile
Code climate single file
2 parents baaa78a + 976dabd commit cff4110

9 files changed

+2209
-26
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+
```

codeclimateEslintRules.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// THIS FILE IS AUTO-GENERATED. DO NOT MODIFY THIS FILE BY HAND
2+
module.exports = {
3+
"plugins": [
4+
"html",
5+
"json",
6+
"babel",
7+
"react-hooks"
8+
],
9+
"extends": [
10+
"airbnb",
11+
"plugin:prettier/recommended",
12+
"prettier/react",
13+
"plugin:jest/recommended"
14+
],
15+
"rules": {
16+
"prettier/prettier": [
17+
"warn",
18+
{
19+
"printWidth": 100,
20+
"singleQuote": true,
21+
"trailingComma": "es5",
22+
"semi": false
23+
}
24+
],
25+
"arrow-parens": [
26+
1,
27+
"as-needed"
28+
],
29+
"no-console": "off",
30+
"no-param-reassign": "off",
31+
"no-plusplus": "off",
32+
"no-unused-expressions": [
33+
"warn",
34+
{
35+
"allowShortCircuit": true
36+
}
37+
],
38+
"no-use-before-define": [
39+
"error",
40+
{
41+
"functions": false,
42+
"classes": true,
43+
"variables": true
44+
}
45+
],
46+
"no-warning-comments": 1,
47+
"prefer-destructuring": "off",
48+
"import/no-extraneous-dependencies": [
49+
"error",
50+
{
51+
"devDependencies": [
52+
"**/*.stories.js",
53+
"**/*.test.js",
54+
"**/demo/**"
55+
]
56+
}
57+
],
58+
"jsx-a11y/label-has-for": 0,
59+
"jsx-a11y/label-has-associated-control": [
60+
2,
61+
{
62+
"assert": "either"
63+
}
64+
],
65+
"react/prop-types": "off",
66+
"react/jsx-filename-extension": "off",
67+
"react/require-default-props": "off",
68+
"react-hooks/rules-of-hooks": "error",
69+
"react-hooks/exhaustive-deps": "warn",
70+
"jest/no-large-snapshots": "error"
71+
},
72+
"env": {
73+
"es6": true,
74+
"browser": true
75+
},
76+
"parserOptions": {
77+
"ecmaVersion": 2018,
78+
"sourceType": "module",
79+
"ecmaFeatures": {
80+
"jsx": true
81+
}
82+
},
83+
"parser": "babel-eslint"
84+
}

es6.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
},
2121
],
2222

23-
//override airbnb overbearing rules
23+
// override airbnb overbearing rules
2424
'arrow-parens': [1, 'as-needed'],
2525
'no-console': 'off',
2626
'no-param-reassign': 'off',
@@ -30,12 +30,17 @@ module.exports = {
3030
'no-warning-comments': 1,
3131
'prefer-destructuring': 'off',
3232

33-
'jest/no-large-snapshots': 'error',
34-
35-
'import/no-extraneous-dependencies': ['error', {devDependencies: ['**/*.stories.js', '**/*.test.js', '**/demo/**']}],
33+
'import/no-extraneous-dependencies': [
34+
'error',
35+
{ devDependencies: ['**/*.stories.js', '**/*.test.js', '**/demo/**'] },
36+
],
3637

37-
"jsx-a11y/label-has-for": 0, // this is deprecated in future versions so disable now
38-
"jsx-a11y/label-has-associated-control": [ 2, { "assert": "either", // fs-styles does not support nesting currently
39-
}],
38+
'jsx-a11y/label-has-for': 0, // this is deprecated in future versions so disable now
39+
'jsx-a11y/label-has-associated-control': [
40+
2,
41+
{
42+
assert: 'either', // fs-styles does not support nesting currently
43+
},
44+
],
4045
},
4146
}

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
extends: [
44
'@fs/eslint-config-frontier-react/es6',
55
'@fs/eslint-config-frontier-react/react',
6+
'@fs/eslint-config-frontier-react/jest',
67
'@fs/eslint-config-frontier-react/noFixRules',
7-
'plugin:jest/recommended',
88
],
99
}

jest.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ['plugin:jest/recommended'],
3+
rules: {
4+
'jest/no-large-snapshots': 'error',
5+
},
6+
}

jsdoc.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
module.exports = {
22
plugins: ['jsdoc'],
33
rules: {
4-
'jsdoc/check-param-names': 2,
5-
'jsdoc/check-tag-names': 2,
6-
'jsdoc/check-types': 2,
7-
'jsdoc/newline-after-description': 0,
8-
'jsdoc/require-description-complete-sentence': 2,
9-
'jsdoc/require-hyphen-before-param-description': 2,
10-
'jsdoc/require-param': 2,
11-
'jsdoc/require-param-description': 2,
12-
'jsdoc/require-param-type': 2,
13-
'jsdoc/require-returns-description': 2,
14-
'jsdoc/require-returns-type': 2,
4+
'jsdoc/check-alignment': 'warn',
5+
'jsdoc/check-examples': 'warn',
6+
'jsdoc/check-indentation': 'off',
7+
'jsdoc/check-param-names': 'warn',
8+
'jsdoc/check-syntax': 'warn',
9+
'jsdoc/check-tag-names': 'warn',
10+
'jsdoc/check-types': 'warn',
11+
'jsdoc/implements-on-classes': 'warn',
12+
'jsdoc/match-description': 'warn',
13+
'jsdoc/newline-after-description': 'off',
14+
'jsdoc/no-types': 'off',
15+
'jsdoc/no-undefined-types': 'warn',
16+
'jsdoc/require-description-complete-sentence': 'off',
17+
'jsdoc/require-description': 'warn',
18+
'jsdoc/require-example': 'off',
19+
'jsdoc/require-hyphen-before-param-description': 'warn',
20+
'jsdoc/require-jsdoc': 'warn',
21+
'jsdoc/require-param-description': 'warn',
22+
'jsdoc/require-param-name': 'warn',
23+
'jsdoc/require-param-type': 'warn',
24+
'jsdoc/require-param': 'warn',
25+
'jsdoc/require-returns-check': 'warn',
26+
'jsdoc/require-returns-description': 'warn',
27+
'jsdoc/require-returns-type': 'warn',
28+
'jsdoc/require-returns': 'warn',
29+
'jsdoc/valid-types': 'warn',
1530
},
1631
}

0 commit comments

Comments
 (0)