-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Concept of Eco-System
Summary
This issue will be very huge and explains what I (@Shinigami92) think would be a really leading way of which direction this tool can grow.
Motivation
Nowadays there are many linters out there but only for one or few languages.
Therefore when working e.g. on a frontend project, you need to choose eslint, htmllint, stylelint and some others and you also need to setup different schemas of configurations.
Detailed Design
- Do not prefer any language, do not provide them from core
- Plugin-System
- Providers
- Core-API
- Editor-Extensions
- Rules and Rule Severities
- Documentation / Website
- Focus on linting / hinting.
Do not prefer any language, do not provide them from core
We should create a core that doesn't prefer or support any language by default.
Also javascript should be a plugin on it's own.
Plugin-System
We should think about a plugin structure so the core can load them on demand and provide lint messages for different langauges.
First idea would be to scan node_modules folder and search for packages like @linter/plugin-{lang} and linter-plugin-{lang}.
Keep in mind that there are also languages like objective-c, so there could be a plugin like @linter/plugin-objective-c 🤔
The core collects all scoped files (with glob pattern) and then emit the files to the plugins.
The plugins processes the received file and produces well defined linting information.
The core collects the results and provide these lint-information collection so a CLI or IDE/Editor extension can consume it.
Providers
This is NOT my idea! But I like the idea of provide providers for already existing linting tools. (like eslint, prettier, stylelint, htmllint, pug-lint, ...)
These provides can be like a bridge between our tool and the specific linting tool.
The provider use the underlying tool and converts the information to our well defined linting information.
Core-API
The core API should "just" emit files and receive info objects and produce consumable lint-collections.
This collection can then consumed by the CLI or any IDE/Editor extension.
The core should also handle configuration (glob-pattern (include / exclude), rulesets and so on).
Editor-Extensions
We should create extensions for big IDEs/Editors like VSCode.
Each extension can use the @linter/core under the hood and use the collection object to display messages in the related GUI.
Rules and Rule Severities
Rule structures should be well defined so they can generically consumed by the core.
Rule structure are not related to a specific language (like HTML-rules are structured that way...) -> we define the standard / structure!
Rules could be categorized into:
- fatal: broken syntax
- hinting/guiding: like warnings that help to improve code
- stylistic: info about e.g. how to format
Rules can have one of three severity levels: off, warn and error.
Idea: we could also define info 🤔 (for stylistic)
Documentation / Website to explain the concept
We should initiate a website (#8) to help customers to create plugins, rulesets, contribute to our repos and so on.
Focus on linting / hinting.
This should be a linting tool!
Formatting should be done by tools like Prettier.
We should think and plan to support auto-fixing, but this could be done in a much later planned step.
We can provide a bridge for tools like prettier, but then only to hint/guide stylistic lint messages.
Open Questions
-
How to provide different rulesets for the same langauge?
-
Because I'm not onboarded currently into the existing project, it would be helpful to get an explanation of what the project is currently doing / what direction was aimed.
Maybe I can merge some other ideas (like providers) also into my concept 🙂 -
Would someone working on a Golang, .Net, Rust, C++, PHP, etc. project install a javascript package for it's linting/formatting needs?
-
How will the config look like, will there be different config files for each language or will there be a single linter config for all languages?
-
Global vs local devDependency
Help Needed
Of course!
I never created emitters by my self, so this would be new to me.
Interessting task to tackle 🙂
Frequently Asked Questions
Currently none
Related Discussions
Currently none