Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1057707: eslint is incompatible with node-ajv >= 8

89 views
Skip to first unread message

Yadd

unread,
Dec 7, 2023, 6:50:05 AM12/7/23
to
Package: eslint
Version: 6.4.0~dfsg+~6.1.9-7
Severity: important
Tags: ftbfs upstream

Hi,

eslint depends on node-ajv 6 and is incompatible with node-ajv 8
(available in exeprimental branch). All is in lib/shared/ajv.js:

- eslint requires 'ajv/lib/refs/json-schema-draft-04.json' which is no
more available
- eslint tries to set `ajv._opts.defaultMeta` which is
`ajv.opts.defaultMeta` in node-ajv 8.

Changing "ajv/lib/refs/json-schema-draft-04.json" to
"ajv/lib/refs/json-schema-draft-06.json" doesn't work. I tried this
patch which looks to work but 27 tests fail (not the good error string).
It uses default ajv schemas.

Help needed here ;-)

--- a/lib/shared/ajv.js
+++ b/lib/shared/ajv.js
@@ -8,8 +8,7 @@
// Requirements
//------------------------------------------------------------------------------

-const Ajv = require("ajv"),
- metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
+const Ajv = require("ajv");

//------------------------------------------------------------------------------
// Public Interface
@@ -17,6 +16,7 @@

module.exports = (additionalOptions = {}) => {
const ajv = new Ajv({
+ strict: false,
meta: false,
useDefaults: true,
validateSchema: false,
@@ -26,9 +26,5 @@
...additionalOptions
});

- ajv.addMetaSchema(metaSchema);
- // eslint-disable-next-line no-underscore-dangle
- ajv._opts.defaultMeta = metaSchema.id;
-
return ajv;
};

Jérémy Lal

unread,
Dec 7, 2023, 7:20:06 AM12/7/23
to
Le jeu. 7 déc. 2023 à 12:45, Yadd <ya...@debian.org> a écrit :
Package: eslint
Version: 6.4.0~dfsg+~6.1.9-7
Severity: important
Tags: ftbfs upstream

Hi,

eslint depends on node-ajv 6 and is incompatible with node-ajv 8
(available in exeprimental branch). All is in lib/shared/ajv.js:

 - eslint requires 'ajv/lib/refs/json-schema-draft-04.json' which is no
   more available
 - eslint tries to set `ajv._opts.defaultMeta` which is
   `ajv.opts.defaultMeta` in node-ajv 8.

Changing "ajv/lib/refs/json-schema-draft-04.json" to
"ajv/lib/refs/json-schema-draft-06.json" doesn't work. I tried this
patch which looks to work but 27 tests fail (not the good error string).
It uses default ajv schemas.

Help needed here ;-)

Jonas Smedegaard

unread,
Dec 7, 2023, 7:10:05 PM12/7/23
to
Quoting Yadd (2023-12-07 14:37:31)
> Control: tags -1 + patch
>
> On 12/7/23 15:52, Jérémy Lal wrote:
> >
> >
> > Le jeu. 7 déc. 2023 à 12:45, Yadd <ya...@debian.org
> > <mailto:ya...@debian.org>> a écrit :
> >
> > Package: eslint
> > Version: 6.4.0~dfsg+~6.1.9-7
> > Severity: important
> > Tags: ftbfs upstream
> >
> > Hi,
> >
> > eslint depends on node-ajv 6 and is incompatible with node-ajv 8
> > (available in exeprimental branch). All is in lib/shared/ajv.js:
> >
> >  - eslint requires 'ajv/lib/refs/json-schema-draft-04.json' which is no
> >    more available
> >  - eslint tries to set `ajv._opts.defaultMeta` which is
> >    `ajv.opts.defaultMeta` in node-ajv 8.
> >
> > Changing "ajv/lib/refs/json-schema-draft-04.json" to
> > "ajv/lib/refs/json-schema-draft-06.json" doesn't work. I tried this
> > patch which looks to work but 27 tests fail (not the good error string).
> > It uses default ajv schemas.
> >
> > Help needed here ;-)
> >
> >
> > <https://github.com/eslint/eslint/pull/13911/commits>
> > ?
>
> Thanks a lot Jérémy! Based on your suggestion, I succeed to build a patch.
>
> @Jonas, do you agree if I push this to experimental ?

If it succeeds the testsuite then by all means, go for it.

But if not, then instead please let's look in more detail at the
options, to avoid complicating matters for this delicate beast.

- Jonas

--
* Jonas Smedegaard - idealist & Internet-arkitekt
* Tlf.: +45 40843136 Website: http://dr.jones.dk/
* Sponsorship: https://ko-fi.com/drjones

[x] quote me freely [ ] ask before reusing [ ] keep private
signature.asc

Jonas Smedegaard

unread,
Dec 8, 2023, 2:30:05 PM12/8/23
to
Quoting Yadd (2023-12-08 03:55:11)
> On 12/8/23 03:59, Jonas Smedegaard wrote:
>> Quoting Yadd (2023-12-07 14:37:31)
>>> @Jonas, do you agree if I push this to experimental ?
>>
>> If it succeeds the testsuite then by all means, go for it.
>
> sure, all test passed now. Only error strings had to be updated

Great! Thanks a lot for working on this.
signature.asc
0 new messages