My project is currently using eslint v1.8.0 to analyze the test.js
file:
require('fs');
var a = 1;
Initially, my .eslintrc
file is empty:
{
}
After running eslint test.js
, I get the following errors:
1:1 error "require" is not defined no-undef
1:9 error Strings must use doublequote quotes
2:5 error "a" is defined but never used no-unused-vars
Since this is a node application, I need to customize the configuration. By running eslint --env node test.js
, I see the desired output:
1:9 error Strings must use doublequote quotes
2:5 error "a" is defined but never used no-unused-vars
By updating my .eslintrc
file to include the node environment settings:
{
"env": {
"node": true
}
}
After making this change, running estlint test.js
no longer produces any warnings. I am wondering why adding this configuration to my .eslintrc
file resolves the issues with quotes
and no-unused-vars
warnings.