Navigation Menu

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

issue with indented script tags in html files #22

Open
ncrawlins opened this issue May 19, 2016 · 5 comments
Open

issue with indented script tags in html files #22

ncrawlins opened this issue May 19, 2016 · 5 comments

Comments

@ncrawlins
Copy link
Collaborator

If the script tag is indented, is there a way to get standard to not complain about the space before the closing script tag?

  <script>
    console.log('hello')
  </script>

this will give the error for trailing spaces not allowed as well as no newline at and of file, but if I don't indent the closing script tag, it's fine. My OCD hates having script tags nested in other tags not be indented, but it also hates having red marks from Standard linter.

is there a way to suppress that error without having to add an ignore rule to every script tag block?

@Flet
Copy link
Owner

Flet commented May 19, 2016

In general I'm not happy with the js-inside-html formatting :(

If you can see a way to do this, a PR is certainly welcome! I'm also OK with turning off linting for HTML files, which should not be too difficult...

@ncrawlins
Copy link
Collaborator Author

i like having the linting in html files.

I haven't done anything with python in about 12 years... just looking at the Linter class code, could the lint_view method be overridden? If the file syntax is html and the code ends with a line that is nothing but white space, simply truncate that extra white space (which presumably is in front of the closing script tag), and then call super with the updated code?

does that make sense? if so, I can probably figure out how to do that

@ghost
Copy link

ghost commented Aug 24, 2018

If the indent issue doesn't look like it's going to be fixed then js-inside-html formatting needs to be disabled. 👍

@findrakecil
Copy link

Hello, @Flet

Maybe you want to reconsider adding support for js-in-html because some people have to write JavaScript in HTML. For example, when developing mobile app using Cordova and Framework7.

Jepretan Layar 2020-06-13 pukul 12 47 30 PM

I also feel not OK about this issue. So, my workaround for this issue is to use SublimeLinter-eslint.

Jepretan Layar 2020-06-13 pukul 12 46 50 PM

@Flet
Copy link
Owner

Flet commented Jun 13, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants