@darksheep/eslint 8.0.7 → 9.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/package.json +8 -3
  3. package/src/configs/eslint-base.js +5 -2
  4. package/src/configs/eslint-complexity.js +4 -1
  5. package/src/configs/eslint-ignores.js +7 -3
  6. package/src/configs/eslint-style.js +6 -3
  7. package/src/configs/react.js +4 -1
  8. package/src/custom-logger/index.js +5 -2
  9. package/src/custom-rules/instance-of-array.js +13 -9
  10. package/src/custom-rules/loose-types.js +8 -4
  11. package/src/custom-rules/no-useless-expression.js +6 -2
  12. package/src/custom-rules/sequence-expression.js +5 -2
  13. package/src/helper/disable-plugin.js +17 -0
  14. package/src/helper/disable-rule.js +17 -0
  15. package/src/helper/edit-rule.js +33 -0
  16. package/src/index.js +11 -4
  17. package/src/plugins/command.js +20 -0
  18. package/src/plugins/eslint-comments.js +4 -1
  19. package/src/plugins/jest.js +135 -0
  20. package/src/plugins/jsdoc.js +23 -3
  21. package/src/plugins/json.js +8 -2
  22. package/src/plugins/node.js +6 -2
  23. package/src/plugins/package-json.js +30 -2
  24. package/src/plugins/perfectionist.js +7 -4
  25. package/src/plugins/promise.js +4 -1
  26. package/src/plugins/react-native.js +4 -1
  27. package/src/plugins/react.js +6 -3
  28. package/src/plugins/regexp.js +4 -1
  29. package/src/plugins/sca.js +4 -1
  30. package/src/plugins/security.js +4 -1
  31. package/src/plugins/style.js +4 -2
  32. package/src/plugins/typescript.js +8 -3
  33. package/src/plugins/unicorn.js +22 -4
  34. package/src/plugins/unused-imports.js +6 -2
  35. package/src/plugins/yml.js +4 -1
  36. package/src/utilities/editorconfig.js +12 -8
  37. package/src/utilities/eslint-files.js +9 -5
  38. package/src/utilities/package.js +6 -2
  39. package/types/src/configs/eslint-base.d.ts +3 -2
  40. package/types/src/configs/eslint-complexity.d.ts +6 -2
  41. package/types/src/configs/eslint-ignores.d.ts +5 -3
  42. package/types/src/configs/eslint-style.d.ts +4 -3
  43. package/types/src/configs/react.d.ts +6 -2
  44. package/types/src/custom-logger/index.d.ts +2 -1
  45. package/types/src/custom-rules/instance-of-array.d.ts +3 -2
  46. package/types/src/custom-rules/loose-types.d.ts +3 -2
  47. package/types/src/custom-rules/no-useless-expression.d.ts +3 -2
  48. package/types/src/custom-rules/sequence-expression.d.ts +6 -2
  49. package/types/src/helper/disable-plugin.d.ts +10 -0
  50. package/types/src/helper/disable-rule.d.ts +10 -0
  51. package/types/src/helper/edit-rule.d.ts +9 -0
  52. package/types/src/index.d.ts +5 -3
  53. package/types/src/plugins/command.d.ts +6 -0
  54. package/types/src/plugins/eslint-comments.d.ts +3 -2
  55. package/types/src/plugins/jest.d.ts +8 -0
  56. package/types/src/plugins/jsdoc.d.ts +3 -2
  57. package/types/src/plugins/json.d.ts +3 -2
  58. package/types/src/plugins/node.d.ts +3 -2
  59. package/types/src/plugins/package-json.d.ts +3 -2
  60. package/types/src/plugins/perfectionist.d.ts +3 -2
  61. package/types/src/plugins/promise.d.ts +3 -2
  62. package/types/src/plugins/react-native.d.ts +3 -2
  63. package/types/src/plugins/react.d.ts +3 -2
  64. package/types/src/plugins/regexp.d.ts +3 -2
  65. package/types/src/plugins/sca.d.ts +3 -2
  66. package/types/src/plugins/security.d.ts +3 -2
  67. package/types/src/plugins/style.d.ts +3 -2
  68. package/types/src/plugins/typescript.d.ts +5 -3
  69. package/types/src/plugins/unicorn.d.ts +3 -2
  70. package/types/src/plugins/unused-imports.d.ts +5 -3
  71. package/types/src/plugins/yml.d.ts +3 -2
  72. package/types/src/utilities/editorconfig.d.ts +4 -3
  73. package/types/src/utilities/eslint-files.d.ts +5 -4
  74. package/types/src/utilities/package.d.ts +5 -3
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import jsdoc from 'eslint-plugin-jsdoc';
2
5
 
