Config file not found in project root, instead looking in node_modules folder
See original GitHub issueWhich version of lesshint
are you using?
Using Lesshint 3.1.1
How are you running lesshint
? CLI, Node.js API, Grunt/Gulp plugin?
via npm start - lesshint is being run via lesshint-webpack-plugin
If you’re reporting a bug, please show us some code that’s failing.
module.exports = function (path) {
path = path || process.cwd();
const stats = fs.statSync(path);
let config;
if (stats.isFile()) {
// A file was passed, try to load it
config = loadConfig(path);
} else {
// Try to find a config file instead
const rcfinder = new RcFinder('.lesshintrc', {
loader: loadConfig
});
config = rcfinder.find(path);
}
return config;
};
What did you expect to happen?
I am running webpack
from a webpack.config.js
file and using the lesshint-webpack-plugin
in my plugins. From the documentation, lesshint should look for a .lesshintrc
file in my project root (ie. same folder as the webpack config file), however it does not see my .lesshintrc file.
When debugging the config-loader.js
file of lesshint, I noticed that the process.cwd() seems to return the lesshint plugin in the node_modules
directory, instead of the top level project root folder, thus it cannot find my .lesshintrc file and just uses the default.
is this a bug or working properly? i don’t mind setting the path to a .json file instead, however i thought it’s supposed to just look for my file directly, and documentation seemed to suggest that that’s how it should work.
Thanks guys 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Ahh nice! thanks 😃 Will do.
@shellscape Good idea! I’ll reach out to them.