Skip to content
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 additional languages #278

Closed
pvdlg opened this issue Jan 3, 2018 · 3 comments
Closed

Support additional languages #278

pvdlg opened this issue Jan 3, 2018 · 3 comments

Comments

@pvdlg
Copy link
Contributor

pvdlg commented Jan 3, 2018

We could support markdown via remark-lint and css/sass/scss via stylelint.

By default we would lint *.css, *.sass and *.scss with stylelint-config-xo or stylelint-config-xo-space based on the space options.

We would have to create the remark-xo-config repo for the remark-link config (maybe based on awesome-lint/config.js?).

The CLI options would work as follow:

  • --plugin: add an ESLint plugin (for backward compatibility)
  • --plugin-js: add an ESLint plugin
  • --plugin-css: add a Stylelint plugin
  • --plugin-md: add a Remark-lint plugin (which is equivalent to add a rule or a preset are they are all npm package name to add to the config)
  • --extend : add an ESLint shareable config (for backward compatibility)
  • --extend-js: add an ESLint shareable config
  • --extend-css: add a Stylelint shareable config
  • --extend-md: add a Remark-lint preset (which is equivalent to add a rule or a preset are they are all npm package name to add to the config)
  • --extension: set file extension to lint with ESLint (for backward compatibility)
  • --extension-js: set file extension to lint with ESLint
  • --extension-css: set file extension to lint with Stylelint
  • --extension-md: set file extension to lint with Remark-lint

The configuration options would work as follow:

  • plugins:
    • if set as a String or an Array defines the ESLint plugin
    • if set as an Object, the js defines the ESLint plugins, the css key the Stylelint plugins and the md key the Remark-lint plugins
  • extends:
    • if set as a String or an Array defines the ESLint config
    • if set as an Object, the js defines the ESLint config, the css key the Stylelint config and the md key the Remark-lint config
  • rules:
    • if set as a String or an Array defines the ESLint rules
    • if set as an Object, the js defines the ESLint rules, the css key the Stylelint rules and the md key the Remark-lint rules
  • extensions:
    • if set as a String or an Array defines the file extension to lint with ESLint
    • if set as an Object, the js defines the file extension to lint with ESLint, the css key the one to lint with Stylelint and the md key the one to lint with Remark-lint

We could use [vfile-reporter-pretty]https://github.com/vfile/vfile-reporter-pretty to report errors in markdown files and stylelint-formatter-pretty for Stylelint.

Most of the logic could be re-used especially options-manager.js. We would have to call the proper linter in index.js based on the file extension.

@sindresorhus
Copy link
Member

I don't want to lint Markdown. It's much harder to do it reliably. And the it's hard to make rules that are not annoying and overly strict. Markdown is a loose language in contrast to code. I'm open to considering linting CSS, but I'm not yet sure I want to open that floodgate. It will add a lot of bloat, both in code, maintenance, and in the documentation. In the few project I have with CSS, it's easy enough to just add stylelint, so what would the value be to add CSS support to XO?

@pvdlg
Copy link
Contributor Author

pvdlg commented Jan 3, 2018

I don't want to lint Markdown. It's much harder to do it reliably.

My experience with remark-lint 6 has been pretty positive. But there is indeed a lot of rules that are very opinionated and doesn't bring much value. The one you have in awesome-lint are pretty good I think. But the default could have a very limited set or basic rules (line new lines, working header links, consistent - or * for list, etc...).

so what would the value be to add CSS support to XO?

Basically the same value than XO has over ESLint:

  • Better output
  • Good default with no config, configurable when needed
  • Good default for file path to include/ignore

In addition you would have one tool to take care of both JS and stylesheet file, without config, by just running xo.

@fregante
Copy link
Member

fregante commented Jan 4, 2023

As much as I'd like this, Stylelint isn't as good and as well-supported as ESLint. Mashing multiple tools under XO would just double the supporting code/glue required, for little benefit,

I'd suggest using them directly, perhaps with https://github.com/xojs/stylelint-config-xo

Closing because it's been a minute

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants