ajv-validator / ajv-validator/ajv

makeValidate is blocked in WebExtension context

Aperta
#2,547 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
14.8k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

An issue occurs in bundling ESLint for WebExtension use.

It appears that ESLint is depending [Ajv](https://github.com/eslint/eslint/blob/910bd13c4cb49001f2a9f172229360771b857585/package.json#L120) to [validate ESLint configurations](https://github.com/eslint/eslint/blob/910bd13c4cb49001f2a9f172229360771b857585/lib/config/rule-validator.js#L158) by matching them to a JSON schema. Ajv [uses Function()](https://github.com/ajv-validator/ajv/blob/82735a15826a30cc51e97a1bbfb59b3d388e4b98/lib/compile/index.ts#L171) to compile JSON schemas into JavaScript functions.

The `new Function()` is blocked by the browser CSP which results in a `throw`.

An alternative method (for the WebExtension context) would be greatly beneficial.

See also: [Errors with eslint-linter-browserify](https://github.com/UziTech/eslint-linter-browserify/issues/519)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.