eslint-config-heck 0.0.4 → 0.1.3

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.
Files changed (2) hide show
  1. package/node.js +158 -43
  2. package/package.json +6 -5
package/node.js CHANGED
@@ -20,7 +20,7 @@ const env = {
20
20
 
21
21
  const globals = {};
22
22
 
23
- const plugins = ["react"];
23
+ const plugins = ["react", "unicorn"];
24
24
  const settings = {
25
25
  react: {
26
26
  version: "detect",
@@ -148,7 +148,7 @@ const rules = {
148
148
  "no-floating-decimal": "error",
149
149
  "no-global-assign": "error",
150
150
  "no-implicit-coercion": "error",
151
- "no-implicit-globals": "error",
151
+ "no-implicit-globals": "off",
152
152
  "no-implied-eval": "error",
153
153
  "no-invalid-this": "error",
154
154
  "no-iterator": "error",
@@ -244,7 +244,7 @@ const rules = {
244
244
  caughtErrors: "all",
245
245
  },
246
246
  ],
247
- "no-use-before-define": "error",
247
+ "no-use-before-define": ["error", "nofunc"],
248
248
 
249
249
  // Stylistic issues
250
250
  "array-bracket-newline": [
@@ -268,7 +268,7 @@ const rules = {
268
268
  "func-call-spacing": "error",
269
269
  "func-name-matching": "off",
270
270
  "func-names": "off",
271
- "func-style": "error",
271
+ "func-style": ["error", "declaration", { allowArrowFunctions: true }],
272
272
  "function-call-argument-newline": ["error", "consistent"],
273
273
  "function-paren-newline": ["error", "multiline-arguments"],
274
274
  "id-denylist": "off",
@@ -292,22 +292,7 @@ const rules = {
292
292
  "keyword-spacing": "error",
293
293
  "line-comment-position": "error",
294
294
  "linebreak-style": ["error"],
295
- "lines-around-comment": [
296
- "error",
297
- {
298
- beforeBlockComment: true,
299
- beforeLineComment: true,
300
- allowBlockStart: true,
301
- allowBlockEnd: false,
302
- allowObjectStart: true,
303
- allowObjectEnd: false,
304
- allowArrayStart: true,
305
- allowArrayEnd: false,
306
- allowClassStart: true,
307
- allowClassEnd: false,
308
- applyDefaultIgnorePatterns: true,
309
- },
310
- ],
295
+ "lines-around-comment": "off",
311
296
  "lines-between-class-members": [
312
297
  "error",
313
298
  "always",
@@ -350,6 +335,7 @@ const rules = {
350
335
  },
351
336
  ],
352
337
  "no-negated-condition": "off",
338
+
353
339
  "no-nested-ternary": "error",
354
340
  "no-new-object": "error",
355
341
  "no-plusplus": "off",
@@ -372,14 +358,7 @@ const rules = {
372
358
  consistent: true,
373
359
  },
374
360
  ],
375
- "object-curly-spacing": [
376
- "error",
377
- "always",
378
- {
379
- arraysInObjects: false,
380
- objectsInObjects: false,
381
- },
382
- ],
361
+ "object-curly-spacing": ["error", "always"],
383
362
  "object-property-newline": [
384
363
  "error",
385
364
  {
@@ -489,8 +468,14 @@ const rules = {
489
468
  "prefer-destructuring": [
490
469
  "error",
491
470
  {
492
- object: true,
493
- array: false,
471
+ VariableDeclarator: {
472
+ array: false,
473
+ object: true,
474
+ },
475
+ AssignmentExpression: {
476
+ array: false,
477
+ object: false,
478
+ },
494
479
  },
495
480
  ],
496
481
  "prefer-numeric-literals": "error",
@@ -523,8 +508,8 @@ const rules = {
523
508
  "react/function-component-definition": [
524
509
  "error",
525
510
  {
526
- namedComponents: "function-expression",
527
- unnamedComponents: "function-expression",
511
+ namedComponents: "function-declaration",
512
+ unnamedComponents: "arrow-function",
528
513
  },
529
514
  ],
530
515
  "react/no-access-state-in-setstate": "error",
@@ -572,7 +557,7 @@ const rules = {
572
557
  "error",
573
558
  {
574
559
  groups: {
575
- rendering: ["/^render.+$/", "render"],
560
+ render: ["render", "/^render.+$/"],
576
561
  },
577
562
  },
578
563
  ],
@@ -632,7 +617,7 @@ const rules = {
632
617
  "react/jsx-max-depth": "off",
633
618
  "react/jsx-max-props-per-line": "error",
634
619
  "react/jsx-newline": "off",
635
- "react/jsx-no-bind": "error",
620
+ "react/jsx-no-bind": ["error", { allowArrowFunctions: true }],
636
621
  "react/jsx-no-comment-textnodes": "error",
637
622
  "react/jsx-no-constructed-context-values": "error",
638
623
  "react/jsx-no-duplicate-props": "error",
@@ -676,6 +661,127 @@ const rules = {
676
661
  arrow: "parens-new-line",
677
662
  },
678
663
  ],
664
+
665
+ // eslint-plugin-unicorn
666
+ "unicorn/better-regex": "error",
667
+ "unicorn/catch-error-name": [
668
+ "error", {
669
+ name: "ex",
670
+ ignore: ["^ex([A-Z0-9].*)?$"],
671
+ },
672
+ ],
673
+ "unicorn/consistent-destructuring": "error",
674
+ "unicorn/consistent-function-scoping": [
675
+ "error", {
676
+ checkArrowFunctions: false,
677
+ },
678
+ ],
679
+ "unicorn/custom-error-definition": "off",
680
+ "unicorn/empty-brace-spaces": "off",
681
+ "unicorn/error-message": "error",
682
+ "unicorn/escape-case": "error",
683
+ "unicorn/expiring-todo-comments": "error",
684
+ "unicorn/explicit-length-check": "error",
685
+ "unicorn/filename-case": [
686
+ "error", {
687
+ cases: {
688
+ camelCase: true,
689
+ pascalCase: true,
690
+ kebabCase: false,
691
+ snakeCase: false,
692
+ },
693
+ },
694
+ ],
695
+ "unicorn/import-index": "error",
696
+ "unicorn/import-style": "error",
697
+ "unicorn/new-for-builtins": "error",
698
+ "unicorn/no-abusive-eslint-disable": "error",
699
+ "unicorn/no-array-callback-reference": "off",
700
+ "unicorn/no-array-for-each": "off",
701
+ "unicorn/no-array-method-this-argument": "error",
702
+ "unicorn/no-array-push-push": "error",
703
+ "unicorn/no-array-reduce": "off",
704
+ "unicorn/no-console-spaces": "error",
705
+ "unicorn/no-document-cookie": "error",
706
+ "unicorn/no-empty-file": "error",
707
+ "unicorn/no-for-loop": "error",
708
+ "unicorn/no-hex-escape": "error",
709
+ "unicorn/no-instanceof-array": "error",
710
+ "unicorn/no-invalid-remove-event-listener": "error",
711
+ "unicorn/no-keyword-prefix": "off",
712
+ "unicorn/no-lonely-if": "error",
713
+ "unicorn/no-nested-ternary": "off",
714
+ "unicorn/no-new-array": "error",
715
+ "unicorn/no-new-buffer": "error",
716
+ "unicorn/no-null": "off",
717
+ "unicorn/no-object-as-default-parameter": "error",
718
+ "unicorn/no-process-exit": "error",
719
+ "unicorn/no-static-only-class": "error",
720
+ "unicorn/no-this-assignment": "error",
721
+ "unicorn/no-unreadable-array-destructuring": "error",
722
+ "unicorn/no-unsafe-regex": "off",
723
+ "unicorn/no-unused-properties": "error",
724
+ "unicorn/no-useless-fallback-in-spread": "error",
725
+ "unicorn/no-useless-length-check": "error",
726
+ "unicorn/no-useless-spread": "error",
727
+ "unicorn/no-useless-undefined": "error",
728
+ "unicorn/no-zero-fractions": "error",
729
+ "unicorn/number-literal-case": "error",
730
+ "unicorn/numeric-separators-style": [
731
+ "error", {
732
+ number: { minimumDigits: 0, groupLength: 3 },
733
+ },
734
+ ],
735
+ "unicorn/prefer-add-event-listener": "error",
736
+ "unicorn/prefer-array-find": "error",
737
+ "unicorn/prefer-array-flat": "error",
738
+ "unicorn/prefer-array-flat-map": "error",
739
+ "unicorn/prefer-array-index-of": "error",
740
+ "unicorn/prefer-array-some": "error",
741
+ "unicorn/prefer-at": "error",
742
+ "unicorn/prefer-date-now": "error",
743
+ "unicorn/prefer-default-parameters": "error",
744
+ "unicorn/prefer-dom-node-append": "error",
745
+ "unicorn/prefer-dom-node-dataset": "error",
746
+ "unicorn/prefer-dom-node-remove": "error",
747
+ "unicorn/prefer-dom-node-text-content": "error",
748
+ "unicorn/prefer-export-from": "off",
749
+ "unicorn/prefer-includes": "error",
750
+ "unicorn/prefer-keyboard-event-key": "error",
751
+ "unicorn/prefer-math-trunc": "error",
752
+ "unicorn/prefer-modern-dom-apis": "error",
753
+ "unicorn/prefer-module": "off",
754
+ "unicorn/prefer-negative-index": "error",
755
+ "unicorn/prefer-node-protocol": "error",
756
+ "unicorn/prefer-number-properties": "error",
757
+ "unicorn/prefer-object-from-entries": "error",
758
+ "unicorn/prefer-object-has-own": "error",
759
+ "unicorn/prefer-optional-catch-binding": "error",
760
+ "unicorn/prefer-prototype-methods": "error",
761
+ "unicorn/prefer-query-selector": "off",
762
+ "unicorn/prefer-reflect-apply": "error",
763
+ "unicorn/prefer-regexp-test": "error",
764
+ "unicorn/prefer-set-has": "error",
765
+ "unicorn/prefer-spread": "error",
766
+
767
+ // TODO: only available in Node.js 15+, so enable it later
768
+ "unicorn/prefer-string-replace-all": "off",
769
+ "unicorn/prefer-string-slice": "error",
770
+ "unicorn/prefer-string-starts-ends-with": "error",
771
+ "unicorn/prefer-string-trim-start-end": "error",
772
+ "unicorn/prefer-switch": "error",
773
+
774
+ // TODO: off until there is a solution to this: https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1079
775
+ "unicorn/prefer-ternary": "off",
776
+ "unicorn/prefer-top-level-await": "off",
777
+ "unicorn/prefer-type-error": "error",
778
+ "unicorn/prevent-abbreviations": "off",
779
+ "unicorn/require-array-join-separator": "error",
780
+ "unicorn/require-number-to-fixed-digits-argument": "error",
781
+ "unicorn/require-post-message-target-origin": "error",
782
+ "unicorn/string-content": "off",
783
+ "unicorn/template-indent": "off",
784
+ "unicorn/throw-new-error": "error",
679
785
  };
680
786
 
681
787
  const overrides = [
@@ -716,7 +822,7 @@ const overrides = [
716
822
  "@typescript-eslint/class-literal-property-style": "error",
717
823
  "@typescript-eslint/consistent-indexed-object-style": "error",
718
824
  "@typescript-eslint/consistent-type-assertions": "error",
719
- "@typescript-eslint/consistent-type-definitions": "off",
825
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
720
826
  "@typescript-eslint/consistent-type-imports": [
721
827
  "error",
722
828
  {
@@ -761,6 +867,12 @@ const overrides = [
761
867
  regex: "^__html$", match: false,
762
868
  },
763
869
  },
870
+ {
871
+ selector: ["parameter"],
872
+ modifiers: ["unused"],
873
+ format: ["strictCamelCase"],
874
+ leadingUnderscore: "require",
875
+ },
764
876
  {
765
877
  selector: ["typeLike"],
766
878
  format: ["StrictPascalCase"],
@@ -787,7 +899,11 @@ const overrides = [
787
899
  "@typescript-eslint/no-for-in-array": "error",
788
900
  "@typescript-eslint/no-implicit-any-catch": "error",
789
901
  "@typescript-eslint/no-inferrable-types": "error",
790
- "@typescript-eslint/no-invalid-void-type": "error",
902
+ "@typescript-eslint/no-invalid-void-type": [
903
+ "error", {
904
+ allowAsThisParameter: true,
905
+ },
906
+ ],
791
907
  "@typescript-eslint/no-meaningless-void-operator": "error",
792
908
  "@typescript-eslint/no-misused-new": "error",
793
909
  "@typescript-eslint/no-misused-promises": "error",
@@ -960,12 +1076,7 @@ const overrides = [
960
1076
  "no-useless-constructor": "off",
961
1077
  "@typescript-eslint/no-useless-constructor": "error",
962
1078
  "object-curly-spacing": "off",
963
- "@typescript-eslint/object-curly-spacing": [
964
- "error", "always", {
965
- arraysInObjects: false,
966
- objectsInObjects: false,
967
- },
968
- ],
1079
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
969
1080
  "padding-line-between-statements": "off",
970
1081
  "@typescript-eslint/padding-line-between-statements": [
971
1082
  "error",
@@ -1034,7 +1145,11 @@ const overrides = [
1034
1145
  rules: {
1035
1146
  // eslint-plugin-jest
1036
1147
  "jest/consistent-test-it": "error",
1037
- "jest/expect-expect": "error",
1148
+ "jest/expect-expect": [
1149
+ "error", {
1150
+ assertFunctionNames: ["expect*"],
1151
+ },
1152
+ ],
1038
1153
  "jest/max-nested-describe": "off",
1039
1154
  "jest/no-alias-methods": "error",
1040
1155
  "jest/no-commented-out-tests": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-heck",
3
- "version": "0.0.4",
3
+ "version": "0.1.3",
4
4
  "description": "Contains an ESLint configuration for ES2015+, TypeScript, and React.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,18 +15,19 @@
15
15
  "author": "atheck",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@typescript-eslint/eslint-plugin": "5.3.1",
19
- "@typescript-eslint/parser": "5.3.1",
18
+ "@typescript-eslint/eslint-plugin": "5.4.0",
19
+ "@typescript-eslint/parser": "5.4.0",
20
20
  "eslint": "8.2.0",
21
21
  "eslint-plugin-deprecation": "1.2.1",
22
22
  "eslint-plugin-jest": "25.2.4",
23
23
  "eslint-plugin-react": "7.27.0",
24
+ "eslint-plugin-unicorn": "38.0.1",
24
25
  "react": "17.0.2",
25
- "typescript": "4.4.4"
26
+ "typescript": "4.5.2"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/jest": "27.0.2",
29
- "@types/react": "17.0.34",
30
+ "@types/react": "17.0.35",
30
31
  "jest": "27.3.1"
31
32
  }
32
33
  }