eslint-plugin-package-json 1.6.0 → 1.6.1

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.
@@ -0,0 +1,105 @@
1
+ import { AST, RuleListener } from "jsonc-eslint-parser";
2
+ import { AST as AST$1, Rule, SourceCode } from "eslint";
3
+ import * as ESTree from "estree";
4
+
5
+ //#region node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.d.ts
6
+ declare const $JSONSchema: unique symbol;
7
+ type $JSONSchema = typeof $JSONSchema;
8
+ type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
9
+ type JSONSchema = boolean | Readonly<{
10
+ [$JSONSchema]?: $JSONSchema;
11
+ $id?: string | undefined;
12
+ $ref?: string | undefined;
13
+ $schema?: string | undefined;
14
+ $comment?: string | undefined;
15
+ type?: JSONSchemaType | readonly JSONSchemaType[];
16
+ const?: unknown;
17
+ enum?: unknown;
18
+ multipleOf?: number | undefined;
19
+ maximum?: number | undefined;
20
+ exclusiveMaximum?: number | undefined;
21
+ minimum?: number | undefined;
22
+ exclusiveMinimum?: number | undefined;
23
+ maxLength?: number | undefined;
24
+ minLength?: number | undefined;
25
+ pattern?: string | undefined;
26
+ items?: JSONSchema | readonly JSONSchema[];
27
+ additionalItems?: JSONSchema;
28
+ contains?: JSONSchema;
29
+ maxItems?: number | undefined;
30
+ minItems?: number | undefined;
31
+ uniqueItems?: boolean | undefined;
32
+ maxProperties?: number | undefined;
33
+ minProperties?: number | undefined;
34
+ required?: readonly string[];
35
+ properties?: Readonly<Record<string, JSONSchema>>;
36
+ patternProperties?: Readonly<Record<string, JSONSchema>>;
37
+ additionalProperties?: JSONSchema;
38
+ unevaluatedProperties?: JSONSchema;
39
+ dependencies?: Readonly<Record<string, JSONSchema | readonly string[]>>;
40
+ propertyNames?: JSONSchema;
41
+ if?: JSONSchema;
42
+ then?: JSONSchema;
43
+ else?: JSONSchema;
44
+ allOf?: readonly JSONSchema[];
45
+ anyOf?: readonly JSONSchema[];
46
+ oneOf?: readonly JSONSchema[];
47
+ not?: JSONSchema;
48
+ format?: string | undefined;
49
+ contentMediaType?: string | undefined;
50
+ contentEncoding?: string | undefined;
51
+ definitions?: Readonly<Record<string, JSONSchema>>;
52
+ title?: string | undefined;
53
+ description?: string | undefined;
54
+ default?: unknown;
55
+ readOnly?: boolean | undefined;
56
+ writeOnly?: boolean | undefined;
57
+ examples?: readonly unknown[];
58
+ nullable?: boolean;
59
+ }>;
60
+ //#endregion
61
+ //#region src/createRule.d.ts
62
+ type ASTBodyExpression = ESTree.Expression & {
63
+ properties: ASTBodyProperty[];
64
+ };
65
+ type ASTBodyProperty = AST.JSONProperty & {
66
+ value: string;
67
+ };
68
+ interface ASTBodyStatement extends ESTree.ExpressionStatement {
69
+ expression: ASTBodyExpression;
70
+ }
71
+ interface PackageAST extends AST$1.Program {
72
+ body: [ASTBodyStatement];
73
+ }
74
+ interface PackageJsonPluginSettings {
75
+ /**
76
+ * Whether `require-*` rules, if used, should enforce the presence of
77
+ * the corresponding property *in package.json files with `"private": true`*.
78
+ *
79
+ * If not specified, it will not enforce the presence only of `name` and `version` properties.
80
+ */
81
+ enforceForPrivate?: boolean;
82
+ }
83
+ interface PackageJsonRuleContext<Options extends unknown[] = unknown[]> extends Rule.RuleContext {
84
+ options: Options;
85
+ settings: {
86
+ packageJson?: PackageJsonPluginSettings;
87
+ };
88
+ sourceCode: PackageJsonSourceCode;
89
+ }
90
+ interface PackageJsonRuleModule<Options extends unknown[] = unknown[], Schema extends JSONSchema[] = JSONSchema[]> {
91
+ create(context: PackageJsonRuleContext<Options>): RuleListener;
92
+ meta: Omit<Rule.RuleMetaData, 'defaultOptions' | 'docs' | 'schema'> & {
93
+ defaultOptions?: NoInfer<Options>;
94
+ docs?: Rule.RuleMetaData['docs'] & {
95
+ category?: string; /** An optional route segment to group this rule under */
96
+ ruleGroup?: string;
97
+ };
98
+ schema?: Schema;
99
+ };
100
+ }
101
+ interface PackageJsonSourceCode extends SourceCode {
102
+ ast: PackageAST;
103
+ }
104
+ //#endregion
105
+ export { PackageJsonRuleModule as n, JSONSchema as r, PackageJsonPluginSettings as t };
@@ -1,4 +1,4 @@
1
- import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "../createRule-B1Ow8h0I.mjs";
1
+ import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "../createRule-29pC9RoP.mjs";
2
2
  import { ESLint } from "eslint";
3
3
 
4
4
  //#region src/experimental/plugin.d.ts
@@ -1,4 +1,4 @@
1
- import { t as plugin$1 } from "../plugin-kxKPlCNd.mjs";
1
+ import { t as plugin$1 } from "../plugin-C-Z8sf5g.mjs";
2
2
  import { toCompatRule } from "eslint-json-compat-utils";
3
3
  //#region src/experimental/plugin.ts
4
4
  const language = "json/json";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "./createRule-B1Ow8h0I.mjs";
1
+ import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "./createRule-29pC9RoP.mjs";
2
2
  import * as parserJsonc from "jsonc-eslint-parser";
3
3
  import { ESLint } from "eslint";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as plugin } from "./plugin-kxKPlCNd.mjs";
1
+ import { t as plugin } from "./plugin-C-Z8sf5g.mjs";
2
2
  //#region src/index.ts
3
3
  const rules = plugin.rules;
4
4
  const configs = plugin.configs;
@@ -512,7 +512,7 @@ const createShorthand = (url, provider) => {
512
512
  };
513
513
  const createUrl = (shorthand) => {
514
514
  if (shorthand.includes(":")) {
515
- const [provider, repo] = shorthand.split(":");
515
+ const [provider, repo] = shorthand.split(":", 2);
516
516
  if (isProvider(provider)) return `${providerUrls[provider]}${repo}`;
517
517
  }
518
518
  return `${providerUrls.github}${shorthand}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-package-json",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Rules for consistent, readable, and valid package.json files. 🗂️",
5
5
  "homepage": "https://github.com/michaelfaith/eslint-plugin-package-json#readme",
6
6
  "bugs": {
@@ -71,24 +71,24 @@
71
71
  "@typescript/native": "npm:typescript@7.0.2",
72
72
  "@vitest/coverage-v8": "4.1.8",
73
73
  "@vitest/eslint-plugin": "1.6.20",
74
- "astro": "7.0.6",
74
+ "astro": "7.1.0",
75
75
  "astro-og-canvas": "0.13.0",
76
76
  "canvaskit-wasm": "0.41.1",
77
77
  "console-fail-test": "0.6.0",
78
- "eslint": "10.6.0",
79
- "eslint-doc-generator": "3.6.0",
80
- "eslint-plugin-eslint-plugin": "7.4.0",
81
- "eslint-plugin-jsdoc": "63.0.2",
78
+ "eslint": "10.7.0",
79
+ "eslint-doc-generator": "3.7.0",
80
+ "eslint-plugin-eslint-plugin": "7.5.0",
81
+ "eslint-plugin-jsdoc": "63.2.0",
82
82
  "eslint-plugin-jsonc": "3.3.0",
83
83
  "eslint-plugin-n": "18.2.1",
84
84
  "eslint-plugin-node-dependencies": "2.2.0",
85
85
  "eslint-plugin-perfectionist": "5.10.0",
86
86
  "eslint-plugin-regexp": "3.1.0",
87
- "eslint-plugin-unicorn": "71.1.0",
87
+ "eslint-plugin-unicorn": "72.0.0",
88
88
  "eslint-plugin-yml": "3.6.0",
89
89
  "jiti": "2.7.0",
90
90
  "json-schema-to-ts": "3.1.1",
91
- "knip": "6.26.0",
91
+ "knip": "6.27.0",
92
92
  "prettier": "3.9.0",
93
93
  "prettier-plugin-curly": "0.4.1",
94
94
  "prettier-plugin-packagejson": "3.0.2",
@@ -99,16 +99,20 @@
99
99
  "starlight-auto-sidebar": "0.4.0",
100
100
  "tsdown": "0.22.2",
101
101
  "typescript": "npm:@typescript/typescript6@6.0.2",
102
- "typescript-eslint": "8.63.0",
102
+ "typescript-eslint": "8.65.0",
103
103
  "vitest": "4.1.8"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "@eslint/json": ">=1.0.0",
107
+ "@types/estree": ">=1.0.0",
107
108
  "eslint": ">=9.0.0"
108
109
  },
109
110
  "peerDependenciesMeta": {
110
111
  "@eslint/json": {
111
112
  "optional": true
113
+ },
114
+ "@types/estree": {
115
+ "optional": true
112
116
  }
113
117
  },
114
118
  "engines": {
@@ -1,541 +0,0 @@
1
- import { AST, RuleListener } from "jsonc-eslint-parser";
2
- import { AST as AST$1, Rule, SourceCode } from "eslint";
3
-
4
- //#region node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.d.ts
5
- declare const $JSONSchema: unique symbol;
6
- type $JSONSchema = typeof $JSONSchema;
7
- type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
8
- type JSONSchema = boolean | Readonly<{
9
- [$JSONSchema]?: $JSONSchema;
10
- $id?: string | undefined;
11
- $ref?: string | undefined;
12
- $schema?: string | undefined;
13
- $comment?: string | undefined;
14
- type?: JSONSchemaType | readonly JSONSchemaType[];
15
- const?: unknown;
16
- enum?: unknown;
17
- multipleOf?: number | undefined;
18
- maximum?: number | undefined;
19
- exclusiveMaximum?: number | undefined;
20
- minimum?: number | undefined;
21
- exclusiveMinimum?: number | undefined;
22
- maxLength?: number | undefined;
23
- minLength?: number | undefined;
24
- pattern?: string | undefined;
25
- items?: JSONSchema | readonly JSONSchema[];
26
- additionalItems?: JSONSchema;
27
- contains?: JSONSchema;
28
- maxItems?: number | undefined;
29
- minItems?: number | undefined;
30
- uniqueItems?: boolean | undefined;
31
- maxProperties?: number | undefined;
32
- minProperties?: number | undefined;
33
- required?: readonly string[];
34
- properties?: Readonly<Record<string, JSONSchema>>;
35
- patternProperties?: Readonly<Record<string, JSONSchema>>;
36
- additionalProperties?: JSONSchema;
37
- unevaluatedProperties?: JSONSchema;
38
- dependencies?: Readonly<Record<string, JSONSchema | readonly string[]>>;
39
- propertyNames?: JSONSchema;
40
- if?: JSONSchema;
41
- then?: JSONSchema;
42
- else?: JSONSchema;
43
- allOf?: readonly JSONSchema[];
44
- anyOf?: readonly JSONSchema[];
45
- oneOf?: readonly JSONSchema[];
46
- not?: JSONSchema;
47
- format?: string | undefined;
48
- contentMediaType?: string | undefined;
49
- contentEncoding?: string | undefined;
50
- definitions?: Readonly<Record<string, JSONSchema>>;
51
- title?: string | undefined;
52
- description?: string | undefined;
53
- default?: unknown;
54
- readOnly?: boolean | undefined;
55
- writeOnly?: boolean | undefined;
56
- examples?: readonly unknown[];
57
- nullable?: boolean;
58
- }>;
59
- //#endregion
60
- //#region node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts
61
- // This definition file follows a somewhat unusual format. ESTree allows
62
- // runtime type checks based on the `type` parameter. In order to explain this
63
- // to typescript we want to use discriminated union types:
64
- // https://github.com/Microsoft/TypeScript/pull/9163
65
- //
66
- // For ESTree this is a bit tricky because the high level interfaces like
67
- // Node or Function are pulling double duty. We want to pass common fields down
68
- // to the interfaces that extend them (like Identifier or
69
- // ArrowFunctionExpression), but you can't extend a type union or enforce
70
- // common fields on them. So we've split the high level interfaces into two
71
- // types, a base type which passes down inherited fields, and a type union of
72
- // all types which extend the base type. Only the type union is exported, and
73
- // the union is how other types refer to the collection of inheriting types.
74
- //
75
- // This makes the definitions file here somewhat more difficult to maintain,
76
- // but it has the notable advantage of making ESTree much easier to use as
77
- // an end user.
78
- interface BaseNodeWithoutComments {
79
- // Every leaf interface that extends BaseNode must specify a type property.
80
- // The type property should be a string literal. For example, Identifier
81
- // has: `type: "Identifier"`
82
- type: string;
83
- loc?: SourceLocation | null | undefined;
84
- range?: [number, number] | undefined;
85
- }
86
- interface BaseNode extends BaseNodeWithoutComments {
87
- leadingComments?: Comment[] | undefined;
88
- trailingComments?: Comment[] | undefined;
89
- }
90
- interface Comment extends BaseNodeWithoutComments {
91
- type: "Line" | "Block";
92
- value: string;
93
- }
94
- interface SourceLocation {
95
- source?: string | null | undefined;
96
- start: Position;
97
- end: Position;
98
- }
99
- interface Position {
100
- /** >= 1 */
101
- line: number;
102
- /** >= 0 */
103
- column: number;
104
- }
105
- interface BaseFunction extends BaseNode {
106
- params: Pattern[];
107
- generator?: boolean | undefined;
108
- async?: boolean | undefined; // The body is either BlockStatement or Expression because arrow functions
109
- // can have a body that's either. FunctionDeclarations and
110
- // FunctionExpressions have only BlockStatement bodies.
111
- body: BlockStatement | Expression;
112
- }
113
- type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
114
- interface BaseStatement extends BaseNode {}
115
- interface EmptyStatement extends BaseStatement {
116
- type: "EmptyStatement";
117
- }
118
- interface BlockStatement extends BaseStatement {
119
- type: "BlockStatement";
120
- body: Statement[];
121
- innerComments?: Comment[] | undefined;
122
- }
123
- interface StaticBlock extends Omit<BlockStatement, "type"> {
124
- type: "StaticBlock";
125
- }
126
- interface ExpressionStatement extends BaseStatement {
127
- type: "ExpressionStatement";
128
- expression: Expression;
129
- }
130
- interface IfStatement extends BaseStatement {
131
- type: "IfStatement";
132
- test: Expression;
133
- consequent: Statement;
134
- alternate?: Statement | null | undefined;
135
- }
136
- interface LabeledStatement extends BaseStatement {
137
- type: "LabeledStatement";
138
- label: Identifier;
139
- body: Statement;
140
- }
141
- interface BreakStatement extends BaseStatement {
142
- type: "BreakStatement";
143
- label?: Identifier | null | undefined;
144
- }
145
- interface ContinueStatement extends BaseStatement {
146
- type: "ContinueStatement";
147
- label?: Identifier | null | undefined;
148
- }
149
- interface WithStatement extends BaseStatement {
150
- type: "WithStatement";
151
- object: Expression;
152
- body: Statement;
153
- }
154
- interface SwitchStatement extends BaseStatement {
155
- type: "SwitchStatement";
156
- discriminant: Expression;
157
- cases: SwitchCase[];
158
- }
159
- interface ReturnStatement extends BaseStatement {
160
- type: "ReturnStatement";
161
- argument?: Expression | null | undefined;
162
- }
163
- interface ThrowStatement extends BaseStatement {
164
- type: "ThrowStatement";
165
- argument: Expression;
166
- }
167
- interface TryStatement extends BaseStatement {
168
- type: "TryStatement";
169
- block: BlockStatement;
170
- handler?: CatchClause | null | undefined;
171
- finalizer?: BlockStatement | null | undefined;
172
- }
173
- interface WhileStatement extends BaseStatement {
174
- type: "WhileStatement";
175
- test: Expression;
176
- body: Statement;
177
- }
178
- interface DoWhileStatement extends BaseStatement {
179
- type: "DoWhileStatement";
180
- body: Statement;
181
- test: Expression;
182
- }
183
- interface ForStatement extends BaseStatement {
184
- type: "ForStatement";
185
- init?: VariableDeclaration | Expression | null | undefined;
186
- test?: Expression | null | undefined;
187
- update?: Expression | null | undefined;
188
- body: Statement;
189
- }
190
- interface BaseForXStatement extends BaseStatement {
191
- left: VariableDeclaration | Pattern;
192
- right: Expression;
193
- body: Statement;
194
- }
195
- interface ForInStatement extends BaseForXStatement {
196
- type: "ForInStatement";
197
- }
198
- interface DebuggerStatement extends BaseStatement {
199
- type: "DebuggerStatement";
200
- }
201
- type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
202
- interface BaseDeclaration extends BaseStatement {}
203
- interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
204
- type: "FunctionDeclaration";
205
- /** It is null when a function declaration is a part of the `export default function` statement */
206
- id: Identifier | null;
207
- body: BlockStatement;
208
- }
209
- interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
210
- id: Identifier;
211
- }
212
- interface VariableDeclaration extends BaseDeclaration {
213
- type: "VariableDeclaration";
214
- declarations: VariableDeclarator[];
215
- kind: "var" | "let" | "const" | "using" | "await using";
216
- }
217
- interface VariableDeclarator extends BaseNode {
218
- type: "VariableDeclarator";
219
- id: Pattern;
220
- init?: Expression | null | undefined;
221
- }
222
- interface ExpressionMap {
223
- ArrayExpression: ArrayExpression;
224
- ArrowFunctionExpression: ArrowFunctionExpression;
225
- AssignmentExpression: AssignmentExpression;
226
- AwaitExpression: AwaitExpression;
227
- BinaryExpression: BinaryExpression;
228
- CallExpression: CallExpression;
229
- ChainExpression: ChainExpression;
230
- ClassExpression: ClassExpression;
231
- ConditionalExpression: ConditionalExpression;
232
- FunctionExpression: FunctionExpression;
233
- Identifier: Identifier;
234
- ImportExpression: ImportExpression;
235
- Literal: Literal;
236
- LogicalExpression: LogicalExpression;
237
- MemberExpression: MemberExpression;
238
- MetaProperty: MetaProperty;
239
- NewExpression: NewExpression;
240
- ObjectExpression: ObjectExpression;
241
- SequenceExpression: SequenceExpression;
242
- TaggedTemplateExpression: TaggedTemplateExpression;
243
- TemplateLiteral: TemplateLiteral;
244
- ThisExpression: ThisExpression;
245
- UnaryExpression: UnaryExpression;
246
- UpdateExpression: UpdateExpression;
247
- YieldExpression: YieldExpression;
248
- }
249
- type Expression = ExpressionMap[keyof ExpressionMap];
250
- interface BaseExpression extends BaseNode {}
251
- type ChainElement = SimpleCallExpression | MemberExpression;
252
- interface ChainExpression extends BaseExpression {
253
- type: "ChainExpression";
254
- expression: ChainElement;
255
- }
256
- interface ThisExpression extends BaseExpression {
257
- type: "ThisExpression";
258
- }
259
- interface ArrayExpression extends BaseExpression {
260
- type: "ArrayExpression";
261
- elements: Array<Expression | SpreadElement | null>;
262
- }
263
- interface ObjectExpression extends BaseExpression {
264
- type: "ObjectExpression";
265
- properties: Array<Property | SpreadElement>;
266
- }
267
- interface PrivateIdentifier extends BaseNode {
268
- type: "PrivateIdentifier";
269
- name: string;
270
- }
271
- interface Property extends BaseNode {
272
- type: "Property";
273
- key: Expression | PrivateIdentifier;
274
- value: Expression | Pattern; // Could be an AssignmentProperty
275
- kind: "init" | "get" | "set";
276
- method: boolean;
277
- shorthand: boolean;
278
- computed: boolean;
279
- }
280
- interface PropertyDefinition extends BaseNode {
281
- type: "PropertyDefinition";
282
- key: Expression | PrivateIdentifier;
283
- value?: Expression | null | undefined;
284
- computed: boolean;
285
- static: boolean;
286
- }
287
- interface FunctionExpression extends BaseFunction, BaseExpression {
288
- id?: Identifier | null | undefined;
289
- type: "FunctionExpression";
290
- body: BlockStatement;
291
- }
292
- interface SequenceExpression extends BaseExpression {
293
- type: "SequenceExpression";
294
- expressions: Expression[];
295
- }
296
- interface UnaryExpression extends BaseExpression {
297
- type: "UnaryExpression";
298
- operator: UnaryOperator;
299
- prefix: true;
300
- argument: Expression;
301
- }
302
- interface BinaryExpression extends BaseExpression {
303
- type: "BinaryExpression";
304
- operator: BinaryOperator;
305
- left: Expression | PrivateIdentifier;
306
- right: Expression;
307
- }
308
- interface AssignmentExpression extends BaseExpression {
309
- type: "AssignmentExpression";
310
- operator: AssignmentOperator;
311
- left: Pattern | MemberExpression;
312
- right: Expression;
313
- }
314
- interface UpdateExpression extends BaseExpression {
315
- type: "UpdateExpression";
316
- operator: UpdateOperator;
317
- argument: Expression;
318
- prefix: boolean;
319
- }
320
- interface LogicalExpression extends BaseExpression {
321
- type: "LogicalExpression";
322
- operator: LogicalOperator;
323
- left: Expression;
324
- right: Expression;
325
- }
326
- interface ConditionalExpression extends BaseExpression {
327
- type: "ConditionalExpression";
328
- test: Expression;
329
- alternate: Expression;
330
- consequent: Expression;
331
- }
332
- interface BaseCallExpression extends BaseExpression {
333
- callee: Expression | Super;
334
- arguments: Array<Expression | SpreadElement>;
335
- }
336
- type CallExpression = SimpleCallExpression | NewExpression;
337
- interface SimpleCallExpression extends BaseCallExpression {
338
- type: "CallExpression";
339
- optional: boolean;
340
- }
341
- interface NewExpression extends BaseCallExpression {
342
- type: "NewExpression";
343
- }
344
- interface MemberExpression extends BaseExpression, BasePattern {
345
- type: "MemberExpression";
346
- object: Expression | Super;
347
- property: Expression | PrivateIdentifier;
348
- computed: boolean;
349
- optional: boolean;
350
- }
351
- type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
352
- interface BasePattern extends BaseNode {}
353
- interface SwitchCase extends BaseNode {
354
- type: "SwitchCase";
355
- test?: Expression | null | undefined;
356
- consequent: Statement[];
357
- }
358
- interface CatchClause extends BaseNode {
359
- type: "CatchClause";
360
- param: Pattern | null;
361
- body: BlockStatement;
362
- }
363
- interface Identifier extends BaseNode, BaseExpression, BasePattern {
364
- type: "Identifier";
365
- name: string;
366
- }
367
- type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
368
- interface SimpleLiteral extends BaseNode, BaseExpression {
369
- type: "Literal";
370
- value: string | boolean | number | null;
371
- raw?: string | undefined;
372
- }
373
- interface RegExpLiteral extends BaseNode, BaseExpression {
374
- type: "Literal";
375
- value?: RegExp | null | undefined;
376
- regex: {
377
- pattern: string;
378
- flags: string;
379
- };
380
- raw?: string | undefined;
381
- }
382
- interface BigIntLiteral extends BaseNode, BaseExpression {
383
- type: "Literal";
384
- value?: bigint | null | undefined;
385
- bigint: string;
386
- raw?: string | undefined;
387
- }
388
- type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
389
- type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
390
- type LogicalOperator = "||" | "&&" | "??";
391
- type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
392
- type UpdateOperator = "++" | "--";
393
- interface ForOfStatement extends BaseForXStatement {
394
- type: "ForOfStatement";
395
- await: boolean;
396
- }
397
- interface Super extends BaseNode {
398
- type: "Super";
399
- }
400
- interface SpreadElement extends BaseNode {
401
- type: "SpreadElement";
402
- argument: Expression;
403
- }
404
- interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
405
- type: "ArrowFunctionExpression";
406
- expression: boolean;
407
- body: BlockStatement | Expression;
408
- }
409
- interface YieldExpression extends BaseExpression {
410
- type: "YieldExpression";
411
- argument?: Expression | null | undefined;
412
- delegate: boolean;
413
- }
414
- interface TemplateLiteral extends BaseExpression {
415
- type: "TemplateLiteral";
416
- quasis: TemplateElement[];
417
- expressions: Expression[];
418
- }
419
- interface TaggedTemplateExpression extends BaseExpression {
420
- type: "TaggedTemplateExpression";
421
- tag: Expression;
422
- quasi: TemplateLiteral;
423
- }
424
- interface TemplateElement extends BaseNode {
425
- type: "TemplateElement";
426
- tail: boolean;
427
- value: {
428
- /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */cooked?: string | null | undefined;
429
- raw: string;
430
- };
431
- }
432
- interface AssignmentProperty extends Property {
433
- value: Pattern;
434
- kind: "init";
435
- method: boolean; // false
436
- }
437
- interface ObjectPattern extends BasePattern {
438
- type: "ObjectPattern";
439
- properties: Array<AssignmentProperty | RestElement>;
440
- }
441
- interface ArrayPattern extends BasePattern {
442
- type: "ArrayPattern";
443
- elements: Array<Pattern | null>;
444
- }
445
- interface RestElement extends BasePattern {
446
- type: "RestElement";
447
- argument: Pattern;
448
- }
449
- interface AssignmentPattern extends BasePattern {
450
- type: "AssignmentPattern";
451
- left: Pattern;
452
- right: Expression;
453
- }
454
- interface BaseClass extends BaseNode {
455
- superClass?: Expression | null | undefined;
456
- body: ClassBody;
457
- }
458
- interface ClassBody extends BaseNode {
459
- type: "ClassBody";
460
- body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
461
- }
462
- interface MethodDefinition extends BaseNode {
463
- type: "MethodDefinition";
464
- key: Expression | PrivateIdentifier;
465
- value: FunctionExpression;
466
- kind: "constructor" | "method" | "get" | "set";
467
- computed: boolean;
468
- static: boolean;
469
- }
470
- interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
471
- type: "ClassDeclaration";
472
- /** It is null when a class declaration is a part of the `export default class` statement */
473
- id: Identifier | null;
474
- }
475
- interface ClassDeclaration extends MaybeNamedClassDeclaration {
476
- id: Identifier;
477
- }
478
- interface ClassExpression extends BaseClass, BaseExpression {
479
- type: "ClassExpression";
480
- id?: Identifier | null | undefined;
481
- }
482
- interface MetaProperty extends BaseExpression {
483
- type: "MetaProperty";
484
- meta: Identifier;
485
- property: Identifier;
486
- }
487
- interface ImportExpression extends BaseExpression {
488
- type: "ImportExpression";
489
- source: Expression;
490
- options?: Expression | null | undefined;
491
- }
492
- interface AwaitExpression extends BaseExpression {
493
- type: "AwaitExpression";
494
- argument: Expression;
495
- }
496
- //#endregion
497
- //#region src/createRule.d.ts
498
- type ASTBodyExpression = Expression & {
499
- properties: ASTBodyProperty[];
500
- };
501
- type ASTBodyProperty = AST.JSONProperty & {
502
- value: string;
503
- };
504
- interface ASTBodyStatement extends ExpressionStatement {
505
- expression: ASTBodyExpression;
506
- }
507
- interface PackageAST extends AST$1.Program {
508
- body: [ASTBodyStatement];
509
- }
510
- interface PackageJsonPluginSettings {
511
- /**
512
- * Whether `require-*` rules, if used, should enforce the presence of
513
- * the corresponding property *in package.json files with `"private": true`*.
514
- *
515
- * If not specified, it will not enforce the presence only of `name` and `version` properties.
516
- */
517
- enforceForPrivate?: boolean;
518
- }
519
- interface PackageJsonRuleContext<Options extends unknown[] = unknown[]> extends Rule.RuleContext {
520
- options: Options;
521
- settings: {
522
- packageJson?: PackageJsonPluginSettings;
523
- };
524
- sourceCode: PackageJsonSourceCode;
525
- }
526
- interface PackageJsonRuleModule<Options extends unknown[] = unknown[], Schema extends JSONSchema[] = JSONSchema[]> {
527
- create(context: PackageJsonRuleContext<Options>): RuleListener;
528
- meta: Omit<Rule.RuleMetaData, 'defaultOptions' | 'docs' | 'schema'> & {
529
- defaultOptions?: NoInfer<Options>;
530
- docs?: Rule.RuleMetaData['docs'] & {
531
- category?: string; /** An optional route segment to group this rule under */
532
- ruleGroup?: string;
533
- };
534
- schema?: Schema;
535
- };
536
- }
537
- interface PackageJsonSourceCode extends SourceCode {
538
- ast: PackageAST;
539
- }
540
- //#endregion
541
- export { PackageJsonRuleModule as n, JSONSchema as r, PackageJsonPluginSettings as t };