@the-stranger/eslint-plugin 2.0.2 → 2.1.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 (79) hide show
  1. package/README.md +41 -29
  2. package/package.json +26 -72
  3. package/src/index.d.ts +1 -2
  4. package/src/index.js +1 -1
  5. package/src/lib/configs.d.ts +19 -0
  6. package/src/lib/configs.js +65 -0
  7. package/src/lib/disable-type-checked.d.ts +4 -0
  8. package/src/lib/disable-type-checked.js +8 -0
  9. package/src/lib/meta.d.ts +0 -1
  10. package/src/lib/namer.d.ts +3 -1
  11. package/src/lib/namer.js +2 -0
  12. package/src/lib/utils/get-module-root.d.ts +11 -0
  13. package/src/lib/utils/get-module-root.js +31 -0
  14. package/src/lib/utils/optional-import-resolver.d.ts +76 -0
  15. package/src/lib/utils/optional-import-resolver.js +168 -0
  16. package/src/lib/utils/optional-import.d.ts +47 -0
  17. package/src/lib/utils/optional-import.js +142 -0
  18. package/src/lib/utils/options.d.ts +3 -0
  19. package/src/lib/utils/options.js +24 -0
  20. package/src/utils.d.ts +2 -4
  21. package/src/utils.js +2 -3
  22. package/src/index.d.ts.map +0 -1
  23. package/src/lib/configs/index.d.ts +0 -17
  24. package/src/lib/configs/index.d.ts.map +0 -1
  25. package/src/lib/configs/index.js +0 -26
  26. package/src/lib/configs/jest.d.ts +0 -4
  27. package/src/lib/configs/jest.d.ts.map +0 -1
  28. package/src/lib/configs/jest.js +0 -27
  29. package/src/lib/configs/jsdoc.d.ts +0 -5
  30. package/src/lib/configs/jsdoc.d.ts.map +0 -1
  31. package/src/lib/configs/jsdoc.js +0 -44
  32. package/src/lib/configs/jsonc.d.ts +0 -4
  33. package/src/lib/configs/jsonc.d.ts.map +0 -1
  34. package/src/lib/configs/jsonc.js +0 -128
  35. package/src/lib/configs/n.d.ts +0 -4
  36. package/src/lib/configs/n.d.ts.map +0 -1
  37. package/src/lib/configs/n.js +0 -24
  38. package/src/lib/configs/nx.d.ts +0 -6
  39. package/src/lib/configs/nx.d.ts.map +0 -1
  40. package/src/lib/configs/nx.js +0 -45
  41. package/src/lib/configs/perfectionist.d.ts +0 -4
  42. package/src/lib/configs/perfectionist.d.ts.map +0 -1
  43. package/src/lib/configs/perfectionist.js +0 -129
  44. package/src/lib/configs/promise.d.ts +0 -4
  45. package/src/lib/configs/promise.d.ts.map +0 -1
  46. package/src/lib/configs/promise.js +0 -16
  47. package/src/lib/configs/regexp.d.ts +0 -4
  48. package/src/lib/configs/regexp.d.ts.map +0 -1
  49. package/src/lib/configs/regexp.js +0 -5
  50. package/src/lib/configs/toml.d.ts +0 -4
  51. package/src/lib/configs/toml.d.ts.map +0 -1
  52. package/src/lib/configs/toml.js +0 -35
  53. package/src/lib/configs/typescript-eslint.d.ts +0 -4
  54. package/src/lib/configs/typescript-eslint.d.ts.map +0 -1
  55. package/src/lib/configs/typescript-eslint.js +0 -26
  56. package/src/lib/configs/unicorn.d.ts +0 -4
  57. package/src/lib/configs/unicorn.d.ts.map +0 -1
  58. package/src/lib/configs/unicorn.js +0 -66
  59. package/src/lib/configs/vitest.d.ts +0 -4
  60. package/src/lib/configs/vitest.d.ts.map +0 -1
  61. package/src/lib/configs/vitest.js +0 -15
  62. package/src/lib/configs/yml.d.ts +0 -4
  63. package/src/lib/configs/yml.d.ts.map +0 -1
  64. package/src/lib/configs/yml.js +0 -127
  65. package/src/lib/extend-config.d.ts +0 -3
  66. package/src/lib/extend-config.d.ts.map +0 -1
  67. package/src/lib/extend-config.js +0 -22
  68. package/src/lib/meta.d.ts.map +0 -1
  69. package/src/lib/namer.d.ts.map +0 -1
  70. package/src/lib/patterns.d.ts +0 -82
  71. package/src/lib/patterns.d.ts.map +0 -1
  72. package/src/lib/patterns.js +0 -147
  73. package/src/lib/rule-levels.d.ts +0 -43
  74. package/src/lib/rule-levels.d.ts.map +0 -1
  75. package/src/lib/rule-levels.js +0 -71
  76. package/src/lib/severity.d.ts +0 -13
  77. package/src/lib/severity.d.ts.map +0 -1
  78. package/src/lib/severity.js +0 -34
  79. package/src/utils.d.ts.map +0 -1
