@the-stranger/eslint-plugin 2.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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/package.json +100 -0
  4. package/src/index.d.ts +3 -0
  5. package/src/index.d.ts.map +1 -0
  6. package/src/index.js +2 -0
  7. package/src/lib/configs/index.d.ts +17 -0
  8. package/src/lib/configs/index.d.ts.map +1 -0
  9. package/src/lib/configs/index.js +26 -0
  10. package/src/lib/configs/jest.d.ts +4 -0
  11. package/src/lib/configs/jest.d.ts.map +1 -0
  12. package/src/lib/configs/jest.js +27 -0
  13. package/src/lib/configs/jsdoc.d.ts +5 -0
  14. package/src/lib/configs/jsdoc.d.ts.map +1 -0
  15. package/src/lib/configs/jsdoc.js +44 -0
  16. package/src/lib/configs/jsonc.d.ts +4 -0
  17. package/src/lib/configs/jsonc.d.ts.map +1 -0
  18. package/src/lib/configs/jsonc.js +128 -0
  19. package/src/lib/configs/n.d.ts +4 -0
  20. package/src/lib/configs/n.d.ts.map +1 -0
  21. package/src/lib/configs/n.js +24 -0
  22. package/src/lib/configs/nx.d.ts +6 -0
  23. package/src/lib/configs/nx.d.ts.map +1 -0
  24. package/src/lib/configs/nx.js +45 -0
  25. package/src/lib/configs/perfectionist.d.ts +4 -0
  26. package/src/lib/configs/perfectionist.d.ts.map +1 -0
  27. package/src/lib/configs/perfectionist.js +129 -0
  28. package/src/lib/configs/promise.d.ts +4 -0
  29. package/src/lib/configs/promise.d.ts.map +1 -0
  30. package/src/lib/configs/promise.js +16 -0
  31. package/src/lib/configs/regexp.d.ts +4 -0
  32. package/src/lib/configs/regexp.d.ts.map +1 -0
  33. package/src/lib/configs/regexp.js +5 -0
  34. package/src/lib/configs/toml.d.ts +4 -0
  35. package/src/lib/configs/toml.d.ts.map +1 -0
  36. package/src/lib/configs/toml.js +35 -0
  37. package/src/lib/configs/typescript-eslint.d.ts +4 -0
  38. package/src/lib/configs/typescript-eslint.d.ts.map +1 -0
  39. package/src/lib/configs/typescript-eslint.js +26 -0
  40. package/src/lib/configs/unicorn.d.ts +4 -0
  41. package/src/lib/configs/unicorn.d.ts.map +1 -0
  42. package/src/lib/configs/unicorn.js +66 -0
  43. package/src/lib/configs/vitest.d.ts +4 -0
  44. package/src/lib/configs/vitest.d.ts.map +1 -0
  45. package/src/lib/configs/vitest.js +15 -0
  46. package/src/lib/configs/yml.d.ts +4 -0
  47. package/src/lib/configs/yml.d.ts.map +1 -0
  48. package/src/lib/configs/yml.js +127 -0
  49. package/src/lib/extend-config.d.ts +3 -0
  50. package/src/lib/extend-config.d.ts.map +1 -0
  51. package/src/lib/extend-config.js +22 -0
  52. package/src/lib/meta.d.ts +3 -0
  53. package/src/lib/meta.d.ts.map +1 -0
  54. package/src/lib/meta.js +3 -0
  55. package/src/lib/namer.d.ts +24 -0
  56. package/src/lib/namer.d.ts.map +1 -0
  57. package/src/lib/namer.js +36 -0
  58. package/src/lib/patterns.d.ts +82 -0
  59. package/src/lib/patterns.d.ts.map +1 -0
  60. package/src/lib/patterns.js +147 -0
  61. package/src/lib/rule-levels.d.ts +43 -0
  62. package/src/lib/rule-levels.d.ts.map +1 -0
  63. package/src/lib/rule-levels.js +71 -0
  64. package/src/lib/severity.d.ts +13 -0
  65. package/src/lib/severity.d.ts.map +1 -0
  66. package/src/lib/severity.js +34 -0
  67. package/src/utils.d.ts +4 -0
  68. package/src/utils.d.ts.map +1 -0
  69. package/src/utils.js +3 -0
@@ -0,0 +1,129 @@
1
+ import perfectionist from 'eslint-plugin-perfectionist';
2
+ import { namer, objectNamer } from '../namer.js';
3
+ import { FilePatterns, getFilePatterns } from '../patterns.js';
4
+ import { setRuleLevel } from '../severity.js';
5
+ const configNatural = setRuleLevel('warn', perfectionist.configs['recommended-natural']);
6
+ export default [
7
+ objectNamer(configNatural, 'perfectionist-recommended-natural'),
8
+ {
9
+ files: getFilePatterns(FilePatterns.source),
10
+ name: namer('perfectionist'),
11
+ rules: {
12
+ 'perfectionist/sort-classes': [
13
+ 'warn',
14
+ {
15
+ groups: [
16
+ 'constructor',
17
+ 'index-signature',
18
+ 'static-block',
19
+ 'accessor-property',
20
+ ['get-method', 'set-method'],
21
+ 'method',
22
+ 'override-method',
23
+ 'static-method',
24
+ 'protected-method',
25
+ 'private-method',
26
+ 'protected-accessor-property',
27
+ 'private-accessor-property',
28
+ ['private-get-method', 'private-set-method'],
29
+ ],
30
+ },
31
+ ],
32
+ 'perfectionist/sort-enums': [
33
+ 'warn',
34
+ {
35
+ forceNumericSort: true,
36
+ },
37
+ ],
38
+ 'perfectionist/sort-exports': [
39
+ 'warn',
40
+ {
41
+ type: 'natural',
42
+ },
43
+ ],
44
+ 'perfectionist/sort-imports': [
45
+ 'warn',
46
+ {
47
+ groups: [
48
+ ['side-effect', 'side-effect-style'],
49
+ 'builtin',
50
+ 'external',
51
+ 'type',
52
+ 'internal-type',
53
+ 'internal',
54
+ ['parent-type', 'sibling-type', 'index-type'],
55
+ ['parent', 'sibling', 'index'],
56
+ 'object',
57
+ 'unknown',
58
+ ],
59
+ newlinesBetween: 'always',
60
+ type: 'natural',
61
+ },
62
+ ],
63
+ 'perfectionist/sort-interfaces': 'off',
64
+ 'perfectionist/sort-modules': [
65
+ 'warn',
66
+ {
67
+ groups: [
68
+ 'unknown',
69
+ 'export-class',
70
+ 'export-function',
71
+ 'export-enum',
72
+ ['export-interface', 'export-type'],
73
+ 'class',
74
+ 'function',
75
+ 'enum',
76
+ ['interface', 'type'],
77
+ [
78
+ 'export-default-class',
79
+ 'export-default-function',
80
+ 'export-default-enum',
81
+ 'export-default-type',
82
+ 'export-default-interface',
83
+ ],
84
+ ],
85
+ },
86
+ ],
87
+ 'perfectionist/sort-named-exports': [
88
+ 'warn',
89
+ {
90
+ groupKind: 'values-first',
91
+ type: 'natural',
92
+ },
93
+ ],
94
+ 'perfectionist/sort-named-imports': [
95
+ 'warn',
96
+ {
97
+ type: 'natural',
98
+ },
99
+ ],
100
+ 'perfectionist/sort-union-types': [
101
+ 'warn',
102
+ {
103
+ groups: [
104
+ 'conditional',
105
+ 'function',
106
+ 'operator',
107
+ 'literal',
108
+ 'keyword',
109
+ 'named',
110
+ 'import',
111
+ 'tuple',
112
+ 'object',
113
+ ['intersection', 'union'],
114
+ 'nullish',
115
+ 'unknown',
116
+ ],
117
+ ignoreCase: false,
118
+ },
119
+ ],
120
+ },
121
+ },
122
+ {
123
+ files: ['eslint.config.*', 'prettier.config.*', 'yarn.config.cjs'],
124
+ name: namer('disable sort for configuration files'),
125
+ rules: {
126
+ 'perfectionist/sort-objects': 'off',
127
+ },
128
+ },
129
+ ];
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/promise.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAkB/B,MAAM,CAAC,MAAM,EAAE;AAbpB,wBAaoB"}
@@ -0,0 +1,16 @@
1
+ import promise from 'eslint-plugin-promise';
2
+ import { namer } from '../namer.js';
3
+ import { FilePatterns, getFilePatterns } from '../patterns.js';
4
+ export default [
5
+ promise.configs['flat/recommended'],
6
+ {
7
+ files: getFilePatterns(FilePatterns.source),
8
+ name: namer('promise'),
9
+ rules: {
10
+ 'promise/no-multiple-resolved': 'warn',
11
+ 'promise/prefer-await-to-callbacks': 'warn',
12
+ 'promise/prefer-await-to-then': 'warn',
13
+ 'promise/spec-only': 'error',
14
+ },
15
+ },
16
+ ];
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=regexp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/regexp.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAM/B,MAAM,CAAC,MAAM,EAAE;AAFpB,wBAEoB"}
@@ -0,0 +1,5 @@
1
+ import re from 'eslint-plugin-regexp';
2
+ import { objectNamer } from '../namer.js';
3
+ export default [
4
+ objectNamer(re.configs['flat/recommended'], 're-recommended'),
5
+ ];
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=toml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/toml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAqC/B,MAAM,CAAC,MAAM,EAAE;AAjCpB,wBAiCoB"}
@@ -0,0 +1,35 @@
1
+ import toml from 'eslint-plugin-toml';
2
+ import { namer } from '../namer.js';
3
+ export default [
4
+ toml.configs['flat/recommended'],
5
+ {
6
+ files: ['**/*.toml'],
7
+ name: namer('toml'),
8
+ rules: {
9
+ 'toml/array-bracket-newline': ['warn', 'consistent'],
10
+ 'toml/array-bracket-spacing': [
11
+ 'warn',
12
+ 'always',
13
+ {
14
+ arraysInArrays: false,
15
+ objectsInArrays: false,
16
+ singleValue: true,
17
+ },
18
+ ],
19
+ 'toml/array-element-newline': ['warn', 'consistent'],
20
+ 'toml/comma-style': 'warn',
21
+ 'toml/indent': ['warn', 2],
22
+ 'toml/inline-table-curly-spacing': 'warn',
23
+ 'toml/key-spacing': [
24
+ 'warn',
25
+ { afterEqual: true, beforeEqual: true, mode: 'strict' },
26
+ ],
27
+ 'toml/no-space-dots': 'warn',
28
+ 'toml/no-unreadable-number-separator': 'warn',
29
+ 'toml/precision-of-fractional-seconds': ['warn', { max: 3 }],
30
+ 'toml/precision-of-integer': ['warn', { maxBit: 64 }],
31
+ 'toml/spaced-comment': 'warn',
32
+ 'toml/table-bracket-spacing': 'warn',
33
+ },
34
+ },
35
+ ];
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const config: Linter.Config[];
3
+ export default config;
4
+ //# sourceMappingURL=typescript-eslint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-eslint.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/typescript-eslint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAgB1B,CAAA;AAQD,eAAe,MAAM,CAAA"}
@@ -0,0 +1,26 @@
1
+ import tseslint from 'typescript-eslint';
2
+ import { namer } from '../namer.js';
3
+ import { FilePatterns, getFilePatterns } from '../patterns.js';
4
+ const config = [
5
+ {
6
+ files: getFilePatterns(FilePatterns.source),
7
+ name: namer('unnecessary ts rules'),
8
+ rules: {
9
+ // I do what I want ¯\_(ツ)_/¯
10
+ '@typescript-eslint/no-explicit-any': 'off',
11
+ '@typescript-eslint/no-unused-vars': 'warn',
12
+ },
13
+ },
14
+ {
15
+ files: getFilePatterns(FilePatterns.test),
16
+ name: namer('disable no-non-null in tests'),
17
+ rules: { '@typescript-eslint/no-non-null-assertion': 'off' },
18
+ },
19
+ ];
20
+ try {
21
+ await import('@nx/eslint-plugin');
22
+ }
23
+ catch {
24
+ config.unshift(...tseslint.configs.recommended);
25
+ }
26
+ export default config;
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=unicorn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/unicorn.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAgF/B,MAAM,CAAC,MAAM,EAAE;AA3EpB,wBA2EoB"}
@@ -0,0 +1,66 @@
1
+ import unicorn from 'eslint-plugin-unicorn';
2
+ import { defineConfig } from 'eslint/config';
3
+ import { namer } from '../namer.js';
4
+ import { FilePatterns, getFilePatterns } from '../patterns.js';
5
+ export default defineConfig(unicorn.configs['recommended'], {
6
+ files: ['**/*'],
7
+ name: namer('unicorn/allow abbreviations'),
8
+ rules: {
9
+ 'unicorn/prevent-abbreviations': 'off',
10
+ },
11
+ }, {
12
+ files: [getFilePatterns(FilePatterns.source)],
13
+ name: namer('unicorn/base'),
14
+ rules: {
15
+ 'unicorn/custom-error-definition': 'warn',
16
+ 'unicorn/import-style': 'off',
17
+ 'unicorn/no-array-callback-reference': 'off',
18
+ 'unicorn/no-array-reduce': 'off',
19
+ 'unicorn/no-array-reverse': 'off',
20
+ 'unicorn/no-array-sort': 'off',
21
+ 'unicorn/no-keyword-prefix': 'error',
22
+ 'unicorn/no-useless-undefined': ['error', { checkArrowFunctionBody: false }],
23
+ 'unicorn/numeric-separators-style': ['warn', { number: { minimumDigits: 12 } }],
24
+ 'unicorn/prefer-import-meta-properties': 'warn',
25
+ 'unicorn/prefer-math-trunc': 'off',
26
+ 'unicorn/prefer-node-protocol': 'off',
27
+ },
28
+ }, {
29
+ files: getFilePatterns(FilePatterns.cjs),
30
+ name: namer("unicorn/CJS files don't have to be modules"),
31
+ rules: {
32
+ 'unicorn/prefer-module': 'off',
33
+ },
34
+ }, {
35
+ files: getFilePatterns(FilePatterns.react, FilePatterns.astro),
36
+ name: namer('unicorn/allow pascal case for react files'),
37
+ rules: {
38
+ 'unicorn/filename-case': [
39
+ 'error',
40
+ {
41
+ cases: {
42
+ kebabCase: true,
43
+ pascalCase: true,
44
+ },
45
+ },
46
+ ],
47
+ },
48
+ }, {
49
+ files: getFilePatterns(FilePatterns.test),
50
+ name: namer('unicorn/test files'),
51
+ rules: {
52
+ 'unicorn/consistent-function-scoping': 'off',
53
+ 'unicorn/no-nested-ternary': 'off',
54
+ 'unicorn/no-null': 'off',
55
+ 'unicorn/no-useless-undefined': [
56
+ 'error',
57
+ { checkArguments: false, checkArrowFunctionBody: false },
58
+ ],
59
+ },
60
+ }, {
61
+ files: getFilePatterns(FilePatterns.astroScript),
62
+ name: 'ignore filename case for virtual files',
63
+ rules: {
64
+ 'unicorn/filename-case': 'off',
65
+ },
66
+ });
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/vitest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAiB/B,MAAM,CAAC,MAAM,EAAE;AAZpB,wBAYoB"}
@@ -0,0 +1,15 @@
1
+ import vitest from '@vitest/eslint-plugin';
2
+ import { namer } from '../namer.js';
3
+ import { FilePatterns, getFilePatterns } from '../patterns.js';
4
+ export default [
5
+ vitest.configs['recommended'],
6
+ {
7
+ files: getFilePatterns(FilePatterns.test),
8
+ name: namer('vitest'),
9
+ rules: {
10
+ 'vitest/consistent-test-it': ['error', { fn: 'it' }],
11
+ 'vitest/prefer-hooks-in-order': 'warn',
12
+ 'vitest/valid-title': ['warn', { disallowedWords: ['should'] }],
13
+ },
14
+ },
15
+ ];
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: Linter.Config[];
3
+ export default _default;
4
+ //# sourceMappingURL=yml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yml.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/yml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAwI/B,MAAM,CAAC,MAAM,EAAE;AAtGpB,wBAsGoB"}
@@ -0,0 +1,127 @@
1
+ import yml from 'eslint-plugin-yml';
2
+ import { namer } from '../namer.js';
3
+ const topLevelKeyOrder = [
4
+ 'name',
5
+ 'on',
6
+ 'permissions',
7
+ 'env',
8
+ 'defaults',
9
+ 'concurrency',
10
+ 'jobs',
11
+ ];
12
+ const jobKeyOrder = [
13
+ 'strategy',
14
+ 'name',
15
+ 'if',
16
+ 'needs',
17
+ 'runs-on',
18
+ 'permissions',
19
+ 'environment',
20
+ 'env',
21
+ 'concurrency',
22
+ 'timeout-minutes',
23
+ 'outputs',
24
+ 'defaults',
25
+ 'steps',
26
+ ];
27
+ const stepKeyOrder = ['id', 'name', 'if', 'run', 'uses', 'with', 'env'];
28
+ const topLevelAscKeys = ['on', 'permissions', 'defaults'].join('|');
29
+ export default [
30
+ yml.configs['flat/standard'],
31
+ {
32
+ files: ['cspell.config.yaml', '**/cspell.config.yaml'],
33
+ name: namer('cspell-config'),
34
+ rules: {
35
+ 'yml/sort-keys': [
36
+ 'error',
37
+ {
38
+ order: [
39
+ 'version',
40
+ 'language',
41
+ 'import',
42
+ 'ignorePaths',
43
+ 'dictionaries',
44
+ 'ignoreWords',
45
+ 'words',
46
+ 'languageSettings',
47
+ { order: { type: 'asc' } },
48
+ ],
49
+ pathPattern: '^$',
50
+ },
51
+ {
52
+ order: ['languageId', 'dictionaries', { order: { type: 'asc' } }],
53
+ pathPattern: 'languageSettings$',
54
+ },
55
+ ],
56
+ 'yml/sort-sequence-values': [
57
+ 'error',
58
+ {
59
+ order: { type: 'asc' },
60
+ pathPattern: 'dictionaries|import|ignorePaths|ignoreWords|words$',
61
+ },
62
+ ],
63
+ },
64
+ },
65
+ {
66
+ files: ['.github/workflows/*.yml'],
67
+ name: namer('github-actions'),
68
+ rules: {
69
+ 'yml/no-empty-mapping-values': 'off',
70
+ 'yml/sort-keys': [
71
+ 'error',
72
+ {
73
+ order: [topLevelKeyOrder, { order: { type: 'asc' } }],
74
+ pathPattern: '^$',
75
+ },
76
+ {
77
+ order: { type: 'asc' },
78
+ pathPattern: `^${topLevelAscKeys}`,
79
+ },
80
+ {
81
+ order: [stepKeyOrder, { order: { type: 'asc' } }],
82
+ pathPattern: String.raw `^jobs\..+steps`,
83
+ },
84
+ {
85
+ order: [jobKeyOrder, { order: { type: 'asc' } }],
86
+ pathPattern: '^jobs',
87
+ },
88
+ ],
89
+ 'yml/sort-sequence-values': [
90
+ 'error',
91
+ {
92
+ order: { type: 'asc' },
93
+ pathPattern: `^${topLevelAscKeys}`,
94
+ },
95
+ ],
96
+ },
97
+ },
98
+ {
99
+ files: ['.markdownlint-cli2.yaml'],
100
+ name: namer('markdownlint-config'),
101
+ rules: {
102
+ 'yml/sort-keys': [
103
+ 'error',
104
+ { order: ['ignores', { order: { type: 'asc' } }], pathPattern: '^$' },
105
+ { order: { type: 'asc' }, pathPattern: '^configs' },
106
+ ],
107
+ 'yml/sort-sequence-values': [
108
+ 'error',
109
+ { order: { type: 'asc' }, pathPattern: '^ignores' },
110
+ ],
111
+ },
112
+ },
113
+ {
114
+ files: ['.yarnrc.yml'],
115
+ name: namer('yarnrc'),
116
+ rules: {
117
+ 'yml/sort-keys': ['error', { order: { type: 'asc' }, pathPattern: '^$' }],
118
+ 'yml/sort-sequence-values': [
119
+ 'error',
120
+ {
121
+ order: ['.env?', { order: { type: 'asc' } }],
122
+ pathPattern: '^injectEnvironmentFiles',
123
+ },
124
+ ],
125
+ },
126
+ },
127
+ ];
@@ -0,0 +1,3 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function extendConfig(...configs: (Linter.Config | Linter.Config[])[]): Linter.Config[];
3
+ //# sourceMappingURL=extend-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extend-config.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint-plugin/src/lib/extend-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,GAqBpC,MAAM,CAAC,MAAM,EAAE,CACtD"}
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ export function extendConfig(...configs) {
3
+ const base = [
4
+ {
5
+ ignores: [
6
+ '.cache',
7
+ '.github',
8
+ '.nx',
9
+ '.pnp.*',
10
+ '.yarn',
11
+ 'coverage',
12
+ 'dist',
13
+ 'node_modules',
14
+ 'pnpm-lock.yaml',
15
+ 'pnpm-workspace.yaml',
16
+ 'tmp',
17
+ ],
18
+ },
19
+ { linterOptions: { reportUnusedDisableDirectives: 'error' } },
20
+ ];
21
+ return defineConfig(configs, base);
22
+ }
@@ -0,0 +1,3 @@
1
+ import type { ESLint } from 'eslint';
2
+ export declare const meta: ESLint.Plugin['meta'];
3
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint-plugin/src/lib/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAqB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import pkg from '../../package.json' with { type: 'json' };
2
+ const { name, version } = pkg;
3
+ export const meta = { name, version };
@@ -0,0 +1,24 @@
1
+ import type { Linter } from 'eslint';
2
+ /**
3
+ * Prepend the workspace's namespace or full name to a string. Useful for naming eslint configuration objects.
4
+ * @param value the value to add to the name
5
+ * @returns prefixed value
6
+ */
7
+ export declare function namer(value?: string): string;
8
+ /**
9
+ * Set the `name` property of an ESLint config.
10
+ * @param config the object
11
+ * @param defaultName override the default behavior of this function
12
+ * @returns the named config(s)
13
+ */
14
+ export declare function objectNamer(config: Config, defaultName?: string): Named<Config>;
15
+ /**
16
+ * Make the name property of an object required. Preserves JSDoc comments for objects that already have a name property.
17
+ */
18
+ export type Named<T extends object> = Required<T extends N ? Pick<T, 'name'> : N> & T;
19
+ type Config = Linter.Config;
20
+ type N = {
21
+ name?: string;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=namer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namer.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint-plugin/src/lib/namer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAIpC;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,UAMnC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAa/E;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,IAAI,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAErF,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;AAE3B,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -0,0 +1,36 @@
1
+ import pkg from '../../package.json' with { type: 'json' };
2
+ /**
3
+ * Prepend the workspace's namespace or full name to a string. Useful for naming eslint configuration objects.
4
+ * @param value the value to add to the name
5
+ * @returns prefixed value
6
+ */
7
+ export function namer(value) {
8
+ const ws = /@[a-z-]+\/.+/i.exec(pkg.name)?.[0] ?? pkg.name;
9
+ if (value) {
10
+ return value.startsWith(ws) ? value : `${ws}/${value}`;
11
+ }
12
+ return ws;
13
+ }
14
+ /**
15
+ * Set the `name` property of an ESLint config.
16
+ * @param config the object
17
+ * @param defaultName override the default behavior of this function
18
+ * @returns the named config(s)
19
+ */
20
+ export function objectNamer(config, defaultName) {
21
+ if (defaultName) {
22
+ return { ...config, name: defaultName };
23
+ }
24
+ else if (config.name) {
25
+ return config;
26
+ }
27
+ else if (config.plugins) {
28
+ const plugins = Object.keys(config.plugins);
29
+ return { ...config, name: namer(plugins[0]) };
30
+ }
31
+ else {
32
+ const rules = Object.keys(config.rules ?? {}).map(e => e.split('/')[0]);
33
+ const name = [...new Set(rules)].join('/');
34
+ return { ...config, name };
35
+ }
36
+ }