@eslint/json 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -292,8 +292,7 @@ Apache 2.0
292
292
  The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
293
293
  to get your logo on our READMEs and [website](https://eslint.org/sponsors).
294
294
 
295
- <h3>Diamond Sponsors</h3>
296
- <p><a href="https://www.ag-grid.com/"><img src="https://images.opencollective.com/ag-grid/bec0580/logo.png" alt="AG Grid" height="128"></a></p><h3>Platinum Sponsors</h3>
295
+ <h3>Platinum Sponsors</h3>
297
296
  <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
298
297
  <p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
299
298
  <p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
@@ -32,7 +32,7 @@ var naturalCompare = require('natural-compare');
32
32
  const commentParser = new pluginKit.ConfigCommentParser();
33
33
 
34
34
  const INLINE_CONFIG =
35
- /^\s*(?:eslint(?:-enable|-disable(?:(?:-next)?-line)?)?)(?:\s|$)/u;
35
+ /^\s*eslint(?:-enable|-disable(?:(?:-next)?-line)?)?(?:\s|$)/u;
36
36
 
37
37
  /**
38
38
  * A class to represent a step in the traversal process.
@@ -196,7 +196,9 @@ class JSONSourceCode extends pluginKit.TextSourceCodeBase {
196
196
  * that ESLint needs to further process the directives.
197
197
  */
198
198
  getDisableDirectives() {
199
+ /** @type {Array<FileProblem>} */
199
200
  const problems = [];
201
+ /** @type {Array<Directive>} */
200
202
  const directives = [];
201
203
 
202
204
  this.getInlineConfigNodes().forEach(comment => {
@@ -249,7 +251,9 @@ class JSONSourceCode extends pluginKit.TextSourceCodeBase {
249
251
  * that ESLint needs to further process the rule configurations.
250
252
  */
251
253
  applyInlineConfig() {
254
+ /** @type {Array<FileProblem>} */
252
255
  const problems = [];
256
+ /** @type {Array<{config:{rules:RulesConfig},loc:SourceLocation}>} */
253
257
  const configs = [];
254
258
 
255
259
  this.getInlineConfigNodes().forEach(comment => {
@@ -804,8 +808,7 @@ const rule$3 = {
804
808
  * We separately capture the integer and fractional parts of a number, so that
805
809
  * we can check for unsafe numbers that will evaluate to Infinity.
806
810
  */
807
- const NUMBER =
808
- /^-?(?<int>0|([1-9][0-9]*))(?:\.(?<frac>[0-9]+))?(?:[eE][+-]?[0-9]+)?$/u;
811
+ const NUMBER = /^-?(?<int>0|([1-9]\d*))(?:\.(?<frac>\d+))?(?:e[+-]?\d+)?$/iu;
809
812
  const NON_ZERO = /[1-9]/u;
810
813
 
811
814
  //-----------------------------------------------------------------------------
@@ -1238,7 +1241,7 @@ var rules = {
1238
1241
  const plugin = {
1239
1242
  meta: {
1240
1243
  name: "@eslint/json",
1241
- version: "0.13.0", // x-release-please-version
1244
+ version: "0.13.2", // x-release-please-version
1242
1245
  },
1243
1246
  languages: {
1244
1247
  json: new JSONLanguage({ mode: "json" }),
@@ -7,7 +7,11 @@
7
7
  // Imports
8
8
  //------------------------------------------------------------------------------
9
9
 
10
- import type { RuleVisitor, RuleDefinition } from "@eslint/core";
10
+ import type {
11
+ CustomRuleDefinitionType,
12
+ CustomRuleTypeDefinitions,
13
+ RuleVisitor,
14
+ } from "@eslint/core";
11
15
  import type {
12
16
  DocumentNode,
13
17
  MemberNode,
@@ -68,25 +72,16 @@ export interface JSONRuleVisitor extends RuleVisitor {
68
72
  "Identifier:exit"?(node: IdentifierNode, parent?: ValueNodeParent): void;
69
73
  }
70
74
 
71
- export type JSONRuleDefinitionTypeOptions = {
72
- RuleOptions: unknown[];
73
- MessageIds: string;
74
- ExtRuleDocs: Record<string, unknown>;
75
- };
75
+ export type JSONRuleDefinitionTypeOptions = CustomRuleTypeDefinitions;
76
76
 
77
77
  export type JSONRuleDefinition<
78
78
  Options extends Partial<JSONRuleDefinitionTypeOptions> = {},
79
- > = RuleDefinition<
80
- // Language specific type options (non-configurable)
79
+ > = CustomRuleDefinitionType<
81
80
  {
82
81
  LangOptions: JSONLanguageOptions;
83
82
  Code: JSONSourceCode;
84
83
  Visitor: JSONRuleVisitor;
85
84
  Node: AnyNode;
86
- } & Required<
87
- // Rule specific type options (custom)
88
- Options &
89
- // Rule specific type options (defaults)
90
- Omit<JSONRuleDefinitionTypeOptions, keyof Options>
91
- >
85
+ },
86
+ Options
92
87
  >;
package/dist/esm/index.js CHANGED
@@ -29,7 +29,7 @@ import naturalCompare from 'natural-compare';
29
29
  const commentParser = new ConfigCommentParser();
30
30
 
31
31
  const INLINE_CONFIG =
32
- /^\s*(?:eslint(?:-enable|-disable(?:(?:-next)?-line)?)?)(?:\s|$)/u;
32
+ /^\s*eslint(?:-enable|-disable(?:(?:-next)?-line)?)?(?:\s|$)/u;
33
33
 
34
34
  /**
35
35
  * A class to represent a step in the traversal process.
@@ -193,7 +193,9 @@ class JSONSourceCode extends TextSourceCodeBase {
193
193
  * that ESLint needs to further process the directives.
194
194
  */
195
195
  getDisableDirectives() {
196
+ /** @type {Array<FileProblem>} */
196
197
  const problems = [];
198
+ /** @type {Array<Directive>} */
197
199
  const directives = [];
198
200
 
199
201
  this.getInlineConfigNodes().forEach(comment => {
@@ -246,7 +248,9 @@ class JSONSourceCode extends TextSourceCodeBase {
246
248
  * that ESLint needs to further process the rule configurations.
247
249
  */
248
250
  applyInlineConfig() {
251
+ /** @type {Array<FileProblem>} */
249
252
  const problems = [];
253
+ /** @type {Array<{config:{rules:RulesConfig},loc:SourceLocation}>} */
250
254
  const configs = [];
251
255
 
252
256
  this.getInlineConfigNodes().forEach(comment => {
@@ -801,8 +805,7 @@ const rule$3 = {
801
805
  * We separately capture the integer and fractional parts of a number, so that
802
806
  * we can check for unsafe numbers that will evaluate to Infinity.
803
807
  */
804
- const NUMBER =
805
- /^-?(?<int>0|([1-9][0-9]*))(?:\.(?<frac>[0-9]+))?(?:[eE][+-]?[0-9]+)?$/u;
808
+ const NUMBER = /^-?(?<int>0|([1-9]\d*))(?:\.(?<frac>\d+))?(?:e[+-]?\d+)?$/iu;
806
809
  const NON_ZERO = /[1-9]/u;
807
810
 
808
811
  //-----------------------------------------------------------------------------
@@ -1235,7 +1238,7 @@ var rules = {
1235
1238
  const plugin = {
1236
1239
  meta: {
1237
1240
  name: "@eslint/json",
1238
- version: "0.13.0", // x-release-please-version
1241
+ version: "0.13.2", // x-release-please-version
1239
1242
  },
1240
1243
  languages: {
1241
1244
  json: new JSONLanguage({ mode: "json" }),
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Additional types for this package.
3
3
  * @author Nicholas C. Zakas
4
4
  */
5
- import type { RuleVisitor, RuleDefinition } from "@eslint/core";
5
+ import type { CustomRuleDefinitionType, CustomRuleTypeDefinitions, RuleVisitor } from "@eslint/core";
6
6
  import type { DocumentNode, MemberNode, ElementNode, ObjectNode, ArrayNode, StringNode, NullNode, NumberNode, BooleanNode, NaNNode, InfinityNode, IdentifierNode, AnyNode, Token } from "@humanwhocodes/momoa";
7
7
  import type { JSONLanguageOptions, JSONSourceCode } from "./index.js";
8
8
  type ValueNodeParent = DocumentNode | MemberNode | ElementNode;
@@ -39,15 +39,11 @@ export interface JSONRuleVisitor extends RuleVisitor {
39
39
  "Infinity:exit"?(node: InfinityNode, parent?: ValueNodeParent): void;
40
40
  "Identifier:exit"?(node: IdentifierNode, parent?: ValueNodeParent): void;
41
41
  }
42
- export type JSONRuleDefinitionTypeOptions = {
43
- RuleOptions: unknown[];
44
- MessageIds: string;
45
- ExtRuleDocs: Record<string, unknown>;
46
- };
47
- export type JSONRuleDefinition<Options extends Partial<JSONRuleDefinitionTypeOptions> = {}> = RuleDefinition<{
42
+ export type JSONRuleDefinitionTypeOptions = CustomRuleTypeDefinitions;
43
+ export type JSONRuleDefinition<Options extends Partial<JSONRuleDefinitionTypeOptions> = {}> = CustomRuleDefinitionType<{
48
44
  LangOptions: JSONLanguageOptions;
49
45
  Code: JSONSourceCode;
50
46
  Visitor: JSONRuleVisitor;
51
47
  Node: AnyNode;
52
- } & Required<Options & Omit<JSONRuleDefinitionTypeOptions, keyof Options>>>;
48
+ }, Options>;
53
49
  export {};
package/dist/esm/types.ts CHANGED
@@ -7,7 +7,11 @@
7
7
  // Imports
8
8
  //------------------------------------------------------------------------------
9
9
 
10
- import type { RuleVisitor, RuleDefinition } from "@eslint/core";
10
+ import type {
11
+ CustomRuleDefinitionType,
12
+ CustomRuleTypeDefinitions,
13
+ RuleVisitor,
14
+ } from "@eslint/core";
11
15
  import type {
12
16
  DocumentNode,
13
17
  MemberNode,
@@ -68,25 +72,16 @@ export interface JSONRuleVisitor extends RuleVisitor {
68
72
  "Identifier:exit"?(node: IdentifierNode, parent?: ValueNodeParent): void;
69
73
  }
70
74
 
71
- export type JSONRuleDefinitionTypeOptions = {
72
- RuleOptions: unknown[];
73
- MessageIds: string;
74
- ExtRuleDocs: Record<string, unknown>;
75
- };
75
+ export type JSONRuleDefinitionTypeOptions = CustomRuleTypeDefinitions;
76
76
 
77
77
  export type JSONRuleDefinition<
78
78
  Options extends Partial<JSONRuleDefinitionTypeOptions> = {},
79
- > = RuleDefinition<
80
- // Language specific type options (non-configurable)
79
+ > = CustomRuleDefinitionType<
81
80
  {
82
81
  LangOptions: JSONLanguageOptions;
83
82
  Code: JSONSourceCode;
84
83
  Visitor: JSONRuleVisitor;
85
84
  Node: AnyNode;
86
- } & Required<
87
- // Rule specific type options (custom)
88
- Options &
89
- // Rule specific type options (defaults)
90
- Omit<JSONRuleDefinitionTypeOptions, keyof Options>
91
- >
85
+ },
86
+ Options
92
87
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/json",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "JSON linting plugin for ESLint",
5
5
  "author": "Nicholas C. Zakas",
6
6
  "type": "module",
@@ -70,8 +70,8 @@
70
70
  "fmt": "prettier --write .",
71
71
  "fmt:check": "prettier --check .",
72
72
  "test": "mocha tests/**/*.js",
73
- "test:jsr": "npx jsr@latest publish --dry-run",
74
73
  "test:coverage": "c8 npm test",
74
+ "test:jsr": "npx jsr@latest publish --dry-run",
75
75
  "test:types": "tsc -p tests/types/tsconfig.json"
76
76
  },
77
77
  "keywords": [
@@ -83,16 +83,16 @@
83
83
  ],
84
84
  "license": "Apache-2.0",
85
85
  "dependencies": {
86
- "@eslint/core": "^0.14.0",
87
- "@eslint/plugin-kit": "^0.3.1",
88
- "@humanwhocodes/momoa": "^3.3.4",
86
+ "@eslint/core": "^0.15.2",
87
+ "@eslint/plugin-kit": "^0.3.5",
88
+ "@humanwhocodes/momoa": "^3.3.9",
89
89
  "natural-compare": "^1.4.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "c8": "^10.1.3",
93
93
  "dedent": "^1.5.3",
94
- "eslint": "^9.25.1",
95
- "eslint-config-eslint": "^11.0.0",
94
+ "eslint": "^9.31.0",
95
+ "eslint-config-eslint": "^12.0.0",
96
96
  "eslint-plugin-eslint-plugin": "^6.3.2",
97
97
  "got": "^14.4.2",
98
98
  "lint-staged": "^15.2.7",
@@ -102,7 +102,7 @@
102
102
  "rollup": "^4.41.0",
103
103
  "rollup-plugin-copy": "^3.5.0",
104
104
  "rollup-plugin-delete": "^3.0.1",
105
- "typescript": "^5.8.3",
105
+ "typescript": "^5.9.2",
106
106
  "yorkie": "^2.0.0"
107
107
  },
108
108
  "engines": {