@eslint/json 0.13.2 → 0.14.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  This package contains a plugin that allows you to natively lint JSON, JSONC, and JSON5 files using ESLint.
6
6
 
7
- **Important:** This plugin requires ESLint v9.6.0 or higher and you must be using the [new configuration system](https://eslint.org/docs/latest/use/configure/configuration-files).
7
+ **Important:** This plugin requires ESLint v9.15.0 or higher and you must be using the [new configuration system](https://eslint.org/docs/latest/use/configure/configuration-files).
8
8
 
9
9
  ## Installation
10
10
 
@@ -294,9 +294,9 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).
294
294
 
295
295
  <h3>Platinum Sponsors</h3>
296
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>
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>
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>
299
- <p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
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://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
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/2d6c3b6/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>
299
+ <p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
300
300
  <h3>Technology Sponsors</h3>
301
301
  Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
302
302
  <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * @import { DocumentNode, AnyNode, Token, MemberNode } from "@humanwhocodes/momoa"
4
- * @import { SourceLocation, FileProblem, DirectiveType, RulesConfig, Language, OkParseResult, ParseResult, File } from "@eslint/core"
3
+ * @import { DocumentNode, AnyNode, Token, LocationRange, MemberNode } from "@humanwhocodes/momoa"
4
+ * @import { FileProblem, DirectiveType, RulesConfig, Language, OkParseResult, ParseResult, File } from "@eslint/core"
5
5
  * @import { JSONSyntaxElement, JSONRuleDefinition } from "./types.ts"
6
6
  */
7
7
  'use strict';
@@ -147,7 +147,7 @@ class JSONSourceCode extends pluginKit.TextSourceCodeBase {
147
147
  * @param {DocumentNode} options.ast The root AST node.
148
148
  */
149
149
  constructor({ text, ast }) {
150
- super({ text, ast });
150
+ super({ text, ast, lineEndingPattern: /\r\n|[\r\n]/u });
151
151
  this.ast = ast;
152
152
 
153
153
  const { comments, starts, ends } = processTokens(this.ast.tokens ?? []);
@@ -247,13 +247,13 @@ class JSONSourceCode extends pluginKit.TextSourceCodeBase {
247
247
  /**
248
248
  * Returns inline rule configurations along with any problems
249
249
  * encountered while parsing the configurations.
250
- * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:SourceLocation}>}} Information
250
+ * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:LocationRange}>}} Information
251
251
  * that ESLint needs to further process the rule configurations.
252
252
  */
253
253
  applyInlineConfig() {
254
254
  /** @type {Array<FileProblem>} */
255
255
  const problems = [];
256
- /** @type {Array<{config:{rules:RulesConfig},loc:SourceLocation}>} */
256
+ /** @type {Array<{config:{rules:RulesConfig},loc:LocationRange}>} */
257
257
  const configs = [];
258
258
 
259
259
  this.getInlineConfigNodes().forEach(comment => {
@@ -754,12 +754,16 @@ const rule$3 = {
754
754
  additionalProperties: false,
755
755
  },
756
756
  ],
757
+
758
+ defaultOptions: [
759
+ {
760
+ form: "NFC",
761
+ },
762
+ ],
757
763
  },
758
764
 
759
765
  create(context) {
760
- const form = context.options.length
761
- ? context.options[0].form
762
- : undefined;
766
+ const [{ form }] = context.options;
763
767
 
764
768
  return {
765
769
  Member(node) {
@@ -1241,7 +1245,7 @@ var rules = {
1241
1245
  const plugin = {
1242
1246
  meta: {
1243
1247
  name: "@eslint/json",
1244
- version: "0.13.2", // x-release-please-version
1248
+ version: "0.14.0", // x-release-please-version
1245
1249
  },
1246
1250
  languages: {
1247
1251
  json: new JSONLanguage({ mode: "json" }),
@@ -163,7 +163,7 @@ export class JSONSourceCode extends TextSourceCodeBase<{
163
163
  /**
164
164
  * Returns inline rule configurations along with any problems
165
165
  * encountered while parsing the configurations.
166
- * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:SourceLocation}>}} Information
166
+ * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:LocationRange}>}} Information
167
167
  * that ESLint needs to further process the rule configurations.
168
168
  */
169
169
  applyInlineConfig(): {
@@ -172,7 +172,7 @@ export class JSONSourceCode extends TextSourceCodeBase<{
172
172
  config: {
173
173
  rules: RulesConfig;
174
174
  };
175
- loc: SourceLocation;
175
+ loc: LocationRange;
176
176
  }>;
177
177
  };
178
178
  /**
@@ -238,7 +238,7 @@ import { TextSourceCodeBase } from '@eslint/plugin-kit';
238
238
  import type { FileProblem } from "@eslint/core";
239
239
  import { Directive } from '@eslint/plugin-kit';
240
240
  import type { RulesConfig } from "@eslint/core";
241
- import type { SourceLocation } from "@eslint/core";
241
+ import type { LocationRange } from "@humanwhocodes/momoa";
242
242
  import type { AnyNode } from "@humanwhocodes/momoa";
243
243
  /**
244
244
  * A class to represent a step in the traversal process.
@@ -163,7 +163,7 @@ export class JSONSourceCode extends TextSourceCodeBase<{
163
163
  /**
164
164
  * Returns inline rule configurations along with any problems
165
165
  * encountered while parsing the configurations.
166
- * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:SourceLocation}>}} Information
166
+ * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:LocationRange}>}} Information
167
167
  * that ESLint needs to further process the rule configurations.
168
168
  */
169
169
  applyInlineConfig(): {
@@ -172,7 +172,7 @@ export class JSONSourceCode extends TextSourceCodeBase<{
172
172
  config: {
173
173
  rules: RulesConfig;
174
174
  };
175
- loc: SourceLocation;
175
+ loc: LocationRange;
176
176
  }>;
177
177
  };
178
178
  /**
@@ -238,7 +238,7 @@ import { TextSourceCodeBase } from '@eslint/plugin-kit';
238
238
  import type { FileProblem } from "@eslint/core";
239
239
  import { Directive } from '@eslint/plugin-kit';
240
240
  import type { RulesConfig } from "@eslint/core";
241
- import type { SourceLocation } from "@eslint/core";
241
+ import type { LocationRange } from "@humanwhocodes/momoa";
242
242
  import type { AnyNode } from "@humanwhocodes/momoa";
243
243
  /**
244
244
  * A class to represent a step in the traversal process.
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * @import { DocumentNode, AnyNode, Token, MemberNode } from "@humanwhocodes/momoa"
4
- * @import { SourceLocation, FileProblem, DirectiveType, RulesConfig, Language, OkParseResult, ParseResult, File } from "@eslint/core"
3
+ * @import { DocumentNode, AnyNode, Token, LocationRange, MemberNode } from "@humanwhocodes/momoa"
4
+ * @import { FileProblem, DirectiveType, RulesConfig, Language, OkParseResult, ParseResult, File } from "@eslint/core"
5
5
  * @import { JSONSyntaxElement, JSONRuleDefinition } from "./types.ts"
6
6
  */
7
7
  // @ts-self-types="./index.d.ts"
@@ -144,7 +144,7 @@ class JSONSourceCode extends TextSourceCodeBase {
144
144
  * @param {DocumentNode} options.ast The root AST node.
145
145
  */
146
146
  constructor({ text, ast }) {
147
- super({ text, ast });
147
+ super({ text, ast, lineEndingPattern: /\r\n|[\r\n]/u });
148
148
  this.ast = ast;
149
149
 
150
150
  const { comments, starts, ends } = processTokens(this.ast.tokens ?? []);
@@ -244,13 +244,13 @@ class JSONSourceCode extends TextSourceCodeBase {
244
244
  /**
245
245
  * Returns inline rule configurations along with any problems
246
246
  * encountered while parsing the configurations.
247
- * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:SourceLocation}>}} Information
247
+ * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:LocationRange}>}} Information
248
248
  * that ESLint needs to further process the rule configurations.
249
249
  */
250
250
  applyInlineConfig() {
251
251
  /** @type {Array<FileProblem>} */
252
252
  const problems = [];
253
- /** @type {Array<{config:{rules:RulesConfig},loc:SourceLocation}>} */
253
+ /** @type {Array<{config:{rules:RulesConfig},loc:LocationRange}>} */
254
254
  const configs = [];
255
255
 
256
256
  this.getInlineConfigNodes().forEach(comment => {
@@ -751,12 +751,16 @@ const rule$3 = {
751
751
  additionalProperties: false,
752
752
  },
753
753
  ],
754
+
755
+ defaultOptions: [
756
+ {
757
+ form: "NFC",
758
+ },
759
+ ],
754
760
  },
755
761
 
756
762
  create(context) {
757
- const form = context.options.length
758
- ? context.options[0].form
759
- : undefined;
763
+ const [{ form }] = context.options;
760
764
 
761
765
  return {
762
766
  Member(node) {
@@ -1238,7 +1242,7 @@ var rules = {
1238
1242
  const plugin = {
1239
1243
  meta: {
1240
1244
  name: "@eslint/json",
1241
- version: "0.13.2", // x-release-please-version
1245
+ version: "0.14.0", // x-release-please-version
1242
1246
  },
1243
1247
  languages: {
1244
1248
  json: new JSONLanguage({ mode: "json" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/json",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "JSON linting plugin for ESLint",
5
5
  "author": "Nicholas C. Zakas",
6
6
  "type": "module",
@@ -62,14 +62,14 @@
62
62
  "build:cts": "node tools/build-cts.js",
63
63
  "build:rules": "node tools/build-rules.js",
64
64
  "build": "npm run build:rules && rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
65
- "build:readme": "node tools/update-readme.js",
66
65
  "build:update-rules-docs": "node tools/update-rules-docs.js",
67
66
  "prepare": "npm run build",
68
67
  "pretest": "npm run build",
69
68
  "lint": "eslint",
69
+ "lint:fix": "eslint --fix",
70
70
  "fmt": "prettier --write .",
71
71
  "fmt:check": "prettier --check .",
72
- "test": "mocha tests/**/*.js",
72
+ "test": "mocha \"tests/**/*.test.js\"",
73
73
  "test:coverage": "c8 npm test",
74
74
  "test:jsr": "npx jsr@latest publish --dry-run",
75
75
  "test:types": "tsc -p tests/types/tsconfig.json"
@@ -83,23 +83,22 @@
83
83
  ],
84
84
  "license": "Apache-2.0",
85
85
  "dependencies": {
86
- "@eslint/core": "^0.15.2",
87
- "@eslint/plugin-kit": "^0.3.5",
88
- "@humanwhocodes/momoa": "^3.3.9",
86
+ "@eslint/core": "^0.17.0",
87
+ "@eslint/plugin-kit": "^0.4.1",
88
+ "@humanwhocodes/momoa": "^3.3.10",
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.31.0",
95
- "eslint-config-eslint": "^12.0.0",
94
+ "eslint": "^9.36.0",
95
+ "eslint-config-eslint": "^13.0.0",
96
96
  "eslint-plugin-eslint-plugin": "^6.3.2",
97
- "got": "^14.4.2",
98
97
  "lint-staged": "^15.2.7",
99
98
  "mdast-util-from-markdown": "^2.0.2",
100
99
  "mocha": "^11.3.0",
101
100
  "prettier": "^3.4.1",
102
- "rollup": "^4.41.0",
101
+ "rollup": "^4.52.3",
103
102
  "rollup-plugin-copy": "^3.5.0",
104
103
  "rollup-plugin-delete": "^3.0.1",
105
104
  "typescript": "^5.9.2",