-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autodiscovery of *.js configs #97
Comments
Alternatively, we could probably allow this in "@company/markdownlint-config" Ideally, this should resolve to discovered package dir → |
I don’t want to knowingly expose a security vulnerability (even if other packages do), but I’m not sure we need to. If I understand correctly, you are OK with the way this feature works in the CLI today, but are concerned with how it would work in the VS Code extension. I think this is a similar situation as custom rules which are already implemented in both places. Using a custom rule with the CLI requires passing a command line argument; doing so in the extension pops a dialog that asks the user to confirm they are going to run external code. They can allow it once or allow it permanently for that project. I think a similar approach should work here – if the JS config file is detected by the extension, prompt the user to confirm it should be used. If so, then it can be loaded and executed similarly to how the CLI handles this. Does that seem like it would work? |
👋 @DavidAnson, thanks for your reply! I understand your motivation to not add The only reason why I was wondering about At the moment, if we store config in the autodiscoverable {
"extends": "@company/markdownlint-config",
"some-extra-rule": true
} It has to be: {
"extends": "./node_modules/@company/markdownlint-config/whatever.json",
"some-extra-rule": true
} Such a hardcoded file exposes unnecessary details and is thus less friendly and more fragile. Config autodiscovery is an important feature IMHO, because it lets CLI and the editor stick with the same set of rules without any action from the user. Because of that, WDYT of applying |
I like the idea, but have a question. In the |
When you call |
That’s great, but it feels like there will need to be two different types of packages: one that executes code in order to support the existing |
Conceptually yes, there could be two types of packages: those saying Giving feedback on importing a I was playing with {
"extends": "./packages/markdownlint-config/index.js"
} This was failing silently without any message about the impossibility of extending So I see two independent themes here:
Here is the essence of the second theme. Current instructions for the shared config: README.md |
I like your idea of switching to |
@kachkaev, in thinking about this in the context of Doing the same thing for |
I see your point @DavidAnson. WDYT of replacing |
The way I read the documentation, replacing one call with the other would break some path scenarios that work today. I'm thinking that it may be necessary to use both approaches in order to preserve support for paths and also add the support for modules as you are asking. |
So, just to be clear, is this issue resolved by #342? |
I don't think this issue is resolved: the |
I’m working on creating
@company/markdownlint-config
and have a question about this statement in the docs:Given this limitation, it’s unclear how to keep the CLI config in sync with the editor integration (e.g. the VSCode one). Tools like Prettier and ESlint autoload
*.js
configs and it not a security concern for them. Because CLI does this, so can the editor.Meanwhile, creating a custom package with the config and referring to it in a js files is problematic. While it is possible to feed this ‘unsafe’ file to CLI via
--config
, the editor won’t see this and will report wrong problems as you type. Ideally, I’d like to allow users of a shared config to just do this:Could
.js
files be made autodiscoverable too? I understand that theoretically this is a security hole of some sort, but the experience of other tools suggests that it’s fine in practice.cc @alejandroclaro (author of #85) and @DavidAnson (author of a1f9a15)
The text was updated successfully, but these errors were encountered: