-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allow a default config to be used #2
Conversation
Add eslint for fixing
Hey, thanks for the PR 🙂 I'll take a look at it during this week and see if it's good or if it needs some improvements |
@creativenull any comment on the PR other than code formatting/style? |
From what I see the code looks good to add default configs to the Let me add an editorconfig and lua format rules to the project and let you know when ready for you to make the formatting changes. In the meantime, you can move the eslint formatter config to a different PR. |
Great! I'll move eslint fixer to another PR. could you please ping me when you have the editorconfig? thanks! |
@creativenull go for it! thanks |
This PR's adds a default config to the plugin and an option to enable it when you init.
The default config is meant to ease the setup of diagnostics and formatting for the same standard files that are supported by the plugin.
To avoid breaking any configuration from people using the plugin, the default configuration is opt-in.
To enable this default configuration a new parameter can be passed to the init function
require'diagnosticls-nvim'.init {default_config = true}
This will internally set all the linters and formatters.
A user could change or disable specific linters or formatters by passing custom config. E.g. If eslint would like to be used to fix JS files instead of prettier, an user could write this:
note that in the previous snippet the linter is also passed. If not passed the linter will be empty: the default config containing linter and formatter as keys will be overwritten by a new table containing only formatter.
This PR also adds an additional option:
format
.The idea is, if some use wants to use the default_config for linting for not for formatting, they could pass this to the init and the plugin will not set any formatter (not even the ones passed on the setup function).
This is useful for users that'd like to use this plugin only for linting with the default config.
Note: I applied lua-format to the init.lua file.