@remcohaszing/eslint 12.0.1 → 14.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/README.md CHANGED
@@ -1,11 +1,9 @@
1
1
  # @remcohaszing/eslint
2
2
 
3
- > A strict ESLint configuration
4
-
5
3
  [![build status](https://github.com/remcohaszing/eslint/workflows/ci/badge.svg)](https://github.com/remcohaszing/eslint/actions)
6
4
  [![codecov](https://codecov.io/gh/remcohaszing/eslint/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/eslint)
7
- [![npm](https://img.shields.io/npm/v/@remcohaszing/eslint)](https://www.npmjs.com/package/@remcohaszing/eslint)
8
- [![prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
5
+ [![npm version](https://img.shields.io/npm/v/@remcohaszing/eslint)](https://www.npmjs.com/package/@remcohaszing/eslint)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@remcohaszing/eslint)](https://www.npmjs.com/package/@remcohaszing/eslint)
9
7
 
10
8
  This is a strict shareable ESLint configuration. All ESLint core rules and a variety of ESLint
11
9
  plugins have been carefully considered. Overrides are used to apply rules based on context.
@@ -24,42 +22,13 @@ plugins have been carefully considered. Overrides are used to apply rules based
24
22
 
25
23
  ## Installation
26
24
 
27
- Install `@remcohaszing/eslint` using `npm`.
28
-
29
25
  ```sh
30
- npm install --save-dev \
31
- eslint \
32
- @remcohaszing/eslint \
33
- prettier
26
+ npm install --save-dev @remcohaszing/eslint
34
27
  ```
35
28
 
36
29
  ## Configuration
37
30
 
38
- First [configure Prettier](https://prettier.io/docs/en/configuration.html). For example, create a
39
- `.editorconfig` with the following content:
40
-
41
- ```ini
42
- root = true
43
-
44
- [*]
45
- charset = utf-8
46
- end_of_line = lf
47
- indent_size = 2
48
- indent_style = space
49
- insert_final_newline = true
50
- max_line_length = 100
51
- trim_trailing_whitespace = true
52
- ```
53
-
54
- And create a `.prettierrc.yaml` with the following content:
55
-
56
- ```yaml
57
- proseWrap: always
58
- singleQuote: true
59
- trailingComma: all
60
- ```
61
-
62
- Next, create `eslint.config.js` with the following content:
31
+ Create `eslint.config.js` with the following content:
63
32
 
64
33
  ```js
65
34
  export { default } from '@remcohaszing/eslint'
@@ -85,8 +54,6 @@ Code blocks in Markdown are linted by default using
85
54
  [`@eslint/markdown`](https://github.com/eslint/markdown). The type checking rules from
86
55
  `@typescript-eslint/eslint-plugin` don’t work with markdown code blocks.
87
56
 
88
- `prettier/prettier` is disabled, because it doesn’t play nice with `eslint-plugin-markdown`.
89
-
90
57
  Some other rules have been turned off, because these rules may conflict with the purpose of the
91
58
  documentation.
92
59
 
@@ -126,7 +93,7 @@ eslint
126
93
 
127
94
  ## Compatibility
128
95
 
129
- This project requires Node.js 22 or greater.
96
+ This project requires Node.js 24 or greater.
130
97
 
131
98
  ## License
132
99
 
package/lib/config.js CHANGED
@@ -6,7 +6,6 @@ import { dirname, join } from 'node:path'
6
6
 
7
7
  import { includeIgnoreFile } from '@eslint/compat'
8
8
  import markdown from '@eslint/markdown'
9
- // @ts-expect-error
10
9
  import eslintCommunityEslintComments from '@eslint-community/eslint-plugin-eslint-comments'
11
10
  import stylistic from '@stylistic/eslint-plugin'
12
11
  import typescriptEslint from '@typescript-eslint/eslint-plugin'
@@ -14,13 +13,10 @@ import typescriptEslintParser from '@typescript-eslint/parser'
14
13
  import confusingBrowserGlobals from 'confusing-browser-globals'
15
14
  import { defineConfig } from 'eslint/config'
16
15
  import importX from 'eslint-plugin-import-x'
17
- // @ts-expect-error
18
- import jestFormatting from 'eslint-plugin-jest-formatting'
19
16
  import jsdoc from 'eslint-plugin-jsdoc'
20
17
  import n from 'eslint-plugin-n'
21
18
  import perfectionist from 'eslint-plugin-perfectionist'
22
19
  import { Alphabet } from 'eslint-plugin-perfectionist/alphabet'
23
- import prettier from 'eslint-plugin-prettier'
24
20
  import unicorn from 'eslint-plugin-unicorn'
25
21
  import findUp from 'find-up'
26
22
  import globals from 'globals'
@@ -125,6 +121,8 @@ const alphabet = unshiftChar(unshiftChar(characters, '.'), '/')
125
121
  */
126
122
  const NON_COMPONENT_FUNCTION = 'FunctionDeclaration[id.name=/^[a-z]/]'
127
123
  const METHOD_DEFINITION = 'MethodDefinition'
124
+ const TEST_SELECTOR =
125
+ 'ExpressionStatement[expression.callee.name=/^(after|afterAll|afterEach|before|beforeAll|beforeEach|describe|it|suite|test)$/]'
128
126
 
129
127
  const config = defineConfig([
130
128
  getIgnorePatterns(),
@@ -154,13 +152,10 @@ const config = defineConfig([
154
152
  // @ts-expect-error
155
153
  '@typescript-eslint': typescriptEslint,
156
154
  '@eslint-community/eslint-comments': eslintCommunityEslintComments,
157
- // @ts-expect-error
158
155
  'import-x': importX,
159
- 'jest-formatting': jestFormatting,
160
156
  jsdoc,
161
157
  n,
162
158
  perfectionist,
163
- prettier,
164
159
  unicorn
165
160
  },
166
161
  settings: {
@@ -363,10 +358,6 @@ const config = defineConfig([
363
358
  selector:
364
359
  'CallExpression[callee.property.name="toString"][callee.optional=false][arguments.length=0][optional=false]',
365
360
  message: 'Use String() instead.'
366
- },
367
- {
368
- selector: '[returnType.type="TSTypeAnnotation"]>TSTypeAnnotation>TSVoidKeyword',
369
- message: 'Use undefined for non-returning functions of unknown for callbacks'
370
361
  }
371
362
  ],
372
363
  'no-return-assign': ['error', 'always'],
@@ -428,6 +419,7 @@ const config = defineConfig([
428
419
  'prefer-rest-params': 'error',
429
420
  'prefer-spread': 'error',
430
421
  'prefer-template': 'error',
422
+ 'preserve-caught-error': ['error', { requireCatchParameter: true }],
431
423
  radix: ['error', 'as-needed'],
432
424
  'require-await': 'error',
433
425
  'require-yield': 'error',
@@ -442,7 +434,6 @@ const config = defineConfig([
442
434
  '@eslint-community/eslint-comments/no-aggregating-enable': 'error',
443
435
  '@eslint-community/eslint-comments/no-duplicate-disable': 'error',
444
436
  '@eslint-community/eslint-comments/no-unlimited-disable': 'error',
445
- '@eslint-community/eslint-comments/no-unused-disable': 'error',
446
437
  '@eslint-community/eslint-comments/no-unused-enable': 'error',
447
438
  '@eslint-community/eslint-comments/no-use': [
448
439
  'error',
@@ -496,13 +487,13 @@ const config = defineConfig([
496
487
 
497
488
  {
498
489
  blankLine: 'always',
499
- prev: 'function',
490
+ prev: ['function', { selector: TEST_SELECTOR }],
500
491
  next: '*'
501
492
  },
502
493
  {
503
494
  blankLine: 'always',
504
495
  prev: '*',
505
- next: 'function'
496
+ next: ['function', { selector: TEST_SELECTOR }]
506
497
  }
507
498
  ],
508
499
  '@stylistic/quotes': ['error', 'single', { avoidEscape: true, ignoreStringLiterals: true }],
@@ -558,14 +549,6 @@ const config = defineConfig([
558
549
  ],
559
550
  'import-x/no-useless-path-segments': 'error',
560
551
 
561
- // https://github.com/dangreenisrael/eslint-plugin-jest-formatting
562
- 'jest-formatting/padding-around-after-all-blocks': 'error',
563
- 'jest-formatting/padding-around-after-each-blocks': 'error',
564
- 'jest-formatting/padding-around-before-all-blocks': 'error',
565
- 'jest-formatting/padding-around-before-each-blocks': 'error',
566
- 'jest-formatting/padding-around-describe-blocks': 'error',
567
- 'jest-formatting/padding-around-test-blocks': 'error',
568
-
569
552
  // https://github.com/gajus/eslint-plugin-jsdoc
570
553
  'jsdoc/check-access': 'error',
571
554
  'jsdoc/check-indentation': [
@@ -577,6 +560,7 @@ const config = defineConfig([
577
560
  'jsdoc/check-tag-names': ['error', { jsxTags: true }],
578
561
  'jsdoc/check-template-names': 'error',
579
562
  'jsdoc/empty-tags': 'error',
563
+ 'jsdoc/escape-inline-tags': 'error',
580
564
  'jsdoc/match-name': [
581
565
  'error',
582
566
  {
@@ -638,6 +622,9 @@ const config = defineConfig([
638
622
  }
639
623
  ],
640
624
  'jsdoc/no-undefined-types': 'error',
625
+ 'jsdoc/prefer-import-tag': ['error', { exemptTypedefs: false, outputType: 'named-import' }],
626
+ 'jsdoc/reject-any-type': 'error',
627
+ 'jsdoc/reject-function-type': 'error',
641
628
  'jsdoc/require-asterisk-prefix': 'error',
642
629
  'jsdoc/require-description': 'error',
643
630
  'jsdoc/require-hyphen-before-param-description': ['error', 'never'],
@@ -669,8 +656,14 @@ const config = defineConfig([
669
656
  'jsdoc/require-returns-check': 'error',
670
657
  'jsdoc/require-returns-description': 'error',
671
658
  'jsdoc/require-returns-type': 'error',
659
+ 'jsdoc/require-template-description': 'error',
660
+ 'jsdoc/require-throws-description': 'error',
661
+ 'jsdoc/require-throws-type': 'error',
672
662
  'jsdoc/sort-tags': ['error', { alphabetizeExtras: true }],
673
663
  'jsdoc/tag-lines': ['error', 'never', { applyToEndTag: false, startLines: 1, endLines: 0 }],
664
+ 'jsdoc/ts-method-signature-style': 'error',
665
+ 'jsdoc/ts-no-unnecessary-template-expression': 'error',
666
+ 'jsdoc/ts-prefer-function-type': 'error',
674
667
 
675
668
  // https://github.com/eslint-community/eslint-plugin-n
676
669
  'n/callback-return': ['error', ['callback', 'cb']],
@@ -684,9 +677,11 @@ const config = defineConfig([
684
677
  'n/no-unpublished-bin': 'error',
685
678
  'n/prefer-global/buffer': 'error',
686
679
  'n/prefer-global/console': 'error',
680
+ 'n/prefer-global/crypto': 'error',
687
681
  'n/prefer-global/process': 'error',
688
682
  'n/prefer-global/text-decoder': 'error',
689
683
  'n/prefer-global/text-encoder': 'error',
684
+ 'n/prefer-global/timers': 'error',
690
685
  'n/prefer-global/url': 'error',
691
686
  'n/prefer-global/url-search-params': 'error',
692
687
  'n/prefer-promises/dns': 'error',
@@ -696,8 +691,10 @@ const config = defineConfig([
696
691
  // https://perfectionist.dev
697
692
  'perfectionist/sort-array-includes': 'error',
698
693
  'perfectionist/sort-classes': ['error', { type: 'unsorted' }],
694
+ 'perfectionist/sort-export-attributes': 'error',
699
695
  'perfectionist/sort-exports': ['error', { type: 'custom', alphabet }],
700
696
  'perfectionist/sort-heritage-clauses': 'error',
697
+ 'perfectionist/sort-import-attributes': 'error',
701
698
  'perfectionist/sort-imports': [
702
699
  'error',
703
700
  {
@@ -711,17 +708,16 @@ const config = defineConfig([
711
708
  'type-subpath',
712
709
  'type-internal',
713
710
  'type-parent',
714
- { newlinesBetween: 'never' },
711
+ { newlinesBetween: 0 },
715
712
  ['type-sibling', 'type-index'],
716
713
  'builtin',
717
714
  'external',
718
715
  'subpath',
719
716
  'internal',
720
717
  'parent',
721
- { newlinesBetween: 'never' },
718
+ { newlinesBetween: 0 },
722
719
  ['sibling', 'index'],
723
- 'unknown',
724
- 'object'
720
+ 'unknown'
725
721
  ]
726
722
  }
727
723
  ],
@@ -736,20 +732,21 @@ const config = defineConfig([
736
732
  'perfectionist/sort-maps': 'error',
737
733
  'perfectionist/sort-named-exports': 'error',
738
734
  'perfectionist/sort-named-imports': 'error',
739
- 'perfectionist/sort-objects': ['error', { objectDeclarations: false }],
735
+ 'perfectionist/sort-objects': [
736
+ 'error',
737
+ { type: 'unsorted', useConfigurationIf: { objectType: 'non-destructured' } }
738
+ ],
740
739
  'perfectionist/sort-union-types': 'error',
741
740
 
742
- // https://github.com/prettier/eslint-plugin-prettier
743
- 'prettier/prettier': 'error',
744
-
745
741
  // https://github.com/sindresorhus/eslint-plugin-unicorn
746
742
  'unicorn/better-regex': 'error',
747
- 'unicorn/catch-error-name': ['error', { name: 'error', ignore: ['err', /Error^/] }],
743
+ 'unicorn/catch-error-name': ['error', { name: 'error', ignore: ['cause', 'err', /Error$/] }],
748
744
  'unicorn/consistent-assert': 'error',
749
745
  'unicorn/consistent-date-clone': 'error',
750
746
  'unicorn/consistent-destructuring': 'error',
751
747
  'unicorn/consistent-empty-array-spread': 'error',
752
748
  'unicorn/consistent-function-scoping': 'error',
749
+ 'unicorn/consistent-template-literal-escape': 'error',
753
750
  'unicorn/custom-error-definition': 'error',
754
751
  'unicorn/error-message': 'error',
755
752
  'unicorn/escape-case': 'error',
@@ -783,12 +780,14 @@ const config = defineConfig([
783
780
  'unicorn/no-array-for-each': 'error',
784
781
  'unicorn/no-array-method-this-argument': 'error',
785
782
  'unicorn/no-array-reduce': 'error',
783
+ 'unicorn/no-array-sort': 'error',
786
784
  'unicorn/no-await-in-promise-methods': 'error',
787
785
  'unicorn/no-console-spaces': 'error',
788
786
  'unicorn/no-document-cookie': 'error',
789
787
  'unicorn/no-empty-file': 'error',
790
788
  'unicorn/no-for-loop': 'error',
791
789
  'unicorn/no-hex-escape': 'error',
790
+ 'unicorn/no-immediate-mutation': 'error',
792
791
  'unicorn/no-instanceof-builtins': 'error',
793
792
  'unicorn/no-invalid-fetch-options': 'error',
794
793
  'unicorn/no-invalid-remove-event-listener': 'error',
@@ -808,8 +807,10 @@ const config = defineConfig([
808
807
  'unicorn/no-unnecessary-slice-end': 'error',
809
808
  'unicorn/no-unreadable-iife': 'error',
810
809
  'unicorn/no-unused-properties': 'error',
810
+ 'unicorn/no-useless-collection-argument': 'error',
811
811
  'unicorn/no-useless-error-capture-stack-trace': 'error',
812
812
  'unicorn/no-useless-fallback-in-spread': 'error',
813
+ 'unicorn/no-useless-iterator-to-array': 'error',
813
814
  'unicorn/no-useless-length-check': 'error',
814
815
  'unicorn/no-useless-promise-resolve-reject': 'error',
815
816
  'unicorn/no-useless-spread': 'error',
@@ -823,8 +824,10 @@ const config = defineConfig([
823
824
  'unicorn/prefer-array-index-of': 'error',
824
825
  'unicorn/prefer-array-some': 'error',
825
826
  'unicorn/prefer-at': 'error',
827
+ 'unicorn/prefer-bigint-literals': 'error',
826
828
  'unicorn/prefer-blob-reading-methods': 'error',
827
829
  'unicorn/prefer-class-fields': 'error',
830
+ 'unicorn/prefer-classlist-toggle': 'error',
828
831
  'unicorn/prefer-date-now': 'error',
829
832
  'unicorn/prefer-default-parameters': 'error',
830
833
  'unicorn/prefer-dom-node-append': 'error',
@@ -852,6 +855,7 @@ const config = defineConfig([
852
855
  'unicorn/prefer-prototype-methods': 'error',
853
856
  'unicorn/prefer-reflect-apply': 'error',
854
857
  'unicorn/prefer-regexp-test': 'error',
858
+ 'unicorn/prefer-response-static-json': 'error',
855
859
  'unicorn/prefer-set-has': 'error',
856
860
  'unicorn/prefer-set-size': 'error',
857
861
  'unicorn/prefer-single-call': 'error',
@@ -864,9 +868,11 @@ const config = defineConfig([
864
868
  'unicorn/prefer-top-level-await': 'error',
865
869
  'unicorn/prefer-type-error': 'error',
866
870
  'unicorn/relative-url-style': 'error',
871
+ 'unicorn/require-module-attributes': 'error',
867
872
  'unicorn/require-module-specifiers': 'error',
868
873
  'unicorn/require-post-message-target-origin': 'error',
869
874
  'unicorn/switch-case-braces': ['error', 'avoid'],
875
+ 'unicorn/switch-case-break-position': 'error',
870
876
  'unicorn/template-indent': 'error',
871
877
  'unicorn/text-encoding-identifier-case': 'error',
872
878
  'unicorn/throw-new-error': 'error'
@@ -1124,8 +1130,6 @@ const config = defineConfig([
1124
1130
  'n/no-unpublished-import': 'off',
1125
1131
  'n/no-unpublished-require': 'off',
1126
1132
 
1127
- 'prettier/prettier': 'off',
1128
-
1129
1133
  'unicorn/consistent-function-scoping': 'off'
1130
1134
  }
1131
1135
  }
@@ -1174,6 +1178,7 @@ export const typechecking = defineConfig([
1174
1178
  '@typescript-eslint/no-unsafe-member-access': 'error',
1175
1179
  '@typescript-eslint/no-unsafe-return': 'error',
1176
1180
  '@typescript-eslint/no-unsafe-unary-minus': 'error',
1181
+ '@typescript-eslint/no-useless-default-assignment': 'error',
1177
1182
  '@typescript-eslint/non-nullable-type-assertion-style': 'error',
1178
1183
  '@typescript-eslint/only-throw-error': 'error',
1179
1184
  '@typescript-eslint/prefer-destructuring': [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remcohaszing/eslint",
3
- "version": "12.0.1",
3
+ "version": "14.0.0",
4
4
  "description": "A strict ESLint configuration.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -30,31 +30,29 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@eslint-community/eslint-plugin-eslint-comments": "^4.0.0",
33
- "@eslint/compat": "^1.0.0",
34
- "@eslint/markdown": "^7.0.0",
33
+ "@eslint/compat": "^2.0.0",
34
+ "@eslint/markdown": "^8.0.0",
35
35
  "@stylistic/eslint-plugin": "^5.0.0",
36
36
  "@typescript-eslint/eslint-plugin": "^8.0.0",
37
37
  "@typescript-eslint/parser": "^8.0.0",
38
38
  "confusing-browser-globals": "^1.0.0",
39
39
  "eslint-plugin-import-x": "^4.0.0",
40
- "eslint-plugin-jest-formatting": "^3.0.0",
41
- "eslint-plugin-jsdoc": "^54.0.0",
40
+ "eslint-plugin-jsdoc": "^62.0.0",
42
41
  "eslint-plugin-n": "^17.0.0",
43
- "eslint-plugin-perfectionist": "^4.0.0",
44
- "eslint-plugin-prettier": "^5.0.0",
45
- "eslint-plugin-unicorn": "^60.0.0",
42
+ "eslint-plugin-perfectionist": "^5.0.0",
43
+ "eslint-plugin-unicorn": "^64.0.0",
46
44
  "find-up": "^5.0.0"
47
45
  },
48
46
  "devDependencies": {
49
47
  "@types/confusing-browser-globals": "^1.0.0",
50
- "prettier-plugin-packagejson": "^2.0.0",
48
+ "prettier": "^3.0.0",
49
+ "prettier-plugin-packagejson": "^3.0.0",
51
50
  "remark-cli": "^12.0.0",
52
51
  "remark-preset-remcohaszing": "^3.0.0",
53
- "type-fest": "^4.0.0",
54
- "typescript": "^5.0.0"
52
+ "type-fest": "^5.0.0",
53
+ "typescript": "^6.0.0"
55
54
  },
56
55
  "peerDependencies": {
57
- "eslint": "9",
58
- "prettier": "3"
56
+ "eslint": "10"
59
57
  }
60
58
  }
package/types/config.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
  export function define(overrides: Linter.Config | Linter.Config[]): Linter.Config[];
10
10
  export default config;
11
- export const typechecking: Linter.Config<Linter.RulesRecord>[];
11
+ export const typechecking: import("@eslint/config-helpers").Config[];
12
12
  import type { Linter } from 'eslint';
13
- declare const config: Linter.Config<Linter.RulesRecord>[];
13
+ declare const config: import("@eslint/config-helpers").Config[];
14
14
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.js"],"names":[],"mappings":"AA4rCA;;;;;;;GAOG;AACH,kCALW,aAAa,GAAG,aAAa,EAAE,GAE7B,aAAa,EAAE,CAK3B;;AAvFD,+DA2EE;4BAzrCuB,QAAQ;AA+HjC,0DA2+BE"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.js"],"names":[],"mappings":"AAisCA;;;;;;;GAOG;AACH,kCALW,aAAa,GAAG,aAAa,EAAE,GAE7B,aAAa,EAAE,CAK3B;;AAxFD,qEA4EE;4BA9rCuB,QAAQ;AA6HjC,gEAi/BE"}