3
6
  import { getTypescriptFiles } from '../utilities/eslint-files.js';
@@ -6,7 +9,7 @@ import { getPackageJson } from '../utilities/package.js';
6
9
  /**
7
10
  * Get ESLint config for JSDoc.
8
11
  * @param {URL} root - The root of the package being linted.
9
- * @returns {Promise<import('eslint').Linter.Config[]>}
12
+ * @returns {Promise<Linter.Config[]>}
10
13
  */
11
14
  export async function createEslintJSDocConfig(root) {
12
15
  const tsPackage = await getPackageJson(root, 'typescript');
@@ -50,7 +53,7 @@ export async function createEslintJSDocConfig(root) {
50
53
  'jsdoc/lines-before-block': 'off',
51
54
  'jsdoc/match-description': 'off',
52
55
  'jsdoc/match-name': 'off',
53
- 'jsdoc/multiline-blocks': 'off',
56
+ 'jsdoc/multiline-blocks': [ 'warn', { noSingleLineBlocks: true } ],
54
57
  'jsdoc/no-bad-blocks': 'warn',
55
58
  'jsdoc/no-blank-block-descriptions': 'error',
56
59
  'jsdoc/no-blank-blocks': 'error',
@@ -63,7 +66,7 @@ export async function createEslintJSDocConfig(root) {
63
66
  'jsdoc/require-description-complete-sentence': 'error',
64
67
  'jsdoc/require-description': 'off',
65
68
  'jsdoc/require-example': 'off',
66
- 'jsdoc/require-file-overview': 'off', // Could automatically add a licence?
69
+ 'jsdoc/require-file-overview': 'off',
67
70
  'jsdoc/require-hyphen-before-param-description': [ 'error', 'always', { tags: { property: 'always' } } ],
68
71
  'jsdoc/require-jsdoc': [ 'warn', { publicOnly: true } ],
69
72
  'jsdoc/require-param-description': 'warn',
@@ -86,6 +89,23 @@ export async function createEslintJSDocConfig(root) {
86
89
  'jsdoc/tag-lines': 'off',
87
90
  'jsdoc/text-escaping': 'off',
88
91
  'jsdoc/valid-types': typeChecks,
92
+
93
+ 'jsdoc/escape-inline-tags': [ 'error', { enableFixer: true, fixType: 'backslash' } ],
94
+ 'jsdoc/prefer-import-tag': [ 'warn', {
95
+ outputType: 'named-import',
96
+ exemptTypedefs: false,
97
+ } ],
98
+ 'jsdoc/reject-any-type': 'warn',
99
+ 'jsdoc/reject-function-type': 'warn',
100
+ 'jsdoc/require-next-description': 'off',
101
+ 'jsdoc/require-next-type': 'off',
102
+ 'jsdoc/require-tags': 'off',
103
+ 'jsdoc/require-template-description': 'off',
104
+ 'jsdoc/require-throws-description': 'off',
105
+ 'jsdoc/require-throws-type': 'warn',
106
+ 'jsdoc/require-yields-description': 'off',
107
+ 'jsdoc/require-yields-type': 'warn',
108
+ 'jsdoc/type-formatting': [ 'off', { stringQuotes: 'single' } ],
89
109
  },
90
110
  },
91
111
  {
@@ -1,9 +1,12 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import jsonc from 'eslint-plugin-jsonc';
2
5
  import parser from 'jsonc-eslint-parser';
3
6
 
4
7
  /**
5
8
  * Get ESLint config for imports check.
6
- * @returns {Promise<import('eslint').Linter.Config[]>}
9
+ * @returns {Promise<Linter.Config[]>}
7
10
  */
8
11
  export async function createEslintJsonConfig() {
9
12
  return [
@@ -55,6 +58,9 @@ export async function createEslintJsonConfig() {
55
58
  files: [ '**/tsconfig.json' ],
56
59
  rules: { 'jsonc/no-comments': 'off' },
57
60
  },
58
- { ignores: [ '.github/release-please/manifest.json' ] },
61
+ {
62
+ name: 'json/release-please',
63
+ ignores: [ '.github/release-please/manifest.json' ],
64
+ },
59
65
  ];
60
66
  }
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import { dirname } from 'node:path';
2
5
  import { fileURLToPath } from 'node:url';
3
6
 
@@ -14,7 +17,7 @@ import {
14
17
  const script = n.configs['flat/recommended-script'];
15
18
  const module = n.configs['flat/recommended-module'];
16
19
 
17
- /** @type {import('eslint').Linter.RulesRecord} */
20
+ /** @type {Linter.RulesRecord} */
18
21
  const commonRules = {
19
22
  'n/callback-return': 'error',
20
23
  'n/exports-style': [ 'error', 'module.exports' ],
@@ -32,6 +35,7 @@ const commonRules = {
32
35
  'n/no-process-exit': 'warn',
33
36
  'n/no-restricted-import': 'off',
34
37
  'n/no-restricted-require': 'off',
38
+ 'n/no-top-level-await': 'error',
35
39
  'n/no-unpublished-bin': 'error',
36
40
  'n/no-unpublished-import': [ 'error', { ignoreTypeImport: true } ],
37
41
  'n/no-unpublished-require': 'error',
@@ -62,7 +66,7 @@ function toExt(globs) {
62
66
  /**
63
67
  * Get ESLint config for the node plugin.
64
68
  * @param {URL} root - Root url.
65
- * @returns {Promise<import('eslint').Linter.Config[]>}
69
+ * @returns {Promise<Linter.Config[]>}
66
70
  */
67
71
  export async function createEslintNodeConfig(root) {
68
72
  const commonFiles = await getCommonFiles(root);
@@ -1,9 +1,12 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import * as plugin from 'eslint-plugin-package-json';
2
5
  import jsoncParser from 'jsonc-eslint-parser';
3
6
 
4
7
  /**
5
8
  * Get ESLint config for the regexp plugin.
6
- * @returns {Promise<import('eslint').Linter.Config[]>}
9
+ * @returns {Promise<Linter.Config[]>}
7
10
  */
8
11
  export async function createEslintPackageJsonConfig() {
9
12
  return [
@@ -22,16 +25,41 @@ export async function createEslintPackageJsonConfig() {
22
25
  'package-json/prefer-repository-shorthand': 'off',
23
26
  'package-json/repository-shorthand': [ 'error', { form: 'object' } ],
24
27
  'package-json/require-author': 'off',
28
+ 'package-json/require-bugs': 'off',
29
+ 'package-json/require-bundleDependencies': 'off',
30
+ 'package-json/require-dependencies': 'warn',
31
+ 'package-json/require-description': 'warn',
32
+ 'package-json/require-devDependencies': 'warn',
33
+ 'package-json/require-engines': [ 'warn', { ignorePrivate: true } ],
25
34
  'package-json/require-files': 'warn',
26
35
  'package-json/require-keywords': 'off',
27
36
  'package-json/require-name': 'error',
37
+ 'package-json/require-optionalDependencies': 'off',
38
+ 'package-json/require-peerDependencies': 'off',
39
+ 'package-json/require-type': 'error',
40
+ 'package-json/require-types': 'off',
28
41
  'package-json/require-version': 'error',
42
+ 'package-json/restrict-dependency-ranges': 'off',
29
43
  'package-json/sort-collections': 'error',
30
44
  'package-json/unique-dependencies': 'error',
31
- 'package-json/valid-local-dependency': 'error',
45
+ 'package-json/valid-author': 'warn',
46
+ 'package-json/valid-bin': 'warn',
47
+ 'package-json/valid-bundleDependencies': 'warn',
48
+ 'package-json/valid-config': 'warn',
49
+ 'package-json/valid-cpu': 'warn',
50
+ 'package-json/valid-dependencies': 'warn',
51
+ 'package-json/valid-description': 'warn',
52
+ 'package-json/valid-devDependencies': 'warn',
53
+ 'package-json/valid-directories': 'warn',
54
+ 'package-json/valid-exports': 'warn',
55
+ 'package-json/valid-license': 'warn',
32
56
  'package-json/valid-name': 'error',
57
+ 'package-json/valid-optionalDependencies': 'warn',
33
58
  'package-json/valid-package-definition': 'warn',
59
+ 'package-json/valid-peerDependencies': 'warn',
34
60
  'package-json/valid-repository-directory': 'error',
61
+ 'package-json/valid-scripts': 'warn',
62
+ 'package-json/valid-type': 'warn',
35
63
  'package-json/valid-version': 'error',
36
64
  },
37
65
  },
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import perfectionist from 'eslint-plugin-perfectionist';
2
5
 
3
6
  import {
@@ -6,7 +9,7 @@ import {
6
9
  getTypescriptFiles,
7
10
  } from '../utilities/eslint-files.js';
8
11
 
9
- /** @type {import('eslint').Linter.RulesRecord} */
12
+ /** @type {Linter.RulesRecord} */
10
13
  const commonRules = {
11
14
  'perfectionist/sort-classes': [
12
15
  'warn',
@@ -36,7 +39,7 @@ const commonRules = {
36
39
  'perfectionist/sort-objects': 0,
37
40
  };
38
41
 
39
- /** @type {import('eslint').Linter.RulesRecord} */
42
+ /** @type {Linter.RulesRecord} */
40
43
  const moduleRules = {
41
44
  'perfectionist/sort-exports': [
42
45
  'warn',
@@ -81,7 +84,7 @@ const moduleRules = {
81
84
  ],
82
85
  };
83
86
 
84
- /** @type {import('eslint').Linter.RulesRecord} */
87
+ /** @type {Linter.RulesRecord} */
85
88
  const typescriptRules = {
86
89
  'perfectionist/sort-astro-attributes': 0,
87
90
  'perfectionist/sort-enums': 0,
@@ -101,7 +104,7 @@ const typescriptRules = {
101
104
  /**
102
105
  * Get ESLint config for imports check.
103
106
  * @param {URL} root - The root of the package being linted.
104
- * @returns {Promise<import('eslint').Linter.Config[]>}
107
+ * @returns {Promise<Linter.Config[]>}
105
108
  */
106
109
  export async function createEslintPerfectionistConfig(root) {
107
110
  return [
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import promise from 'eslint-plugin-promise';
2
5
 
3
6
  /**
4
7
  * Get ESLint config for the promise plugin.
5
- * @returns {import('eslint').Linter.Config[]}
8
+ * @returns {Linter.Config[]}
6
9
  */
7
10
  export function createEslintPromiseConfig() {
8
11
  return [ {
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import { fixupPluginRules } from '@eslint/compat';
2
5
  import reactnative from 'eslint-plugin-react-native';
3
6
 
@@ -6,7 +9,7 @@ import { getPackageJson } from '../utilities/package.js';
6
9
  /**
7
10
  * Get ESLint config for imports check.
8
11
  * @param {URL} root - The root of the package being linted.
9
- * @returns {Promise<import('eslint').Linter.Config[]>}
12
+ * @returns {Promise<Linter.Config[]>}
10
13
  */
11
14
  export async function createEslintReactNativeConfig(root) {
12
15
  const packageJson = await getPackageJson(root, 'react-native');
@@ -1,7 +1,10 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import react from 'eslint-plugin-react';
2
5
 
3
6
  import { getPackageJson } from '../utilities/package.js';
4
- /** @type {import('eslint').Linter.RulesRecord} */
7
+ /** @type {Linter.RulesRecord} */
5
8
  const disabledStyle = {
6
9
  'react/jsx-child-element-spacing': 'off',
7
10
  'react/jsx-closing-bracket-location': 'off',
@@ -23,7 +26,7 @@ const disabledStyle = {
23
26
  'react/jsx-wrap-multilines': 'off',
24
27
  };
25
28
 
26
- /** @type {import('eslint').Linter.RulesRecord} */
29
+ /** @type {Linter.RulesRecord} */
27
30
  const rules = {
28
31
  ...disabledStyle,
29
32
  'react/boolean-prop-naming': 'off',
@@ -114,7 +117,7 @@ const rules = {
114
117
  /**
115
118
  * Get ESLint config for imports check.
116
119
  * @param {URL} root - The root of the package being linted.
117
- * @returns {Promise<import('eslint').Linter.Config[]>}
120
+ * @returns {Promise<Linter.Config[]>}
118
121
  */
119
122
  export async function createEslintReactConfig(root) {
120
123
  const packageJson = await getPackageJson(root, 'react');
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import regexp from 'eslint-plugin-regexp';
2
5
 
3
6
  /**
4
7
  * Get ESLint config for the regexp plugin.
5
- * @returns {import('eslint').Linter.Config[]}
8
+ * @returns {Linter.Config[]}
6
9
  */
7
10
  export function createEslintRegexpConfig() {
8
11
  return [
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import logger from '../custom-logger/index.js';
2
5
  import sca from '../custom-rules/index.js';
3
6
  import {
@@ -9,7 +12,7 @@ import {
9
12
  /**
10
13
  * Get ESLint config for the sca plugin.
11
14
  * @param {URL} root - The root url of the package we are linting.
12
- * @returns {Promise<import('eslint').Linter.Config[]>}
15
+ * @returns {Promise<Linter.Config[]>}
13
16
  */
14
17
  export async function createEslintSCAConfig(root) {
15
18
  return [
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import security from 'eslint-plugin-security';
2
5
 
3
6
  /**
4
7
  * Get ESLint config for the security plugin.
5
- * @returns {import('eslint').Linter.Config[]}
8
+ * @returns {Linter.Config[]}
6
9
  */
7
10
  export function createEslintSecurityConfig() {
8
11
  return [ {
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import stylistic from '@stylistic/eslint-plugin';
2
5
 
3
6
  /**
4
7
  * Get ESLint config for the style plugin.
5
- * @returns {import('eslint').Linter.Config[]}
8
+ * @returns {Linter.Config[]}
6
9
  */
7
10
  export function createEslintStyleConfig() {
8
11
  return [ {
@@ -41,7 +44,6 @@ export function createEslintStyleConfig() {
41
44
  'style/jsx-newline': 'off',
42
45
  'style/jsx-one-expression-per-line': 'off',
43
46
  'style/jsx-pascal-case': 'off',
44
- 'style/jsx-props-no-multi-spaces': 'off',
45
47
  'style/jsx-quotes': 'error',
46
48
  'style/jsx-self-closing-comp': 'off',
47
49
  'style/jsx-sort-props': 'off',
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import { URL } from 'node:url';
3
+ * @import { Linter } from 'eslint';
4
+ */
1
5
  import { getTypescriptFiles } from '../utilities/eslint-files.js';
2
6
  import { getPackageJson } from '../utilities/package.js';
3
7
 
@@ -12,8 +16,8 @@ function idef(target) {
12
16
 
13
17
  /**
14
18
  * Get ESLint config for the typescript plugin.
15
- * @param {import('node:url').URL} root - Root url.
16
- * @returns {Promise<import('eslint').Linter.Config[]>}
19
+ * @param {URL} root - Root url.
20
+ * @returns {Promise<Linter.Config[]>}
17
21
  */
18
22
  export async function createEslintTypescriptConfig(root) {
19
23
  const packageJson = await getPackageJson(root, 'typescript');
@@ -36,7 +40,8 @@ export async function createEslintTypescriptConfig(root) {
36
40
  },
37
41
  },
38
42
  plugins: {
39
- '@typescript-eslint': /** @type {*} */ (typescriptPlugin),
43
+ // @ts-expect-error -- I love that the ts plugin is not compatible...
44
+ '@typescript-eslint': typescriptPlugin,
40
45
  },
41
46
  rules: {
42
47
  // Rules that fight with typescript
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import unicorn from 'eslint-plugin-unicorn';
2
5
 
3
6
  import { getModuleFiles, getTypescriptFiles } from '../utilities/eslint-files.js';
@@ -5,7 +8,7 @@ import { getModuleFiles, getTypescriptFiles } from '../utilities/eslint-files.js
5
8
  /**
6
9
  * Get ESLint config for the unicorn plugin.
7
10
  * @param {URL} root - Root url.
8
- * @returns {Promise<import('eslint').Linter.Config[]>}
11
+ * @returns {Promise<Linter.Config[]>}
9
12
  */
10
13
  export async function createEslintUnicornConfig(root) {
11
14
  return [
@@ -26,6 +29,8 @@ export async function createEslintUnicornConfig(root) {
26
29
  rules: {
27
30
  'unicorn/better-regex': 'off',
28
31
  'unicorn/catch-error-name': 'error',
32
+ 'unicorn/consistent-assert': 'off',
33
+ 'unicorn/consistent-date-clone': 'error',
29
34
  'unicorn/consistent-destructuring': 'off',
30
35
  'unicorn/consistent-empty-array-spread': 'error',
31
36
  'unicorn/consistent-existence-index-check': 'warn',
@@ -40,12 +45,14 @@ export async function createEslintUnicornConfig(root) {
40
45
  'unicorn/import-style': 'off',
41
46
  'unicorn/new-for-builtins': 'warn',
42
47
  'unicorn/no-abusive-eslint-disable': 'warn',
48
+ 'unicorn/no-accessor-recursion': 'warn',
43
49
  'unicorn/no-anonymous-default-export': 'warn',
44
50
  'unicorn/no-array-callback-reference': 'off',
45
51
  'unicorn/no-array-for-each': 'error',
46
52
  'unicorn/no-array-method-this-argument': 'error',
47
- 'unicorn/no-array-push-push': 'warn',
48
53
  'unicorn/no-array-reduce': 'error',
54
+ 'unicorn/no-array-reverse': 'warn',
55
+ 'unicorn/no-array-sort': 'warn',
49
56
  'unicorn/no-await-expression-member': 'off',
50
57
  'unicorn/no-await-in-promise-methods': 'warn',
51
58
  'unicorn/no-console-spaces': 'error',
@@ -53,13 +60,13 @@ export async function createEslintUnicornConfig(root) {
53
60
  'unicorn/no-empty-file': 'warn',
54
61
  'unicorn/no-for-loop': 'warn',
55
62
  'unicorn/no-hex-escape': 'warn',
56
- 'unicorn/no-instanceof-array': 'off',
63
+ 'unicorn/no-instanceof-builtins': 'off',
57
64
  'unicorn/no-invalid-fetch-options': 'off',
58
65
  'unicorn/no-invalid-remove-event-listener': 'error',
59
66
  'unicorn/no-keyword-prefix': [ 'warn', { checkProperties: false } ],
60
- 'unicorn/no-length-as-slice-end': 'warn',
61
67
  'unicorn/no-lonely-if': 'warn',
62
68
  'unicorn/no-magic-array-flat-depth': 'off', // Breaks typescript
69
+ 'unicorn/no-named-default': 'error',
63
70
  'unicorn/no-negated-condition': 'error',
64
71
  'unicorn/no-negation-in-equality-check': 'warn',
65
72
  'unicorn/no-nested-ternary': 'warn',
@@ -73,11 +80,15 @@ export async function createEslintUnicornConfig(root) {
73
80
  'unicorn/no-thenable': 'off',
74
81
  'unicorn/no-this-assignment': 'warn',
75
82
  'unicorn/no-typeof-undefined': 'off',
83
+ 'unicorn/no-unnecessary-array-flat-depth': 'warn',
84
+ 'unicorn/no-unnecessary-array-splice-count': 'warn',
76
85
  'unicorn/no-unnecessary-await': 'error',
77
86
  'unicorn/no-unnecessary-polyfills': 'off',
87
+ 'unicorn/no-unnecessary-slice-end': 'warn',
78
88
  'unicorn/no-unreadable-array-destructuring': 'error',
79
89
  'unicorn/no-unreadable-iife': 'off',
80
90
  'unicorn/no-unused-properties': 'off',
91
+ 'unicorn/no-useless-error-capture-stack-trace': 'warn',
81
92
  'unicorn/no-useless-fallback-in-spread': 'warn',
82
93
  'unicorn/no-useless-length-check': 'error',
83
94
  'unicorn/no-useless-promise-resolve-reject': 'error',
@@ -94,7 +105,10 @@ export async function createEslintUnicornConfig(root) {
94
105
  'unicorn/prefer-array-index-of': 'error',
95
106
  'unicorn/prefer-array-some': 'error',
96
107
  'unicorn/prefer-at': 'error',
108
+ 'unicorn/prefer-bigint-literals': 'error',
97
109
  'unicorn/prefer-blob-reading-methods': 'error',
110
+ 'unicorn/prefer-class-fields': 'warn',
111
+ 'unicorn/prefer-classlist-toggle': 'off',
98
112
  'unicorn/prefer-code-point': 'error',
99
113
  'unicorn/prefer-date-now': 'error',
100
114
  'unicorn/prefer-default-parameters': 'error',
@@ -105,6 +119,7 @@ export async function createEslintUnicornConfig(root) {
105
119
  'unicorn/prefer-event-target': 'warn',
106
120
  'unicorn/prefer-export-from': 'warn',
107
121
  'unicorn/prefer-global-this': 'warn',
122
+ 'unicorn/prefer-import-meta-properties': 'warn',
108
123
  'unicorn/prefer-includes': 'error',
109
124
  'unicorn/prefer-json-parse-buffer': 'error',
110
125
  'unicorn/prefer-keyboard-event-key': 'error',
@@ -125,6 +140,7 @@ export async function createEslintUnicornConfig(root) {
125
140
  'unicorn/prefer-regexp-test': 'warn',
126
141
  'unicorn/prefer-set-has': 'warn',
127
142
  'unicorn/prefer-set-size': 'error',
143
+ 'unicorn/prefer-single-call': 'warn',
128
144
  'unicorn/prefer-spread': 'error',
129
145
  'unicorn/prefer-string-raw': 'warn',
130
146
  'unicorn/prefer-string-replace-all': 'error',
@@ -138,6 +154,8 @@ export async function createEslintUnicornConfig(root) {
138
154
  'unicorn/prevent-abbreviations': 'off',
139
155
  'unicorn/relative-url-style': 'error',
140
156
  'unicorn/require-array-join-separator': 'error',
157
+ 'unicorn/require-module-attributes': 'warn',
158
+ 'unicorn/require-module-specifiers': 'warn',
141
159
  'unicorn/require-number-to-fixed-digits-argument': 'error',
142
160
  'unicorn/require-post-message-target-origin': 'error',
143
161
  'unicorn/string-content': 'off',
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import { URL } from 'node:url';
3
+ * @import { Linter } from 'eslint';
4
+ */
1
5
  import unused from 'eslint-plugin-unused-imports';
2
6
 
3
7
  import { unusedConfig } from '../configs/eslint-recommended.js';
@@ -8,8 +12,8 @@ import {
8
12
 
9
13
  /**
10
14
  * Get ESLint config for the unused import plugin.
11
- * @param {import('node:url').URL} root - Root url.
12
- * @returns {Promise<import('eslint').Linter.Config[]>}
15
+ * @param {URL} root - Root url.
16
+ * @returns {Promise<Linter.Config[]>}
13
17
  */
14
18
  export async function createEslintUnusedImportsConfig(root) {
15
19
  return [
@@ -1,9 +1,12 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  import yml from 'eslint-plugin-yml';
2
5
  import parser from 'yaml-eslint-parser';
3
6
 
4
7
  /**
5
8
  * Get ESLint config for yml check.
6
- * @returns {Promise<import('eslint').Linter.Config[]>}
9
+ * @returns {Promise<Linter.Config[]>}
7
10
  */
8
11
  export async function createEslintYmlConfig() {
9
12
  return [
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import { SectionBody } from 'editorconfig';
3
+ * @import { Linter } from 'eslint';
4
+ */
1
5
  import { readFile } from 'node:fs/promises';
2
6
  import { resolve } from 'node:path';
3
7
  import { fileURLToPath } from 'node:url';
@@ -18,12 +22,12 @@ import { findUp } from './filesystem.js';
18
22
  */
19
23
 
20
24
  /**
21
- * @param {import('editorconfig').SectionBody} input - Raw editor config converted into an object.
25
+ * @param {SectionBody} input - Raw editor config converted into an object.
22
26
  * @param {RuleSet} RULES - The rules used to create eslint rules options.
23
- * @returns {import('eslint').Linter.RulesRecord}
27
+ * @returns {Linter.RulesRecord}
24
28
  */
25
29
  function convert(input, RULES) {
26
- /** @type {import('eslint').Linter.RulesRecord} */
30
+ /** @type {Linter.RulesRecord} */
27
31
  const output = {};
28
32
 
29
33
  if (input?.end_of_line === 'lf') {
@@ -152,8 +156,8 @@ function equal(one, two) {
152
156
  }
153
157
 
154
158
  /**
155
- * @param {import('eslint').Linter.Config[]} configs - [description].
156
- * @param {import('eslint').Linter.Config} config - [description].
159
+ * @param {Linter.Config[]} configs - The current configs.
160
+ * @param {Linter.Config} config - The latest and greatest config.
157
161
  */
158
162
  function addOrMergeConfig(configs, config) {
159
163
  for (const previous of configs) {
@@ -173,8 +177,8 @@ function addOrMergeConfig(configs, config) {
173
177
  }
174
178
 
175
179
  /**
176
- * @param {import('node:url').URL} root - Root url.
177
- * @returns {Promise<import('eslint').Linter.Config[]>}
180
+ * @param {URL} root - Root url.
181
+ * @returns {Promise<Linter.Config[]>}
178
182
  */
179
183
  export async function createEditorOverrides(root) {
180
184
  const eslintConfigPath = resolve(fileURLToPath(root), 'eslint.config.js');
@@ -185,7 +189,7 @@ export async function createEditorOverrides(root) {
185
189
 
186
190
  const editorconfig = parseBuffer(await readFile(path));
187
191
 
188
- /** @type {import('eslint').Linter.Config[]} */
192
+ /** @type {Linter.Config[]} */
189
193
  const configs = [];
190
194
  for (const [ name, body ] of editorconfig) {
191
195
  if (name === null) {
@@ -1,10 +1,14 @@
1
+ /**
2
+ * @import { URL } from 'node:url';
3
+ */
4
+
1
5
  import { expandGlob } from './expand-glob.js';
2
6
  import { getPackageJson } from './package.js';
3
7
 
4
8
  /**
5
- * @param {string[]} files - [description].
6
- * @param {string} type - [description].
7
- * @param {string} target - [description].
9
+ * @param {string[]} files - An array of globsp.
10
+ * @param {'commonjs'|'module'} type - The package.json#type.
11
+ * @param {'commonjs'|'module'} target - The type we are serving.
8
12
  * @returns {string[]}
9
13
  */
10
14
  function getFiles(files, type, target) {
@@ -17,7 +21,7 @@ function getFiles(files, type, target) {
17
21
 
18
22
  /**
19
23
  * Get a list of globs for common js files.
20
- * @param {import('node:url').URL} root - Root url.
24
+ * @param {URL} root - Root url.
21
25
  * @returns {Promise<string[]>}
22
26
  */
23
27
  export async function getCommonFiles(root) {
@@ -28,7 +32,7 @@ export async function getCommonFiles(root) {
28
32
 
29
33
  /**
30
34
  * Get a list of globs for module files.
31
- * @param {import('node:url').URL} root - Root url.
35
+ * @param {URL} root - Root url.
32
36
  * @returns {Promise<string[]>}
33
37
  */
34
38
  export async function getModuleFiles(root) {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @import { URL } from 'node:url';
3
+ * @import { PackageJson } from 'type-fest';
4
+ */
1
5
  import { readFile } from 'node:fs/promises';
2
6
  import { resolve } from 'node:path';
3
7
  import { fileURLToPath } from 'node:url';
@@ -24,9 +28,9 @@ async function modulePaths(rootPath, packageName) {
24
28
 
25
29
  /**
26
30
  * Get the path of the eslint package json.
27
- * @param {import('node:url').URL} rootUrl - The root url of the module.
31
+ * @param {URL} rootUrl - The root url of the module.
28
32
  * @param {string} [packageName] - The name of the npm package.
29
- * @returns {Promise<import('type-fest').PackageJson | null>}
33
+ * @returns {Promise<PackageJson | null>}
30
34
  */
31
35
  export async function getPackageJson(rootUrl, packageName) {
32
36
  const root = fileURLToPath(rootUrl);
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Get the ESLint base config.
3
- * @returns {Promise<import('eslint').Linter.Config[]>}
3
+ * @returns {Promise<Linter.Config[]>}
4
4
  */
5
- export function createEslintBaseConfig(): Promise<import("eslint").Linter.Config[]>;
5
+ export function createEslintBaseConfig(): Promise<Linter.Config[]>;
6
+ import type { Linter } from 'eslint';
@@ -1,5 +1,9 @@
1
+ /**
2
+ * @import { Linter } from 'eslint';
3
+ */
1
4
  /**
2
5
  * Get the ESLint config for complexity checks.
3
- * @returns {import('eslint').Linter.Config[]}
6
+ * @returns {Linter.Config[]}
4
7
  */
5
- export function createEslintComplexityConfig(): import("eslint").Linter.Config[];
8
+ export function createEslintComplexityConfig(): Linter.Config[];
9
+ import type { Linter } from 'eslint';
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Get basic ESLint ignores config.
3
- * @param {import('node:url').URL} root - Root url.
4
- * @returns {Promise<import('eslint').Linter.Config[]>}
3
+ * @param {URL} root - Root url.
4
+ * @returns {Promise<Linter.Config[]>}
5
5
  */
6
- export function createEslintIgnoresConfig(root: import("node:url").URL): Promise<import("eslint").Linter.Config[]>;
6
+ export function createEslintIgnoresConfig(root: URL): Promise<Linter.Config[]>;
7
+ import type { URL } from 'node:url';
8
+ import type { Linter } from 'eslint';