Short version: If you run eslint from a subdirectory of a project, when the no-unsanitized plugin loads, it fails because of the readFileSync("./package.json") line in index.js.
This caused a problem for Thunderbird which always runs mach eslint in the comm/ subdirectory so it uses the right eslint configuration.
STR:
In a mozilla-central clone, run ../mach eslint base/content/*.js from the browser/ directory.
Fails with:
Error: Failed to load plugin 'no-unsanitized' declared in '../.eslintrc.js » plugin:mozilla/recommended': ENOENT: no such file or directory, open './package.json'
I was able to minimally reproduce with a small js project with eslint and no-unsantized as well.
I suspect the intent was to read the package.json from this package to fill in the plugin metadata version?
Bug 1921150 filed with workaround fix for Thunderbird. Workaround is to create an empty package.json prior to running eslint and then remove it.
Short version: If you run eslint from a subdirectory of a project, when the no-unsanitized plugin loads, it fails because of the readFileSync("./package.json") line in index.js.
This caused a problem for Thunderbird which always runs mach eslint in the comm/ subdirectory so it uses the right eslint configuration.
STR:
../mach eslint base/content/*.js
from the browser/ directory.Fails with: Error: Failed to load plugin 'no-unsanitized' declared in '../.eslintrc.js » plugin:mozilla/recommended': ENOENT: no such file or directory, open './package.json'
I was able to minimally reproduce with a small js project with eslint and no-unsantized as well.
I suspect the intent was to read the package.json from this package to fill in the plugin metadata version?
Bug 1921150 filed with workaround fix for Thunderbird. Workaround is to create an empty package.json prior to running eslint and then remove it.