Environment plugin does not work if it is a scoped package
See original GitHub issueTell us about your environment
- ESLint Version: 6.2.2
- Node Version: 12.8.0
- npm Version: 6.10.2
What parser (default, Babel-ESLint, etc.) are you using? Default
Please show your full configuration:
Attempt 1
{
"env": {
"truffle/truffle": true
},
"plugins": [
"@4cadia/eslint-plugin-truffle"
]
}
Attempt 2
{
"env": {
"@4cadia/eslint-plugin-truffle/truffle": true
},
"plugins": [
"@4cadia/eslint-plugin-truffle"
]
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
I have created a little plugin to define truffle
global variables:
module.exports = {
environments: {
truffle: {
globals: {
artifacts: 'readonly',
contract: 'readonly',
assert: 'readonly',
web3: true,
},
},
},
};
Currently, I am using npm link
to use it as a local package. The gotcha is that it was supposed to be a scoped package: @4cadia/eslint-plugin-truffle
.
Then in the actual repo which depends upon the plugin, I run it as:
eslint test/Indexer.test.js
What did you expect to happen? ESLint should use the plugin and not report any errors in the file as described in the docs.
What actually happened? Please include the actual, raw output from ESLint. I get the following error:
> Error: .eslintrc:
> Environment key "truffle/truffle" is unknown
>
The same happens if I use the "@4cadia/eslint-plugin-truffle/truffle"
env in the configuration file instead.
IMPORTANT: However, if I drop the @4cadia
scope in the package name and publish/link it as eslint-plugin-truffle
, the code from Attempt 1 works as expected.
Are you willing to submit a pull request to fix this bug?
I am not familiar with the ESLint code base. If someone could please point me to a place to start, I would be happy to contribute.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Hi @hbarcelos, thanks for the issue.
I think we should definitely support scoped packages here. We’ll mark this as accepted if we can recreate the issue.
Closing this issue as the question has been answered.