Closed localjo closed 8 years ago
Maybe this line: https://github.com/editorconfig/editorconfig-core-js/blob/master/editorconfig.js#L114
Could become something like;
var pathPrefix = '';
if (options.root !== '/') { pathPrefix = path.dirname(file.name); }
Willing to open a PR, but I'm not sure if this suggestion is completely misunderstanding or trying to apply this code to a situation it's not designed for.
I'm curious if creating a sym link to ./node_modules/@myorg/code-standards/.editorconfig
in your project root would provide the functionality that you need?
BTW – your code snippet looks like it would only cover *nix environments.
For our use case we ended up using https://github.com/AlbertoElias/gulp-lintspaces with it's built in options and we're maintaining a separate .editorconfig
file. It's less than ideal to maintain the code standards for our org in multiple places, but since they don't change often, if ever, it's an acceptable compromise for us. The symlink solution opens up a whole can of worms of making sure that the symlinks are properly created when cloning the project across platforms. Closing this issue because the overhead to find a solution that works is higher than it's worth.
This started out as me tracking down what I thought was a bug in
gulp-lintspaces
ornode-lintspaces
. Here is a thread that describes most of my issue: https://github.com/schorfES/node-lintspaces/issues/30But it turns out, this may be more of a feature request, or at least a request for clarification. My ultimate goal is to use this gulp task to apply .editorconfig rules from a project dependency to my projects themselves;
But I found that this gulp task doesn't apply the rules to all of the files in the gulp.src glob, but only if they're in the same subdirectory as the
.editorconfig
file specified in the task. I tracked that behavior down to this line https://github.com/editorconfig/editorconfig-core-js/blob/master/editorconfig.js#L87. It seems this is by design, based on how .editorconfig's default behavior is scoped. However, when including an.editorconfig
file from a dependency using something likegulp-lintspaces
, it would be nice to be able to override this default behavior and make the.editorconfig
settings apply to everything in the gulp.src. That could probably be done with some sort of key passed into the options parameter for theeditorconfig.parse()
function, likeglobal: true
, or maybe theroot
key can already be used here to achieve what I want, with only slight, or no, modification.