-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Support EditorConfig #61
Comments
👍 on having a way to pull outside settings to inform how to generate output. I'd be cautious on hard coding it to be editorconfig exclusive.
I'd lean towards this. |
I see remark/rehype as formatters on the same level as prettier or dprint. |
EditorConfig is a tool which tries to standardize settings across editors, but like many post-facto standards, not everybody uses it EditorConfig may be a good default, but it is not the only configuration option out there, with each editor having their own settings file which the information could be pulled from.
It somewhat is, that said, remark/rehype could be configured to automatically generate content more similar (not identical) to how dprint or prettier would. |
I don’t understand, so perhaps these questions can help me understand:
|
I especially don’t understand the meme here. There is but one standard for sharing settings across editors and tools: EditorConfig. |
Each editor has its own standard, which it and maybe a few others follow. That's not to say editor config is bad, just that it isn't universal, and potentially growing more niche (currently). |
I don’t think that tools should be called standards. Prettier is not a standard. Chrome is not a standard. EditorConfig is a standard. Prettier, VS Code, and other tools support EditorConfig. I’d like to support it too. Can we focus on the other parts of the issue too? Perhaps by looking at the questions I asked in my last comments, and seeing how EditorConfig/prettier/VS Code/dprint can solve them? |
Did you read my previous answers? They addressed most of your questions before you asked them, to re-iterate for your convenience.
Through a settings plugin, which reads a configuration file from another tool, and translates it to remark settings.
A settings transform would
settings plugin would likely be lowest precedence
As many as the community wants to create plugins for, starting with one, editorconfig.
Whether someone feels like creating a settings plugin
Maybe, again standardized is not the same widely-adopted. |
No need to be (passive) aggressive.
This answers how custom config can be loaded. I am interested in how you would see such a plugin, sure, but I am particularly interested in what benefit In the original post, I describe that Here you propose a unified plugin, which could exist in userland, that is connected to a certain tool or editor, and to remark. This proposed plugin does not work with the engine, so it seems out of place of the discussion here in this issue tracker?
I do indeed see the target audience of unified as the JavaScript community, yes. |
I'm responding to you stonewalling concerns with a wall of tangential question, any of which go unanswered you'll ignore the over arching concern.
To repeat and make it very clear, I'm currently 👎 on this being a part of unified engine, this should be in userland, for the variety of reasons stated before.
Potentially yes, I don't have any specific fields in mind.
It is also adopted in the Python community (often via pre-commit) and at times in the Java community via gradle/maven plugins. |
This last phrase is ungrammatical, I don’t understand what you mean. Can you rephrase it and explain what you see as the “over arching concern”? Stonewalling is, apparently, the act of avoiding conversation. I have questions. You don’t answer them.
On the point made in this paragraph: this point is new. You are changing the goal posts. Previously you advocated for other things than editorconfig. Now you advocate against configuration files. On your vote: the unified collective uses a consensus-seeking approach, you are supposed to build consensus and to work on an acceptable solution (https://github.com/unifiedjs/collective/blob/main/decisions.md#initiatives).
These points are new. They are solvable. We could have a dialogue on how they can be solved. |
That editorconfig should not be the single editor language supported nor should it be enabled by default.
I have answered each of them. Stonewalling in a deflecting sense, you go on tangents about your definition of standards, re-ask questions which have already been answered previously (or by the issue itself even), seemly to avoid the conversation of why this is needed as a core feature, and not in userland/a plugin.
I'm advocating for both supporting more configuration languages, and not enabling this by default/in unified engine.
Thanks for linking to the guide.
Great, share the intended solution.
As a part of unified engine?
A potential scenario. |
The issue body contains: “Some of those can be done by the engine (
Note: earlier I believed prettier defaulted to not using editorconfig and that xo turned it on, this was incorrect: prettier itself uses editorconfig by default. It is on by default and can be turned off with an option. I want the same for
It has many options. It can have an
I am not proposing for an external download. Similar to how, say,
Say that locally an editorconfig/prettier configuration is used, and remotely no editorconfig/prettier configuration is used, I believe it is expected that prettier produces differing results.
I don’t think this is confusing. An editorconfig is chosen by a team. It gives a few instructions to humans and tools. Maybe a new contributor hasn’t installed the plugin but then tooling like prettier/remark/rehype makes sure the changed code does follow the style guide. |
I don't see one, nor am I advocating for it.
I don't really understand your question. remark should only use non-remarkrc files/properties, only when explicitly told to.
They don't need to be, you shouldn't need a file other than a remark configuration file to configure remark.
I'm fine with the order of precedence/operations.
Prettier is explicitly a formatter, it is expected to make stylistic changes to files. An even an explicit formatter, like prettier, I have mixed feelings about it reading editorconfig.
Setting aside the default value for a moment.
Editor config itself needs a parser to be loaded, a miniture runtime, not to mention some potentially complex rules to ensure we match globbed settings correctly. (similar to #56)
ESLint does not by default eslint/eslint#8941, nor does babel (AFAICT)
Any configuration file gives instructions for tools or a team. |
Why impose such a limit? That only code editors are allowed to look at shared code style configuration? The engine is frequently used in editors or acts as a user agent for editing. Say I typically like 2 spaces. This project likes 4 spaces. It has an
Why? It is not unheard of for projects to load similar files. Other than
I don’t see reasons for projects like
The code needed to resolve editorconfig files is normal sized and stable: https://github.com/editorconfig/editorconfig-core-js/blob/master/src/index.ts. The quality is good enough for Prettier, Renovate, and many other dependants, it’s in 400k repos already. The packagephobia of (I don’t understand the term “miniture runtime” in this context?)
I am not sure what the term “transformer” means in this context. Or why The historic issues about CSTs cannot be solved with an AST. The issues could be ignored. Or unified could become better at formatting. Which is what I am working on (see the problem space of the issue body). As linked, I am adding the features that are configured in editorconfig files.
I agree that it is convoluted. It could also be a small package, used in and shared between
The point I attempted to make here was about config files in general, and that whether you ship them to a CI or not, affects how that tool runs on a CI.
I don’t get this point. That only editors are allowed to use |
It is named editorconfig for a reason, it is literally intended to be information for code editors.
As far as I'm aware, engine was first used in editors with the additional of the language server. Engine is still primarily used in the context of CLIs and build tools, which are not code editors.
No it is not.
To repeat a point you make frequently Titus. Your arguments seem to center around unified only being a formatter, but it isn't.
Yeah, having this live in the stringifiers themselves would make that clearer.
I agree, and my point is that folks generally won't expect dev tools options to be needed for CI, unless it is explicitly stated. |
I see
That they are different can be observed by how they are used: IntelliJ supports
The engine is in use in editors through several projects already. I know of several Atom, VS Code, and SublimeText projects, that I either made myself, or by others.
Formatting is also expected when transforming from markdown to HTML or vice versa.
I don’t understand the point you are trying to make. Attempting to make it more concrete with an example, I get: “my point is that folks generally won't expect {Jest,ESLint,prettier,remark} options to be needed for CI, unless it is explicitly stated.”? It seems normal to expect that when tools are used somewhere, they are configured? |
This is neither here nor there.
editorconfig can be intended for multiple editor projects, that doesn't make it intended for non-editor projects.
There are two kinds of vscode config files, the personal config file in a developers home folder, and a workspace config in a project folder.
They are a part of the process.
All of the projects you reference are, linters, not compilers/formatters
The only one that gets into formatting is the more recent https://github.com/remarkjs/vscode-remark Which again, I could see a preset reading editorconfig for remark-lint or for remark-stringify.
To give another concrete example of why this would be unexpected. I would only expect a config file for another project to affect remark if a setting |
It’s an important aspect that editorconfig is nothing on its own except for the different tools that implemented it, and that VS Code config is config for that particular tool and not meant for other tools.
Your interpretation of Users edit files through tools. Users configure tools through config files. Some of those files are shared between tools.
I’ve looked at some examples and you are right that workspace config is indeed shared.
I believe this to be incorrect. Why do you believe this? When the statement is correct, that folks would only lint, then they wouldn’t be affected by
Your mixing things: how unified / unified-engine is used (which is not only through editors) and which editor integrations currently exist. Looking at existing tooling within a certain space does not mean that tooling can’t be improved or expanded upon. If formatting gets better, linting doesn’t get worse.
At this point it seems like you: a) don’t use unified to format things, b) don’t use editorconfig at all?
If a CI/CD process deals with code style, and these folks have an
Yes. Just like a This change improves how unified is used for folks that do use editorconfig and do format. It allows for folks to run it with less config files. Or at least to not have to duplicate configuration. |
Yes, its intent to work with editors/IDEs is literally in the name and in the description.
Again, unified is different from either of those.
non sequitur. It is also a straw-man.
editorconfig has settings unified won't leverage, vscode workspace settings has settings unified won't leverage. 🤷♂️
I do use unified to format things at times, and do sometimes use editorconfig.
Agreed |
Initial checklist
Problem
EditorConfig defines certain code-style preferences.
Some of those can be done by the engine (
charset
,insert_final_newline
).Others by the processor (syntax-tree/mdast-util-to-markdown#51, syntax-tree/mdast-util-to-markdown#50; what about HTML though where the whitespace is part of the AST?).
Some are ambiguous (
end_of_line
).Solution
Can we load (as an option), editorconfig files, and pass their keys, camelcased, to settings?
That passes them to
*-parse
and*-stringify
.We could pass a nested object if there’s fear that it would conflict, but I don’t think it does?
Alternatives
remark-cli
to the engine) that transform an EditorConfig into certain settings? Could be modules, e.g., callededitorconfig-to-remark-settings
or so?The text was updated successfully, but these errors were encountered: