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 linting for CSS nesting #666

Closed
CrendKing opened this issue Nov 12, 2024 · 9 comments
Closed

Support linting for CSS nesting #666

CrendKing opened this issue Nov 12, 2024 · 9 comments

Comments

@CrendKing
Copy link

Firefox officially supported CSS nesting since 117. I have been using it wherever appropriate and enjoyed it. Unfortunately, FireMonkey doesn't properly lint nested CSS out of the box. I also don't find any hint to fix this in the Help section. If this can be solved with config change, please let me know. Otherwise, would you please consider supporting it? Thank you!

I found your post at CSSLint/csslint#776. If you consider switching to stylelint, there is a way to enable nesting.

@erosman
Copy link
Owner

erosman commented Nov 12, 2024

Please note that I have created a dedicated FireMonkey repo.

As mentioned in #665 (comment)

The editor uses CodeMirros 5 which uses old CSS & JS linters which don't support new CSS/JS.

jshint
JSHint 2.13.6 Latest
on Nov 11, 2022

csslint
v1.0.3 Latest
on Sep 20, 2016

stylelint is very good and up-to-date. However, CodeMirros 5 doesnt support it.
CodeMirros 6 was rewritten and can support Stylelint but it has to be complied from NPM and it becomes very large.
I have found any instruction on compiling it either.

@CrendKing
Copy link
Author

Please note that I have created a dedicated FireMonkey repo.

Noted.

CodeMirros 6 was rewritten and can support Stylelint but it has to be complied from NPM and it becomes very large.
I have found any instruction on compiling it either.

https://codemirror.net/examples/bundle/ mentions Rollup as example bundler. Since Vite uses Rollup, and I'm somewhat familiar with Vite, I just tested and it seems working. Bundled size is less than 500KB.

There is a discussion at their forum and this post sums up what I did: https://discuss.codemirror.net/t/is-there-any-documentation-on-how-to-use-this/8550/10. Can you give it a try?

@erosman
Copy link
Owner

erosman commented Nov 12, 2024

I have also been asking around about other editors such as monaco-editor, ace, or even ESlint Playground.

I am open to suggestions on alternatives. Any decent "playground" code that can handle JS & CSS would be fine, as long as it has a repo that can be referenced for the source code (AMO requirement).

@CrendKing
Copy link
Author

CrendKing commented Nov 12, 2024

It seems stylelint still does not support running in browser. So I have to use the modified version from openstyles. I came up with a quick snippet of calling stylelint as a CodeMirror linter. Does it help in any sense?

https://github.com/CrendKing/codemirror-stylelint-test

  1. Install dependencies with pnpm or bun: bun install
  2. Run with bun run dev
  3. Build bundle with bun run build

@erosman
Copy link
Owner

erosman commented Nov 12, 2024

In order to integrate Stylelint into CodeMirror 5, it requires:

@CrendKing
Copy link
Author

CrendKing commented Nov 12, 2024

Sorry. I was responding to your comment about upgrading to CodeMirror 6 + stylelint. I was saying your can use Rollup to reduce the distribution size.

@erosman
Copy link
Owner

erosman commented Nov 13, 2024

Upgrading to CodeMirror 6 requires a rewrite of the editor and the associated code which is a major undertaking

@CrendKing
Copy link
Author

I understand that. I'm simply sharing some knowledge that might be helpful. I can live with status quo. Thanks for the work.

@erosman
Copy link
Owner

erosman commented Nov 13, 2024

Thank you for your help.
Nonetheless, I am hoping to update the editor once FireMonkey has to be updated for MV3.

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

2 participants