@@ -0,0 +1,168 @@
1
+ import { getModuleRoot } from './get-module-root.js';
2
+ export class ImportResolver {
3
+ allowSubpathMatch;
4
+ cache;
5
+ useCache;
6
+ constructor(options) {
7
+ this.useCache = options?.cache ?? true;
8
+ this.allowSubpathMatch = options?.allowSubpathMatch ?? true;
9
+ this.cache = new Map();
10
+ }
11
+ clear(specifier) {
12
+ if (specifier) {
13
+ this.cache.delete(specifier);
14
+ }
15
+ else {
16
+ this.cache.clear();
17
+ }
18
+ }
19
+ has(specifier) {
20
+ return this.cache.has(specifier);
21
+ }
22
+ async import(specifier) {
23
+ if (!this.useCache) {
24
+ return this.loadModule(specifier);
25
+ }
26
+ const cached = this.cache.get(specifier);
27
+ if (cached) {
28
+ return cached;
29
+ }
30
+ try {
31
+ const pending = this.loadModule(specifier);
32
+ this.cache.set(specifier, pending);
33
+ return pending;
34
+ }
35
+ catch (error) {
36
+ this.cache.delete(specifier);
37
+ throw error;
38
+ }
39
+ }
40
+ async importDefault(specifier) {
41
+ const result = await this.import(specifier);
42
+ if (!result.success) {
43
+ return;
44
+ }
45
+ return (result.module?.default ?? result.module);
46
+ }
47
+ async requireImport(specifier) {
48
+ const result = await this.import(specifier);
49
+ if (result.success) {
50
+ return result.module;
51
+ }
52
+ throw new Error(`Required dependency "${specifier}" is not installed.`);
53
+ }
54
+ /**
55
+ * Narrow unknown to a Node-like error shape.
56
+ * @param value the value
57
+ * @returns the error-like object, or undefined if the value is not an object of the expected shape
58
+ */
59
+ asNodeLikeError(value) {
60
+ if (typeof value !== 'object' || value === null) {
61
+ return;
62
+ }
63
+ const record = value;
64
+ const code = typeof record['code'] === 'string' ? record['code'] : undefined;
65
+ const message = typeof record['message'] === 'string' ? record['message'] : undefined;
66
+ return { code, message };
67
+ }
68
+ /**
69
+ * Extract the target from CommonJS-style error messages like:
70
+ * - Cannot find module 'pg'
71
+ * @param message the error message
72
+ * @returns the target, or undefined if the message doesn't match the expected pattern
73
+ */
74
+ extractCannotFindModuleTarget(message) {
75
+ const match = message.match(/Cannot find module ['"]([^'"]+)['"]/i);
76
+ return match?.[1];
77
+ }
78
+ /**
79
+ * Extract the quoted missing target from error messages like:
80
+ * - Cannot find package 'pg' imported from ...
81
+ * - Cannot find module 'pg' imported from ...
82
+ * @param message the error message
83
+ * @returns the target, or undefined if the message doesn't match the expected pattern
84
+ */
85
+ extractQuotedMissingTarget(message) {
86
+ const match = message.match(/Cannot find (?:package|module) ['"]([^'"]+)['"]/i);
87
+ return match?.[1];
88
+ }
89
+ /**
90
+ * Detect whether an import error means that the *requested* specifier is missing, as opposed to one of its transitive dependencies. This is necessarily heuristic because Node error shapes/messages vary by version.
91
+ * @param error the captured error
92
+ * @param specifier the value that was imported
93
+ * @returns true if the error is caused by the requested module; false otherwise
94
+ */
95
+ isRequestedModuleMissing(error, specifier) {
96
+ const err = this.asNodeLikeError(error);
97
+ if (!err) {
98
+ return false;
99
+ }
100
+ // Common Node loader errors for missing modules in ESM/CJS contexts.
101
+ const { code, message } = err;
102
+ if ((code !== 'ERR_MODULE_NOT_FOUND' && code !== 'MODULE_NOT_FOUND') || !message) {
103
+ return false;
104
+ }
105
+ const requestedPackageName = getModuleRoot(specifier);
106
+ // ESM-style message often includes:
107
+ // Cannot find package 'pg' imported from ...
108
+ //
109
+ // or:
110
+ // Cannot find module 'pg' imported from ...
111
+ //
112
+ // If the missing target in the message matches the requested package (or exact
113
+ // specifier where appropriate), we consider that a true "missing module".
114
+ const quotedTarget = this.extractQuotedMissingTarget(message);
115
+ if (quotedTarget) {
116
+ if (quotedTarget === specifier) {
117
+ return true;
118
+ }
119
+ if (quotedTarget === requestedPackageName) {
120
+ return true;
121
+ }
122
+ if (this.isSameOrSubpath(quotedTarget, requestedPackageName)) {
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+ // Older/CommonJS-style message may look like:
128
+ // Cannot find module 'pg'
129
+ const cjsTarget = this.extractCannotFindModuleTarget(message);
130
+ if (cjsTarget) {
131
+ if (cjsTarget === specifier) {
132
+ return true;
133
+ }
134
+ if (cjsTarget === requestedPackageName) {
135
+ return true;
136
+ }
137
+ if (this.isSameOrSubpath(cjsTarget, requestedPackageName)) {
138
+ return true;
139
+ }
140
+ return false;
141
+ }
142
+ return false;
143
+ }
144
+ /**
145
+ * Determine whether the target is the requested module, or a subpath of it.
146
+ * @param target the identified target specifier
147
+ * @param requested the requested module specifier
148
+ * @returns true if {@link target} is a subpath of {@link requested}; false otherwise
149
+ * @example
150
+ * isSubpathOfModule('@scope/pkg/subpath', '@scope/pkg') // -> true
151
+ */
152
+ isSameOrSubpath(target, requested) {
153
+ return (this.allowSubpathMatch &&
154
+ (target === requested || target.startsWith(`${requested}/`)));
155
+ }
156
+ async loadModule(specifier) {
157
+ try {
158
+ const mod = (await import(specifier));
159
+ return { module: mod, success: true };
160
+ }
161
+ catch (error) {
162
+ if (this.isRequestedModuleMissing(error, specifier)) {
163
+ return { module: undefined, success: false };
164
+ }
165
+ throw error;
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,47 @@
1
+ export declare class OptionalImport<TModule = unknown> {
2
+ readonly moduleSpecifier: string;
3
+ private matchSubpaths?;
4
+ private missing?;
5
+ private module?;
6
+ private readonly moduleRoot;
7
+ private nodeRequire?;
8
+ constructor(specifier: string, options?: ImportResolverOptions);
9
+ /**
10
+ * Import the module if it can be resolved.
11
+ * @returns the module
12
+ */
13
+ load(): Promise<TModule | undefined>;
14
+ loadDefault(): Promise<TModule | undefined>;
15
+ require(): TModule | undefined;
16
+ resolve(): string | undefined;
17
+ /**
18
+ * Extract the target specifier from an error message.
19
+ * @param message the error message
20
+ * @returns the assumed target, or undefined if the message doesn't match any of the expected patterns
21
+ */
22
+ private static extractMissingTarget;
23
+ /**
24
+ * Detect whether an import error indicates that the requested specifier is missing, as opposed to one of its transitive dependencies. This is necessarily heuristic because Node error shapes/messages vary by version.
25
+ * @param error the captured error
26
+ * @returns true if the error is caused by attempting to import this module; false otherwise
27
+ */
28
+ private isMissingImportError;
29
+ /**
30
+ * Determine whether the target is the requested module, or a subpath of it.
31
+ * @param target the identified target specifier
32
+ * @returns true if {@link target} is a subpath of this module; false otherwise
33
+ */
34
+ private isSameOrSubpath;
35
+ }
36
+ export interface ImportResolverOptions {
37
+ /**
38
+ * Treat package subpaths as belonging to the same package.
39
+ * @default true
40
+ */
41
+ allowSubpathMatch?: boolean;
42
+ /**
43
+ * Cache resolved promises/results for each specifier.
44
+ * @default true
45
+ */
46
+ cache?: boolean;
47
+ }
@@ -0,0 +1,142 @@
1
+ import { createRequire } from 'node:module';
2
+ import { getModuleRoot } from './get-module-root.js';
3
+ export class OptionalImport {
4
+ moduleSpecifier;
5
+ matchSubpaths;
6
+ missing;
7
+ module;
8
+ moduleRoot;
9
+ nodeRequire;
10
+ constructor(specifier, options) {
11
+ this.moduleSpecifier = specifier;
12
+ this.moduleRoot = getModuleRoot(this.moduleSpecifier);
13
+ this.matchSubpaths = options?.allowSubpathMatch;
14
+ }
15
+ /**
16
+ * Import the module if it can be resolved.
17
+ * @returns the module
18
+ */
19
+ async load() {
20
+ if (this.module !== undefined || this.missing) {
21
+ return this.module;
22
+ }
23
+ try {
24
+ const m = (await import(this.moduleSpecifier));
25
+ this.module = m;
26
+ this.missing = false;
27
+ return this.module;
28
+ }
29
+ catch (error) {
30
+ if (this.isMissingImportError(error)) {
31
+ this.missing = true;
32
+ return;
33
+ }
34
+ // if (!Error.isError())
35
+ throw error;
36
+ }
37
+ }
38
+ async loadDefault() {
39
+ const m = (await this.load());
40
+ if (m !== undefined) {
41
+ return (m?.default ?? m);
42
+ }
43
+ return;
44
+ }
45
+ require() {
46
+ if (this.module !== undefined || this.missing) {
47
+ return this.module;
48
+ }
49
+ if (!this.nodeRequire) {
50
+ this.nodeRequire = createRequire(import.meta.url);
51
+ }
52
+ try {
53
+ const m = this.nodeRequire(this.moduleSpecifier);
54
+ this.module = m;
55
+ this.missing = false;
56
+ return this.module;
57
+ }
58
+ catch (error) {
59
+ if (this.isMissingImportError(error)) {
60
+ this.missing = true;
61
+ return;
62
+ }
63
+ throw error;
64
+ }
65
+ }
66
+ resolve() {
67
+ if (this.missing) {
68
+ return;
69
+ }
70
+ if (!this.nodeRequire) {
71
+ this.nodeRequire = createRequire(import.meta.url);
72
+ }
73
+ try {
74
+ return this.nodeRequire.resolve(this.moduleSpecifier);
75
+ }
76
+ catch (error) {
77
+ if (this.isMissingImportError(error)) {
78
+ this.missing = true;
79
+ return;
80
+ }
81
+ throw error;
82
+ }
83
+ }
84
+ /**
85
+ * Extract the target specifier from an error message.
86
+ * @param message the error message
87
+ * @returns the assumed target, or undefined if the message doesn't match any of the expected patterns
88
+ */
89
+ static extractMissingTarget(message) {
90
+ const esmExp = /Cannot find (?:package|module) ['"]([^'"]+)['"]/i;
91
+ const cjsExp = /Cannot find module ['"]([^'"]+)['"]/i;
92
+ if (esmExp.test(message)) {
93
+ return esmExp.exec(message)?.[1];
94
+ }
95
+ else if (cjsExp.test(message)) {
96
+ return cjsExp.exec(message)?.[1];
97
+ }
98
+ else {
99
+ return;
100
+ }
101
+ }
102
+ /**
103
+ * Detect whether an import error indicates that the requested specifier is missing, as opposed to one of its transitive dependencies. This is necessarily heuristic because Node error shapes/messages vary by version.
104
+ * @param error the captured error
105
+ * @returns true if the error is caused by attempting to import this module; false otherwise
106
+ */
107
+ isMissingImportError(error) {
108
+ if (this.missing !== undefined) {
109
+ return this.missing;
110
+ }
111
+ if (!isNodeError(error)) {
112
+ return;
113
+ }
114
+ const { code, message } = error;
115
+ if ((code !== 'ERR_MODULE_NOT_FOUND' && code !== 'MODULE_NOT_FOUND') || !message) {
116
+ return false;
117
+ }
118
+ const target = OptionalImport.extractMissingTarget(message);
119
+ if (target) {
120
+ return this.isSameOrSubpath(target);
121
+ }
122
+ return false;
123
+ }
124
+ /**
125
+ * Determine whether the target is the requested module, or a subpath of it.
126
+ * @param target the identified target specifier
127
+ * @returns true if {@link target} is a subpath of this module; false otherwise
128
+ */
129
+ isSameOrSubpath(target) {
130
+ return (target === this.moduleSpecifier ||
131
+ (this.matchSubpaths === true && target.startsWith(`${this.moduleRoot}/`)));
132
+ }
133
+ }
134
+ function isNodeError(value) {
135
+ if (value === null || typeof value !== 'object') {
136
+ return false;
137
+ }
138
+ const keys = ['code', 'message'];
139
+ const has = (prop) => value[prop] === undefined ||
140
+ typeof value[prop] === 'string';
141
+ return keys.every(e => has(e));
142
+ }
@@ -0,0 +1,3 @@
1
+ import { type ConfigOptions, type Options } from '@the-stranger/eslint-config';
2
+ export declare function disableExcept<K extends keyof ConfigOptions>(config: Options, ...keys: K[]): import("eslint/config").Config[];
3
+ export declare function disableOptionsExcept<K extends keyof ConfigOptions>(config: Options, ...keys: K[]): Options;
@@ -0,0 +1,24 @@
1
+ import { configure, } from '@the-stranger/eslint-config';
2
+ export function disableExcept(config, ...keys) {
3
+ return configure(disableOptionsExcept(config, ...keys));
4
+ }
5
+ export function disableOptionsExcept(config, ...keys) {
6
+ const configKeys = [
7
+ 'json',
8
+ 'source',
9
+ 'nx',
10
+ 'tests',
11
+ 'toml',
12
+ 'yaml',
13
+ ];
14
+ const keySet = new Set(keys);
15
+ for (const key of configKeys) {
16
+ if (keySet.has(key)) {
17
+ config[key] ??= true;
18
+ }
19
+ else {
20
+ config[key] = false;
21
+ }
22
+ }
23
+ return config;
24
+ }
package/src/utils.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export { namer, objectNamer, type Named } from './lib/namer.js';
2
- export { FilePatterns, getFilePatterns } from './lib/patterns.js';
3
- export { setRuleLevel } from './lib/severity.js';
4
- //# sourceMappingURL=utils.d.ts.map
1
+ export { configure, type ConfigOptions } from '@the-stranger/eslint-config';
2
+ export { FilePatterns, getFilePatterns, setSeverity } from '@the-stranger/eslint-utils';
package/src/utils.js CHANGED
@@ -1,3 +1,2 @@
1
- export { namer, objectNamer } from './lib/namer.js';
2
- export { FilePatterns, getFilePatterns } from './lib/patterns.js';
3
- export { setRuleLevel } from './lib/severity.js';
1
+ export { configure } from '@the-stranger/eslint-config';
2
+ export { FilePatterns, getFilePatterns, setSeverity } from '@the-stranger/eslint-utils';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/eslint-plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA"}
@@ -1,17 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- interface Configs {
3
- base: Linter.Config[];
4
- jsdoc: Linter.Config[];
5
- jsonc: Linter.Config[];
6
- n: Linter.Config[];
7
- perfectionist: Linter.Config[];
8
- promise: Linter.Config[];
9
- recommended: Linter.Config[];
10
- regexp: Linter.Config[];
11
- ts: Linter.Config[];
12
- unicorn: Linter.Config[];
13
- yml: Linter.Config[];
14
- }
15
- export declare const configs: Configs;
16
- export {};
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAyBpC,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACtB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IAClB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACxB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACvB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;CACrB;AAED,eAAO,MAAM,OAAO,EAAE,OAIrB,CAAA"}
@@ -1,26 +0,0 @@
1
- import { extendConfig } from '../extend-config.js';
2
- import jsdoc from './jsdoc.js';
3
- import jsonc from './jsonc.js';
4
- import n from './n.js';
5
- import perfectionist from './perfectionist.js';
6
- import promise from './promise.js';
7
- import regexp from './regexp.js';
8
- import ts from './typescript-eslint.js';
9
- import unicorn from './unicorn.js';
10
- import yml from './yml.js';
11
- const recommendedConfigs = {
12
- jsdoc,
13
- jsonc,
14
- n,
15
- perfectionist,
16
- promise,
17
- regexp,
18
- ts,
19
- unicorn,
20
- yml,
21
- };
22
- export const configs = {
23
- ...recommendedConfigs,
24
- base: extendConfig(),
25
- recommended: extendConfig(...Object.values(recommendedConfigs)),
26
- };
@@ -1,4 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- declare const _default: Linter.Config[];
3
- export default _default;
4
- //# sourceMappingURL=jest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/jest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBA6B/B,MAAM,CAAC,MAAM,EAAE;AAxBpB,wBAwBoB"}
@@ -1,27 +0,0 @@
1
- import jest from 'eslint-plugin-jest';
2
- import { namer } from '../namer.js';
3
- import { FilePatterns, getFilePatterns } from '../patterns.js';
4
- export default [
5
- jest.configs['flat/recommended'],
6
- jest.configs['flat/style'],
7
- {
8
- files: getFilePatterns(FilePatterns.test),
9
- name: namer('jest'),
10
- rules: {
11
- 'jest/consistent-test-it': ['error', { fn: 'it' }],
12
- 'jest/no-confusing-set-timeout': 'error',
13
- 'jest/prefer-each': 'warn',
14
- 'jest/prefer-equality-matcher': 'error',
15
- 'jest/prefer-expect-resolves': 'warn',
16
- 'jest/prefer-hooks-in-order': 'error',
17
- 'jest/prefer-hooks-on-top': 'warn',
18
- 'jest/prefer-importing-jest-globals': 'error',
19
- 'jest/prefer-jest-mocked': 'warn',
20
- 'jest/prefer-lowercase-title': 'warn',
21
- 'jest/prefer-mock-promise-shorthand': 'warn',
22
- 'jest/prefer-spy-on': 'warn',
23
- 'jest/prefer-strict-equal': 'warn',
24
- 'jest/valid-title': ['warn', { disallowedWords: ['should'] }],
25
- },
26
- },
27
- ];
@@ -1,5 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- export declare const DOCUSAURUS_TAGS: string[];
3
- declare const _default: Linter.Config[];
4
- export default _default;
5
- //# sourceMappingURL=jsdoc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsdoc.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/jsdoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAMpC,eAAO,MAAM,eAAe,UAAe,CAAA;wBA2CtC,MAAM,CAAC,MAAM,EAAE;AAzCpB,wBAyCoB"}
@@ -1,44 +0,0 @@
1
- import jsdoc from 'eslint-plugin-jsdoc';
2
- import { namer } from '../namer.js';
3
- import { FilePatterns, getFilePatterns } from '../patterns.js';
4
- // tags used by docusaurus to generate docs from jsdoc comments
5
- export const DOCUSAURUS_TAGS = ['document'];
6
- export default [
7
- {
8
- name: namer('jsdoc'),
9
- plugins: { jsdoc },
10
- rules: {
11
- 'jsdoc/require-jsdoc': 'off',
12
- 'jsdoc/require-returns': [
13
- 'error',
14
- {
15
- checkGetters: false,
16
- },
17
- ],
18
- },
19
- settings: {
20
- jsdoc: {
21
- tagNamePreference: {
22
- augments: 'extends',
23
- },
24
- },
25
- },
26
- },
27
- {
28
- extends: [jsdoc.configs['flat/recommended-typescript']],
29
- files: getFilePatterns(FilePatterns.ts),
30
- name: namer('jsdoc/typescript'),
31
- },
32
- {
33
- extends: [jsdoc.configs['flat/recommended']],
34
- files: getFilePatterns(FilePatterns.js),
35
- name: namer('jsdoc/javascript'),
36
- },
37
- {
38
- files: getFilePatterns(FilePatterns.source),
39
- name: namer('jsdoc/docusaurus'),
40
- rules: {
41
- 'jsdoc/check-tag-names': ['warn', { definedTags: DOCUSAURUS_TAGS }],
42
- },
43
- },
44
- ];
@@ -1,4 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- declare const _default: Linter.Config[];
3
- export default _default;
4
- //# sourceMappingURL=jsonc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin/src/lib/configs/jsonc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;wBAwI/B,MAAM,CAAC,MAAM,EAAE;AApIpB,wBAoIoB"}