Skip to content

Commit e677dc8

Browse files
feat: merge ES6 config into main config (#126)
BREAKING CHANGE: ES6 config is now part of the main config
1 parent 4adcf71 commit e677dc8

File tree

4 files changed

+49
-101
lines changed

4 files changed

+49
-101
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ for it.
9696

9797
### Things to know
9898

99-
- The default config uses `@babel/eslint-parser` to support stage features that
100-
ESLint doesn't support and it opts to use the `@babel/eslint-plugin` rules
101-
over the ESLint rules to support rules for these features as well.
10299
- All plugins needed for rules used by these configs are dependencies of this
103100
module so you don't have to install anything on your own.
104101
- The default config actually is composed of several configurations and you can
@@ -109,7 +106,7 @@ for it.
109106

110107
```javascript
111108
module.exports = {
112-
extends: ['kentcdodds/es6', 'kentcdodds/import', 'kentcdodds/jest'],
109+
extends: ['kentcdodds/import', 'kentcdodds/jest'],
113110
rules: {
114111
/* custom rules */
115112
},

es6.js

Lines changed: 0 additions & 92 deletions
This file was deleted.

index.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ const tsConfig = fs.existsSync('tsconfig.json')
1010
module.exports = {
1111
env: {
1212
browser: true,
13+
es6: true,
1314
node: true,
1415
},
15-
extends: ['prettier', './import.js', './es6.js'],
16+
extends: ['prettier', './import.js'],
1617
rules: {
1718
'accessor-pairs': 'error',
1819
'array-callback-return': 'error',
20+
'arrow-body-style': 'off',
1921
'block-scoped-var': 'error',
2022
camelcase: 'off', // annoying to disable...
2123
'capitalized-comments': 'off', // wHO CaRes?
2224
'class-methods-use-this': 'off', // three words: "componentDidMount" :)
2325
complexity: ['error', 20],
2426
'consistent-return': 'error',
2527
'consistent-this': 'off', // Too many use-cases for reassigning "this" to different values
28+
'constructor-super': 'error',
2629
curly: ['error', 'multi-line'],
2730
'default-case': 'error',
2831
'default-case-last': 'error',
@@ -66,9 +69,11 @@ module.exports = {
6669
'no-bitwise': 'error',
6770
'no-caller': 'error',
6871
'no-case-declarations': 'error',
72+
'no-class-assign': 'error',
6973
'no-compare-neg-zero': 'error',
7074
'no-cond-assign': 'error',
7175
'no-console': 'off',
76+
'no-const-assign': 'error',
7277
'no-constant-condition': 'error',
7378
'no-constructor-return': 'error',
7479
'no-continue': 'off',
@@ -77,9 +82,11 @@ module.exports = {
7782
'no-delete-var': 'error',
7883
'no-div-regex': 'error',
7984
'no-dupe-args': 'error',
85+
'no-dupe-class-members': 'error',
8086
'no-dupe-else-if': 'error',
8187
'no-dupe-keys': 'error',
8288
'no-duplicate-case': 'error',
89+
'no-duplicate-imports': 'error',
8390
'no-else-return': 'off',
8491
'no-empty': 'error',
8592
'no-empty-character-class': 'error',
@@ -120,6 +127,7 @@ module.exports = {
120127
'no-new': 'error',
121128
'no-new-func': 'error',
122129
'no-new-object': 'error',
130+
'no-new-symbol': 'error',
123131
'no-new-wrappers': 'error',
124132
'no-nonoctal-decimal-escape': 'error',
125133
'no-obj-calls': 'error',
@@ -132,7 +140,9 @@ module.exports = {
132140
'no-prototype-builtins': 'off',
133141
'no-redeclare': 'error',
134142
'no-regex-spaces': 'error',
143+
'no-restricted-exports': 'off', // not applicable for a config preset (should be configured only in projects)
135144
'no-restricted-globals': ['error', 'event', 'fdescribe'],
145+
'no-restricted-imports': 'off', // not applicable for a config preset (should be configured only in projects)
136146
'no-restricted-properties': 'off', // no ideas of what to disallow right now...
137147
'no-restricted-syntax': ['error', 'WithStatement'],
138148
'no-return-assign': 'error',
@@ -147,6 +157,7 @@ module.exports = {
147157
'no-sparse-arrays': 'error',
148158
'no-template-curly-in-string': 'error',
149159
'no-ternary': 'off',
160+
'no-this-before-super': 'error',
150161
'no-throw-literal': 'error',
151162
'no-undef': 'error',
152163
'no-undef-init': 'error',
@@ -158,6 +169,7 @@ module.exports = {
158169
'no-unreachable-loop': 'error',
159170
'no-unsafe-finally': 'error',
160171
'no-unsafe-negation': 'error',
172+
'no-unsafe-optional-chaining': 'error',
161173
'no-unused-expressions': 'off',
162174
'no-unused-labels': 'error',
163175
'no-unused-vars': [
@@ -173,28 +185,46 @@ module.exports = {
173185
'no-useless-backreference': 'error',
174186
'no-useless-call': 'error',
175187
'no-useless-catch': 'error',
188+
'no-useless-computed-key': 'error',
176189
'no-useless-concat': 'error',
190+
'no-useless-constructor': 'error',
177191
'no-useless-escape': 'error',
192+
'no-useless-rename': 'error',
178193
'no-useless-return': 'error',
194+
'no-var': 'error',
179195
'no-void': 'off',
180196
'no-warning-comments': ['error', {location: 'anywhere', terms: ['fixme']}],
181197
'no-with': 'off',
198+
'object-shorthand': ['error', 'properties'], // methods are optional so you can specify a name if you want
182199
'one-var': ['error', {initialized: 'never', uninitialized: 'always'}],
183200
'operator-assignment': 'off', // readability on a case-by-case basis
184201
'padding-line-between-statements': 'off', // meh...
202+
'prefer-arrow-callback': [
203+
'error',
204+
{allowNamedFunctions: true, allowUnboundThis: true},
205+
],
206+
'prefer-const': 'error',
207+
'prefer-destructuring': 'off', // nah, I like it, but not that much...
185208
'prefer-exponentiation-operator': 'warn',
186209
'prefer-named-capture-group': 'off', // maybe one day... But I'm not used to it yet.
210+
'prefer-numeric-literals': 'error',
187211
'prefer-object-spread': 'warn',
188212
'prefer-promise-reject-errors': 'off', // maybe one day... Not sure I'm in...
189213
'prefer-regex-literals': 'off',
214+
'prefer-rest-params': 'error',
215+
'prefer-spread': 'error',
216+
'prefer-template': 'error',
190217
radix: 'error',
191218
'require-atomic-updates': 'off',
192219
'require-await': 'off',
193220
'require-unicode-regexp': 'off',
221+
'require-yield': 'error',
222+
'sort-imports': 'off',
194223
'sort-keys': 'off',
195224
'sort-vars': 'off',
196225
'spaced-comment': 'off',
197226
strict: 'error',
227+
'symbol-description': 'error',
198228
'use-isnan': 'error',
199229
'valid-typeof': 'error',
200230
'vars-on-top': 'error',
@@ -211,19 +241,27 @@ module.exports = {
211241
},
212242
plugins: ['@typescript-eslint'],
213243
rules: {
244+
'constructor-super': 'off', // ts(2335) & ts(2377)
214245
'getter-return': 'off', // ts(2378)
246+
'no-const-assign': 'off', // ts(2588)
215247
'no-dupe-args': 'off', // ts(2300)
216248
'no-dupe-keys': 'off', // ts(1117)
217249
'no-func-assign': 'off', // ts(2539)
218250
'no-import-assign': 'off', // ts(2539) & ts(2540)
251+
'no-new-symbol': 'off', // ts(2588)
219252
'no-obj-calls': 'off', // ts(2349)
220253
'no-setter-return': 'off', // ts(2408)
254+
'no-this-before-super': 'off', // ts(2376)
221255
'no-undef': 'off', // ts(2304)
222256
'no-unreachable': 'off', // ts(7027)
223257
'no-unsafe-negation': 'off', // ts(2365) & ts(2360) & ts(2358)
224258
'valid-typeof': 'off', // ts(2367)
225259

226260
'consistent-return': 'off', // in TS this is much less an issue
261+
'no-var': 'error', // TS transpiles let/const to var, so no need for vars any more
262+
'prefer-const': 'error', // TS provides better types with const
263+
'prefer-rest-params': 'error', // TS provides better types with rest args over arguments
264+
'prefer-spread': 'error', // TS transpiles spread to apply, so no need for manual apply
227265

228266
'default-param-last': 'off',
229267
'@typescript-eslint/default-param-last': 'off',
@@ -240,6 +278,12 @@ module.exports = {
240278
'no-array-constructor': 'off',
241279
'@typescript-eslint/no-array-constructor': 'error',
242280

281+
'no-dupe-class-members': 'off',
282+
'@typescript-eslint/no-dupe-class-members': 'off', // ts(2393) & ts(2300)
283+
284+
'no-duplicate-imports': 'off',
285+
'@typescript-eslint/no-duplicate-imports': 'error',
286+
243287
'no-empty-function': 'off',
244288
'@typescript-eslint/no-empty-function': 'off',
245289

@@ -287,6 +331,9 @@ module.exports = {
287331
},
288332
],
289333

334+
'no-useless-constructor': 'off',
335+
'@typescript-eslint/no-useless-constructor': 'error',
336+
290337
'@typescript-eslint/adjacent-overload-signatures': 'error',
291338
'@typescript-eslint/array-type': 'off',
292339
'@typescript-eslint/await-thenable': 'error',

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
},
3434
"homepage": "https://github.com/kentcdodds/eslint-config-kentcdodds#readme",
3535
"dependencies": {
36-
"@babel/core": "^7.16.5",
37-
"@babel/eslint-parser": "^7.16.5",
38-
"@babel/eslint-plugin": "^7.16.5",
39-
"@babel/preset-react": "^7.16.5",
4036
"@typescript-eslint/eslint-plugin": "^4.33.0",
4137
"@typescript-eslint/parser": "^4.33.0",
4238
"eslint-config-prettier": "^8.3.0",

0 commit comments

Comments
 (0)