@zendeskgarden/eslint-config 35.0.0 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/eslint-config",
3
- "version": "35.0.0",
3
+ "version": "36.0.0",
4
4
  "description": "Garden ESLint config",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -23,17 +23,17 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@babel/eslint-parser": "^7.15.0",
26
- "eslint": "^8.50.0",
26
+ "eslint": "^8.56.0",
27
27
  "eslint-plugin-node": "^11.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@babel/core": "7.23.0",
31
- "@babel/eslint-parser": "7.22.15",
32
- "@typescript-eslint/eslint-plugin": "6.7.2",
33
- "@typescript-eslint/parser": "6.7.2",
34
- "eslint": "8.50.0",
35
- "eslint-plugin-jest": "27.4.0",
36
- "eslint-plugin-jsx-a11y": "6.7.1",
30
+ "@babel/core": "7.23.6",
31
+ "@babel/eslint-parser": "7.23.3",
32
+ "@typescript-eslint/eslint-plugin": "6.15.0",
33
+ "@typescript-eslint/parser": "6.15.0",
34
+ "eslint": "8.56.0",
35
+ "eslint-plugin-jest": "27.6.0",
36
+ "eslint-plugin-jsx-a11y": "6.8.0",
37
37
  "eslint-plugin-node": "11.1.0",
38
38
  "eslint-plugin-notice": "0.9.10",
39
39
  "eslint-plugin-react": "7.33.2",
@@ -43,7 +43,7 @@
43
43
  "prettier-package-json": "2.8.0",
44
44
  "react": "18.2.0",
45
45
  "standard-version": "9.5.0",
46
- "typescript": "5.2.2"
46
+ "typescript": "5.3.3"
47
47
  },
48
48
  "keywords": [
49
49
  "eslint",
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  const bestPractices = require('../rules/best-practices').rules;
9
+ const es6 = require('../rules/es6').rules;
9
10
  const possibleErrors = require('../rules/possible-errors').rules;
10
- const stylisticIssues = require('../rules/stylistic-issues').rules;
11
11
 
12
12
  module.exports = {
13
13
  plugins: ['@typescript-eslint'],
@@ -15,17 +15,15 @@ module.exports = {
15
15
  rules: {
16
16
  // Disable ESLint rules that are handled by TypeScript
17
17
  'dot-notation': 0,
18
- 'key-spacing': 0,
19
18
  'no-implied-eval': 0,
20
19
  'no-throw-literal': 0,
20
+ 'prefer-destructuring': 0,
21
21
  'require-await': 0,
22
22
 
23
23
  // disallows awaiting a value that is not a `Thenable`
24
24
  '@typescript-eslint/await-thenable': 2,
25
25
  // enforce dot notation whenever possible
26
26
  '@typescript-eslint/dot-notation': bestPractices['dot-notation'],
27
- // enforce consistent spacing between keys and values in object literal properties
28
- '@typescript-eslint/key-spacing': stylisticIssues['key-spacing'],
29
27
  // requires that `.toString()` is only called on objects which provide useful information when stringified
30
28
  '@typescript-eslint/no-base-to-string': 2,
31
29
  // requires expressions of type void to appear in statement position
@@ -67,8 +65,14 @@ module.exports = {
67
65
  '@typescript-eslint/no-unsafe-member-access': 2,
68
66
  // disallows returning any from a function
69
67
  '@typescript-eslint/no-unsafe-return': 2,
68
+ // require unary negation to take a number
69
+ '@typescript-eslint/no-unsafe-unary-minus': 2,
70
+ // disallow unnecessary template literals
71
+ '@typescript-eslint/no-useless-template-literals': 2,
70
72
  // prefers a non-null assertion over explicit type cast when possible
71
73
  '@typescript-eslint/non-nullable-type-assertion-style': 1,
74
+ // require destructuring from arrays and/or objects
75
+ '@typescript-eslint/prefer-destructuring': es6['prefer-destructuring'],
72
76
  // enforce includes method over `indexOf` method
73
77
  '@typescript-eslint/prefer-includes': 2,
74
78
  // enforce the usage of the nullish coalescing operator instead of logical chaining
@@ -16,26 +16,18 @@ module.exports = {
16
16
  parser: '@typescript-eslint/parser',
17
17
  rules: {
18
18
  // Disable ESLint rules that are handled by TypeScript
19
- 'brace-style': 0,
20
19
  'class-methods-use-this': 0,
21
- 'comma-dangle': 0,
22
- 'comma-spacing': 0,
23
20
  'constructor-super': 0,
24
21
  'default-param-last': 0,
25
- 'func-call-spacing': 0,
26
22
  'getter-return': 0,
27
- 'indent': 0,
28
23
  'init-declarations': 0,
29
24
  'keyword-spacing': 0,
30
- 'lines-between-class-members': 0,
31
25
  'no-array-constructor': 0,
32
26
  'no-const-assign': 0,
33
27
  'no-dupe-args': 0,
34
28
  'no-dupe-class-members': 0,
35
29
  'no-dupe-keys': 0,
36
30
  'no-empty-function': 0,
37
- 'no-extra-parens': 0,
38
- 'no-extra-semi': 0,
39
31
  'no-func-assign': 0,
40
32
  'no-import-assign': 0,
41
33
  'no-invalid-this': 0,
@@ -56,11 +48,6 @@ module.exports = {
56
48
  'no-unsafe-negation': 0,
57
49
  'no-unused-expressions': 0,
58
50
  'no-unused-vars': 0,
59
- 'object-curly-spacing': 0,
60
- 'quotes': 0,
61
- 'semi': 0,
62
- 'space-before-function-paren': 0,
63
- 'space-infix-ops': 0,
64
51
  'valid-typeof': 0,
65
52
 
66
53
  // require that member overloads be consecutive
@@ -73,17 +60,11 @@ module.exports = {
73
60
  '@typescript-eslint/ban-tslint-comment': 1,
74
61
  // bans specific types from being used
75
62
  '@typescript-eslint/ban-types': 2,
76
- // enforce consistent brace style for blocks
77
- '@typescript-eslint/brace-style': stylisticIssues['brace-style'],
78
63
  // ensures that literals on classes are exposed in a consistent style
79
64
  '@typescript-eslint/class-literal-property-style': 2,
80
65
  // enforce that class methods utilize `this`
81
66
  '@typescript-eslint/class-methods-use-this':
82
67
  bestPractices['class-methods-use-this'],
83
- // require or disallow trailing comma
84
- '@typescript-eslint/comma-dangle': stylisticIssues['comma-dangle'],
85
- // enforces consistent spacing before and after commas
86
- '@typescript-eslint/comma-spacing': stylisticIssues['comma-spacing'],
87
68
  // enforce or disallow the use of the record type
88
69
  '@typescript-eslint/consistent-indexed-object-style': 2,
89
70
  // enforces consistent usage of type assertions
@@ -104,18 +85,10 @@ module.exports = {
104
85
  ],
105
86
  // require explicit return and argument types on exported functions' and classes' public class methods
106
87
  '@typescript-eslint/explicit-module-boundary-types': 2,
107
- // require or disallow spacing between function identifiers and their invocations
108
- '@typescript-eslint/func-call-spacing':
109
- stylisticIssues['func-call-spacing'],
110
- // enforce consistent indentation
111
- '@typescript-eslint/indent': stylisticIssues.indent,
112
88
  // require or disallow initialization in variable declarations
113
89
  '@typescript-eslint/init-declarations': variables['init-declarations'],
114
90
  // enforce consistent spacing before and after keywords
115
91
  '@typescript-eslint/keyword-spacing': stylisticIssues['keyword-spacing'],
116
- // require or disallow an empty line between class members
117
- '@typescript-eslint/lines-between-class-members':
118
- stylisticIssues['lines-between-class-members'],
119
92
  // require a specific member delimiter style for interfaces and type literals
120
93
  '@typescript-eslint/member-delimiter-style': 2,
121
94
  // require a consistent member declaration order
@@ -157,10 +130,6 @@ module.exports = {
157
130
  '@typescript-eslint/no-explicit-any': 2,
158
131
  // disallow extra non-null assertion
159
132
  '@typescript-eslint/no-extra-non-null-assertion': 2,
160
- // disallow unnecessary parentheses
161
- '@typescript-eslint/no-extra-parens': possibleErrors['no-extra-parens'],
162
- // disallow unnecessary semicolons
163
- '@typescript-eslint/no-extra-semi': possibleErrors['no-extra-semi'],
164
133
  // forbids the use of classes as namespaces
165
134
  '@typescript-eslint/no-extraneous-class': 2,
166
135
  // disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean
@@ -216,9 +185,6 @@ module.exports = {
216
185
  '@typescript-eslint/no-useless-constructor': es6['no-useless-constructor'],
217
186
  // disallows the use of require statements except in import statements
218
187
  '@typescript-eslint/no-var-requires': 2,
219
- // enforce consistent spacing inside braces
220
- '@typescript-eslint/object-curly-spacing':
221
- stylisticIssues['object-curly-spacing'],
222
188
  // prefer usage of `as const` over literal type
223
189
  '@typescript-eslint/prefer-as-const': 2,
224
190
  // prefer initializing each enums member value
@@ -235,15 +201,6 @@ module.exports = {
235
201
  '@typescript-eslint/prefer-optional-chain': 0,
236
202
  // recommends using `@ts-expect-error` over `@ts-ignore`
237
203
  '@typescript-eslint/prefer-ts-expect-error': 2,
238
- // enforce the consistent use of either backticks, double, or single quotes
239
- '@typescript-eslint/quotes': stylisticIssues.quotes,
240
- // require or disallow semicolons instead of ASI
241
- '@typescript-eslint/semi': stylisticIssues.semi,
242
- // enforces consistent spacing before function parenthesis
243
- '@typescript-eslint/space-before-function-paren':
244
- stylisticIssues['space-before-function-paren'],
245
- // ensure there are spaces around infix operators
246
- '@typescript-eslint/space-infix-ops': stylisticIssues['space-infix-ops'],
247
204
  // sets preference level for triple slash directives versus ES6-style import declarations
248
205
  '@typescript-eslint/triple-slash-reference': 2,
249
206
  // require consistent spacing around type annotations
@@ -27,8 +27,6 @@ module.exports = {
27
27
  'default-case-last': 2,
28
28
  // enforce default parameters to be last
29
29
  'default-param-last': 2,
30
- // enforces consistent newlines before or after dots
31
- 'dot-location': [2, 'property'],
32
30
  // encourages use of dot notation whenever possible
33
31
  'dot-notation': [2, { allowKeywords: true }],
34
32
  // require the use of `===` and `!==`
@@ -69,8 +67,6 @@ module.exports = {
69
67
  'no-extra-label': 2,
70
68
  // disallow fallthrough of `case` statements
71
69
  'no-fallthrough': 2,
72
- // disallow the use of leading or trailing decimal points in numeric literals
73
- 'no-floating-decimal': 2,
74
70
  // disallow assignments to native objects or read-only global variables
75
71
  'no-global-assign': 2,
76
72
  // disallow the type conversions with shorter notations
@@ -91,8 +87,6 @@ module.exports = {
91
87
  'no-loop-func': 2,
92
88
  // disallow the use of magic numbers
93
89
  'no-magic-numbers': 0,
94
- // disallow use of multiple spaces
95
- 'no-multi-spaces': 2,
96
90
  // disallow use of multiline strings
97
91
  'no-multi-str': 2,
98
92
  // disallow use of `new` operator when not part of the assignment or comparison
@@ -168,8 +162,6 @@ module.exports = {
168
162
  'require-unicode-regexp': 2,
169
163
  // requires to declare all vars on top of their containing scope
170
164
  'vars-on-top': 2,
171
- // require immediate function invocation to be wrapped in parentheses
172
- 'wrap-iife': [2, 'any'],
173
165
  // require or disallow Yoda conditions
174
166
  'yoda': 2
175
167
  }
package/rules/es6.js CHANGED
@@ -9,18 +9,10 @@ module.exports = {
9
9
  rules: {
10
10
  // require braces in arrow function body
11
11
  'arrow-body-style': 0,
12
- // require parens in arrow function arguments
13
- 'arrow-parens': [2, 'as-needed'],
14
- // require space before/after arrow function's arrow
15
- 'arrow-spacing': 2,
16
12
  // verify calls of `super()` in constructors
17
13
  'constructor-super': 2,
18
- // enforce the spacing around the `*` in generator functions
19
- 'generator-star-spacing': 0,
20
14
  // disallow modifying variables of class declarations
21
15
  'no-class-assign': 0,
22
- // disallow arrow functions where they could be confused with comparisons
23
- 'no-confusing-arrow': 2,
24
16
  // disallow modifying variables that are declared using `const`
25
17
  'no-const-assign': 2,
26
18
  // disallow duplicate name in class members
@@ -61,15 +53,9 @@ module.exports = {
61
53
  'prefer-template': 2,
62
54
  // disallow generator functions that do not have `yield`
63
55
  'require-yield': 0,
64
- // enforce spacing between rest and spread operators and their expressions
65
- 'rest-spread-spacing': 2,
66
56
  // sort import declarations within module
67
57
  'sort-imports': 1,
68
58
  // require symbol descriptions
69
- 'symbol-description': 2,
70
- // enforce spacing around embedded expressions of template strings
71
- 'template-curly-spacing': [2, 'never'],
72
- // enforce spacing around the `*` in `yield*` expressions
73
- 'yield-star-spacing': [2, 'after']
59
+ 'symbol-description': 2
74
60
  }
75
61
  };
@@ -43,10 +43,6 @@ module.exports = {
43
43
  'no-ex-assign': 2,
44
44
  // disallow double-negation boolean casts in a boolean context
45
45
  'no-extra-boolean-cast': 2,
46
- // disallow unnecessary parentheses
47
- 'no-extra-parens': [2, 'functions'],
48
- // disallow unnecessary semicolons
49
- 'no-extra-semi': 2,
50
46
  // disallow overwriting functions written as function declarations
51
47
  'no-func-assign': 2,
52
48
  // disallow assigning to imported bindings
@@ -7,83 +7,32 @@
7
7
 
8
8
  module.exports = {
9
9
  rules: {
10
- // enforce linebreaks after opening and before closing array brackets
11
- 'array-bracket-newline': [2, 'consistent'],
12
- // enforce spacing inside array brackets
13
- 'array-bracket-spacing': [2, 'never'],
14
- // enforce line breaks after each array element
15
- 'array-element-newline': 0,
16
- // disallow or enforce spaces inside of single line blocks
17
- 'block-spacing': [2, 'always'],
18
- // enforce one true brace style
19
- 'brace-style': [2, '1tbs', { allowSingleLine: true }],
20
10
  // require camel case names
21
11
  'camelcase': [2, { properties: 'never' }],
22
12
  // enforce or disallow capitalization of the first letter of a comment
23
13
  'capitalize-comments': 0,
24
- // disallow or enforce trailing commas
25
- 'comma-dangle': 2,
26
- // enforce spacing before and after comma
27
- 'comma-spacing': [2, {
28
- before: false,
29
- after: true
30
- }],
31
- // enforce one true comma style
32
- 'comma-style': [2, 'last'],
33
- // require or disallow padding inside computed properties
34
- 'computed-property-spacing': [2, 'never'],
35
14
  // enforces consistent naming when capturing the current execution context
36
15
  'consistent-this': [0, 'self'],
37
- // enforce newline at the end of file, with no multiple empty lines
38
- 'eol-last': 2,
39
- // require or disallow spacing between function identifiers and their invocations
40
- 'func-call-spacing': 2,
41
16
  // require function names to match the name of the variable or property to which they are assigned
42
17
  'func-name-matching': 2,
43
18
  // require function expressions to have a name
44
19
  'func-names': 1,
45
20
  // enforce use of function declarations or expressions
46
21
  'func-style': 0,
47
- // enforce line breaks between arguments of a function call
48
- 'function-call-argument-newline': [2, 'consistent'],
49
- // enforce consistent line breaks inside function parentheses
50
- 'function-paren-newline': 2,
51
22
  // disallow specified identifiers
52
23
  'id-denylist': 0,
53
24
  // this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
54
25
  'id-length': 0,
55
26
  // require identifiers to match the provided regular expression
56
27
  'id-match': 0,
57
- // enforce the location of arrow function bodies with implicit returns
58
- 'implicit-arrow-linebreak': 2,
59
- // this option sets a specific tab width for your code
60
- 'indent': [2, 2, { SwitchCase: 1 }],
61
- // specify whether double or single quotes should be used in JSX attributes
62
- 'jsx-quotes': 0,
63
- // enforces spacing between keys and values in object literal properties
64
- 'key-spacing': [2, {
65
- beforeColon: false,
66
- afterColon: true
67
- }],
68
28
  // enforce spacing before and after keywords
69
29
  'keyword-spacing': 2,
70
30
  // enforce position of line comments
71
31
  'line-comment-position': 0,
72
- // disallow mixed 'LF' and 'CRLF' as linebreaks
73
- 'linebreak-style': 0,
74
- // enforces empty lines around comments
75
- 'lines-around-comment': 0,
76
- // require or disallow an empty line between class members
77
- 'lines-between-class-members': 2,
78
32
  // require or disallow logical assignment logical operator shorthand
79
33
  'logical-assignment-operators': 2,
80
34
  // specify the maximum depth that blocks can be nested
81
35
  'max-depth': [0, 4],
82
- // specify the maximum length of a line in your program
83
- 'max-len': [1, 80, 2, {
84
- ignoreComments: true,
85
- ignoreUrls: true
86
- }],
87
36
  // enforce a maximum number of lines per file
88
37
  'max-lines': 0,
89
38
  // enforce a maximum number of line of code in a function
@@ -94,18 +43,10 @@ module.exports = {
94
43
  'max-params': [0, 3],
95
44
  // specify the maximum number of statement allowed in a function
96
45
  'max-statements': [0, 10],
97
- // specify the maximum number of statements allowed per line
98
- 'max-statements-per-line': [2, { max: 1 }],
99
46
  // enforce a particular style for multiline comments
100
47
  'multiline-comment-style': 0,
101
- // enforce newlines between operands of ternary expressions
102
- 'multiline-ternary': 0,
103
48
  // require a capital letter for constructors
104
49
  'new-cap': [2, { newIsCap: true }],
105
- // disallow the omission of parentheses when invoking a constructor with no arguments
106
- 'new-parens': 2,
107
- // enforce newline after each call when chaining the calls
108
- 'newline-per-chained-call': 0,
109
50
  // disallow use of the `Array` constructor
110
51
  'no-array-constructor': 2,
111
52
  // disallow use of bitwise operators
@@ -116,14 +57,8 @@ module.exports = {
116
57
  'no-inline-comments': 0,
117
58
  // disallow `if` as the only statement in an `else` block
118
59
  'no-lonely-if': 2,
119
- // disallow mixed binary operators
120
- 'no-mixed-operators': 2,
121
- // disallow mixed spaces and tabs for indentation
122
- 'no-mixed-spaces-and-tabs': 2,
123
60
  // disallow use of chained assignment expressions
124
61
  'no-multi-assign': 2,
125
- // disallow multiple empty lines
126
- 'no-multiple-empty-lines': [2, { max: 2 }],
127
62
  // disallow negated conditions
128
63
  'no-negated-condition': 2,
129
64
  // disallow nested ternary expressions
@@ -134,112 +69,27 @@ module.exports = {
134
69
  'no-plusplus': 0,
135
70
  // disallow use of certain syntax in code
136
71
  'no-restricted-syntax': 0,
137
- // disallow all tabs
138
- 'no-tabs': 2,
139
72
  // disallow the use of ternary operators
140
73
  'no-ternary': 0,
141
- // disallow trailing whitespace at the end of lines
142
- 'no-trailing-spaces': 2,
143
74
  // disallow dangling underscores in identifiers
144
75
  'no-underscore-dangle': 0,
145
76
  // disallow the use of `Boolean` literals in conditional expressions
146
77
  'no-unneeded-ternary': 2,
147
- // disallow whitespace before properties
148
- 'no-whitespace-before-property': 2,
149
- // enforce the location of single-line statements
150
- 'nonblock-statement-body-position': 2,
151
- // enforce consistent line breaks inside braces
152
- 'object-curly-newline': 0,
153
- // require or disallow padding inside curly braces
154
- 'object-curly-spacing': [2, 'always'],
155
- // enforce placing object properties on separate lines
156
- 'object-property-newline': 2,
157
78
  // allow just one var statement per function
158
79
  'one-var': [2, 'never'],
159
- // require or disallow an newline around variable declarations
160
- 'one-var-declaration-per-line': [2, 'initializations'],
161
80
  // require assignment operator shorthand where possible or prohibit it entirely
162
81
  'operator-assignment': 0,
163
- // enforce operators to be placed before or after line breaks
164
- 'operator-linebreak': [2, 'after'],
165
- // enforce padding within blocks
166
- 'padded-blocks': [2, { blocks: 'never' }],
167
- // require or disallow padding lines between statements
168
- 'padding-line-between-statements': [1,
169
- {
170
- blankLine: 'always',
171
- prev: 'directive',
172
- next: '*'
173
- },
174
- {
175
- blankLine: 'any',
176
- prev: 'directive',
177
- next: 'directive'
178
- },
179
- {
180
- blankLine: 'always',
181
- prev: ['const', 'let', 'var'],
182
- next: '*'
183
- },
184
- {
185
- blankLine: 'any',
186
- prev: ['const', 'let', 'var'],
187
- next: ['const', 'let', 'var']
188
- },
189
- {
190
- blankLine: 'always',
191
- prev: '*',
192
- next: 'return'
193
- }],
194
82
  // disallow the use of `Math.pow` in favor of the `**` operator
195
83
  'prefer-exponentiation-operator': 1,
196
84
  // disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`
197
85
  'prefer-object-has-own': 1,
198
86
  // prefer use of an object spread over `Object.assign`
199
87
  'prefer-object-spread': 1,
200
- // require quotes around object literal property names
201
- 'quote-props': [2, 'consistent-as-needed'],
202
- // specify whether double or single quotes should be used
203
- 'quotes': [2, 'single', 'avoid-escape'],
204
- // require or disallow use of semicolons instead of ASI
205
- 'semi': [2, 'always'],
206
- // enforce spacing before and after semicolons
207
- 'semi-spacing': [2, {
208
- before: false,
209
- after: true
210
- }],
211
- // enforce location of semicolons
212
- 'semi-style': 2,
213
88
  // require object keys to be sorted
214
89
  'sort-keys': 0,
215
90
  // sort variables within the same declaration block
216
91
  'sort-vars': 0,
217
- // require or disallow space before blocks
218
- 'space-before-blocks': 2,
219
- // require or disallow space before function opening parenthesis
220
- 'space-before-function-paren': [2, {
221
- anonymous: 'never',
222
- named: 'never',
223
- asyncArrow: 'always'
224
- }],
225
- // require or disallow spaces inside parentheses
226
- 'space-in-parens': 2,
227
- // require spaces around operators
228
- 'space-infix-ops': 2,
229
- // Require or disallow spaces before/after unary operators
230
- 'space-unary-ops': 0,
231
- // require or disallow a space immediately following the `//` or `/*` in a comment
232
- 'spaced-comment': [2, 'always', {
233
- exceptions: ['-', '+'],
234
- markers: ['=', '!'] // space here to support sprockets directives
235
- }],
236
- // enforce spacing around colons of switch statements
237
- 'switch-colon-spacing': 2,
238
- // require or disallow spacing between template tags and their literals
239
- 'template-tag-spacing': 2,
240
92
  // require or disallow Unicode byte order mark (BOM)
241
- 'unicode-bom': 2,
242
- // require regex literals to be wrapped in parentheses
243
- 'wrap-regex': 0
93
+ 'unicode-bom': 2
244
94
  }
245
95
  };