Skip to content

Commit 77dba40

Browse files
committed
Update linting plugins and rules
eslint-config-standard: ^12 --> ^14 eslint-plugin-jsdoc: 8.3.0 --> ^20 eslint-plugin-json: ^1 --> ^2 eslint-plugin-sonarjs: ^0.3 --> ^0.5 Release version 2.0.2.
1 parent b151b61 commit 77dba40

File tree

6 files changed

+70
-27
lines changed

6 files changed

+70
-27
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
module.exports = {
33
extends: [
44
'eslint-config-frontier',
5-
'plugin:eslint-plugin-sonarjs/recommended',
5+
'eslint-config-standard',
6+
// 'plugin:eslint-plugin-sonarjs/recommended' // Disabled globally, for now, because it is a much higher standard than Tree's existing code currently adheres to. Enable on a case-by-case basis, if you wish.
67
'plugin:promise/recommended',
78
'./index.js'
89
],

demo/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ no-undefined
1919
*/
2020

2121
/**
22-
* @function _fetchPreferences - Fetch a user's tree-view-options preference so that we know what options to call the tree-data endpoint with.
22+
* @description a somewhat valid description
2323
* @param {hobject} a
2424
* @param b
2525
* @returns

demo/test/snapshots/lint-output.js.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ Generated by [AVA](https://ava.li).
2020
9:1 warning Unexpected 'TODO' comment no-warning-comments␊
2121
10:1 warning Unexpected 'HACK' comment no-warning-comments␊
2222
11:1 warning Unexpected 'HERE BE DRAGONS' comment no-warning-comments␊
23-
21:1 warning Missing JSDoc @description declaration jsdoc/require-description␊
23+
21:1 warning JSDoc type missing brace valid-jsdoc␊
24+
21:1 warning Missing JSDoc block description jsdoc/require-description␊
2425
21:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊
25-
21:1 warning JSDoc syntax error valid-jsdoc␊
26-
23:0 warning Expected @param names to be "params". Got "a, b" jsdoc/check-param-names␊
26+
21:1 warning Missing JSDoc @param "params" declaration jsdoc/require-param␊
2727
23:0 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊
28+
23:0 warning Expected @param names to be "params". Got "a, b" jsdoc/check-param-names␊
29+
23:0 warning The type 'hobject' is undefined jsdoc/no-undefined-types␊
2830
24:0 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊
2931
24:0 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊
3032
25:0 warning Missing JSDoc @returns description jsdoc/require-returns-description␊
3133
25:0 warning Missing JSDoc @returns type jsdoc/require-returns-type␊
34+
30:5 error 'myPromise' is never reassigned. Use 'const' instead prefer-const␊
3235
30:17 warning Avoid creating new promises promise/avoid-new␊
3336
32:1 warning Expected catch() or return promise/catch-or-return␊
3437
33:3 warning Each then() should return a value or throw promise/always-return␊
@@ -37,6 +40,7 @@ Generated by [AVA](https://ava.li).
3740
36:5 error 'forgotToReturn' is not defined no-undef␊
3841
36:21 error Missing semicolon semi␊
3942
38:3 error Missing semicolon semi␊
43+
40:5 error 'variable' is never reassigned. Use 'const' instead prefer-const␊
4044
40:5 error 'variable' is assigned a value but never used no-unused-vars␊
4145
40:16 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊
4246
40:17 error Unexpected constant condition no-constant-condition␊
@@ -48,21 +52,24 @@ Generated by [AVA](https://ava.li).
4852
42:62 error 'params' is not defined no-undef␊
4953
43:3 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊
5054
44:28 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊
51-
46:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊
5255
46:3 error 'deprecatedFunction' is not defined no-undef␊
53-
47:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression
56+
46:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function
5457
47:3 error '$' is not defined no-undef␊
58+
47:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊
5559
48:3 error Unexpected 'debugger' statement no-debugger␊
5660
61+
/Users/clif/sandbox/frontier/common/eslint-config-tree/index.js␊
62+
49:0 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊
63+
5764
example.json␊
58-
4:5 error Property keys must be doublequoted json/undefined␊
59-
4:13 error Value expected json/valueexpected
60-
5:11 error Colon expected json/colonexpected
61-
6:5 error Expected comma json/commaexpected
62-
5:5 warning Duplicate object key json/duplicatekey
63-
6:19 error Trailing comma json/trailingcomma
64-
8:2 error End of file expected json/undefined␊
65+
4:6 error Property keys must be doublequoted json/undefined␊
66+
4:14 error Value expected json/value-expected
67+
5:6 error Duplicate object key json/duplicate-key
68+
5:12 error Colon expected json/colon-expected
69+
6:6 error Expected comma json/comma-expected
70+
6:20 error Trailing comma json/trailing-comma
71+
8:3 error End of file expected json/undefined␊
6572
66-
48 problems (23 errors, 25 warnings)␊
67-
4 errors and 0 warnings potentially fixable with the `--fix` option.␊
73+
53 problems (26 errors, 27 warnings)␊
74+
6 errors and 1 warning potentially fixable with the `--fix` option.␊
6875
`
145 Bytes
Binary file not shown.

index.js

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
module.exports = {
2+
3+
// NOTE: See .eslintrc.js for example `extends` and `plugins` sections, which have to be done individually by each repository because of Code Climate not supporting everything we use.
4+
25
extends: [
36
'eslint-config-standard'
4-
// 'plugin:promise/recommended' // Disabled, because Code Climate does not support promise.
5-
// 'plugin:eslint-plugin-sonarjs/recommended' // Disabled globally, for now, because it is a much higher standard than Tree's existing code currently adheres to. Enable on a case-by-case basis, if you wish.
67
],
8+
9+
/**
10+
* @property {object} env - Base environments to enable associated globals.
11+
*/
712
env: {
813
'browser': true,
914
'mocha': true
1015
},
1116
/**
12-
* @property globals - Tree set of typical global variables, to avoid numerous `no-undef` errors.
17+
* @property {object} globals - Tree set of typical global variables, to avoid numerous `no-undef` errors.
1318
*/
1419
globals: {
1520
'__services__': true,
@@ -40,7 +45,7 @@ module.exports = {
4045
},
4146
parser: 'babel-eslint',
4247
/**
43-
* @property plugins - Tree additional linter plugins.
48+
* @property {object} plugins - Tree additional linter plugins.
4449
* @note - Code Climate does not support bestpractices, deprecate, no-only-tests, no-skip-tests, sonarjs, and test-selectors, and breaks if they are present. You will need to add these plugins individually in your .eslintrc.js file.
4550
*/
4651
plugins: [
@@ -56,36 +61,65 @@ module.exports = {
5661
// 'eslint-plugin-test-selectors' // NOTE: Only runs against JSX
5762
],
5863
/**
59-
* @property rules - Tree custom rule and additional linter configuration.
64+
* @property {object} rules - Tree custom rule and additional linter configuration.
6065
*/
6166
rules: {
67+
'jsdoc/check-access': 'warn',
6268
'jsdoc/check-alignment': 'warn',
6369
'jsdoc/check-examples': 'warn',
6470
'jsdoc/check-indentation': 'off',
6571
'jsdoc/check-param-names': 'warn',
72+
'jsdoc/check-property-names': 'warn',
6673
'jsdoc/check-syntax': 'warn',
6774
'jsdoc/check-tag-names': 'warn',
6875
'jsdoc/check-types': 'warn',
76+
'jsdoc/check-values': 'warn',
77+
'jsdoc/empty-tags': 'warn',
6978
'jsdoc/implements-on-classes': 'warn',
7079
'jsdoc/match-description': 'warn',
7180
'jsdoc/newline-after-description': 'off',
7281
'jsdoc/no-types': 'off',
73-
'jsdoc/no-undefined-types': 'off', // This was broken in eslint-plugin-jsdoc#8 in 2019-06. Disabled, for now. Check back later.
82+
'jsdoc/no-undefined-types': 'warn',
7483
'jsdoc/require-description-complete-sentence': 'off',
7584
'jsdoc/require-description': 'warn',
7685
'jsdoc/require-example': 'off',
86+
'jsdoc/require-file-overview': 'off',
7787
'jsdoc/require-hyphen-before-param-description': 'warn',
7888
'jsdoc/require-jsdoc': 'warn',
7989
'jsdoc/require-param-description': 'warn',
8090
'jsdoc/require-param-name': 'warn',
8191
'jsdoc/require-param-type': 'warn',
8292
'jsdoc/require-param': 'warn',
93+
'jsdoc/require-property': 'warn',
94+
'jsdoc/require-property-description': 'warn',
95+
'jsdoc/require-property-name': 'warn',
96+
'jsdoc/require-property-type': 'warn',
8397
'jsdoc/require-returns-check': 'warn',
8498
'jsdoc/require-returns-description': 'warn',
8599
'jsdoc/require-returns-type': 'warn',
86100
'jsdoc/require-returns': 'warn',
87101
'jsdoc/valid-types': 'warn',
88102

103+
'json/undefined': 'error',
104+
'json/enum-value-mismatch': 'error',
105+
'json/unexpected-end-of-comment': 'error',
106+
'json/unexpected-end-of-string': 'error',
107+
'json/unexpected-end-of-number': 'error',
108+
'json/invalid-unicode': 'error',
109+
'json/invalid-escape-character': 'error',
110+
'json/invalid-character': 'error',
111+
'json/property-expected': 'error',
112+
'json/comma-expected': 'error',
113+
'json/colon-expected': 'error',
114+
'json/value-expected': 'error',
115+
'json/comma-or-close-backet-expected': 'error',
116+
'json/comma-or-close-brace-expected': 'error',
117+
'json/trailing-comma': 'error',
118+
'json/duplicate-key': 'error',
119+
'json/comment-not-permitted': 'error',
120+
'json/schema-resolve-error': 'error',
121+
'json/unknown': 'error',
122+
89123
'jsx-quotes': 'off',
90124

91125
'no-else-return': 'off',
@@ -96,6 +130,7 @@ module.exports = {
96130
'no-undefined': 'warn',
97131
'no-case-declarations': 'off',
98132
'object-curly-spacing': 'off',
133+
'quote-props': 'off',
99134
'semi': ['error', 'always'],
100135

101136
'bestpractices/no-eslint-disable': 'warn',

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-tree",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Shared Tree configuration that contains overrides and enhancements on top of the base frontier configuration.",
55
"main": "index.js",
66
"repository": {
@@ -25,18 +25,18 @@
2525
"babel-eslint": "^8",
2626
"eslint": "^6",
2727
"eslint-config-standard-react": "^7",
28-
"eslint-config-standard": "^12",
28+
"eslint-config-standard": "^14",
2929
"eslint-plugin-bestpractices": "git+https://github.com/skye2k2/eslint-plugin-bestpractices.git",
3030
"eslint-plugin-deprecate": "^0.5",
3131
"eslint-plugin-html": "^6",
3232
"eslint-plugin-import": "^2",
33-
"eslint-plugin-jsdoc": "8.3.0",
34-
"eslint-plugin-json": "^1",
33+
"eslint-plugin-jsdoc": "^20",
34+
"eslint-plugin-json": "^2",
3535
"eslint-plugin-no-only-tests": "^2",
3636
"eslint-plugin-no-skip-tests": "^1",
3737
"eslint-plugin-node": "^9",
3838
"eslint-plugin-promise": "^4",
39-
"eslint-plugin-sonarjs": "^0.3",
39+
"eslint-plugin-sonarjs": "^0.5",
4040
"eslint-plugin-standard": "^4",
4141
"eslint-plugin-test-selectors": "^1"
4242
},

0 commit comments

Comments
 (0)