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

Automatically configure alternative syntax scopes when available #16

Closed
sindresorhus opened this issue Mar 27, 2019 · 3 comments · Fixed by #20
Closed

Automatically configure alternative syntax scopes when available #16

sindresorhus opened this issue Mar 27, 2019 · 3 comments · Fixed by #20
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@sindresorhus
Copy link
Member

sindresorhus commented Mar 27, 2019

Issuehunt badges

Users can add plugins to XO to enable support for alternative syntax:

It would be useful if the XO binary could have a private CLI flag to share this information and then this plugin could somehow dynamically set the selector setting:

'selector': 'source.js - meta.attribute-with-value',
for the supported syntax scopes.

Currently, the user has to do this manually, which is not a great experience.


This issue requires fairly high understanding of JS and good problem-solving skills.

Some hints on how to solve it here: SublimeLinter/SublimeLinter-eslint#253 (comment)


IssueHunt Summary

kaste kaste has been rewarded.

Backers (Total: $80.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@IssueHuntBot
Copy link

@IssueHunt has funded $80.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@kaste
Copy link
Contributor

kaste commented Nov 8, 2019

Hi! 👋

XO uses the standard plugins just like eslint? (T.i. not some variants.) If so, it is basically enough to look at the package.json (dev)Dependencies to see if a plugin is installed. (Strictly, doesn't mean it is also configured well, but that's an edge case.) And if so, XO would pick it up automatically. Basically saying just like with eslint, I don't need a CLI flag to define the used plugins, usually they're configured in the config files.

(I consider implementing this, and want to know how much code share between eslint and XO I could have.)

kaste added a commit to kaste/SublimeLinter-contrib-xo that referenced this issue Nov 10, 2019
Fixes xojs#16

The strategy here is to use a wide `selector` in the beginning and
then narrow it down during actual linting.

SublimeLinter needs a good `selector` as a **fast** check to match
views and installed linters because this first check runs on a shared
worker. T.i. we cannot just select *all* views and then decide later.

After the first check, it is always possible to abort loud or silently.
We do here silently because it's not a configuration error coming
from the user but an automatic algorithm bailing out.

With this implementation there comes the drawback that we have to flip
the previous default behavior. The default behavior was for the linter
to run on parts of the buffer marked as `source.js` concurrently. E.g.
it did run on the `<script>` tags when viewing a HTML file.

However, this default often did not produce good results. I.e. in an
HTML file it has no notion of gloabls introduced in one script which
are accessible in another script.

If the user wants this behavior, she now has to opt in by setting the
old selector `'source.js - meta.attribute-with-value'` in the settings
on her own.

Implementation risks:

- We deep import `read_json_file`. It is possible that this import can
  break since deep imports are not protected by any deprecation policy.

- We have two side-effects: `self.notify_unassign()` followed by
  `raise PermanentError()`. It is possible that in the future we need
  to signal the same outcome differently.
@issuehunt-oss issuehunt-oss bot removed the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Mar 9, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Mar 9, 2020

@sindresorhus has rewarded $72.00 to @kaste. See it on IssueHunt

  • 💰 Total deposit: $80.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $8.00

@issuehunt-oss issuehunt-oss bot added the 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt label Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants